app.js 2.0 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364683656836668367683686836968370683716837268373683746837568376683776837868379683806838168382683836838468385683866838768388683896839068391683926839368394683956839668397683986839968400684016840268403684046840568406684076840868409684106841168412684136841468415684166841768418684196842068421684226842368424684256842668427684286842968430684316843268433684346843568436684376843868439684406844168442684436844468445684466844768448684496845068451684526845368454684556845668457684586845968460684616846268463684646846568466684676846868469684706847168472684736847468475684766847768478684796848068481684826848368484684856848668487684886848968490684916849268493684946849568496684976849868499685006850168502685036850468505685066850768508685096851068511685126851368514685156851668517685186851968520685216852268523685246852568526685276852868529685306853168532685336853468535685366853768538685396854068541685426854368544685456854668547685486854968550685516855268553685546855568556685576855868559685606856168562685636856468565685666856768568685696857068571685726857368574685756857668577685786857968580685816858268583685846858568586685876858868589685906859168592685936859468595685966859768598685996860068601686026860368604686056860668607686086860968610686116861268613686146861568616686176861868619686206862168622686236862468625686266862768628686296863068631686326863368634686356863668637686386863968640686416864268643686446864568646686476864868649686506865168652686536865468655686566865768658686596866068661686626866368664686656866668667686686866968670686716867268673686746867568676686776867868679686806868168682686836868468685686866868768688686896869068691686926869368694686956869668697686986869968700687016870268703687046870568706687076870868709687106871168712687136871468715687166871768718687196872068721687226872368724687256872668727687286872968730687316873268733687346873568736687376873868739687406874168742687436874468745687466874768748687496875068751687526875368754687556875668757687586875968760687616876268763
  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/AssetInfo.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/AssetInfo.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. /* harmony import */ var _components_AssetInfoEditModal_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/AssetInfoEditModal.vue */ "./resources/js/components/AssetInfoEditModal.vue");
  1582. //
  1583. //
  1584. //
  1585. //
  1586. //
  1587. //
  1588. //
  1589. //
  1590. //
  1591. //
  1592. //
  1593. //
  1594. //
  1595. /* harmony default export */ __webpack_exports__["default"] = ({
  1596. components: {
  1597. AssetInfoEditModal: _components_AssetInfoEditModal_vue__WEBPACK_IMPORTED_MODULE_0__["default"]
  1598. },
  1599. props: ['asset'],
  1600. mounted: function mounted() {
  1601. var _this = this;
  1602. Echo.channel('asset.' + this.asset.pcid).listen('AssetUpdated', function (e) {
  1603. _this.asset = e.data;
  1604. });
  1605. }
  1606. });
  1607. /***/ }),
  1608. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js&":
  1609. /*!*****************************************************************************************************************************************************************************!*\
  1610. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js& ***!
  1611. \*****************************************************************************************************************************************************************************/
  1612. /*! exports provided: default */
  1613. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1614. "use strict";
  1615. __webpack_require__.r(__webpack_exports__);
  1616. /* harmony import */ var _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Modal.vue */ "./resources/js/components/Modal.vue");
  1617. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  1618. //
  1619. //
  1620. //
  1621. //
  1622. //
  1623. //
  1624. //
  1625. //
  1626. //
  1627. //
  1628. //
  1629. //
  1630. //
  1631. //
  1632. //
  1633. //
  1634. //
  1635. //
  1636. //
  1637. //
  1638. //
  1639. //
  1640. //
  1641. //
  1642. //
  1643. //
  1644. //
  1645. //
  1646. //
  1647. //
  1648. //
  1649. //
  1650. //
  1651. //
  1652. //
  1653. //
  1654. //
  1655. //
  1656. //
  1657. //
  1658. //
  1659. //
  1660. //
  1661. //
  1662. //
  1663. //
  1664. //
  1665. //
  1666. //
  1667. /* harmony default export */ __webpack_exports__["default"] = ({
  1668. components: {
  1669. Modal: _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  1670. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_1__["default"]
  1671. },
  1672. props: ['populateWith', 'modalId'],
  1673. data: function data() {
  1674. return {
  1675. // Essentially makes a copy of the object. Otherwise
  1676. // We would have a reference to the exising object causing
  1677. // unwanted mutations in the parent component.
  1678. asset: JSON.parse(JSON.stringify(this.populateWith)),
  1679. assetSaving: false
  1680. };
  1681. },
  1682. methods: {
  1683. updateAsset: function updateAsset() {
  1684. var _this = this;
  1685. this.assetSaving = true;
  1686. axios.put("/api/assets/".concat(this.asset.pcid), this.asset).then(function (response) {
  1687. _this.assetSaving = false;
  1688. $("#".concat(_this.modalId)).modal('hide');
  1689. })["catch"](function (error) {
  1690. _this.assetSaving = false;
  1691. });
  1692. }
  1693. }
  1694. });
  1695. /***/ }),
  1696. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js&":
  1697. /*!*************************************************************************************************************************************************************************************!*\
  1698. !*** ./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& ***!
  1699. \*************************************************************************************************************************************************************************************/
  1700. /*! exports provided: default */
  1701. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1702. "use strict";
  1703. __webpack_require__.r(__webpack_exports__);
  1704. //
  1705. //
  1706. //
  1707. //
  1708. //
  1709. //
  1710. //
  1711. //
  1712. //
  1713. //
  1714. //
  1715. //
  1716. //
  1717. //
  1718. //
  1719. //
  1720. //
  1721. //
  1722. //
  1723. //
  1724. //
  1725. /* harmony default export */ __webpack_exports__["default"] = ({
  1726. props: {
  1727. value: null,
  1728. // An object with the following format
  1729. // {
  1730. // key: value,
  1731. // key: value,
  1732. // }
  1733. options: {
  1734. type: Object,
  1735. required: true
  1736. },
  1737. allowCustom: {
  1738. type: Boolean,
  1739. "default": false
  1740. }
  1741. },
  1742. data: function data() {
  1743. return {
  1744. searchText: '',
  1745. selectedOption: null,
  1746. open: false,
  1747. // allows for checking whether button was clicked or text was typed.
  1748. // If button was clicked, we show all options without having to clear
  1749. // out any searchText that was autofilled when page loaded.
  1750. isSearching: false
  1751. };
  1752. },
  1753. computed: {
  1754. matches: function matches() {
  1755. var _this = this;
  1756. // If button was clicked, show all options, if typing, filter
  1757. // options based on searchText
  1758. return Object.entries(this.options).filter(function (option) {
  1759. var optionText = option[1].toUpperCase();
  1760. if (_this.isSearching) {
  1761. return optionText.match(_this.searchText.toUpperCase());
  1762. } else {
  1763. return optionText.match('');
  1764. }
  1765. });
  1766. }
  1767. },
  1768. methods: {
  1769. // if button is clicked, show all options
  1770. setOpen: function setOpen(isOpen) {
  1771. this.open = isOpen;
  1772. this.isSearching = false;
  1773. },
  1774. // if typing in the box, start filtering options
  1775. searchChanged: function searchChanged() {
  1776. if (!this.open) {
  1777. this.open = true;
  1778. }
  1779. if (!this.isSearching) {
  1780. this.isSearching = true;
  1781. } // If custom values are allowed, emits {id: 'custom', name: searchtext}
  1782. if (this.allowCustom) {
  1783. this.$emit('input', {
  1784. 'id': 'custom',
  1785. 'name': this.searchText
  1786. });
  1787. }
  1788. },
  1789. // emits { id: suggestion_id, name: suggestion_name} to v-model when
  1790. // a suggestion is selected
  1791. suggestionSelected: function suggestionSelected(suggestion) {
  1792. this.open = false;
  1793. this.searchText = suggestion[1];
  1794. this.$emit('input', {
  1795. 'id': suggestion[0],
  1796. 'name': suggestion[1]
  1797. });
  1798. },
  1799. updateComponentWithValue: function updateComponentWithValue(newValue) {
  1800. if (this.allowCustom) {
  1801. this.searchText = this.value.name;
  1802. } else {
  1803. if (newValue.id > -1) {
  1804. // Find the matching text for the supplied option value
  1805. for (var id in this.options) {
  1806. if (this.options.hasOwnProperty(id)) {
  1807. if (this.options[id] === this.options[newValue.id]) {
  1808. this.searchText = this.options[id];
  1809. }
  1810. }
  1811. }
  1812. }
  1813. }
  1814. }
  1815. },
  1816. mounted: function mounted() {
  1817. this.updateComponentWithValue(this.value);
  1818. },
  1819. watch: {
  1820. value: function value(newValue) {
  1821. this.updateComponentWithValue(newValue);
  1822. }
  1823. }
  1824. });
  1825. /***/ }),
  1826. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js&":
  1827. /*!************************************************************************************************************************************************************************!*\
  1828. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js& ***!
  1829. \************************************************************************************************************************************************************************/
  1830. /*! exports provided: default */
  1831. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1832. "use strict";
  1833. __webpack_require__.r(__webpack_exports__);
  1834. //
  1835. //
  1836. //
  1837. //
  1838. /* harmony default export */ __webpack_exports__["default"] = ({
  1839. name: 'IntersectingCirclesSpinner',
  1840. props: {
  1841. color: {
  1842. type: String,
  1843. "default": '#fff'
  1844. },
  1845. size: {
  1846. type: String,
  1847. "default": '10'
  1848. }
  1849. }
  1850. });
  1851. /***/ }),
  1852. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/Credential.vue?vue&type=script&lang=js&":
  1853. /*!*********************************************************************************************************************************************************************!*\
  1854. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/Credential.vue?vue&type=script&lang=js& ***!
  1855. \*********************************************************************************************************************************************************************/
  1856. /*! exports provided: default */
  1857. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1858. "use strict";
  1859. __webpack_require__.r(__webpack_exports__);
  1860. /* harmony import */ var _components_CredentialFormModal_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/CredentialFormModal.vue */ "./resources/js/components/CredentialFormModal.vue");
  1861. /* harmony import */ var _components_Modal_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/Modal.vue */ "./resources/js/components/Modal.vue");
  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. /* harmony default export */ __webpack_exports__["default"] = ({
  1906. components: {
  1907. CredentialFormModal: _components_CredentialFormModal_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  1908. Modal: _components_Modal_vue__WEBPACK_IMPORTED_MODULE_1__["default"]
  1909. },
  1910. props: ['credential', 'descriptions'],
  1911. data: function data() {
  1912. return {
  1913. data: this.credential,
  1914. creddescList: this.descriptions
  1915. };
  1916. },
  1917. mounted: function mounted() {
  1918. var _this = this;
  1919. Echo.channel('credential.' + this.data.credid).listen('CredentialUpdated', function (e) {
  1920. _this.data = e.credential;
  1921. });
  1922. },
  1923. methods: {
  1924. deleteCredential: function deleteCredential() {
  1925. var _this2 = this;
  1926. axios["delete"]('/api/credentials/' + this.data.credid, this.data).then(function (response) {
  1927. $('#credential' + _this2.data.credid + 'deleteModal').modal('hide');
  1928. })["catch"](function (error) {
  1929. console.error(error);
  1930. });
  1931. }
  1932. }
  1933. });
  1934. /***/ }),
  1935. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CredentialFormModal.vue?vue&type=script&lang=js&":
  1936. /*!******************************************************************************************************************************************************************************!*\
  1937. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/CredentialFormModal.vue?vue&type=script&lang=js& ***!
  1938. \******************************************************************************************************************************************************************************/
  1939. /*! exports provided: default */
  1940. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1941. "use strict";
  1942. __webpack_require__.r(__webpack_exports__);
  1943. /* harmony import */ var _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Modal.vue */ "./resources/js/components/Modal.vue");
  1944. /* harmony import */ var _components_AutocompleteCustomDropdown_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/AutocompleteCustomDropdown.vue */ "./resources/js/components/AutocompleteCustomDropdown.vue");
  1945. //
  1946. //
  1947. //
  1948. //
  1949. //
  1950. //
  1951. //
  1952. //
  1953. //
  1954. //
  1955. //
  1956. //
  1957. //
  1958. //
  1959. //
  1960. //
  1961. //
  1962. //
  1963. //
  1964. //
  1965. //
  1966. //
  1967. //
  1968. //
  1969. //
  1970. //
  1971. /* harmony default export */ __webpack_exports__["default"] = ({
  1972. components: {
  1973. AutocompleteCustomDropdown: _components_AutocompleteCustomDropdown_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
  1974. Modal: _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__["default"]
  1975. },
  1976. props: {
  1977. populateWith: {
  1978. type: Object,
  1979. "default": function _default() {
  1980. return {
  1981. creddesc: null,
  1982. creduser: null,
  1983. credpass: null,
  1984. groupid: null,
  1985. pcid: null,
  1986. credtype: null
  1987. };
  1988. }
  1989. },
  1990. modalId: {
  1991. type: String,
  1992. required: true
  1993. },
  1994. descriptions: {
  1995. type: Object,
  1996. required: true
  1997. },
  1998. create: {
  1999. type: Boolean
  2000. },
  2001. pcid: {
  2002. type: Number
  2003. },
  2004. groupid: {
  2005. type: Number
  2006. }
  2007. },
  2008. data: function data() {
  2009. return {
  2010. data: JSON.parse(JSON.stringify(this.populateWith)),
  2011. creddesc: {},
  2012. id: this.modalId,
  2013. errors: []
  2014. };
  2015. },
  2016. mounted: function mounted() {
  2017. this.creddesc = {
  2018. 'id': this.data.credtype,
  2019. 'name': this.data.creddesc
  2020. };
  2021. },
  2022. methods: {
  2023. rndStr: function rndStr(len) {
  2024. var text = "";
  2025. var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%";
  2026. for (var i = 0; i < len; i++) {
  2027. text += chars.charAt(Math.floor(Math.random() * chars.length));
  2028. }
  2029. return text;
  2030. },
  2031. getRandomPassword: function getRandomPassword(id) {
  2032. this.data.credpass = this.rndStr(16);
  2033. },
  2034. updateCredential: function updateCredential() {
  2035. var _this = this;
  2036. if (this.creddesc.id === "custom") {
  2037. this.data.credtype = 1;
  2038. this.data.creddesc = this.creddesc.name;
  2039. } else {
  2040. this.data.credtype = this.creddesc.id;
  2041. this.data.creddesc = this.creddesc.name;
  2042. }
  2043. if (this.create) {
  2044. if (this.pcid) {
  2045. this.data.pcid = this.pcid;
  2046. }
  2047. if (this.groupid) {
  2048. this.data.groupid = this.groupid;
  2049. }
  2050. axios.post('/api/credentials/', this.data).then(function (response) {
  2051. $('#' + _this.id).modal('hide');
  2052. });
  2053. } else {
  2054. axios.put('/api/credentials/' + this.data.credid, this.data).then(function (response) {
  2055. $('#' + _this.id).modal('hide');
  2056. })["catch"](function (error) {
  2057. console.error(error);
  2058. });
  2059. }
  2060. }
  2061. }
  2062. });
  2063. /***/ }),
  2064. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CredentialList.vue?vue&type=script&lang=js&":
  2065. /*!*************************************************************************************************************************************************************************!*\
  2066. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/CredentialList.vue?vue&type=script&lang=js& ***!
  2067. \*************************************************************************************************************************************************************************/
  2068. /*! exports provided: default */
  2069. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2070. "use strict";
  2071. __webpack_require__.r(__webpack_exports__);
  2072. /* harmony import */ var _components_Credential_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Credential.vue */ "./resources/js/components/Credential.vue");
  2073. /* harmony import */ var _components_CredentialFormModal_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/CredentialFormModal.vue */ "./resources/js/components/CredentialFormModal.vue");
  2074. //
  2075. //
  2076. //
  2077. //
  2078. //
  2079. //
  2080. //
  2081. //
  2082. //
  2083. /* harmony default export */ __webpack_exports__["default"] = ({
  2084. components: {
  2085. Credential: _components_Credential_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  2086. CredentialFormModal: _components_CredentialFormModal_vue__WEBPACK_IMPORTED_MODULE_1__["default"]
  2087. },
  2088. props: {
  2089. credentials: {
  2090. type: Array,
  2091. required: true
  2092. },
  2093. descriptions: {
  2094. type: Array,
  2095. required: true
  2096. },
  2097. pcid: {
  2098. type: Number
  2099. },
  2100. groupid: {
  2101. type: Number
  2102. }
  2103. },
  2104. computed: {
  2105. creddescList: function creddescList() {
  2106. var list = {};
  2107. this.descriptions.map(function (val) {
  2108. list[val.creddescid] = val.credtitle;
  2109. });
  2110. return list;
  2111. }
  2112. },
  2113. methods: {
  2114. deleteCred: function deleteCred(index) {
  2115. this.credentials.splice(index, 1);
  2116. }
  2117. },
  2118. mounted: function mounted() {
  2119. var _this = this;
  2120. if (this.pcid) {
  2121. Echo.channel('credlist.pcid.' + this.pcid).listen('CredentialDeleted', function (e) {
  2122. var deletedCred = e.credential;
  2123. var index = _this.credentials.findIndex(function (credential) {
  2124. return credential.credid === deletedCred['credid'];
  2125. });
  2126. $('#credential' + deletedCred['credid'] + 'deleteModal').modal('hide');
  2127. _this.deleteCred(index);
  2128. }).listen('CredentialAdded', function (e) {
  2129. _this.credentials.unshift(e.credential);
  2130. });
  2131. }
  2132. if (this.groupid) {
  2133. Echo.channel('credlist.groupid.' + this.groupid).listen('CredentialDeleted', function (e) {
  2134. var deletedCred = e.credential;
  2135. var index = _this.credentials.findIndex(function (credential) {
  2136. return credential.groupid === deletedCred['groupid'];
  2137. });
  2138. $('#credential' + deletedCred['credid'] + 'deleteModal').modal('hide');
  2139. _this.deleteCred(index);
  2140. }).listen('CredentialAdded', function (e) {
  2141. _this.credentials.unshift(e.credential);
  2142. });
  2143. }
  2144. }
  2145. });
  2146. /***/ }),
  2147. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js&":
  2148. /*!**************************************************************************************************************************************************************************!*\
  2149. !*** ./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& ***!
  2150. \**************************************************************************************************************************************************************************/
  2151. /*! exports provided: default */
  2152. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2153. "use strict";
  2154. __webpack_require__.r(__webpack_exports__);
  2155. /* harmony import */ var _components_Modal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Modal */ "./resources/js/components/Modal.vue");
  2156. /* harmony import */ var _components_AutocompleteCustomDropdown__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/AutocompleteCustomDropdown */ "./resources/js/components/AutocompleteCustomDropdown.vue");
  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. /* harmony default export */ __webpack_exports__["default"] = ({
  2191. components: {
  2192. Modal: _components_Modal__WEBPACK_IMPORTED_MODULE_0__["default"],
  2193. AutocompleteCustomDropdown: _components_AutocompleteCustomDropdown__WEBPACK_IMPORTED_MODULE_1__["default"]
  2194. },
  2195. props: ['populateWith', 'storeList', 'modalId'],
  2196. data: function data() {
  2197. return {
  2198. // Copies object from prop, so it doesn't mutate the object
  2199. // from the parent component. Parent component will be updated via
  2200. // Websocket if updateWorkOrder is successful.
  2201. data: JSON.parse(JSON.stringify(this.populateWith)),
  2202. id: this.modalId,
  2203. store: {},
  2204. errors: []
  2205. };
  2206. },
  2207. methods: {
  2208. updateWorkOrder: function updateWorkOrder() {
  2209. var _this = this;
  2210. this.data.storeid = this.store.id;
  2211. axios.put('/api/workorders/' + this.data.woid, this.data).then(function (response) {
  2212. $('#workordereditModal').modal('hide');
  2213. })["catch"](function (error) {
  2214. _this.errors = JSON.parse(error.response.request.response).errors;
  2215. });
  2216. }
  2217. },
  2218. mounted: function mounted() {
  2219. this.store = {
  2220. 'id': this.data.storeid,
  2221. 'name': this.storeList[this.data.storeid]
  2222. };
  2223. },
  2224. // This was originally here because the populateWith info would originally
  2225. // not necessarily be loaded when this component was mounted. That is no
  2226. // longer the case as I now don't render the parent component until the
  2227. // ajax request is finised. The watch statements are still here to cover
  2228. // the case where someone else updates the populateWith values while
  2229. // someone is editing, although it probably should be edited so it doesn't
  2230. // immediately overwrite the unsaved edits of the current user.
  2231. watch: {
  2232. populateWith: function populateWith(value) {
  2233. this.data = JSON.parse(JSON.stringify(this.populateWith));
  2234. this.store = {
  2235. 'id': this.data.storeid,
  2236. 'name': this.storeList[this.data.storeid]
  2237. };
  2238. },
  2239. storeList: function storeList(value) {
  2240. this.store = {
  2241. 'id': this.data.storeid,
  2242. 'name': this.storeList[this.data.storeid]
  2243. };
  2244. }
  2245. }
  2246. });
  2247. /***/ }),
  2248. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js&":
  2249. /*!************************************************************************************************************************************************************************!*\
  2250. !*** ./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& ***!
  2251. \************************************************************************************************************************************************************************/
  2252. /*! exports provided: default */
  2253. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2254. "use strict";
  2255. __webpack_require__.r(__webpack_exports__);
  2256. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2257. /* harmony import */ var _components_WoInfoEditModal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/WoInfoEditModal */ "./resources/js/components/WoInfoEditModal.vue");
  2258. //
  2259. //
  2260. //
  2261. //
  2262. //
  2263. //
  2264. //
  2265. //
  2266. //
  2267. //
  2268. //
  2269. //
  2270. //
  2271. //
  2272. //
  2273. //
  2274. //
  2275. //
  2276. //
  2277. //
  2278. /* harmony default export */ __webpack_exports__["default"] = ({
  2279. components: {
  2280. WoInfoEditModal: _components_WoInfoEditModal__WEBPACK_IMPORTED_MODULE_1__["default"]
  2281. },
  2282. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2283. props: ['workOrder', 'stores'],
  2284. computed: {
  2285. storeList: function storeList() {
  2286. var list = {};
  2287. Object.values(this.stores).map(function (val) {
  2288. list[val.storeid] = val.storesname;
  2289. });
  2290. return list;
  2291. }
  2292. }
  2293. });
  2294. /***/ }),
  2295. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/App.vue?vue&type=script&lang=js&":
  2296. /*!*********************************************************************************************************************************************************!*\
  2297. !*** ./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& ***!
  2298. \*********************************************************************************************************************************************************/
  2299. /*! exports provided: default */
  2300. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2301. "use strict";
  2302. __webpack_require__.r(__webpack_exports__);
  2303. //
  2304. //
  2305. //
  2306. //
  2307. //
  2308. //
  2309. //
  2310. //
  2311. //
  2312. //
  2313. //
  2314. //
  2315. //
  2316. //
  2317. //
  2318. //
  2319. //
  2320. //
  2321. //
  2322. //
  2323. //
  2324. //
  2325. //
  2326. //
  2327. //
  2328. //
  2329. //
  2330. //
  2331. //
  2332. //
  2333. //
  2334. //
  2335. //
  2336. //
  2337. //
  2338. //
  2339. //
  2340. //
  2341. //
  2342. //
  2343. //
  2344. //
  2345. //
  2346. //
  2347. //
  2348. //
  2349. //
  2350. //
  2351. //
  2352. //
  2353. //
  2354. //
  2355. //
  2356. //
  2357. //
  2358. //
  2359. //
  2360. //
  2361. //
  2362. //
  2363. //
  2364. //
  2365. //
  2366. //
  2367. //
  2368. //
  2369. //
  2370. //
  2371. //
  2372. //
  2373. //
  2374. /* harmony default export */ __webpack_exports__["default"] = ({
  2375. data: function data() {
  2376. return {
  2377. isLoggedIn: null,
  2378. username: null
  2379. };
  2380. },
  2381. mounted: function mounted() {
  2382. this.isLoggedIn = localStorage.getItem('jwt');
  2383. this.username = localStorage.getItem('user');
  2384. }
  2385. });
  2386. /***/ }),
  2387. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Dashboard.vue?vue&type=script&lang=js&":
  2388. /*!***************************************************************************************************************************************************************!*\
  2389. !*** ./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& ***!
  2390. \***************************************************************************************************************************************************************/
  2391. /*! exports provided: default */
  2392. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2393. "use strict";
  2394. __webpack_require__.r(__webpack_exports__);
  2395. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  2396. //
  2397. //
  2398. //
  2399. //
  2400. //
  2401. //
  2402. //
  2403. //
  2404. //
  2405. //
  2406. //
  2407. //
  2408. //
  2409. //
  2410. //
  2411. //
  2412. //
  2413. //
  2414. //
  2415. //
  2416. //
  2417. //
  2418. //
  2419. //
  2420. //
  2421. //
  2422. /* harmony default export */ __webpack_exports__["default"] = ({
  2423. components: {
  2424. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_0__["default"]
  2425. },
  2426. data: function data() {
  2427. return {
  2428. workOrders: [],
  2429. isLoading: true
  2430. };
  2431. },
  2432. mounted: function mounted() {
  2433. var _this = this;
  2434. var token = localStorage.getItem('jwt');
  2435. var user = localStorage.getItem('user');
  2436. axios.defaults.headers.common['Content-Type'] = 'application/json';
  2437. axios.defaults.headers.common['Authorization'] = 'Bearer ' + token;
  2438. axios.get('api/users/' + user + '/workorders').then(function (response) {
  2439. _this.workOrders = response.data;
  2440. _this.isLoading = false;
  2441. })["catch"](function (error) {
  2442. console.log(error);
  2443. });
  2444. },
  2445. beforeRouteEnter: function beforeRouteEnter(to, from, next) {
  2446. if (!localStorage.getItem('jwt')) {
  2447. return next('login');
  2448. }
  2449. next();
  2450. }
  2451. });
  2452. /***/ }),
  2453. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Login.vue?vue&type=script&lang=js&":
  2454. /*!***********************************************************************************************************************************************************!*\
  2455. !*** ./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& ***!
  2456. \***********************************************************************************************************************************************************/
  2457. /*! exports provided: default */
  2458. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2459. "use strict";
  2460. __webpack_require__.r(__webpack_exports__);
  2461. //
  2462. //
  2463. //
  2464. //
  2465. //
  2466. //
  2467. //
  2468. //
  2469. //
  2470. //
  2471. //
  2472. //
  2473. //
  2474. //
  2475. //
  2476. //
  2477. //
  2478. //
  2479. //
  2480. //
  2481. //
  2482. //
  2483. //
  2484. //
  2485. //
  2486. //
  2487. //
  2488. //
  2489. //
  2490. //
  2491. //
  2492. //
  2493. //
  2494. //
  2495. //
  2496. //
  2497. //
  2498. //
  2499. //
  2500. /* harmony default export */ __webpack_exports__["default"] = ({
  2501. data: function data() {
  2502. return {
  2503. username: "",
  2504. password: ""
  2505. };
  2506. },
  2507. methods: {
  2508. handleSubmit: function handleSubmit(e) {
  2509. var _this = this;
  2510. e.preventDefault();
  2511. if (this.password.length > 0) {
  2512. axios.post('api/login', {
  2513. username: this.username,
  2514. password: this.password
  2515. }).then(function (response) {
  2516. localStorage.setItem('user', response.data.success.username);
  2517. localStorage.setItem('jwt', response.data.success.token);
  2518. if (localStorage.getItem('jwt') != null) {
  2519. _this.$router.go('/dashboard');
  2520. }
  2521. })["catch"](function (error) {
  2522. console.error(error);
  2523. });
  2524. }
  2525. }
  2526. },
  2527. beforeRouteEnter: function beforeRouteEnter(to, from, next) {
  2528. if (localStorage.getItem('jwt')) {
  2529. return next('dashboard');
  2530. }
  2531. next();
  2532. }
  2533. });
  2534. /***/ }),
  2535. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=script&lang=js&":
  2536. /*!*************************************************************************************************************************************************************!*\
  2537. !*** ./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& ***!
  2538. \*************************************************************************************************************************************************************/
  2539. /*! exports provided: default */
  2540. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2541. "use strict";
  2542. __webpack_require__.r(__webpack_exports__);
  2543. //
  2544. //
  2545. //
  2546. //
  2547. //
  2548. //
  2549. //
  2550. //
  2551. //
  2552. //
  2553. //
  2554. //
  2555. //
  2556. //
  2557. //
  2558. //
  2559. //
  2560. //
  2561. //
  2562. //
  2563. //
  2564. //
  2565. //
  2566. //
  2567. //
  2568. //
  2569. //
  2570. //
  2571. //
  2572. //
  2573. //
  2574. //
  2575. //
  2576. //
  2577. //
  2578. //
  2579. //
  2580. //
  2581. //
  2582. //
  2583. //
  2584. //
  2585. //
  2586. //
  2587. //
  2588. //
  2589. //
  2590. //
  2591. //
  2592. //
  2593. //
  2594. /* harmony default export */ __webpack_exports__["default"] = ({});
  2595. /***/ }),
  2596. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/WorkOrder.vue?vue&type=script&lang=js&":
  2597. /*!***************************************************************************************************************************************************************!*\
  2598. !*** ./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& ***!
  2599. \***************************************************************************************************************************************************************/
  2600. /*! exports provided: default */
  2601. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2602. "use strict";
  2603. __webpack_require__.r(__webpack_exports__);
  2604. /* harmony import */ var _components_WorkOrderInfo_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/WorkOrderInfo.vue */ "./resources/js/components/WorkOrderInfo.vue");
  2605. /* harmony import */ var _components_AssetInfo_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/AssetInfo.vue */ "./resources/js/components/AssetInfo.vue");
  2606. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  2607. /* harmony import */ var _components_CredentialList_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../components/CredentialList.vue */ "./resources/js/components/CredentialList.vue");
  2608. //
  2609. //
  2610. //
  2611. //
  2612. //
  2613. //
  2614. //
  2615. //
  2616. //
  2617. //
  2618. //
  2619. //
  2620. //
  2621. //
  2622. //
  2623. //
  2624. //
  2625. //
  2626. //
  2627. //
  2628. //
  2629. //
  2630. //
  2631. //
  2632. //
  2633. //
  2634. //
  2635. //
  2636. //
  2637. //
  2638. //
  2639. //
  2640. //
  2641. //
  2642. //
  2643. //
  2644. //
  2645. //
  2646. //
  2647. //
  2648. //
  2649. //
  2650. //
  2651. //
  2652. //
  2653. //
  2654. //
  2655. //
  2656. //
  2657. //
  2658. //
  2659. //
  2660. //
  2661. //
  2662. //
  2663. //
  2664. //
  2665. //
  2666. //
  2667. //
  2668. //
  2669. //
  2670. //
  2671. //
  2672. //
  2673. //
  2674. //
  2675. //
  2676. //
  2677. //
  2678. //
  2679. //
  2680. //
  2681. //
  2682. //
  2683. //
  2684. //
  2685. //
  2686. //
  2687. //
  2688. //
  2689. //
  2690. //
  2691. //
  2692. //
  2693. //
  2694. //
  2695. //
  2696. //
  2697. //
  2698. //
  2699. //
  2700. //
  2701. //
  2702. //
  2703. //
  2704. //
  2705. //
  2706. //
  2707. /* harmony default export */ __webpack_exports__["default"] = ({
  2708. components: {
  2709. WorkOrderInfo: _components_WorkOrderInfo_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  2710. AssetInfo: _components_AssetInfo_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
  2711. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_2__["default"],
  2712. CredentialList: _components_CredentialList_vue__WEBPACK_IMPORTED_MODULE_3__["default"]
  2713. },
  2714. props: ['id'],
  2715. data: function data() {
  2716. return {
  2717. workOrder: {},
  2718. asset: {},
  2719. stores: {},
  2720. credentials: {},
  2721. credentialDescriptions: {},
  2722. woLoading: true,
  2723. assetLoading: true,
  2724. storesLoading: true,
  2725. credentialsLoading: true,
  2726. credentialDescriptionsLoading: true
  2727. };
  2728. },
  2729. mounted: function mounted() {
  2730. var _this = this;
  2731. // Get authentication info from current user from local storage
  2732. var token = localStorage.getItem('jwt');
  2733. var user = localStorage.getItem('user'); // Set some axios config options for Content-Type and Authentication.
  2734. axios.defaults.headers.common['Content-Type'] = 'application/json';
  2735. axios.defaults.headers.common['Authorization'] = 'Bearer ' + token; // Get WorkOrder from API
  2736. axios.get('/api/workorders/' + this.id).then(function (response) {
  2737. _this.workOrder = response.data;
  2738. _this.woLoading = false;
  2739. })["catch"](function (error) {
  2740. console.log(error);
  2741. }); // Get list of stores from API
  2742. axios.get('/api/stores/').then(function (response) {
  2743. _this.stores = response.data;
  2744. _this.storesLoading = false;
  2745. })["catch"](function (error) {
  2746. console.log(error);
  2747. }); // Get Asset from API (will most likely be replaced with list of assets
  2748. // in the future. Current each WO can only have one but that is likely
  2749. // to change)
  2750. axios.get("/api/workorders/".concat(this.id, "/asset")).then(function (response) {
  2751. _this.asset = response.data;
  2752. _this.assetLoading = false; // Get Credentials for this asset. May be relocated to be part of asset
  2753. // Component when WOs can have more than one asset.
  2754. axios.get("/api/assets/".concat(_this.asset.pcid, "/credentials")).then(function (response) {
  2755. _this.credentials = response.data;
  2756. _this.credentialsLoading = false;
  2757. })["catch"](function (error) {
  2758. console.log(error);
  2759. }); // Get default list of Credential Descriptions. May be relocated along with
  2760. // the above.
  2761. axios.get('/api/credentials/descriptions').then(function (response) {
  2762. _this.credentialDescriptions = response.data;
  2763. _this.credentialDescriptionsLoading = false;
  2764. })["catch"](function (error) {
  2765. console.log(error);
  2766. });
  2767. })["catch"](function (error) {
  2768. console.log(error);
  2769. });
  2770. Echo.channel('work-order.' + this.id).listen('WorkOrderUpdated', function (e) {
  2771. _this.workOrder = e.data;
  2772. });
  2773. }
  2774. });
  2775. /***/ }),
  2776. /***/ "./node_modules/base64-js/index.js":
  2777. /*!*****************************************!*\
  2778. !*** ./node_modules/base64-js/index.js ***!
  2779. \*****************************************/
  2780. /*! no static exports found */
  2781. /***/ (function(module, exports, __webpack_require__) {
  2782. "use strict";
  2783. exports.byteLength = byteLength
  2784. exports.toByteArray = toByteArray
  2785. exports.fromByteArray = fromByteArray
  2786. var lookup = []
  2787. var revLookup = []
  2788. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  2789. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  2790. for (var i = 0, len = code.length; i < len; ++i) {
  2791. lookup[i] = code[i]
  2792. revLookup[code.charCodeAt(i)] = i
  2793. }
  2794. // Support decoding URL-safe base64 strings, as Node.js does.
  2795. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  2796. revLookup['-'.charCodeAt(0)] = 62
  2797. revLookup['_'.charCodeAt(0)] = 63
  2798. function getLens (b64) {
  2799. var len = b64.length
  2800. if (len % 4 > 0) {
  2801. throw new Error('Invalid string. Length must be a multiple of 4')
  2802. }
  2803. // Trim off extra bytes after placeholder bytes are found
  2804. // See: https://github.com/beatgammit/base64-js/issues/42
  2805. var validLen = b64.indexOf('=')
  2806. if (validLen === -1) validLen = len
  2807. var placeHoldersLen = validLen === len
  2808. ? 0
  2809. : 4 - (validLen % 4)
  2810. return [validLen, placeHoldersLen]
  2811. }
  2812. // base64 is 4/3 + up to two characters of the original data
  2813. function byteLength (b64) {
  2814. var lens = getLens(b64)
  2815. var validLen = lens[0]
  2816. var placeHoldersLen = lens[1]
  2817. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2818. }
  2819. function _byteLength (b64, validLen, placeHoldersLen) {
  2820. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2821. }
  2822. function toByteArray (b64) {
  2823. var tmp
  2824. var lens = getLens(b64)
  2825. var validLen = lens[0]
  2826. var placeHoldersLen = lens[1]
  2827. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  2828. var curByte = 0
  2829. // if there are placeholders, only get up to the last complete 4 chars
  2830. var len = placeHoldersLen > 0
  2831. ? validLen - 4
  2832. : validLen
  2833. var i
  2834. for (i = 0; i < len; i += 4) {
  2835. tmp =
  2836. (revLookup[b64.charCodeAt(i)] << 18) |
  2837. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  2838. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  2839. revLookup[b64.charCodeAt(i + 3)]
  2840. arr[curByte++] = (tmp >> 16) & 0xFF
  2841. arr[curByte++] = (tmp >> 8) & 0xFF
  2842. arr[curByte++] = tmp & 0xFF
  2843. }
  2844. if (placeHoldersLen === 2) {
  2845. tmp =
  2846. (revLookup[b64.charCodeAt(i)] << 2) |
  2847. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  2848. arr[curByte++] = tmp & 0xFF
  2849. }
  2850. if (placeHoldersLen === 1) {
  2851. tmp =
  2852. (revLookup[b64.charCodeAt(i)] << 10) |
  2853. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  2854. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  2855. arr[curByte++] = (tmp >> 8) & 0xFF
  2856. arr[curByte++] = tmp & 0xFF
  2857. }
  2858. return arr
  2859. }
  2860. function tripletToBase64 (num) {
  2861. return lookup[num >> 18 & 0x3F] +
  2862. lookup[num >> 12 & 0x3F] +
  2863. lookup[num >> 6 & 0x3F] +
  2864. lookup[num & 0x3F]
  2865. }
  2866. function encodeChunk (uint8, start, end) {
  2867. var tmp
  2868. var output = []
  2869. for (var i = start; i < end; i += 3) {
  2870. tmp =
  2871. ((uint8[i] << 16) & 0xFF0000) +
  2872. ((uint8[i + 1] << 8) & 0xFF00) +
  2873. (uint8[i + 2] & 0xFF)
  2874. output.push(tripletToBase64(tmp))
  2875. }
  2876. return output.join('')
  2877. }
  2878. function fromByteArray (uint8) {
  2879. var tmp
  2880. var len = uint8.length
  2881. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  2882. var parts = []
  2883. var maxChunkLength = 16383 // must be multiple of 3
  2884. // go through the array every three bytes, we'll deal with trailing stuff later
  2885. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  2886. parts.push(encodeChunk(
  2887. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  2888. ))
  2889. }
  2890. // pad the end with zeros, but make sure to not forget the extra bytes
  2891. if (extraBytes === 1) {
  2892. tmp = uint8[len - 1]
  2893. parts.push(
  2894. lookup[tmp >> 2] +
  2895. lookup[(tmp << 4) & 0x3F] +
  2896. '=='
  2897. )
  2898. } else if (extraBytes === 2) {
  2899. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  2900. parts.push(
  2901. lookup[tmp >> 10] +
  2902. lookup[(tmp >> 4) & 0x3F] +
  2903. lookup[(tmp << 2) & 0x3F] +
  2904. '='
  2905. )
  2906. }
  2907. return parts.join('')
  2908. }
  2909. /***/ }),
  2910. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  2911. /*!*****************************************************!*\
  2912. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  2913. \*****************************************************/
  2914. /*! no static exports found */
  2915. /***/ (function(module, exports, __webpack_require__) {
  2916. /*!
  2917. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  2918. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  2919. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2920. */
  2921. (function (global, factory) {
  2922. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  2923. undefined;
  2924. }(this, (function (exports, $, Popper) { 'use strict';
  2925. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  2926. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  2927. function _defineProperties(target, props) {
  2928. for (var i = 0; i < props.length; i++) {
  2929. var descriptor = props[i];
  2930. descriptor.enumerable = descriptor.enumerable || false;
  2931. descriptor.configurable = true;
  2932. if ("value" in descriptor) descriptor.writable = true;
  2933. Object.defineProperty(target, descriptor.key, descriptor);
  2934. }
  2935. }
  2936. function _createClass(Constructor, protoProps, staticProps) {
  2937. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  2938. if (staticProps) _defineProperties(Constructor, staticProps);
  2939. return Constructor;
  2940. }
  2941. function _defineProperty(obj, key, value) {
  2942. if (key in obj) {
  2943. Object.defineProperty(obj, key, {
  2944. value: value,
  2945. enumerable: true,
  2946. configurable: true,
  2947. writable: true
  2948. });
  2949. } else {
  2950. obj[key] = value;
  2951. }
  2952. return obj;
  2953. }
  2954. function ownKeys(object, enumerableOnly) {
  2955. var keys = Object.keys(object);
  2956. if (Object.getOwnPropertySymbols) {
  2957. var symbols = Object.getOwnPropertySymbols(object);
  2958. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  2959. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  2960. });
  2961. keys.push.apply(keys, symbols);
  2962. }
  2963. return keys;
  2964. }
  2965. function _objectSpread2(target) {
  2966. for (var i = 1; i < arguments.length; i++) {
  2967. var source = arguments[i] != null ? arguments[i] : {};
  2968. if (i % 2) {
  2969. ownKeys(Object(source), true).forEach(function (key) {
  2970. _defineProperty(target, key, source[key]);
  2971. });
  2972. } else if (Object.getOwnPropertyDescriptors) {
  2973. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  2974. } else {
  2975. ownKeys(Object(source)).forEach(function (key) {
  2976. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  2977. });
  2978. }
  2979. }
  2980. return target;
  2981. }
  2982. function _inheritsLoose(subClass, superClass) {
  2983. subClass.prototype = Object.create(superClass.prototype);
  2984. subClass.prototype.constructor = subClass;
  2985. subClass.__proto__ = superClass;
  2986. }
  2987. /**
  2988. * --------------------------------------------------------------------------
  2989. * Bootstrap (v4.4.1): util.js
  2990. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2991. * --------------------------------------------------------------------------
  2992. */
  2993. /**
  2994. * ------------------------------------------------------------------------
  2995. * Private TransitionEnd Helpers
  2996. * ------------------------------------------------------------------------
  2997. */
  2998. var TRANSITION_END = 'transitionend';
  2999. var MAX_UID = 1000000;
  3000. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  3001. function toType(obj) {
  3002. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  3003. }
  3004. function getSpecialTransitionEndEvent() {
  3005. return {
  3006. bindType: TRANSITION_END,
  3007. delegateType: TRANSITION_END,
  3008. handle: function handle(event) {
  3009. if ($(event.target).is(this)) {
  3010. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  3011. }
  3012. return undefined; // eslint-disable-line no-undefined
  3013. }
  3014. };
  3015. }
  3016. function transitionEndEmulator(duration) {
  3017. var _this = this;
  3018. var called = false;
  3019. $(this).one(Util.TRANSITION_END, function () {
  3020. called = true;
  3021. });
  3022. setTimeout(function () {
  3023. if (!called) {
  3024. Util.triggerTransitionEnd(_this);
  3025. }
  3026. }, duration);
  3027. return this;
  3028. }
  3029. function setTransitionEndSupport() {
  3030. $.fn.emulateTransitionEnd = transitionEndEmulator;
  3031. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  3032. }
  3033. /**
  3034. * --------------------------------------------------------------------------
  3035. * Public Util Api
  3036. * --------------------------------------------------------------------------
  3037. */
  3038. var Util = {
  3039. TRANSITION_END: 'bsTransitionEnd',
  3040. getUID: function getUID(prefix) {
  3041. do {
  3042. // eslint-disable-next-line no-bitwise
  3043. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  3044. } while (document.getElementById(prefix));
  3045. return prefix;
  3046. },
  3047. getSelectorFromElement: function getSelectorFromElement(element) {
  3048. var selector = element.getAttribute('data-target');
  3049. if (!selector || selector === '#') {
  3050. var hrefAttr = element.getAttribute('href');
  3051. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  3052. }
  3053. try {
  3054. return document.querySelector(selector) ? selector : null;
  3055. } catch (err) {
  3056. return null;
  3057. }
  3058. },
  3059. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  3060. if (!element) {
  3061. return 0;
  3062. } // Get transition-duration of the element
  3063. var transitionDuration = $(element).css('transition-duration');
  3064. var transitionDelay = $(element).css('transition-delay');
  3065. var floatTransitionDuration = parseFloat(transitionDuration);
  3066. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  3067. if (!floatTransitionDuration && !floatTransitionDelay) {
  3068. return 0;
  3069. } // If multiple durations are defined, take the first
  3070. transitionDuration = transitionDuration.split(',')[0];
  3071. transitionDelay = transitionDelay.split(',')[0];
  3072. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  3073. },
  3074. reflow: function reflow(element) {
  3075. return element.offsetHeight;
  3076. },
  3077. triggerTransitionEnd: function triggerTransitionEnd(element) {
  3078. $(element).trigger(TRANSITION_END);
  3079. },
  3080. // TODO: Remove in v5
  3081. supportsTransitionEnd: function supportsTransitionEnd() {
  3082. return Boolean(TRANSITION_END);
  3083. },
  3084. isElement: function isElement(obj) {
  3085. return (obj[0] || obj).nodeType;
  3086. },
  3087. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  3088. for (var property in configTypes) {
  3089. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  3090. var expectedTypes = configTypes[property];
  3091. var value = config[property];
  3092. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  3093. if (!new RegExp(expectedTypes).test(valueType)) {
  3094. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  3095. }
  3096. }
  3097. }
  3098. },
  3099. findShadowRoot: function findShadowRoot(element) {
  3100. if (!document.documentElement.attachShadow) {
  3101. return null;
  3102. } // Can find the shadow root otherwise it'll return the document
  3103. if (typeof element.getRootNode === 'function') {
  3104. var root = element.getRootNode();
  3105. return root instanceof ShadowRoot ? root : null;
  3106. }
  3107. if (element instanceof ShadowRoot) {
  3108. return element;
  3109. } // when we don't find a shadow root
  3110. if (!element.parentNode) {
  3111. return null;
  3112. }
  3113. return Util.findShadowRoot(element.parentNode);
  3114. },
  3115. jQueryDetection: function jQueryDetection() {
  3116. if (typeof $ === 'undefined') {
  3117. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  3118. }
  3119. var version = $.fn.jquery.split(' ')[0].split('.');
  3120. var minMajor = 1;
  3121. var ltMajor = 2;
  3122. var minMinor = 9;
  3123. var minPatch = 1;
  3124. var maxMajor = 4;
  3125. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  3126. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  3127. }
  3128. }
  3129. };
  3130. Util.jQueryDetection();
  3131. setTransitionEndSupport();
  3132. /**
  3133. * ------------------------------------------------------------------------
  3134. * Constants
  3135. * ------------------------------------------------------------------------
  3136. */
  3137. var NAME = 'alert';
  3138. var VERSION = '4.4.1';
  3139. var DATA_KEY = 'bs.alert';
  3140. var EVENT_KEY = "." + DATA_KEY;
  3141. var DATA_API_KEY = '.data-api';
  3142. var JQUERY_NO_CONFLICT = $.fn[NAME];
  3143. var Selector = {
  3144. DISMISS: '[data-dismiss="alert"]'
  3145. };
  3146. var Event = {
  3147. CLOSE: "close" + EVENT_KEY,
  3148. CLOSED: "closed" + EVENT_KEY,
  3149. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  3150. };
  3151. var ClassName = {
  3152. ALERT: 'alert',
  3153. FADE: 'fade',
  3154. SHOW: 'show'
  3155. };
  3156. /**
  3157. * ------------------------------------------------------------------------
  3158. * Class Definition
  3159. * ------------------------------------------------------------------------
  3160. */
  3161. var Alert =
  3162. /*#__PURE__*/
  3163. function () {
  3164. function Alert(element) {
  3165. this._element = element;
  3166. } // Getters
  3167. var _proto = Alert.prototype;
  3168. // Public
  3169. _proto.close = function close(element) {
  3170. var rootElement = this._element;
  3171. if (element) {
  3172. rootElement = this._getRootElement(element);
  3173. }
  3174. var customEvent = this._triggerCloseEvent(rootElement);
  3175. if (customEvent.isDefaultPrevented()) {
  3176. return;
  3177. }
  3178. this._removeElement(rootElement);
  3179. };
  3180. _proto.dispose = function dispose() {
  3181. $.removeData(this._element, DATA_KEY);
  3182. this._element = null;
  3183. } // Private
  3184. ;
  3185. _proto._getRootElement = function _getRootElement(element) {
  3186. var selector = Util.getSelectorFromElement(element);
  3187. var parent = false;
  3188. if (selector) {
  3189. parent = document.querySelector(selector);
  3190. }
  3191. if (!parent) {
  3192. parent = $(element).closest("." + ClassName.ALERT)[0];
  3193. }
  3194. return parent;
  3195. };
  3196. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  3197. var closeEvent = $.Event(Event.CLOSE);
  3198. $(element).trigger(closeEvent);
  3199. return closeEvent;
  3200. };
  3201. _proto._removeElement = function _removeElement(element) {
  3202. var _this = this;
  3203. $(element).removeClass(ClassName.SHOW);
  3204. if (!$(element).hasClass(ClassName.FADE)) {
  3205. this._destroyElement(element);
  3206. return;
  3207. }
  3208. var transitionDuration = Util.getTransitionDurationFromElement(element);
  3209. $(element).one(Util.TRANSITION_END, function (event) {
  3210. return _this._destroyElement(element, event);
  3211. }).emulateTransitionEnd(transitionDuration);
  3212. };
  3213. _proto._destroyElement = function _destroyElement(element) {
  3214. $(element).detach().trigger(Event.CLOSED).remove();
  3215. } // Static
  3216. ;
  3217. Alert._jQueryInterface = function _jQueryInterface(config) {
  3218. return this.each(function () {
  3219. var $element = $(this);
  3220. var data = $element.data(DATA_KEY);
  3221. if (!data) {
  3222. data = new Alert(this);
  3223. $element.data(DATA_KEY, data);
  3224. }
  3225. if (config === 'close') {
  3226. data[config](this);
  3227. }
  3228. });
  3229. };
  3230. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  3231. return function (event) {
  3232. if (event) {
  3233. event.preventDefault();
  3234. }
  3235. alertInstance.close(this);
  3236. };
  3237. };
  3238. _createClass(Alert, null, [{
  3239. key: "VERSION",
  3240. get: function get() {
  3241. return VERSION;
  3242. }
  3243. }]);
  3244. return Alert;
  3245. }();
  3246. /**
  3247. * ------------------------------------------------------------------------
  3248. * Data Api implementation
  3249. * ------------------------------------------------------------------------
  3250. */
  3251. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  3252. /**
  3253. * ------------------------------------------------------------------------
  3254. * jQuery
  3255. * ------------------------------------------------------------------------
  3256. */
  3257. $.fn[NAME] = Alert._jQueryInterface;
  3258. $.fn[NAME].Constructor = Alert;
  3259. $.fn[NAME].noConflict = function () {
  3260. $.fn[NAME] = JQUERY_NO_CONFLICT;
  3261. return Alert._jQueryInterface;
  3262. };
  3263. /**
  3264. * ------------------------------------------------------------------------
  3265. * Constants
  3266. * ------------------------------------------------------------------------
  3267. */
  3268. var NAME$1 = 'button';
  3269. var VERSION$1 = '4.4.1';
  3270. var DATA_KEY$1 = 'bs.button';
  3271. var EVENT_KEY$1 = "." + DATA_KEY$1;
  3272. var DATA_API_KEY$1 = '.data-api';
  3273. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  3274. var ClassName$1 = {
  3275. ACTIVE: 'active',
  3276. BUTTON: 'btn',
  3277. FOCUS: 'focus'
  3278. };
  3279. var Selector$1 = {
  3280. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  3281. DATA_TOGGLES: '[data-toggle="buttons"]',
  3282. DATA_TOGGLE: '[data-toggle="button"]',
  3283. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  3284. INPUT: 'input:not([type="hidden"])',
  3285. ACTIVE: '.active',
  3286. BUTTON: '.btn'
  3287. };
  3288. var Event$1 = {
  3289. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  3290. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  3291. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  3292. };
  3293. /**
  3294. * ------------------------------------------------------------------------
  3295. * Class Definition
  3296. * ------------------------------------------------------------------------
  3297. */
  3298. var Button =
  3299. /*#__PURE__*/
  3300. function () {
  3301. function Button(element) {
  3302. this._element = element;
  3303. } // Getters
  3304. var _proto = Button.prototype;
  3305. // Public
  3306. _proto.toggle = function toggle() {
  3307. var triggerChangeEvent = true;
  3308. var addAriaPressed = true;
  3309. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  3310. if (rootElement) {
  3311. var input = this._element.querySelector(Selector$1.INPUT);
  3312. if (input) {
  3313. if (input.type === 'radio') {
  3314. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  3315. triggerChangeEvent = false;
  3316. } else {
  3317. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  3318. if (activeElement) {
  3319. $(activeElement).removeClass(ClassName$1.ACTIVE);
  3320. }
  3321. }
  3322. } else if (input.type === 'checkbox') {
  3323. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  3324. triggerChangeEvent = false;
  3325. }
  3326. } else {
  3327. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  3328. triggerChangeEvent = false;
  3329. }
  3330. if (triggerChangeEvent) {
  3331. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  3332. $(input).trigger('change');
  3333. }
  3334. input.focus();
  3335. addAriaPressed = false;
  3336. }
  3337. }
  3338. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  3339. if (addAriaPressed) {
  3340. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  3341. }
  3342. if (triggerChangeEvent) {
  3343. $(this._element).toggleClass(ClassName$1.ACTIVE);
  3344. }
  3345. }
  3346. };
  3347. _proto.dispose = function dispose() {
  3348. $.removeData(this._element, DATA_KEY$1);
  3349. this._element = null;
  3350. } // Static
  3351. ;
  3352. Button._jQueryInterface = function _jQueryInterface(config) {
  3353. return this.each(function () {
  3354. var data = $(this).data(DATA_KEY$1);
  3355. if (!data) {
  3356. data = new Button(this);
  3357. $(this).data(DATA_KEY$1, data);
  3358. }
  3359. if (config === 'toggle') {
  3360. data[config]();
  3361. }
  3362. });
  3363. };
  3364. _createClass(Button, null, [{
  3365. key: "VERSION",
  3366. get: function get() {
  3367. return VERSION$1;
  3368. }
  3369. }]);
  3370. return Button;
  3371. }();
  3372. /**
  3373. * ------------------------------------------------------------------------
  3374. * Data Api implementation
  3375. * ------------------------------------------------------------------------
  3376. */
  3377. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  3378. var button = event.target;
  3379. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  3380. button = $(button).closest(Selector$1.BUTTON)[0];
  3381. }
  3382. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  3383. event.preventDefault(); // work around Firefox bug #1540995
  3384. } else {
  3385. var inputBtn = button.querySelector(Selector$1.INPUT);
  3386. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  3387. event.preventDefault(); // work around Firefox bug #1540995
  3388. return;
  3389. }
  3390. Button._jQueryInterface.call($(button), 'toggle');
  3391. }
  3392. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  3393. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  3394. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  3395. });
  3396. $(window).on(Event$1.LOAD_DATA_API, function () {
  3397. // ensure correct active class is set to match the controls' actual values/states
  3398. // find all checkboxes/readio buttons inside data-toggle groups
  3399. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  3400. for (var i = 0, len = buttons.length; i < len; i++) {
  3401. var button = buttons[i];
  3402. var input = button.querySelector(Selector$1.INPUT);
  3403. if (input.checked || input.hasAttribute('checked')) {
  3404. button.classList.add(ClassName$1.ACTIVE);
  3405. } else {
  3406. button.classList.remove(ClassName$1.ACTIVE);
  3407. }
  3408. } // find all button toggles
  3409. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  3410. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  3411. var _button = buttons[_i];
  3412. if (_button.getAttribute('aria-pressed') === 'true') {
  3413. _button.classList.add(ClassName$1.ACTIVE);
  3414. } else {
  3415. _button.classList.remove(ClassName$1.ACTIVE);
  3416. }
  3417. }
  3418. });
  3419. /**
  3420. * ------------------------------------------------------------------------
  3421. * jQuery
  3422. * ------------------------------------------------------------------------
  3423. */
  3424. $.fn[NAME$1] = Button._jQueryInterface;
  3425. $.fn[NAME$1].Constructor = Button;
  3426. $.fn[NAME$1].noConflict = function () {
  3427. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  3428. return Button._jQueryInterface;
  3429. };
  3430. /**
  3431. * ------------------------------------------------------------------------
  3432. * Constants
  3433. * ------------------------------------------------------------------------
  3434. */
  3435. var NAME$2 = 'carousel';
  3436. var VERSION$2 = '4.4.1';
  3437. var DATA_KEY$2 = 'bs.carousel';
  3438. var EVENT_KEY$2 = "." + DATA_KEY$2;
  3439. var DATA_API_KEY$2 = '.data-api';
  3440. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  3441. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  3442. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  3443. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  3444. var SWIPE_THRESHOLD = 40;
  3445. var Default = {
  3446. interval: 5000,
  3447. keyboard: true,
  3448. slide: false,
  3449. pause: 'hover',
  3450. wrap: true,
  3451. touch: true
  3452. };
  3453. var DefaultType = {
  3454. interval: '(number|boolean)',
  3455. keyboard: 'boolean',
  3456. slide: '(boolean|string)',
  3457. pause: '(string|boolean)',
  3458. wrap: 'boolean',
  3459. touch: 'boolean'
  3460. };
  3461. var Direction = {
  3462. NEXT: 'next',
  3463. PREV: 'prev',
  3464. LEFT: 'left',
  3465. RIGHT: 'right'
  3466. };
  3467. var Event$2 = {
  3468. SLIDE: "slide" + EVENT_KEY$2,
  3469. SLID: "slid" + EVENT_KEY$2,
  3470. KEYDOWN: "keydown" + EVENT_KEY$2,
  3471. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  3472. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  3473. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  3474. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  3475. TOUCHEND: "touchend" + EVENT_KEY$2,
  3476. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  3477. POINTERUP: "pointerup" + EVENT_KEY$2,
  3478. DRAG_START: "dragstart" + EVENT_KEY$2,
  3479. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  3480. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  3481. };
  3482. var ClassName$2 = {
  3483. CAROUSEL: 'carousel',
  3484. ACTIVE: 'active',
  3485. SLIDE: 'slide',
  3486. RIGHT: 'carousel-item-right',
  3487. LEFT: 'carousel-item-left',
  3488. NEXT: 'carousel-item-next',
  3489. PREV: 'carousel-item-prev',
  3490. ITEM: 'carousel-item',
  3491. POINTER_EVENT: 'pointer-event'
  3492. };
  3493. var Selector$2 = {
  3494. ACTIVE: '.active',
  3495. ACTIVE_ITEM: '.active.carousel-item',
  3496. ITEM: '.carousel-item',
  3497. ITEM_IMG: '.carousel-item img',
  3498. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  3499. INDICATORS: '.carousel-indicators',
  3500. DATA_SLIDE: '[data-slide], [data-slide-to]',
  3501. DATA_RIDE: '[data-ride="carousel"]'
  3502. };
  3503. var PointerType = {
  3504. TOUCH: 'touch',
  3505. PEN: 'pen'
  3506. };
  3507. /**
  3508. * ------------------------------------------------------------------------
  3509. * Class Definition
  3510. * ------------------------------------------------------------------------
  3511. */
  3512. var Carousel =
  3513. /*#__PURE__*/
  3514. function () {
  3515. function Carousel(element, config) {
  3516. this._items = null;
  3517. this._interval = null;
  3518. this._activeElement = null;
  3519. this._isPaused = false;
  3520. this._isSliding = false;
  3521. this.touchTimeout = null;
  3522. this.touchStartX = 0;
  3523. this.touchDeltaX = 0;
  3524. this._config = this._getConfig(config);
  3525. this._element = element;
  3526. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  3527. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  3528. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  3529. this._addEventListeners();
  3530. } // Getters
  3531. var _proto = Carousel.prototype;
  3532. // Public
  3533. _proto.next = function next() {
  3534. if (!this._isSliding) {
  3535. this._slide(Direction.NEXT);
  3536. }
  3537. };
  3538. _proto.nextWhenVisible = function nextWhenVisible() {
  3539. // Don't call next when the page isn't visible
  3540. // or the carousel or its parent isn't visible
  3541. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  3542. this.next();
  3543. }
  3544. };
  3545. _proto.prev = function prev() {
  3546. if (!this._isSliding) {
  3547. this._slide(Direction.PREV);
  3548. }
  3549. };
  3550. _proto.pause = function pause(event) {
  3551. if (!event) {
  3552. this._isPaused = true;
  3553. }
  3554. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  3555. Util.triggerTransitionEnd(this._element);
  3556. this.cycle(true);
  3557. }
  3558. clearInterval(this._interval);
  3559. this._interval = null;
  3560. };
  3561. _proto.cycle = function cycle(event) {
  3562. if (!event) {
  3563. this._isPaused = false;
  3564. }
  3565. if (this._interval) {
  3566. clearInterval(this._interval);
  3567. this._interval = null;
  3568. }
  3569. if (this._config.interval && !this._isPaused) {
  3570. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  3571. }
  3572. };
  3573. _proto.to = function to(index) {
  3574. var _this = this;
  3575. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3576. var activeIndex = this._getItemIndex(this._activeElement);
  3577. if (index > this._items.length - 1 || index < 0) {
  3578. return;
  3579. }
  3580. if (this._isSliding) {
  3581. $(this._element).one(Event$2.SLID, function () {
  3582. return _this.to(index);
  3583. });
  3584. return;
  3585. }
  3586. if (activeIndex === index) {
  3587. this.pause();
  3588. this.cycle();
  3589. return;
  3590. }
  3591. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  3592. this._slide(direction, this._items[index]);
  3593. };
  3594. _proto.dispose = function dispose() {
  3595. $(this._element).off(EVENT_KEY$2);
  3596. $.removeData(this._element, DATA_KEY$2);
  3597. this._items = null;
  3598. this._config = null;
  3599. this._element = null;
  3600. this._interval = null;
  3601. this._isPaused = null;
  3602. this._isSliding = null;
  3603. this._activeElement = null;
  3604. this._indicatorsElement = null;
  3605. } // Private
  3606. ;
  3607. _proto._getConfig = function _getConfig(config) {
  3608. config = _objectSpread2({}, Default, {}, config);
  3609. Util.typeCheckConfig(NAME$2, config, DefaultType);
  3610. return config;
  3611. };
  3612. _proto._handleSwipe = function _handleSwipe() {
  3613. var absDeltax = Math.abs(this.touchDeltaX);
  3614. if (absDeltax <= SWIPE_THRESHOLD) {
  3615. return;
  3616. }
  3617. var direction = absDeltax / this.touchDeltaX;
  3618. this.touchDeltaX = 0; // swipe left
  3619. if (direction > 0) {
  3620. this.prev();
  3621. } // swipe right
  3622. if (direction < 0) {
  3623. this.next();
  3624. }
  3625. };
  3626. _proto._addEventListeners = function _addEventListeners() {
  3627. var _this2 = this;
  3628. if (this._config.keyboard) {
  3629. $(this._element).on(Event$2.KEYDOWN, function (event) {
  3630. return _this2._keydown(event);
  3631. });
  3632. }
  3633. if (this._config.pause === 'hover') {
  3634. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  3635. return _this2.pause(event);
  3636. }).on(Event$2.MOUSELEAVE, function (event) {
  3637. return _this2.cycle(event);
  3638. });
  3639. }
  3640. if (this._config.touch) {
  3641. this._addTouchEventListeners();
  3642. }
  3643. };
  3644. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  3645. var _this3 = this;
  3646. if (!this._touchSupported) {
  3647. return;
  3648. }
  3649. var start = function start(event) {
  3650. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3651. _this3.touchStartX = event.originalEvent.clientX;
  3652. } else if (!_this3._pointerEvent) {
  3653. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  3654. }
  3655. };
  3656. var move = function move(event) {
  3657. // ensure swiping with one touch and not pinching
  3658. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  3659. _this3.touchDeltaX = 0;
  3660. } else {
  3661. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  3662. }
  3663. };
  3664. var end = function end(event) {
  3665. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3666. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  3667. }
  3668. _this3._handleSwipe();
  3669. if (_this3._config.pause === 'hover') {
  3670. // If it's a touch-enabled device, mouseenter/leave are fired as
  3671. // part of the mouse compatibility events on first tap - the carousel
  3672. // would stop cycling until user tapped out of it;
  3673. // here, we listen for touchend, explicitly pause the carousel
  3674. // (as if it's the second time we tap on it, mouseenter compat event
  3675. // is NOT fired) and after a timeout (to allow for mouse compatibility
  3676. // events to fire) we explicitly restart cycling
  3677. _this3.pause();
  3678. if (_this3.touchTimeout) {
  3679. clearTimeout(_this3.touchTimeout);
  3680. }
  3681. _this3.touchTimeout = setTimeout(function (event) {
  3682. return _this3.cycle(event);
  3683. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  3684. }
  3685. };
  3686. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  3687. return e.preventDefault();
  3688. });
  3689. if (this._pointerEvent) {
  3690. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  3691. return start(event);
  3692. });
  3693. $(this._element).on(Event$2.POINTERUP, function (event) {
  3694. return end(event);
  3695. });
  3696. this._element.classList.add(ClassName$2.POINTER_EVENT);
  3697. } else {
  3698. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  3699. return start(event);
  3700. });
  3701. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  3702. return move(event);
  3703. });
  3704. $(this._element).on(Event$2.TOUCHEND, function (event) {
  3705. return end(event);
  3706. });
  3707. }
  3708. };
  3709. _proto._keydown = function _keydown(event) {
  3710. if (/input|textarea/i.test(event.target.tagName)) {
  3711. return;
  3712. }
  3713. switch (event.which) {
  3714. case ARROW_LEFT_KEYCODE:
  3715. event.preventDefault();
  3716. this.prev();
  3717. break;
  3718. case ARROW_RIGHT_KEYCODE:
  3719. event.preventDefault();
  3720. this.next();
  3721. break;
  3722. }
  3723. };
  3724. _proto._getItemIndex = function _getItemIndex(element) {
  3725. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  3726. return this._items.indexOf(element);
  3727. };
  3728. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  3729. var isNextDirection = direction === Direction.NEXT;
  3730. var isPrevDirection = direction === Direction.PREV;
  3731. var activeIndex = this._getItemIndex(activeElement);
  3732. var lastItemIndex = this._items.length - 1;
  3733. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  3734. if (isGoingToWrap && !this._config.wrap) {
  3735. return activeElement;
  3736. }
  3737. var delta = direction === Direction.PREV ? -1 : 1;
  3738. var itemIndex = (activeIndex + delta) % this._items.length;
  3739. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  3740. };
  3741. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  3742. var targetIndex = this._getItemIndex(relatedTarget);
  3743. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  3744. var slideEvent = $.Event(Event$2.SLIDE, {
  3745. relatedTarget: relatedTarget,
  3746. direction: eventDirectionName,
  3747. from: fromIndex,
  3748. to: targetIndex
  3749. });
  3750. $(this._element).trigger(slideEvent);
  3751. return slideEvent;
  3752. };
  3753. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  3754. if (this._indicatorsElement) {
  3755. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  3756. $(indicators).removeClass(ClassName$2.ACTIVE);
  3757. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  3758. if (nextIndicator) {
  3759. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  3760. }
  3761. }
  3762. };
  3763. _proto._slide = function _slide(direction, element) {
  3764. var _this4 = this;
  3765. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3766. var activeElementIndex = this._getItemIndex(activeElement);
  3767. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  3768. var nextElementIndex = this._getItemIndex(nextElement);
  3769. var isCycling = Boolean(this._interval);
  3770. var directionalClassName;
  3771. var orderClassName;
  3772. var eventDirectionName;
  3773. if (direction === Direction.NEXT) {
  3774. directionalClassName = ClassName$2.LEFT;
  3775. orderClassName = ClassName$2.NEXT;
  3776. eventDirectionName = Direction.LEFT;
  3777. } else {
  3778. directionalClassName = ClassName$2.RIGHT;
  3779. orderClassName = ClassName$2.PREV;
  3780. eventDirectionName = Direction.RIGHT;
  3781. }
  3782. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  3783. this._isSliding = false;
  3784. return;
  3785. }
  3786. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  3787. if (slideEvent.isDefaultPrevented()) {
  3788. return;
  3789. }
  3790. if (!activeElement || !nextElement) {
  3791. // Some weirdness is happening, so we bail
  3792. return;
  3793. }
  3794. this._isSliding = true;
  3795. if (isCycling) {
  3796. this.pause();
  3797. }
  3798. this._setActiveIndicatorElement(nextElement);
  3799. var slidEvent = $.Event(Event$2.SLID, {
  3800. relatedTarget: nextElement,
  3801. direction: eventDirectionName,
  3802. from: activeElementIndex,
  3803. to: nextElementIndex
  3804. });
  3805. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  3806. $(nextElement).addClass(orderClassName);
  3807. Util.reflow(nextElement);
  3808. $(activeElement).addClass(directionalClassName);
  3809. $(nextElement).addClass(directionalClassName);
  3810. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  3811. if (nextElementInterval) {
  3812. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  3813. this._config.interval = nextElementInterval;
  3814. } else {
  3815. this._config.interval = this._config.defaultInterval || this._config.interval;
  3816. }
  3817. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  3818. $(activeElement).one(Util.TRANSITION_END, function () {
  3819. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  3820. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  3821. _this4._isSliding = false;
  3822. setTimeout(function () {
  3823. return $(_this4._element).trigger(slidEvent);
  3824. }, 0);
  3825. }).emulateTransitionEnd(transitionDuration);
  3826. } else {
  3827. $(activeElement).removeClass(ClassName$2.ACTIVE);
  3828. $(nextElement).addClass(ClassName$2.ACTIVE);
  3829. this._isSliding = false;
  3830. $(this._element).trigger(slidEvent);
  3831. }
  3832. if (isCycling) {
  3833. this.cycle();
  3834. }
  3835. } // Static
  3836. ;
  3837. Carousel._jQueryInterface = function _jQueryInterface(config) {
  3838. return this.each(function () {
  3839. var data = $(this).data(DATA_KEY$2);
  3840. var _config = _objectSpread2({}, Default, {}, $(this).data());
  3841. if (typeof config === 'object') {
  3842. _config = _objectSpread2({}, _config, {}, config);
  3843. }
  3844. var action = typeof config === 'string' ? config : _config.slide;
  3845. if (!data) {
  3846. data = new Carousel(this, _config);
  3847. $(this).data(DATA_KEY$2, data);
  3848. }
  3849. if (typeof config === 'number') {
  3850. data.to(config);
  3851. } else if (typeof action === 'string') {
  3852. if (typeof data[action] === 'undefined') {
  3853. throw new TypeError("No method named \"" + action + "\"");
  3854. }
  3855. data[action]();
  3856. } else if (_config.interval && _config.ride) {
  3857. data.pause();
  3858. data.cycle();
  3859. }
  3860. });
  3861. };
  3862. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  3863. var selector = Util.getSelectorFromElement(this);
  3864. if (!selector) {
  3865. return;
  3866. }
  3867. var target = $(selector)[0];
  3868. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  3869. return;
  3870. }
  3871. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  3872. var slideIndex = this.getAttribute('data-slide-to');
  3873. if (slideIndex) {
  3874. config.interval = false;
  3875. }
  3876. Carousel._jQueryInterface.call($(target), config);
  3877. if (slideIndex) {
  3878. $(target).data(DATA_KEY$2).to(slideIndex);
  3879. }
  3880. event.preventDefault();
  3881. };
  3882. _createClass(Carousel, null, [{
  3883. key: "VERSION",
  3884. get: function get() {
  3885. return VERSION$2;
  3886. }
  3887. }, {
  3888. key: "Default",
  3889. get: function get() {
  3890. return Default;
  3891. }
  3892. }]);
  3893. return Carousel;
  3894. }();
  3895. /**
  3896. * ------------------------------------------------------------------------
  3897. * Data Api implementation
  3898. * ------------------------------------------------------------------------
  3899. */
  3900. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  3901. $(window).on(Event$2.LOAD_DATA_API, function () {
  3902. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  3903. for (var i = 0, len = carousels.length; i < len; i++) {
  3904. var $carousel = $(carousels[i]);
  3905. Carousel._jQueryInterface.call($carousel, $carousel.data());
  3906. }
  3907. });
  3908. /**
  3909. * ------------------------------------------------------------------------
  3910. * jQuery
  3911. * ------------------------------------------------------------------------
  3912. */
  3913. $.fn[NAME$2] = Carousel._jQueryInterface;
  3914. $.fn[NAME$2].Constructor = Carousel;
  3915. $.fn[NAME$2].noConflict = function () {
  3916. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  3917. return Carousel._jQueryInterface;
  3918. };
  3919. /**
  3920. * ------------------------------------------------------------------------
  3921. * Constants
  3922. * ------------------------------------------------------------------------
  3923. */
  3924. var NAME$3 = 'collapse';
  3925. var VERSION$3 = '4.4.1';
  3926. var DATA_KEY$3 = 'bs.collapse';
  3927. var EVENT_KEY$3 = "." + DATA_KEY$3;
  3928. var DATA_API_KEY$3 = '.data-api';
  3929. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  3930. var Default$1 = {
  3931. toggle: true,
  3932. parent: ''
  3933. };
  3934. var DefaultType$1 = {
  3935. toggle: 'boolean',
  3936. parent: '(string|element)'
  3937. };
  3938. var Event$3 = {
  3939. SHOW: "show" + EVENT_KEY$3,
  3940. SHOWN: "shown" + EVENT_KEY$3,
  3941. HIDE: "hide" + EVENT_KEY$3,
  3942. HIDDEN: "hidden" + EVENT_KEY$3,
  3943. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  3944. };
  3945. var ClassName$3 = {
  3946. SHOW: 'show',
  3947. COLLAPSE: 'collapse',
  3948. COLLAPSING: 'collapsing',
  3949. COLLAPSED: 'collapsed'
  3950. };
  3951. var Dimension = {
  3952. WIDTH: 'width',
  3953. HEIGHT: 'height'
  3954. };
  3955. var Selector$3 = {
  3956. ACTIVES: '.show, .collapsing',
  3957. DATA_TOGGLE: '[data-toggle="collapse"]'
  3958. };
  3959. /**
  3960. * ------------------------------------------------------------------------
  3961. * Class Definition
  3962. * ------------------------------------------------------------------------
  3963. */
  3964. var Collapse =
  3965. /*#__PURE__*/
  3966. function () {
  3967. function Collapse(element, config) {
  3968. this._isTransitioning = false;
  3969. this._element = element;
  3970. this._config = this._getConfig(config);
  3971. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  3972. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  3973. for (var i = 0, len = toggleList.length; i < len; i++) {
  3974. var elem = toggleList[i];
  3975. var selector = Util.getSelectorFromElement(elem);
  3976. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  3977. return foundElem === element;
  3978. });
  3979. if (selector !== null && filterElement.length > 0) {
  3980. this._selector = selector;
  3981. this._triggerArray.push(elem);
  3982. }
  3983. }
  3984. this._parent = this._config.parent ? this._getParent() : null;
  3985. if (!this._config.parent) {
  3986. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  3987. }
  3988. if (this._config.toggle) {
  3989. this.toggle();
  3990. }
  3991. } // Getters
  3992. var _proto = Collapse.prototype;
  3993. // Public
  3994. _proto.toggle = function toggle() {
  3995. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  3996. this.hide();
  3997. } else {
  3998. this.show();
  3999. }
  4000. };
  4001. _proto.show = function show() {
  4002. var _this = this;
  4003. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  4004. return;
  4005. }
  4006. var actives;
  4007. var activesData;
  4008. if (this._parent) {
  4009. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  4010. if (typeof _this._config.parent === 'string') {
  4011. return elem.getAttribute('data-parent') === _this._config.parent;
  4012. }
  4013. return elem.classList.contains(ClassName$3.COLLAPSE);
  4014. });
  4015. if (actives.length === 0) {
  4016. actives = null;
  4017. }
  4018. }
  4019. if (actives) {
  4020. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  4021. if (activesData && activesData._isTransitioning) {
  4022. return;
  4023. }
  4024. }
  4025. var startEvent = $.Event(Event$3.SHOW);
  4026. $(this._element).trigger(startEvent);
  4027. if (startEvent.isDefaultPrevented()) {
  4028. return;
  4029. }
  4030. if (actives) {
  4031. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  4032. if (!activesData) {
  4033. $(actives).data(DATA_KEY$3, null);
  4034. }
  4035. }
  4036. var dimension = this._getDimension();
  4037. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  4038. this._element.style[dimension] = 0;
  4039. if (this._triggerArray.length) {
  4040. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  4041. }
  4042. this.setTransitioning(true);
  4043. var complete = function complete() {
  4044. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  4045. _this._element.style[dimension] = '';
  4046. _this.setTransitioning(false);
  4047. $(_this._element).trigger(Event$3.SHOWN);
  4048. };
  4049. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  4050. var scrollSize = "scroll" + capitalizedDimension;
  4051. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4052. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4053. this._element.style[dimension] = this._element[scrollSize] + "px";
  4054. };
  4055. _proto.hide = function hide() {
  4056. var _this2 = this;
  4057. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  4058. return;
  4059. }
  4060. var startEvent = $.Event(Event$3.HIDE);
  4061. $(this._element).trigger(startEvent);
  4062. if (startEvent.isDefaultPrevented()) {
  4063. return;
  4064. }
  4065. var dimension = this._getDimension();
  4066. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  4067. Util.reflow(this._element);
  4068. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  4069. var triggerArrayLength = this._triggerArray.length;
  4070. if (triggerArrayLength > 0) {
  4071. for (var i = 0; i < triggerArrayLength; i++) {
  4072. var trigger = this._triggerArray[i];
  4073. var selector = Util.getSelectorFromElement(trigger);
  4074. if (selector !== null) {
  4075. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  4076. if (!$elem.hasClass(ClassName$3.SHOW)) {
  4077. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  4078. }
  4079. }
  4080. }
  4081. }
  4082. this.setTransitioning(true);
  4083. var complete = function complete() {
  4084. _this2.setTransitioning(false);
  4085. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  4086. };
  4087. this._element.style[dimension] = '';
  4088. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4089. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4090. };
  4091. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  4092. this._isTransitioning = isTransitioning;
  4093. };
  4094. _proto.dispose = function dispose() {
  4095. $.removeData(this._element, DATA_KEY$3);
  4096. this._config = null;
  4097. this._parent = null;
  4098. this._element = null;
  4099. this._triggerArray = null;
  4100. this._isTransitioning = null;
  4101. } // Private
  4102. ;
  4103. _proto._getConfig = function _getConfig(config) {
  4104. config = _objectSpread2({}, Default$1, {}, config);
  4105. config.toggle = Boolean(config.toggle); // Coerce string values
  4106. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  4107. return config;
  4108. };
  4109. _proto._getDimension = function _getDimension() {
  4110. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  4111. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  4112. };
  4113. _proto._getParent = function _getParent() {
  4114. var _this3 = this;
  4115. var parent;
  4116. if (Util.isElement(this._config.parent)) {
  4117. parent = this._config.parent; // It's a jQuery object
  4118. if (typeof this._config.parent.jquery !== 'undefined') {
  4119. parent = this._config.parent[0];
  4120. }
  4121. } else {
  4122. parent = document.querySelector(this._config.parent);
  4123. }
  4124. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  4125. var children = [].slice.call(parent.querySelectorAll(selector));
  4126. $(children).each(function (i, element) {
  4127. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  4128. });
  4129. return parent;
  4130. };
  4131. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  4132. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  4133. if (triggerArray.length) {
  4134. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  4135. }
  4136. } // Static
  4137. ;
  4138. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  4139. var selector = Util.getSelectorFromElement(element);
  4140. return selector ? document.querySelector(selector) : null;
  4141. };
  4142. Collapse._jQueryInterface = function _jQueryInterface(config) {
  4143. return this.each(function () {
  4144. var $this = $(this);
  4145. var data = $this.data(DATA_KEY$3);
  4146. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  4147. if (!data && _config.toggle && /show|hide/.test(config)) {
  4148. _config.toggle = false;
  4149. }
  4150. if (!data) {
  4151. data = new Collapse(this, _config);
  4152. $this.data(DATA_KEY$3, data);
  4153. }
  4154. if (typeof config === 'string') {
  4155. if (typeof data[config] === 'undefined') {
  4156. throw new TypeError("No method named \"" + config + "\"");
  4157. }
  4158. data[config]();
  4159. }
  4160. });
  4161. };
  4162. _createClass(Collapse, null, [{
  4163. key: "VERSION",
  4164. get: function get() {
  4165. return VERSION$3;
  4166. }
  4167. }, {
  4168. key: "Default",
  4169. get: function get() {
  4170. return Default$1;
  4171. }
  4172. }]);
  4173. return Collapse;
  4174. }();
  4175. /**
  4176. * ------------------------------------------------------------------------
  4177. * Data Api implementation
  4178. * ------------------------------------------------------------------------
  4179. */
  4180. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  4181. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  4182. if (event.currentTarget.tagName === 'A') {
  4183. event.preventDefault();
  4184. }
  4185. var $trigger = $(this);
  4186. var selector = Util.getSelectorFromElement(this);
  4187. var selectors = [].slice.call(document.querySelectorAll(selector));
  4188. $(selectors).each(function () {
  4189. var $target = $(this);
  4190. var data = $target.data(DATA_KEY$3);
  4191. var config = data ? 'toggle' : $trigger.data();
  4192. Collapse._jQueryInterface.call($target, config);
  4193. });
  4194. });
  4195. /**
  4196. * ------------------------------------------------------------------------
  4197. * jQuery
  4198. * ------------------------------------------------------------------------
  4199. */
  4200. $.fn[NAME$3] = Collapse._jQueryInterface;
  4201. $.fn[NAME$3].Constructor = Collapse;
  4202. $.fn[NAME$3].noConflict = function () {
  4203. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  4204. return Collapse._jQueryInterface;
  4205. };
  4206. /**
  4207. * ------------------------------------------------------------------------
  4208. * Constants
  4209. * ------------------------------------------------------------------------
  4210. */
  4211. var NAME$4 = 'dropdown';
  4212. var VERSION$4 = '4.4.1';
  4213. var DATA_KEY$4 = 'bs.dropdown';
  4214. var EVENT_KEY$4 = "." + DATA_KEY$4;
  4215. var DATA_API_KEY$4 = '.data-api';
  4216. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  4217. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  4218. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  4219. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  4220. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  4221. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  4222. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  4223. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  4224. var Event$4 = {
  4225. HIDE: "hide" + EVENT_KEY$4,
  4226. HIDDEN: "hidden" + EVENT_KEY$4,
  4227. SHOW: "show" + EVENT_KEY$4,
  4228. SHOWN: "shown" + EVENT_KEY$4,
  4229. CLICK: "click" + EVENT_KEY$4,
  4230. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  4231. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  4232. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  4233. };
  4234. var ClassName$4 = {
  4235. DISABLED: 'disabled',
  4236. SHOW: 'show',
  4237. DROPUP: 'dropup',
  4238. DROPRIGHT: 'dropright',
  4239. DROPLEFT: 'dropleft',
  4240. MENURIGHT: 'dropdown-menu-right',
  4241. MENULEFT: 'dropdown-menu-left',
  4242. POSITION_STATIC: 'position-static'
  4243. };
  4244. var Selector$4 = {
  4245. DATA_TOGGLE: '[data-toggle="dropdown"]',
  4246. FORM_CHILD: '.dropdown form',
  4247. MENU: '.dropdown-menu',
  4248. NAVBAR_NAV: '.navbar-nav',
  4249. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  4250. };
  4251. var AttachmentMap = {
  4252. TOP: 'top-start',
  4253. TOPEND: 'top-end',
  4254. BOTTOM: 'bottom-start',
  4255. BOTTOMEND: 'bottom-end',
  4256. RIGHT: 'right-start',
  4257. RIGHTEND: 'right-end',
  4258. LEFT: 'left-start',
  4259. LEFTEND: 'left-end'
  4260. };
  4261. var Default$2 = {
  4262. offset: 0,
  4263. flip: true,
  4264. boundary: 'scrollParent',
  4265. reference: 'toggle',
  4266. display: 'dynamic',
  4267. popperConfig: null
  4268. };
  4269. var DefaultType$2 = {
  4270. offset: '(number|string|function)',
  4271. flip: 'boolean',
  4272. boundary: '(string|element)',
  4273. reference: '(string|element)',
  4274. display: 'string',
  4275. popperConfig: '(null|object)'
  4276. };
  4277. /**
  4278. * ------------------------------------------------------------------------
  4279. * Class Definition
  4280. * ------------------------------------------------------------------------
  4281. */
  4282. var Dropdown =
  4283. /*#__PURE__*/
  4284. function () {
  4285. function Dropdown(element, config) {
  4286. this._element = element;
  4287. this._popper = null;
  4288. this._config = this._getConfig(config);
  4289. this._menu = this._getMenuElement();
  4290. this._inNavbar = this._detectNavbar();
  4291. this._addEventListeners();
  4292. } // Getters
  4293. var _proto = Dropdown.prototype;
  4294. // Public
  4295. _proto.toggle = function toggle() {
  4296. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  4297. return;
  4298. }
  4299. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  4300. Dropdown._clearMenus();
  4301. if (isActive) {
  4302. return;
  4303. }
  4304. this.show(true);
  4305. };
  4306. _proto.show = function show(usePopper) {
  4307. if (usePopper === void 0) {
  4308. usePopper = false;
  4309. }
  4310. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  4311. return;
  4312. }
  4313. var relatedTarget = {
  4314. relatedTarget: this._element
  4315. };
  4316. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  4317. var parent = Dropdown._getParentFromElement(this._element);
  4318. $(parent).trigger(showEvent);
  4319. if (showEvent.isDefaultPrevented()) {
  4320. return;
  4321. } // Disable totally Popper.js for Dropdown in Navbar
  4322. if (!this._inNavbar && usePopper) {
  4323. /**
  4324. * Check for Popper dependency
  4325. * Popper - https://popper.js.org
  4326. */
  4327. if (typeof Popper === 'undefined') {
  4328. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  4329. }
  4330. var referenceElement = this._element;
  4331. if (this._config.reference === 'parent') {
  4332. referenceElement = parent;
  4333. } else if (Util.isElement(this._config.reference)) {
  4334. referenceElement = this._config.reference; // Check if it's jQuery element
  4335. if (typeof this._config.reference.jquery !== 'undefined') {
  4336. referenceElement = this._config.reference[0];
  4337. }
  4338. } // If boundary is not `scrollParent`, then set position to `static`
  4339. // to allow the menu to "escape" the scroll parent's boundaries
  4340. // https://github.com/twbs/bootstrap/issues/24251
  4341. if (this._config.boundary !== 'scrollParent') {
  4342. $(parent).addClass(ClassName$4.POSITION_STATIC);
  4343. }
  4344. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  4345. } // If this is a touch-enabled device we add extra
  4346. // empty mouseover listeners to the body's immediate children;
  4347. // only needed because of broken event delegation on iOS
  4348. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4349. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  4350. $(document.body).children().on('mouseover', null, $.noop);
  4351. }
  4352. this._element.focus();
  4353. this._element.setAttribute('aria-expanded', true);
  4354. $(this._menu).toggleClass(ClassName$4.SHOW);
  4355. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  4356. };
  4357. _proto.hide = function hide() {
  4358. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  4359. return;
  4360. }
  4361. var relatedTarget = {
  4362. relatedTarget: this._element
  4363. };
  4364. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4365. var parent = Dropdown._getParentFromElement(this._element);
  4366. $(parent).trigger(hideEvent);
  4367. if (hideEvent.isDefaultPrevented()) {
  4368. return;
  4369. }
  4370. if (this._popper) {
  4371. this._popper.destroy();
  4372. }
  4373. $(this._menu).toggleClass(ClassName$4.SHOW);
  4374. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4375. };
  4376. _proto.dispose = function dispose() {
  4377. $.removeData(this._element, DATA_KEY$4);
  4378. $(this._element).off(EVENT_KEY$4);
  4379. this._element = null;
  4380. this._menu = null;
  4381. if (this._popper !== null) {
  4382. this._popper.destroy();
  4383. this._popper = null;
  4384. }
  4385. };
  4386. _proto.update = function update() {
  4387. this._inNavbar = this._detectNavbar();
  4388. if (this._popper !== null) {
  4389. this._popper.scheduleUpdate();
  4390. }
  4391. } // Private
  4392. ;
  4393. _proto._addEventListeners = function _addEventListeners() {
  4394. var _this = this;
  4395. $(this._element).on(Event$4.CLICK, function (event) {
  4396. event.preventDefault();
  4397. event.stopPropagation();
  4398. _this.toggle();
  4399. });
  4400. };
  4401. _proto._getConfig = function _getConfig(config) {
  4402. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  4403. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  4404. return config;
  4405. };
  4406. _proto._getMenuElement = function _getMenuElement() {
  4407. if (!this._menu) {
  4408. var parent = Dropdown._getParentFromElement(this._element);
  4409. if (parent) {
  4410. this._menu = parent.querySelector(Selector$4.MENU);
  4411. }
  4412. }
  4413. return this._menu;
  4414. };
  4415. _proto._getPlacement = function _getPlacement() {
  4416. var $parentDropdown = $(this._element.parentNode);
  4417. var placement = AttachmentMap.BOTTOM; // Handle dropup
  4418. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  4419. placement = AttachmentMap.TOP;
  4420. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  4421. placement = AttachmentMap.TOPEND;
  4422. }
  4423. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  4424. placement = AttachmentMap.RIGHT;
  4425. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  4426. placement = AttachmentMap.LEFT;
  4427. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  4428. placement = AttachmentMap.BOTTOMEND;
  4429. }
  4430. return placement;
  4431. };
  4432. _proto._detectNavbar = function _detectNavbar() {
  4433. return $(this._element).closest('.navbar').length > 0;
  4434. };
  4435. _proto._getOffset = function _getOffset() {
  4436. var _this2 = this;
  4437. var offset = {};
  4438. if (typeof this._config.offset === 'function') {
  4439. offset.fn = function (data) {
  4440. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  4441. return data;
  4442. };
  4443. } else {
  4444. offset.offset = this._config.offset;
  4445. }
  4446. return offset;
  4447. };
  4448. _proto._getPopperConfig = function _getPopperConfig() {
  4449. var popperConfig = {
  4450. placement: this._getPlacement(),
  4451. modifiers: {
  4452. offset: this._getOffset(),
  4453. flip: {
  4454. enabled: this._config.flip
  4455. },
  4456. preventOverflow: {
  4457. boundariesElement: this._config.boundary
  4458. }
  4459. }
  4460. }; // Disable Popper.js if we have a static display
  4461. if (this._config.display === 'static') {
  4462. popperConfig.modifiers.applyStyle = {
  4463. enabled: false
  4464. };
  4465. }
  4466. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  4467. } // Static
  4468. ;
  4469. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  4470. return this.each(function () {
  4471. var data = $(this).data(DATA_KEY$4);
  4472. var _config = typeof config === 'object' ? config : null;
  4473. if (!data) {
  4474. data = new Dropdown(this, _config);
  4475. $(this).data(DATA_KEY$4, data);
  4476. }
  4477. if (typeof config === 'string') {
  4478. if (typeof data[config] === 'undefined') {
  4479. throw new TypeError("No method named \"" + config + "\"");
  4480. }
  4481. data[config]();
  4482. }
  4483. });
  4484. };
  4485. Dropdown._clearMenus = function _clearMenus(event) {
  4486. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  4487. return;
  4488. }
  4489. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  4490. for (var i = 0, len = toggles.length; i < len; i++) {
  4491. var parent = Dropdown._getParentFromElement(toggles[i]);
  4492. var context = $(toggles[i]).data(DATA_KEY$4);
  4493. var relatedTarget = {
  4494. relatedTarget: toggles[i]
  4495. };
  4496. if (event && event.type === 'click') {
  4497. relatedTarget.clickEvent = event;
  4498. }
  4499. if (!context) {
  4500. continue;
  4501. }
  4502. var dropdownMenu = context._menu;
  4503. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  4504. continue;
  4505. }
  4506. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  4507. continue;
  4508. }
  4509. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4510. $(parent).trigger(hideEvent);
  4511. if (hideEvent.isDefaultPrevented()) {
  4512. continue;
  4513. } // If this is a touch-enabled device we remove the extra
  4514. // empty mouseover listeners we added for iOS support
  4515. if ('ontouchstart' in document.documentElement) {
  4516. $(document.body).children().off('mouseover', null, $.noop);
  4517. }
  4518. toggles[i].setAttribute('aria-expanded', 'false');
  4519. if (context._popper) {
  4520. context._popper.destroy();
  4521. }
  4522. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  4523. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4524. }
  4525. };
  4526. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  4527. var parent;
  4528. var selector = Util.getSelectorFromElement(element);
  4529. if (selector) {
  4530. parent = document.querySelector(selector);
  4531. }
  4532. return parent || element.parentNode;
  4533. } // eslint-disable-next-line complexity
  4534. ;
  4535. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  4536. // If not input/textarea:
  4537. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  4538. // If input/textarea:
  4539. // - If space key => not a dropdown command
  4540. // - If key is other than escape
  4541. // - If key is not up or down => not a dropdown command
  4542. // - If trigger inside the menu => not a dropdown command
  4543. 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)) {
  4544. return;
  4545. }
  4546. event.preventDefault();
  4547. event.stopPropagation();
  4548. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  4549. return;
  4550. }
  4551. var parent = Dropdown._getParentFromElement(this);
  4552. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  4553. if (!isActive && event.which === ESCAPE_KEYCODE) {
  4554. return;
  4555. }
  4556. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  4557. if (event.which === ESCAPE_KEYCODE) {
  4558. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  4559. $(toggle).trigger('focus');
  4560. }
  4561. $(this).trigger('click');
  4562. return;
  4563. }
  4564. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  4565. return $(item).is(':visible');
  4566. });
  4567. if (items.length === 0) {
  4568. return;
  4569. }
  4570. var index = items.indexOf(event.target);
  4571. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  4572. // Up
  4573. index--;
  4574. }
  4575. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  4576. // Down
  4577. index++;
  4578. }
  4579. if (index < 0) {
  4580. index = 0;
  4581. }
  4582. items[index].focus();
  4583. };
  4584. _createClass(Dropdown, null, [{
  4585. key: "VERSION",
  4586. get: function get() {
  4587. return VERSION$4;
  4588. }
  4589. }, {
  4590. key: "Default",
  4591. get: function get() {
  4592. return Default$2;
  4593. }
  4594. }, {
  4595. key: "DefaultType",
  4596. get: function get() {
  4597. return DefaultType$2;
  4598. }
  4599. }]);
  4600. return Dropdown;
  4601. }();
  4602. /**
  4603. * ------------------------------------------------------------------------
  4604. * Data Api implementation
  4605. * ------------------------------------------------------------------------
  4606. */
  4607. $(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) {
  4608. event.preventDefault();
  4609. event.stopPropagation();
  4610. Dropdown._jQueryInterface.call($(this), 'toggle');
  4611. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  4612. e.stopPropagation();
  4613. });
  4614. /**
  4615. * ------------------------------------------------------------------------
  4616. * jQuery
  4617. * ------------------------------------------------------------------------
  4618. */
  4619. $.fn[NAME$4] = Dropdown._jQueryInterface;
  4620. $.fn[NAME$4].Constructor = Dropdown;
  4621. $.fn[NAME$4].noConflict = function () {
  4622. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  4623. return Dropdown._jQueryInterface;
  4624. };
  4625. /**
  4626. * ------------------------------------------------------------------------
  4627. * Constants
  4628. * ------------------------------------------------------------------------
  4629. */
  4630. var NAME$5 = 'modal';
  4631. var VERSION$5 = '4.4.1';
  4632. var DATA_KEY$5 = 'bs.modal';
  4633. var EVENT_KEY$5 = "." + DATA_KEY$5;
  4634. var DATA_API_KEY$5 = '.data-api';
  4635. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  4636. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  4637. var Default$3 = {
  4638. backdrop: true,
  4639. keyboard: true,
  4640. focus: true,
  4641. show: true
  4642. };
  4643. var DefaultType$3 = {
  4644. backdrop: '(boolean|string)',
  4645. keyboard: 'boolean',
  4646. focus: 'boolean',
  4647. show: 'boolean'
  4648. };
  4649. var Event$5 = {
  4650. HIDE: "hide" + EVENT_KEY$5,
  4651. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  4652. HIDDEN: "hidden" + EVENT_KEY$5,
  4653. SHOW: "show" + EVENT_KEY$5,
  4654. SHOWN: "shown" + EVENT_KEY$5,
  4655. FOCUSIN: "focusin" + EVENT_KEY$5,
  4656. RESIZE: "resize" + EVENT_KEY$5,
  4657. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  4658. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  4659. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  4660. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  4661. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  4662. };
  4663. var ClassName$5 = {
  4664. SCROLLABLE: 'modal-dialog-scrollable',
  4665. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  4666. BACKDROP: 'modal-backdrop',
  4667. OPEN: 'modal-open',
  4668. FADE: 'fade',
  4669. SHOW: 'show',
  4670. STATIC: 'modal-static'
  4671. };
  4672. var Selector$5 = {
  4673. DIALOG: '.modal-dialog',
  4674. MODAL_BODY: '.modal-body',
  4675. DATA_TOGGLE: '[data-toggle="modal"]',
  4676. DATA_DISMISS: '[data-dismiss="modal"]',
  4677. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  4678. STICKY_CONTENT: '.sticky-top'
  4679. };
  4680. /**
  4681. * ------------------------------------------------------------------------
  4682. * Class Definition
  4683. * ------------------------------------------------------------------------
  4684. */
  4685. var Modal =
  4686. /*#__PURE__*/
  4687. function () {
  4688. function Modal(element, config) {
  4689. this._config = this._getConfig(config);
  4690. this._element = element;
  4691. this._dialog = element.querySelector(Selector$5.DIALOG);
  4692. this._backdrop = null;
  4693. this._isShown = false;
  4694. this._isBodyOverflowing = false;
  4695. this._ignoreBackdropClick = false;
  4696. this._isTransitioning = false;
  4697. this._scrollbarWidth = 0;
  4698. } // Getters
  4699. var _proto = Modal.prototype;
  4700. // Public
  4701. _proto.toggle = function toggle(relatedTarget) {
  4702. return this._isShown ? this.hide() : this.show(relatedTarget);
  4703. };
  4704. _proto.show = function show(relatedTarget) {
  4705. var _this = this;
  4706. if (this._isShown || this._isTransitioning) {
  4707. return;
  4708. }
  4709. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4710. this._isTransitioning = true;
  4711. }
  4712. var showEvent = $.Event(Event$5.SHOW, {
  4713. relatedTarget: relatedTarget
  4714. });
  4715. $(this._element).trigger(showEvent);
  4716. if (this._isShown || showEvent.isDefaultPrevented()) {
  4717. return;
  4718. }
  4719. this._isShown = true;
  4720. this._checkScrollbar();
  4721. this._setScrollbar();
  4722. this._adjustDialog();
  4723. this._setEscapeEvent();
  4724. this._setResizeEvent();
  4725. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  4726. return _this.hide(event);
  4727. });
  4728. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  4729. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  4730. if ($(event.target).is(_this._element)) {
  4731. _this._ignoreBackdropClick = true;
  4732. }
  4733. });
  4734. });
  4735. this._showBackdrop(function () {
  4736. return _this._showElement(relatedTarget);
  4737. });
  4738. };
  4739. _proto.hide = function hide(event) {
  4740. var _this2 = this;
  4741. if (event) {
  4742. event.preventDefault();
  4743. }
  4744. if (!this._isShown || this._isTransitioning) {
  4745. return;
  4746. }
  4747. var hideEvent = $.Event(Event$5.HIDE);
  4748. $(this._element).trigger(hideEvent);
  4749. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  4750. return;
  4751. }
  4752. this._isShown = false;
  4753. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4754. if (transition) {
  4755. this._isTransitioning = true;
  4756. }
  4757. this._setEscapeEvent();
  4758. this._setResizeEvent();
  4759. $(document).off(Event$5.FOCUSIN);
  4760. $(this._element).removeClass(ClassName$5.SHOW);
  4761. $(this._element).off(Event$5.CLICK_DISMISS);
  4762. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  4763. if (transition) {
  4764. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4765. $(this._element).one(Util.TRANSITION_END, function (event) {
  4766. return _this2._hideModal(event);
  4767. }).emulateTransitionEnd(transitionDuration);
  4768. } else {
  4769. this._hideModal();
  4770. }
  4771. };
  4772. _proto.dispose = function dispose() {
  4773. [window, this._element, this._dialog].forEach(function (htmlElement) {
  4774. return $(htmlElement).off(EVENT_KEY$5);
  4775. });
  4776. /**
  4777. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  4778. * Do not move `document` in `htmlElements` array
  4779. * It will remove `Event.CLICK_DATA_API` event that should remain
  4780. */
  4781. $(document).off(Event$5.FOCUSIN);
  4782. $.removeData(this._element, DATA_KEY$5);
  4783. this._config = null;
  4784. this._element = null;
  4785. this._dialog = null;
  4786. this._backdrop = null;
  4787. this._isShown = null;
  4788. this._isBodyOverflowing = null;
  4789. this._ignoreBackdropClick = null;
  4790. this._isTransitioning = null;
  4791. this._scrollbarWidth = null;
  4792. };
  4793. _proto.handleUpdate = function handleUpdate() {
  4794. this._adjustDialog();
  4795. } // Private
  4796. ;
  4797. _proto._getConfig = function _getConfig(config) {
  4798. config = _objectSpread2({}, Default$3, {}, config);
  4799. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  4800. return config;
  4801. };
  4802. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  4803. var _this3 = this;
  4804. if (this._config.backdrop === 'static') {
  4805. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  4806. $(this._element).trigger(hideEventPrevented);
  4807. if (hideEventPrevented.defaultPrevented) {
  4808. return;
  4809. }
  4810. this._element.classList.add(ClassName$5.STATIC);
  4811. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  4812. $(this._element).one(Util.TRANSITION_END, function () {
  4813. _this3._element.classList.remove(ClassName$5.STATIC);
  4814. }).emulateTransitionEnd(modalTransitionDuration);
  4815. this._element.focus();
  4816. } else {
  4817. this.hide();
  4818. }
  4819. };
  4820. _proto._showElement = function _showElement(relatedTarget) {
  4821. var _this4 = this;
  4822. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4823. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  4824. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  4825. // Don't move modal's DOM position
  4826. document.body.appendChild(this._element);
  4827. }
  4828. this._element.style.display = 'block';
  4829. this._element.removeAttribute('aria-hidden');
  4830. this._element.setAttribute('aria-modal', true);
  4831. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  4832. modalBody.scrollTop = 0;
  4833. } else {
  4834. this._element.scrollTop = 0;
  4835. }
  4836. if (transition) {
  4837. Util.reflow(this._element);
  4838. }
  4839. $(this._element).addClass(ClassName$5.SHOW);
  4840. if (this._config.focus) {
  4841. this._enforceFocus();
  4842. }
  4843. var shownEvent = $.Event(Event$5.SHOWN, {
  4844. relatedTarget: relatedTarget
  4845. });
  4846. var transitionComplete = function transitionComplete() {
  4847. if (_this4._config.focus) {
  4848. _this4._element.focus();
  4849. }
  4850. _this4._isTransitioning = false;
  4851. $(_this4._element).trigger(shownEvent);
  4852. };
  4853. if (transition) {
  4854. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  4855. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  4856. } else {
  4857. transitionComplete();
  4858. }
  4859. };
  4860. _proto._enforceFocus = function _enforceFocus() {
  4861. var _this5 = this;
  4862. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  4863. .on(Event$5.FOCUSIN, function (event) {
  4864. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  4865. _this5._element.focus();
  4866. }
  4867. });
  4868. };
  4869. _proto._setEscapeEvent = function _setEscapeEvent() {
  4870. var _this6 = this;
  4871. if (this._isShown && this._config.keyboard) {
  4872. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  4873. if (event.which === ESCAPE_KEYCODE$1) {
  4874. _this6._triggerBackdropTransition();
  4875. }
  4876. });
  4877. } else if (!this._isShown) {
  4878. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  4879. }
  4880. };
  4881. _proto._setResizeEvent = function _setResizeEvent() {
  4882. var _this7 = this;
  4883. if (this._isShown) {
  4884. $(window).on(Event$5.RESIZE, function (event) {
  4885. return _this7.handleUpdate(event);
  4886. });
  4887. } else {
  4888. $(window).off(Event$5.RESIZE);
  4889. }
  4890. };
  4891. _proto._hideModal = function _hideModal() {
  4892. var _this8 = this;
  4893. this._element.style.display = 'none';
  4894. this._element.setAttribute('aria-hidden', true);
  4895. this._element.removeAttribute('aria-modal');
  4896. this._isTransitioning = false;
  4897. this._showBackdrop(function () {
  4898. $(document.body).removeClass(ClassName$5.OPEN);
  4899. _this8._resetAdjustments();
  4900. _this8._resetScrollbar();
  4901. $(_this8._element).trigger(Event$5.HIDDEN);
  4902. });
  4903. };
  4904. _proto._removeBackdrop = function _removeBackdrop() {
  4905. if (this._backdrop) {
  4906. $(this._backdrop).remove();
  4907. this._backdrop = null;
  4908. }
  4909. };
  4910. _proto._showBackdrop = function _showBackdrop(callback) {
  4911. var _this9 = this;
  4912. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  4913. if (this._isShown && this._config.backdrop) {
  4914. this._backdrop = document.createElement('div');
  4915. this._backdrop.className = ClassName$5.BACKDROP;
  4916. if (animate) {
  4917. this._backdrop.classList.add(animate);
  4918. }
  4919. $(this._backdrop).appendTo(document.body);
  4920. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  4921. if (_this9._ignoreBackdropClick) {
  4922. _this9._ignoreBackdropClick = false;
  4923. return;
  4924. }
  4925. if (event.target !== event.currentTarget) {
  4926. return;
  4927. }
  4928. _this9._triggerBackdropTransition();
  4929. });
  4930. if (animate) {
  4931. Util.reflow(this._backdrop);
  4932. }
  4933. $(this._backdrop).addClass(ClassName$5.SHOW);
  4934. if (!callback) {
  4935. return;
  4936. }
  4937. if (!animate) {
  4938. callback();
  4939. return;
  4940. }
  4941. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4942. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  4943. } else if (!this._isShown && this._backdrop) {
  4944. $(this._backdrop).removeClass(ClassName$5.SHOW);
  4945. var callbackRemove = function callbackRemove() {
  4946. _this9._removeBackdrop();
  4947. if (callback) {
  4948. callback();
  4949. }
  4950. };
  4951. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4952. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4953. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  4954. } else {
  4955. callbackRemove();
  4956. }
  4957. } else if (callback) {
  4958. callback();
  4959. }
  4960. } // ----------------------------------------------------------------------
  4961. // the following methods are used to handle overflowing modals
  4962. // todo (fat): these should probably be refactored out of modal.js
  4963. // ----------------------------------------------------------------------
  4964. ;
  4965. _proto._adjustDialog = function _adjustDialog() {
  4966. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  4967. if (!this._isBodyOverflowing && isModalOverflowing) {
  4968. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  4969. }
  4970. if (this._isBodyOverflowing && !isModalOverflowing) {
  4971. this._element.style.paddingRight = this._scrollbarWidth + "px";
  4972. }
  4973. };
  4974. _proto._resetAdjustments = function _resetAdjustments() {
  4975. this._element.style.paddingLeft = '';
  4976. this._element.style.paddingRight = '';
  4977. };
  4978. _proto._checkScrollbar = function _checkScrollbar() {
  4979. var rect = document.body.getBoundingClientRect();
  4980. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  4981. this._scrollbarWidth = this._getScrollbarWidth();
  4982. };
  4983. _proto._setScrollbar = function _setScrollbar() {
  4984. var _this10 = this;
  4985. if (this._isBodyOverflowing) {
  4986. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  4987. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  4988. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4989. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  4990. $(fixedContent).each(function (index, element) {
  4991. var actualPadding = element.style.paddingRight;
  4992. var calculatedPadding = $(element).css('padding-right');
  4993. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  4994. }); // Adjust sticky content margin
  4995. $(stickyContent).each(function (index, element) {
  4996. var actualMargin = element.style.marginRight;
  4997. var calculatedMargin = $(element).css('margin-right');
  4998. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  4999. }); // Adjust body padding
  5000. var actualPadding = document.body.style.paddingRight;
  5001. var calculatedPadding = $(document.body).css('padding-right');
  5002. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  5003. }
  5004. $(document.body).addClass(ClassName$5.OPEN);
  5005. };
  5006. _proto._resetScrollbar = function _resetScrollbar() {
  5007. // Restore fixed content padding
  5008. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  5009. $(fixedContent).each(function (index, element) {
  5010. var padding = $(element).data('padding-right');
  5011. $(element).removeData('padding-right');
  5012. element.style.paddingRight = padding ? padding : '';
  5013. }); // Restore sticky content
  5014. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  5015. $(elements).each(function (index, element) {
  5016. var margin = $(element).data('margin-right');
  5017. if (typeof margin !== 'undefined') {
  5018. $(element).css('margin-right', margin).removeData('margin-right');
  5019. }
  5020. }); // Restore body padding
  5021. var padding = $(document.body).data('padding-right');
  5022. $(document.body).removeData('padding-right');
  5023. document.body.style.paddingRight = padding ? padding : '';
  5024. };
  5025. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  5026. // thx d.walsh
  5027. var scrollDiv = document.createElement('div');
  5028. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  5029. document.body.appendChild(scrollDiv);
  5030. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  5031. document.body.removeChild(scrollDiv);
  5032. return scrollbarWidth;
  5033. } // Static
  5034. ;
  5035. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  5036. return this.each(function () {
  5037. var data = $(this).data(DATA_KEY$5);
  5038. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  5039. if (!data) {
  5040. data = new Modal(this, _config);
  5041. $(this).data(DATA_KEY$5, data);
  5042. }
  5043. if (typeof config === 'string') {
  5044. if (typeof data[config] === 'undefined') {
  5045. throw new TypeError("No method named \"" + config + "\"");
  5046. }
  5047. data[config](relatedTarget);
  5048. } else if (_config.show) {
  5049. data.show(relatedTarget);
  5050. }
  5051. });
  5052. };
  5053. _createClass(Modal, null, [{
  5054. key: "VERSION",
  5055. get: function get() {
  5056. return VERSION$5;
  5057. }
  5058. }, {
  5059. key: "Default",
  5060. get: function get() {
  5061. return Default$3;
  5062. }
  5063. }]);
  5064. return Modal;
  5065. }();
  5066. /**
  5067. * ------------------------------------------------------------------------
  5068. * Data Api implementation
  5069. * ------------------------------------------------------------------------
  5070. */
  5071. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  5072. var _this11 = this;
  5073. var target;
  5074. var selector = Util.getSelectorFromElement(this);
  5075. if (selector) {
  5076. target = document.querySelector(selector);
  5077. }
  5078. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  5079. if (this.tagName === 'A' || this.tagName === 'AREA') {
  5080. event.preventDefault();
  5081. }
  5082. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  5083. if (showEvent.isDefaultPrevented()) {
  5084. // Only register focus restorer if modal will actually get shown
  5085. return;
  5086. }
  5087. $target.one(Event$5.HIDDEN, function () {
  5088. if ($(_this11).is(':visible')) {
  5089. _this11.focus();
  5090. }
  5091. });
  5092. });
  5093. Modal._jQueryInterface.call($(target), config, this);
  5094. });
  5095. /**
  5096. * ------------------------------------------------------------------------
  5097. * jQuery
  5098. * ------------------------------------------------------------------------
  5099. */
  5100. $.fn[NAME$5] = Modal._jQueryInterface;
  5101. $.fn[NAME$5].Constructor = Modal;
  5102. $.fn[NAME$5].noConflict = function () {
  5103. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  5104. return Modal._jQueryInterface;
  5105. };
  5106. /**
  5107. * --------------------------------------------------------------------------
  5108. * Bootstrap (v4.4.1): tools/sanitizer.js
  5109. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  5110. * --------------------------------------------------------------------------
  5111. */
  5112. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  5113. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  5114. var DefaultWhitelist = {
  5115. // Global attributes allowed on any supplied element below.
  5116. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  5117. a: ['target', 'href', 'title', 'rel'],
  5118. area: [],
  5119. b: [],
  5120. br: [],
  5121. col: [],
  5122. code: [],
  5123. div: [],
  5124. em: [],
  5125. hr: [],
  5126. h1: [],
  5127. h2: [],
  5128. h3: [],
  5129. h4: [],
  5130. h5: [],
  5131. h6: [],
  5132. i: [],
  5133. img: ['src', 'alt', 'title', 'width', 'height'],
  5134. li: [],
  5135. ol: [],
  5136. p: [],
  5137. pre: [],
  5138. s: [],
  5139. small: [],
  5140. span: [],
  5141. sub: [],
  5142. sup: [],
  5143. strong: [],
  5144. u: [],
  5145. ul: []
  5146. };
  5147. /**
  5148. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  5149. *
  5150. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  5151. */
  5152. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  5153. /**
  5154. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  5155. *
  5156. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  5157. */
  5158. 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;
  5159. function allowedAttribute(attr, allowedAttributeList) {
  5160. var attrName = attr.nodeName.toLowerCase();
  5161. if (allowedAttributeList.indexOf(attrName) !== -1) {
  5162. if (uriAttrs.indexOf(attrName) !== -1) {
  5163. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  5164. }
  5165. return true;
  5166. }
  5167. var regExp = allowedAttributeList.filter(function (attrRegex) {
  5168. return attrRegex instanceof RegExp;
  5169. }); // Check if a regular expression validates the attribute.
  5170. for (var i = 0, l = regExp.length; i < l; i++) {
  5171. if (attrName.match(regExp[i])) {
  5172. return true;
  5173. }
  5174. }
  5175. return false;
  5176. }
  5177. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  5178. if (unsafeHtml.length === 0) {
  5179. return unsafeHtml;
  5180. }
  5181. if (sanitizeFn && typeof sanitizeFn === 'function') {
  5182. return sanitizeFn(unsafeHtml);
  5183. }
  5184. var domParser = new window.DOMParser();
  5185. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  5186. var whitelistKeys = Object.keys(whiteList);
  5187. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  5188. var _loop = function _loop(i, len) {
  5189. var el = elements[i];
  5190. var elName = el.nodeName.toLowerCase();
  5191. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  5192. el.parentNode.removeChild(el);
  5193. return "continue";
  5194. }
  5195. var attributeList = [].slice.call(el.attributes);
  5196. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  5197. attributeList.forEach(function (attr) {
  5198. if (!allowedAttribute(attr, whitelistedAttributes)) {
  5199. el.removeAttribute(attr.nodeName);
  5200. }
  5201. });
  5202. };
  5203. for (var i = 0, len = elements.length; i < len; i++) {
  5204. var _ret = _loop(i);
  5205. if (_ret === "continue") continue;
  5206. }
  5207. return createdDocument.body.innerHTML;
  5208. }
  5209. /**
  5210. * ------------------------------------------------------------------------
  5211. * Constants
  5212. * ------------------------------------------------------------------------
  5213. */
  5214. var NAME$6 = 'tooltip';
  5215. var VERSION$6 = '4.4.1';
  5216. var DATA_KEY$6 = 'bs.tooltip';
  5217. var EVENT_KEY$6 = "." + DATA_KEY$6;
  5218. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  5219. var CLASS_PREFIX = 'bs-tooltip';
  5220. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  5221. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  5222. var DefaultType$4 = {
  5223. animation: 'boolean',
  5224. template: 'string',
  5225. title: '(string|element|function)',
  5226. trigger: 'string',
  5227. delay: '(number|object)',
  5228. html: 'boolean',
  5229. selector: '(string|boolean)',
  5230. placement: '(string|function)',
  5231. offset: '(number|string|function)',
  5232. container: '(string|element|boolean)',
  5233. fallbackPlacement: '(string|array)',
  5234. boundary: '(string|element)',
  5235. sanitize: 'boolean',
  5236. sanitizeFn: '(null|function)',
  5237. whiteList: 'object',
  5238. popperConfig: '(null|object)'
  5239. };
  5240. var AttachmentMap$1 = {
  5241. AUTO: 'auto',
  5242. TOP: 'top',
  5243. RIGHT: 'right',
  5244. BOTTOM: 'bottom',
  5245. LEFT: 'left'
  5246. };
  5247. var Default$4 = {
  5248. animation: true,
  5249. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  5250. trigger: 'hover focus',
  5251. title: '',
  5252. delay: 0,
  5253. html: false,
  5254. selector: false,
  5255. placement: 'top',
  5256. offset: 0,
  5257. container: false,
  5258. fallbackPlacement: 'flip',
  5259. boundary: 'scrollParent',
  5260. sanitize: true,
  5261. sanitizeFn: null,
  5262. whiteList: DefaultWhitelist,
  5263. popperConfig: null
  5264. };
  5265. var HoverState = {
  5266. SHOW: 'show',
  5267. OUT: 'out'
  5268. };
  5269. var Event$6 = {
  5270. HIDE: "hide" + EVENT_KEY$6,
  5271. HIDDEN: "hidden" + EVENT_KEY$6,
  5272. SHOW: "show" + EVENT_KEY$6,
  5273. SHOWN: "shown" + EVENT_KEY$6,
  5274. INSERTED: "inserted" + EVENT_KEY$6,
  5275. CLICK: "click" + EVENT_KEY$6,
  5276. FOCUSIN: "focusin" + EVENT_KEY$6,
  5277. FOCUSOUT: "focusout" + EVENT_KEY$6,
  5278. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  5279. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  5280. };
  5281. var ClassName$6 = {
  5282. FADE: 'fade',
  5283. SHOW: 'show'
  5284. };
  5285. var Selector$6 = {
  5286. TOOLTIP: '.tooltip',
  5287. TOOLTIP_INNER: '.tooltip-inner',
  5288. ARROW: '.arrow'
  5289. };
  5290. var Trigger = {
  5291. HOVER: 'hover',
  5292. FOCUS: 'focus',
  5293. CLICK: 'click',
  5294. MANUAL: 'manual'
  5295. };
  5296. /**
  5297. * ------------------------------------------------------------------------
  5298. * Class Definition
  5299. * ------------------------------------------------------------------------
  5300. */
  5301. var Tooltip =
  5302. /*#__PURE__*/
  5303. function () {
  5304. function Tooltip(element, config) {
  5305. if (typeof Popper === 'undefined') {
  5306. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  5307. } // private
  5308. this._isEnabled = true;
  5309. this._timeout = 0;
  5310. this._hoverState = '';
  5311. this._activeTrigger = {};
  5312. this._popper = null; // Protected
  5313. this.element = element;
  5314. this.config = this._getConfig(config);
  5315. this.tip = null;
  5316. this._setListeners();
  5317. } // Getters
  5318. var _proto = Tooltip.prototype;
  5319. // Public
  5320. _proto.enable = function enable() {
  5321. this._isEnabled = true;
  5322. };
  5323. _proto.disable = function disable() {
  5324. this._isEnabled = false;
  5325. };
  5326. _proto.toggleEnabled = function toggleEnabled() {
  5327. this._isEnabled = !this._isEnabled;
  5328. };
  5329. _proto.toggle = function toggle(event) {
  5330. if (!this._isEnabled) {
  5331. return;
  5332. }
  5333. if (event) {
  5334. var dataKey = this.constructor.DATA_KEY;
  5335. var context = $(event.currentTarget).data(dataKey);
  5336. if (!context) {
  5337. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5338. $(event.currentTarget).data(dataKey, context);
  5339. }
  5340. context._activeTrigger.click = !context._activeTrigger.click;
  5341. if (context._isWithActiveTrigger()) {
  5342. context._enter(null, context);
  5343. } else {
  5344. context._leave(null, context);
  5345. }
  5346. } else {
  5347. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  5348. this._leave(null, this);
  5349. return;
  5350. }
  5351. this._enter(null, this);
  5352. }
  5353. };
  5354. _proto.dispose = function dispose() {
  5355. clearTimeout(this._timeout);
  5356. $.removeData(this.element, this.constructor.DATA_KEY);
  5357. $(this.element).off(this.constructor.EVENT_KEY);
  5358. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  5359. if (this.tip) {
  5360. $(this.tip).remove();
  5361. }
  5362. this._isEnabled = null;
  5363. this._timeout = null;
  5364. this._hoverState = null;
  5365. this._activeTrigger = null;
  5366. if (this._popper) {
  5367. this._popper.destroy();
  5368. }
  5369. this._popper = null;
  5370. this.element = null;
  5371. this.config = null;
  5372. this.tip = null;
  5373. };
  5374. _proto.show = function show() {
  5375. var _this = this;
  5376. if ($(this.element).css('display') === 'none') {
  5377. throw new Error('Please use show on visible elements');
  5378. }
  5379. var showEvent = $.Event(this.constructor.Event.SHOW);
  5380. if (this.isWithContent() && this._isEnabled) {
  5381. $(this.element).trigger(showEvent);
  5382. var shadowRoot = Util.findShadowRoot(this.element);
  5383. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  5384. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  5385. return;
  5386. }
  5387. var tip = this.getTipElement();
  5388. var tipId = Util.getUID(this.constructor.NAME);
  5389. tip.setAttribute('id', tipId);
  5390. this.element.setAttribute('aria-describedby', tipId);
  5391. this.setContent();
  5392. if (this.config.animation) {
  5393. $(tip).addClass(ClassName$6.FADE);
  5394. }
  5395. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  5396. var attachment = this._getAttachment(placement);
  5397. this.addAttachmentClass(attachment);
  5398. var container = this._getContainer();
  5399. $(tip).data(this.constructor.DATA_KEY, this);
  5400. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  5401. $(tip).appendTo(container);
  5402. }
  5403. $(this.element).trigger(this.constructor.Event.INSERTED);
  5404. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  5405. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  5406. // empty mouseover listeners to the body's immediate children;
  5407. // only needed because of broken event delegation on iOS
  5408. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  5409. if ('ontouchstart' in document.documentElement) {
  5410. $(document.body).children().on('mouseover', null, $.noop);
  5411. }
  5412. var complete = function complete() {
  5413. if (_this.config.animation) {
  5414. _this._fixTransition();
  5415. }
  5416. var prevHoverState = _this._hoverState;
  5417. _this._hoverState = null;
  5418. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  5419. if (prevHoverState === HoverState.OUT) {
  5420. _this._leave(null, _this);
  5421. }
  5422. };
  5423. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  5424. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  5425. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5426. } else {
  5427. complete();
  5428. }
  5429. }
  5430. };
  5431. _proto.hide = function hide(callback) {
  5432. var _this2 = this;
  5433. var tip = this.getTipElement();
  5434. var hideEvent = $.Event(this.constructor.Event.HIDE);
  5435. var complete = function complete() {
  5436. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  5437. tip.parentNode.removeChild(tip);
  5438. }
  5439. _this2._cleanTipClass();
  5440. _this2.element.removeAttribute('aria-describedby');
  5441. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  5442. if (_this2._popper !== null) {
  5443. _this2._popper.destroy();
  5444. }
  5445. if (callback) {
  5446. callback();
  5447. }
  5448. };
  5449. $(this.element).trigger(hideEvent);
  5450. if (hideEvent.isDefaultPrevented()) {
  5451. return;
  5452. }
  5453. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  5454. // empty mouseover listeners we added for iOS support
  5455. if ('ontouchstart' in document.documentElement) {
  5456. $(document.body).children().off('mouseover', null, $.noop);
  5457. }
  5458. this._activeTrigger[Trigger.CLICK] = false;
  5459. this._activeTrigger[Trigger.FOCUS] = false;
  5460. this._activeTrigger[Trigger.HOVER] = false;
  5461. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  5462. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  5463. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5464. } else {
  5465. complete();
  5466. }
  5467. this._hoverState = '';
  5468. };
  5469. _proto.update = function update() {
  5470. if (this._popper !== null) {
  5471. this._popper.scheduleUpdate();
  5472. }
  5473. } // Protected
  5474. ;
  5475. _proto.isWithContent = function isWithContent() {
  5476. return Boolean(this.getTitle());
  5477. };
  5478. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5479. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  5480. };
  5481. _proto.getTipElement = function getTipElement() {
  5482. this.tip = this.tip || $(this.config.template)[0];
  5483. return this.tip;
  5484. };
  5485. _proto.setContent = function setContent() {
  5486. var tip = this.getTipElement();
  5487. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  5488. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  5489. };
  5490. _proto.setElementContent = function setElementContent($element, content) {
  5491. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  5492. // Content is a DOM node or a jQuery
  5493. if (this.config.html) {
  5494. if (!$(content).parent().is($element)) {
  5495. $element.empty().append(content);
  5496. }
  5497. } else {
  5498. $element.text($(content).text());
  5499. }
  5500. return;
  5501. }
  5502. if (this.config.html) {
  5503. if (this.config.sanitize) {
  5504. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  5505. }
  5506. $element.html(content);
  5507. } else {
  5508. $element.text(content);
  5509. }
  5510. };
  5511. _proto.getTitle = function getTitle() {
  5512. var title = this.element.getAttribute('data-original-title');
  5513. if (!title) {
  5514. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  5515. }
  5516. return title;
  5517. } // Private
  5518. ;
  5519. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  5520. var _this3 = this;
  5521. var defaultBsConfig = {
  5522. placement: attachment,
  5523. modifiers: {
  5524. offset: this._getOffset(),
  5525. flip: {
  5526. behavior: this.config.fallbackPlacement
  5527. },
  5528. arrow: {
  5529. element: Selector$6.ARROW
  5530. },
  5531. preventOverflow: {
  5532. boundariesElement: this.config.boundary
  5533. }
  5534. },
  5535. onCreate: function onCreate(data) {
  5536. if (data.originalPlacement !== data.placement) {
  5537. _this3._handlePopperPlacementChange(data);
  5538. }
  5539. },
  5540. onUpdate: function onUpdate(data) {
  5541. return _this3._handlePopperPlacementChange(data);
  5542. }
  5543. };
  5544. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  5545. };
  5546. _proto._getOffset = function _getOffset() {
  5547. var _this4 = this;
  5548. var offset = {};
  5549. if (typeof this.config.offset === 'function') {
  5550. offset.fn = function (data) {
  5551. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  5552. return data;
  5553. };
  5554. } else {
  5555. offset.offset = this.config.offset;
  5556. }
  5557. return offset;
  5558. };
  5559. _proto._getContainer = function _getContainer() {
  5560. if (this.config.container === false) {
  5561. return document.body;
  5562. }
  5563. if (Util.isElement(this.config.container)) {
  5564. return $(this.config.container);
  5565. }
  5566. return $(document).find(this.config.container);
  5567. };
  5568. _proto._getAttachment = function _getAttachment(placement) {
  5569. return AttachmentMap$1[placement.toUpperCase()];
  5570. };
  5571. _proto._setListeners = function _setListeners() {
  5572. var _this5 = this;
  5573. var triggers = this.config.trigger.split(' ');
  5574. triggers.forEach(function (trigger) {
  5575. if (trigger === 'click') {
  5576. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  5577. return _this5.toggle(event);
  5578. });
  5579. } else if (trigger !== Trigger.MANUAL) {
  5580. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  5581. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  5582. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  5583. return _this5._enter(event);
  5584. }).on(eventOut, _this5.config.selector, function (event) {
  5585. return _this5._leave(event);
  5586. });
  5587. }
  5588. });
  5589. this._hideModalHandler = function () {
  5590. if (_this5.element) {
  5591. _this5.hide();
  5592. }
  5593. };
  5594. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  5595. if (this.config.selector) {
  5596. this.config = _objectSpread2({}, this.config, {
  5597. trigger: 'manual',
  5598. selector: ''
  5599. });
  5600. } else {
  5601. this._fixTitle();
  5602. }
  5603. };
  5604. _proto._fixTitle = function _fixTitle() {
  5605. var titleType = typeof this.element.getAttribute('data-original-title');
  5606. if (this.element.getAttribute('title') || titleType !== 'string') {
  5607. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  5608. this.element.setAttribute('title', '');
  5609. }
  5610. };
  5611. _proto._enter = function _enter(event, context) {
  5612. var dataKey = this.constructor.DATA_KEY;
  5613. context = context || $(event.currentTarget).data(dataKey);
  5614. if (!context) {
  5615. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5616. $(event.currentTarget).data(dataKey, context);
  5617. }
  5618. if (event) {
  5619. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  5620. }
  5621. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  5622. context._hoverState = HoverState.SHOW;
  5623. return;
  5624. }
  5625. clearTimeout(context._timeout);
  5626. context._hoverState = HoverState.SHOW;
  5627. if (!context.config.delay || !context.config.delay.show) {
  5628. context.show();
  5629. return;
  5630. }
  5631. context._timeout = setTimeout(function () {
  5632. if (context._hoverState === HoverState.SHOW) {
  5633. context.show();
  5634. }
  5635. }, context.config.delay.show);
  5636. };
  5637. _proto._leave = function _leave(event, context) {
  5638. var dataKey = this.constructor.DATA_KEY;
  5639. context = context || $(event.currentTarget).data(dataKey);
  5640. if (!context) {
  5641. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5642. $(event.currentTarget).data(dataKey, context);
  5643. }
  5644. if (event) {
  5645. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  5646. }
  5647. if (context._isWithActiveTrigger()) {
  5648. return;
  5649. }
  5650. clearTimeout(context._timeout);
  5651. context._hoverState = HoverState.OUT;
  5652. if (!context.config.delay || !context.config.delay.hide) {
  5653. context.hide();
  5654. return;
  5655. }
  5656. context._timeout = setTimeout(function () {
  5657. if (context._hoverState === HoverState.OUT) {
  5658. context.hide();
  5659. }
  5660. }, context.config.delay.hide);
  5661. };
  5662. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  5663. for (var trigger in this._activeTrigger) {
  5664. if (this._activeTrigger[trigger]) {
  5665. return true;
  5666. }
  5667. }
  5668. return false;
  5669. };
  5670. _proto._getConfig = function _getConfig(config) {
  5671. var dataAttributes = $(this.element).data();
  5672. Object.keys(dataAttributes).forEach(function (dataAttr) {
  5673. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  5674. delete dataAttributes[dataAttr];
  5675. }
  5676. });
  5677. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  5678. if (typeof config.delay === 'number') {
  5679. config.delay = {
  5680. show: config.delay,
  5681. hide: config.delay
  5682. };
  5683. }
  5684. if (typeof config.title === 'number') {
  5685. config.title = config.title.toString();
  5686. }
  5687. if (typeof config.content === 'number') {
  5688. config.content = config.content.toString();
  5689. }
  5690. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  5691. if (config.sanitize) {
  5692. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  5693. }
  5694. return config;
  5695. };
  5696. _proto._getDelegateConfig = function _getDelegateConfig() {
  5697. var config = {};
  5698. if (this.config) {
  5699. for (var key in this.config) {
  5700. if (this.constructor.Default[key] !== this.config[key]) {
  5701. config[key] = this.config[key];
  5702. }
  5703. }
  5704. }
  5705. return config;
  5706. };
  5707. _proto._cleanTipClass = function _cleanTipClass() {
  5708. var $tip = $(this.getTipElement());
  5709. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  5710. if (tabClass !== null && tabClass.length) {
  5711. $tip.removeClass(tabClass.join(''));
  5712. }
  5713. };
  5714. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  5715. var popperInstance = popperData.instance;
  5716. this.tip = popperInstance.popper;
  5717. this._cleanTipClass();
  5718. this.addAttachmentClass(this._getAttachment(popperData.placement));
  5719. };
  5720. _proto._fixTransition = function _fixTransition() {
  5721. var tip = this.getTipElement();
  5722. var initConfigAnimation = this.config.animation;
  5723. if (tip.getAttribute('x-placement') !== null) {
  5724. return;
  5725. }
  5726. $(tip).removeClass(ClassName$6.FADE);
  5727. this.config.animation = false;
  5728. this.hide();
  5729. this.show();
  5730. this.config.animation = initConfigAnimation;
  5731. } // Static
  5732. ;
  5733. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  5734. return this.each(function () {
  5735. var data = $(this).data(DATA_KEY$6);
  5736. var _config = typeof config === 'object' && config;
  5737. if (!data && /dispose|hide/.test(config)) {
  5738. return;
  5739. }
  5740. if (!data) {
  5741. data = new Tooltip(this, _config);
  5742. $(this).data(DATA_KEY$6, data);
  5743. }
  5744. if (typeof config === 'string') {
  5745. if (typeof data[config] === 'undefined') {
  5746. throw new TypeError("No method named \"" + config + "\"");
  5747. }
  5748. data[config]();
  5749. }
  5750. });
  5751. };
  5752. _createClass(Tooltip, null, [{
  5753. key: "VERSION",
  5754. get: function get() {
  5755. return VERSION$6;
  5756. }
  5757. }, {
  5758. key: "Default",
  5759. get: function get() {
  5760. return Default$4;
  5761. }
  5762. }, {
  5763. key: "NAME",
  5764. get: function get() {
  5765. return NAME$6;
  5766. }
  5767. }, {
  5768. key: "DATA_KEY",
  5769. get: function get() {
  5770. return DATA_KEY$6;
  5771. }
  5772. }, {
  5773. key: "Event",
  5774. get: function get() {
  5775. return Event$6;
  5776. }
  5777. }, {
  5778. key: "EVENT_KEY",
  5779. get: function get() {
  5780. return EVENT_KEY$6;
  5781. }
  5782. }, {
  5783. key: "DefaultType",
  5784. get: function get() {
  5785. return DefaultType$4;
  5786. }
  5787. }]);
  5788. return Tooltip;
  5789. }();
  5790. /**
  5791. * ------------------------------------------------------------------------
  5792. * jQuery
  5793. * ------------------------------------------------------------------------
  5794. */
  5795. $.fn[NAME$6] = Tooltip._jQueryInterface;
  5796. $.fn[NAME$6].Constructor = Tooltip;
  5797. $.fn[NAME$6].noConflict = function () {
  5798. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  5799. return Tooltip._jQueryInterface;
  5800. };
  5801. /**
  5802. * ------------------------------------------------------------------------
  5803. * Constants
  5804. * ------------------------------------------------------------------------
  5805. */
  5806. var NAME$7 = 'popover';
  5807. var VERSION$7 = '4.4.1';
  5808. var DATA_KEY$7 = 'bs.popover';
  5809. var EVENT_KEY$7 = "." + DATA_KEY$7;
  5810. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  5811. var CLASS_PREFIX$1 = 'bs-popover';
  5812. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  5813. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  5814. placement: 'right',
  5815. trigger: 'click',
  5816. content: '',
  5817. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  5818. });
  5819. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  5820. content: '(string|element|function)'
  5821. });
  5822. var ClassName$7 = {
  5823. FADE: 'fade',
  5824. SHOW: 'show'
  5825. };
  5826. var Selector$7 = {
  5827. TITLE: '.popover-header',
  5828. CONTENT: '.popover-body'
  5829. };
  5830. var Event$7 = {
  5831. HIDE: "hide" + EVENT_KEY$7,
  5832. HIDDEN: "hidden" + EVENT_KEY$7,
  5833. SHOW: "show" + EVENT_KEY$7,
  5834. SHOWN: "shown" + EVENT_KEY$7,
  5835. INSERTED: "inserted" + EVENT_KEY$7,
  5836. CLICK: "click" + EVENT_KEY$7,
  5837. FOCUSIN: "focusin" + EVENT_KEY$7,
  5838. FOCUSOUT: "focusout" + EVENT_KEY$7,
  5839. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  5840. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  5841. };
  5842. /**
  5843. * ------------------------------------------------------------------------
  5844. * Class Definition
  5845. * ------------------------------------------------------------------------
  5846. */
  5847. var Popover =
  5848. /*#__PURE__*/
  5849. function (_Tooltip) {
  5850. _inheritsLoose(Popover, _Tooltip);
  5851. function Popover() {
  5852. return _Tooltip.apply(this, arguments) || this;
  5853. }
  5854. var _proto = Popover.prototype;
  5855. // Overrides
  5856. _proto.isWithContent = function isWithContent() {
  5857. return this.getTitle() || this._getContent();
  5858. };
  5859. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5860. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  5861. };
  5862. _proto.getTipElement = function getTipElement() {
  5863. this.tip = this.tip || $(this.config.template)[0];
  5864. return this.tip;
  5865. };
  5866. _proto.setContent = function setContent() {
  5867. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  5868. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  5869. var content = this._getContent();
  5870. if (typeof content === 'function') {
  5871. content = content.call(this.element);
  5872. }
  5873. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  5874. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  5875. } // Private
  5876. ;
  5877. _proto._getContent = function _getContent() {
  5878. return this.element.getAttribute('data-content') || this.config.content;
  5879. };
  5880. _proto._cleanTipClass = function _cleanTipClass() {
  5881. var $tip = $(this.getTipElement());
  5882. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  5883. if (tabClass !== null && tabClass.length > 0) {
  5884. $tip.removeClass(tabClass.join(''));
  5885. }
  5886. } // Static
  5887. ;
  5888. Popover._jQueryInterface = function _jQueryInterface(config) {
  5889. return this.each(function () {
  5890. var data = $(this).data(DATA_KEY$7);
  5891. var _config = typeof config === 'object' ? config : null;
  5892. if (!data && /dispose|hide/.test(config)) {
  5893. return;
  5894. }
  5895. if (!data) {
  5896. data = new Popover(this, _config);
  5897. $(this).data(DATA_KEY$7, data);
  5898. }
  5899. if (typeof config === 'string') {
  5900. if (typeof data[config] === 'undefined') {
  5901. throw new TypeError("No method named \"" + config + "\"");
  5902. }
  5903. data[config]();
  5904. }
  5905. });
  5906. };
  5907. _createClass(Popover, null, [{
  5908. key: "VERSION",
  5909. // Getters
  5910. get: function get() {
  5911. return VERSION$7;
  5912. }
  5913. }, {
  5914. key: "Default",
  5915. get: function get() {
  5916. return Default$5;
  5917. }
  5918. }, {
  5919. key: "NAME",
  5920. get: function get() {
  5921. return NAME$7;
  5922. }
  5923. }, {
  5924. key: "DATA_KEY",
  5925. get: function get() {
  5926. return DATA_KEY$7;
  5927. }
  5928. }, {
  5929. key: "Event",
  5930. get: function get() {
  5931. return Event$7;
  5932. }
  5933. }, {
  5934. key: "EVENT_KEY",
  5935. get: function get() {
  5936. return EVENT_KEY$7;
  5937. }
  5938. }, {
  5939. key: "DefaultType",
  5940. get: function get() {
  5941. return DefaultType$5;
  5942. }
  5943. }]);
  5944. return Popover;
  5945. }(Tooltip);
  5946. /**
  5947. * ------------------------------------------------------------------------
  5948. * jQuery
  5949. * ------------------------------------------------------------------------
  5950. */
  5951. $.fn[NAME$7] = Popover._jQueryInterface;
  5952. $.fn[NAME$7].Constructor = Popover;
  5953. $.fn[NAME$7].noConflict = function () {
  5954. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  5955. return Popover._jQueryInterface;
  5956. };
  5957. /**
  5958. * ------------------------------------------------------------------------
  5959. * Constants
  5960. * ------------------------------------------------------------------------
  5961. */
  5962. var NAME$8 = 'scrollspy';
  5963. var VERSION$8 = '4.4.1';
  5964. var DATA_KEY$8 = 'bs.scrollspy';
  5965. var EVENT_KEY$8 = "." + DATA_KEY$8;
  5966. var DATA_API_KEY$6 = '.data-api';
  5967. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  5968. var Default$6 = {
  5969. offset: 10,
  5970. method: 'auto',
  5971. target: ''
  5972. };
  5973. var DefaultType$6 = {
  5974. offset: 'number',
  5975. method: 'string',
  5976. target: '(string|element)'
  5977. };
  5978. var Event$8 = {
  5979. ACTIVATE: "activate" + EVENT_KEY$8,
  5980. SCROLL: "scroll" + EVENT_KEY$8,
  5981. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  5982. };
  5983. var ClassName$8 = {
  5984. DROPDOWN_ITEM: 'dropdown-item',
  5985. DROPDOWN_MENU: 'dropdown-menu',
  5986. ACTIVE: 'active'
  5987. };
  5988. var Selector$8 = {
  5989. DATA_SPY: '[data-spy="scroll"]',
  5990. ACTIVE: '.active',
  5991. NAV_LIST_GROUP: '.nav, .list-group',
  5992. NAV_LINKS: '.nav-link',
  5993. NAV_ITEMS: '.nav-item',
  5994. LIST_ITEMS: '.list-group-item',
  5995. DROPDOWN: '.dropdown',
  5996. DROPDOWN_ITEMS: '.dropdown-item',
  5997. DROPDOWN_TOGGLE: '.dropdown-toggle'
  5998. };
  5999. var OffsetMethod = {
  6000. OFFSET: 'offset',
  6001. POSITION: 'position'
  6002. };
  6003. /**
  6004. * ------------------------------------------------------------------------
  6005. * Class Definition
  6006. * ------------------------------------------------------------------------
  6007. */
  6008. var ScrollSpy =
  6009. /*#__PURE__*/
  6010. function () {
  6011. function ScrollSpy(element, config) {
  6012. var _this = this;
  6013. this._element = element;
  6014. this._scrollElement = element.tagName === 'BODY' ? window : element;
  6015. this._config = this._getConfig(config);
  6016. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  6017. this._offsets = [];
  6018. this._targets = [];
  6019. this._activeTarget = null;
  6020. this._scrollHeight = 0;
  6021. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  6022. return _this._process(event);
  6023. });
  6024. this.refresh();
  6025. this._process();
  6026. } // Getters
  6027. var _proto = ScrollSpy.prototype;
  6028. // Public
  6029. _proto.refresh = function refresh() {
  6030. var _this2 = this;
  6031. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  6032. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  6033. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  6034. this._offsets = [];
  6035. this._targets = [];
  6036. this._scrollHeight = this._getScrollHeight();
  6037. var targets = [].slice.call(document.querySelectorAll(this._selector));
  6038. targets.map(function (element) {
  6039. var target;
  6040. var targetSelector = Util.getSelectorFromElement(element);
  6041. if (targetSelector) {
  6042. target = document.querySelector(targetSelector);
  6043. }
  6044. if (target) {
  6045. var targetBCR = target.getBoundingClientRect();
  6046. if (targetBCR.width || targetBCR.height) {
  6047. // TODO (fat): remove sketch reliance on jQuery position/offset
  6048. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  6049. }
  6050. }
  6051. return null;
  6052. }).filter(function (item) {
  6053. return item;
  6054. }).sort(function (a, b) {
  6055. return a[0] - b[0];
  6056. }).forEach(function (item) {
  6057. _this2._offsets.push(item[0]);
  6058. _this2._targets.push(item[1]);
  6059. });
  6060. };
  6061. _proto.dispose = function dispose() {
  6062. $.removeData(this._element, DATA_KEY$8);
  6063. $(this._scrollElement).off(EVENT_KEY$8);
  6064. this._element = null;
  6065. this._scrollElement = null;
  6066. this._config = null;
  6067. this._selector = null;
  6068. this._offsets = null;
  6069. this._targets = null;
  6070. this._activeTarget = null;
  6071. this._scrollHeight = null;
  6072. } // Private
  6073. ;
  6074. _proto._getConfig = function _getConfig(config) {
  6075. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  6076. if (typeof config.target !== 'string') {
  6077. var id = $(config.target).attr('id');
  6078. if (!id) {
  6079. id = Util.getUID(NAME$8);
  6080. $(config.target).attr('id', id);
  6081. }
  6082. config.target = "#" + id;
  6083. }
  6084. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  6085. return config;
  6086. };
  6087. _proto._getScrollTop = function _getScrollTop() {
  6088. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  6089. };
  6090. _proto._getScrollHeight = function _getScrollHeight() {
  6091. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  6092. };
  6093. _proto._getOffsetHeight = function _getOffsetHeight() {
  6094. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  6095. };
  6096. _proto._process = function _process() {
  6097. var scrollTop = this._getScrollTop() + this._config.offset;
  6098. var scrollHeight = this._getScrollHeight();
  6099. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  6100. if (this._scrollHeight !== scrollHeight) {
  6101. this.refresh();
  6102. }
  6103. if (scrollTop >= maxScroll) {
  6104. var target = this._targets[this._targets.length - 1];
  6105. if (this._activeTarget !== target) {
  6106. this._activate(target);
  6107. }
  6108. return;
  6109. }
  6110. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  6111. this._activeTarget = null;
  6112. this._clear();
  6113. return;
  6114. }
  6115. var offsetLength = this._offsets.length;
  6116. for (var i = offsetLength; i--;) {
  6117. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  6118. if (isActiveTarget) {
  6119. this._activate(this._targets[i]);
  6120. }
  6121. }
  6122. };
  6123. _proto._activate = function _activate(target) {
  6124. this._activeTarget = target;
  6125. this._clear();
  6126. var queries = this._selector.split(',').map(function (selector) {
  6127. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  6128. });
  6129. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  6130. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  6131. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  6132. $link.addClass(ClassName$8.ACTIVE);
  6133. } else {
  6134. // Set triggered link as active
  6135. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  6136. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  6137. $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
  6138. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  6139. }
  6140. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  6141. relatedTarget: target
  6142. });
  6143. };
  6144. _proto._clear = function _clear() {
  6145. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  6146. return node.classList.contains(ClassName$8.ACTIVE);
  6147. }).forEach(function (node) {
  6148. return node.classList.remove(ClassName$8.ACTIVE);
  6149. });
  6150. } // Static
  6151. ;
  6152. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  6153. return this.each(function () {
  6154. var data = $(this).data(DATA_KEY$8);
  6155. var _config = typeof config === 'object' && config;
  6156. if (!data) {
  6157. data = new ScrollSpy(this, _config);
  6158. $(this).data(DATA_KEY$8, data);
  6159. }
  6160. if (typeof config === 'string') {
  6161. if (typeof data[config] === 'undefined') {
  6162. throw new TypeError("No method named \"" + config + "\"");
  6163. }
  6164. data[config]();
  6165. }
  6166. });
  6167. };
  6168. _createClass(ScrollSpy, null, [{
  6169. key: "VERSION",
  6170. get: function get() {
  6171. return VERSION$8;
  6172. }
  6173. }, {
  6174. key: "Default",
  6175. get: function get() {
  6176. return Default$6;
  6177. }
  6178. }]);
  6179. return ScrollSpy;
  6180. }();
  6181. /**
  6182. * ------------------------------------------------------------------------
  6183. * Data Api implementation
  6184. * ------------------------------------------------------------------------
  6185. */
  6186. $(window).on(Event$8.LOAD_DATA_API, function () {
  6187. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  6188. var scrollSpysLength = scrollSpys.length;
  6189. for (var i = scrollSpysLength; i--;) {
  6190. var $spy = $(scrollSpys[i]);
  6191. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  6192. }
  6193. });
  6194. /**
  6195. * ------------------------------------------------------------------------
  6196. * jQuery
  6197. * ------------------------------------------------------------------------
  6198. */
  6199. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  6200. $.fn[NAME$8].Constructor = ScrollSpy;
  6201. $.fn[NAME$8].noConflict = function () {
  6202. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  6203. return ScrollSpy._jQueryInterface;
  6204. };
  6205. /**
  6206. * ------------------------------------------------------------------------
  6207. * Constants
  6208. * ------------------------------------------------------------------------
  6209. */
  6210. var NAME$9 = 'tab';
  6211. var VERSION$9 = '4.4.1';
  6212. var DATA_KEY$9 = 'bs.tab';
  6213. var EVENT_KEY$9 = "." + DATA_KEY$9;
  6214. var DATA_API_KEY$7 = '.data-api';
  6215. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  6216. var Event$9 = {
  6217. HIDE: "hide" + EVENT_KEY$9,
  6218. HIDDEN: "hidden" + EVENT_KEY$9,
  6219. SHOW: "show" + EVENT_KEY$9,
  6220. SHOWN: "shown" + EVENT_KEY$9,
  6221. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  6222. };
  6223. var ClassName$9 = {
  6224. DROPDOWN_MENU: 'dropdown-menu',
  6225. ACTIVE: 'active',
  6226. DISABLED: 'disabled',
  6227. FADE: 'fade',
  6228. SHOW: 'show'
  6229. };
  6230. var Selector$9 = {
  6231. DROPDOWN: '.dropdown',
  6232. NAV_LIST_GROUP: '.nav, .list-group',
  6233. ACTIVE: '.active',
  6234. ACTIVE_UL: '> li > .active',
  6235. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  6236. DROPDOWN_TOGGLE: '.dropdown-toggle',
  6237. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  6238. };
  6239. /**
  6240. * ------------------------------------------------------------------------
  6241. * Class Definition
  6242. * ------------------------------------------------------------------------
  6243. */
  6244. var Tab =
  6245. /*#__PURE__*/
  6246. function () {
  6247. function Tab(element) {
  6248. this._element = element;
  6249. } // Getters
  6250. var _proto = Tab.prototype;
  6251. // Public
  6252. _proto.show = function show() {
  6253. var _this = this;
  6254. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  6255. return;
  6256. }
  6257. var target;
  6258. var previous;
  6259. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  6260. var selector = Util.getSelectorFromElement(this._element);
  6261. if (listElement) {
  6262. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  6263. previous = $.makeArray($(listElement).find(itemSelector));
  6264. previous = previous[previous.length - 1];
  6265. }
  6266. var hideEvent = $.Event(Event$9.HIDE, {
  6267. relatedTarget: this._element
  6268. });
  6269. var showEvent = $.Event(Event$9.SHOW, {
  6270. relatedTarget: previous
  6271. });
  6272. if (previous) {
  6273. $(previous).trigger(hideEvent);
  6274. }
  6275. $(this._element).trigger(showEvent);
  6276. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  6277. return;
  6278. }
  6279. if (selector) {
  6280. target = document.querySelector(selector);
  6281. }
  6282. this._activate(this._element, listElement);
  6283. var complete = function complete() {
  6284. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  6285. relatedTarget: _this._element
  6286. });
  6287. var shownEvent = $.Event(Event$9.SHOWN, {
  6288. relatedTarget: previous
  6289. });
  6290. $(previous).trigger(hiddenEvent);
  6291. $(_this._element).trigger(shownEvent);
  6292. };
  6293. if (target) {
  6294. this._activate(target, target.parentNode, complete);
  6295. } else {
  6296. complete();
  6297. }
  6298. };
  6299. _proto.dispose = function dispose() {
  6300. $.removeData(this._element, DATA_KEY$9);
  6301. this._element = null;
  6302. } // Private
  6303. ;
  6304. _proto._activate = function _activate(element, container, callback) {
  6305. var _this2 = this;
  6306. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  6307. var active = activeElements[0];
  6308. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  6309. var complete = function complete() {
  6310. return _this2._transitionComplete(element, active, callback);
  6311. };
  6312. if (active && isTransitioning) {
  6313. var transitionDuration = Util.getTransitionDurationFromElement(active);
  6314. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6315. } else {
  6316. complete();
  6317. }
  6318. };
  6319. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  6320. if (active) {
  6321. $(active).removeClass(ClassName$9.ACTIVE);
  6322. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  6323. if (dropdownChild) {
  6324. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  6325. }
  6326. if (active.getAttribute('role') === 'tab') {
  6327. active.setAttribute('aria-selected', false);
  6328. }
  6329. }
  6330. $(element).addClass(ClassName$9.ACTIVE);
  6331. if (element.getAttribute('role') === 'tab') {
  6332. element.setAttribute('aria-selected', true);
  6333. }
  6334. Util.reflow(element);
  6335. if (element.classList.contains(ClassName$9.FADE)) {
  6336. element.classList.add(ClassName$9.SHOW);
  6337. }
  6338. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  6339. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  6340. if (dropdownElement) {
  6341. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  6342. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  6343. }
  6344. element.setAttribute('aria-expanded', true);
  6345. }
  6346. if (callback) {
  6347. callback();
  6348. }
  6349. } // Static
  6350. ;
  6351. Tab._jQueryInterface = function _jQueryInterface(config) {
  6352. return this.each(function () {
  6353. var $this = $(this);
  6354. var data = $this.data(DATA_KEY$9);
  6355. if (!data) {
  6356. data = new Tab(this);
  6357. $this.data(DATA_KEY$9, data);
  6358. }
  6359. if (typeof config === 'string') {
  6360. if (typeof data[config] === 'undefined') {
  6361. throw new TypeError("No method named \"" + config + "\"");
  6362. }
  6363. data[config]();
  6364. }
  6365. });
  6366. };
  6367. _createClass(Tab, null, [{
  6368. key: "VERSION",
  6369. get: function get() {
  6370. return VERSION$9;
  6371. }
  6372. }]);
  6373. return Tab;
  6374. }();
  6375. /**
  6376. * ------------------------------------------------------------------------
  6377. * Data Api implementation
  6378. * ------------------------------------------------------------------------
  6379. */
  6380. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  6381. event.preventDefault();
  6382. Tab._jQueryInterface.call($(this), 'show');
  6383. });
  6384. /**
  6385. * ------------------------------------------------------------------------
  6386. * jQuery
  6387. * ------------------------------------------------------------------------
  6388. */
  6389. $.fn[NAME$9] = Tab._jQueryInterface;
  6390. $.fn[NAME$9].Constructor = Tab;
  6391. $.fn[NAME$9].noConflict = function () {
  6392. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  6393. return Tab._jQueryInterface;
  6394. };
  6395. /**
  6396. * ------------------------------------------------------------------------
  6397. * Constants
  6398. * ------------------------------------------------------------------------
  6399. */
  6400. var NAME$a = 'toast';
  6401. var VERSION$a = '4.4.1';
  6402. var DATA_KEY$a = 'bs.toast';
  6403. var EVENT_KEY$a = "." + DATA_KEY$a;
  6404. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  6405. var Event$a = {
  6406. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  6407. HIDE: "hide" + EVENT_KEY$a,
  6408. HIDDEN: "hidden" + EVENT_KEY$a,
  6409. SHOW: "show" + EVENT_KEY$a,
  6410. SHOWN: "shown" + EVENT_KEY$a
  6411. };
  6412. var ClassName$a = {
  6413. FADE: 'fade',
  6414. HIDE: 'hide',
  6415. SHOW: 'show',
  6416. SHOWING: 'showing'
  6417. };
  6418. var DefaultType$7 = {
  6419. animation: 'boolean',
  6420. autohide: 'boolean',
  6421. delay: 'number'
  6422. };
  6423. var Default$7 = {
  6424. animation: true,
  6425. autohide: true,
  6426. delay: 500
  6427. };
  6428. var Selector$a = {
  6429. DATA_DISMISS: '[data-dismiss="toast"]'
  6430. };
  6431. /**
  6432. * ------------------------------------------------------------------------
  6433. * Class Definition
  6434. * ------------------------------------------------------------------------
  6435. */
  6436. var Toast =
  6437. /*#__PURE__*/
  6438. function () {
  6439. function Toast(element, config) {
  6440. this._element = element;
  6441. this._config = this._getConfig(config);
  6442. this._timeout = null;
  6443. this._setListeners();
  6444. } // Getters
  6445. var _proto = Toast.prototype;
  6446. // Public
  6447. _proto.show = function show() {
  6448. var _this = this;
  6449. var showEvent = $.Event(Event$a.SHOW);
  6450. $(this._element).trigger(showEvent);
  6451. if (showEvent.isDefaultPrevented()) {
  6452. return;
  6453. }
  6454. if (this._config.animation) {
  6455. this._element.classList.add(ClassName$a.FADE);
  6456. }
  6457. var complete = function complete() {
  6458. _this._element.classList.remove(ClassName$a.SHOWING);
  6459. _this._element.classList.add(ClassName$a.SHOW);
  6460. $(_this._element).trigger(Event$a.SHOWN);
  6461. if (_this._config.autohide) {
  6462. _this._timeout = setTimeout(function () {
  6463. _this.hide();
  6464. }, _this._config.delay);
  6465. }
  6466. };
  6467. this._element.classList.remove(ClassName$a.HIDE);
  6468. Util.reflow(this._element);
  6469. this._element.classList.add(ClassName$a.SHOWING);
  6470. if (this._config.animation) {
  6471. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6472. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6473. } else {
  6474. complete();
  6475. }
  6476. };
  6477. _proto.hide = function hide() {
  6478. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  6479. return;
  6480. }
  6481. var hideEvent = $.Event(Event$a.HIDE);
  6482. $(this._element).trigger(hideEvent);
  6483. if (hideEvent.isDefaultPrevented()) {
  6484. return;
  6485. }
  6486. this._close();
  6487. };
  6488. _proto.dispose = function dispose() {
  6489. clearTimeout(this._timeout);
  6490. this._timeout = null;
  6491. if (this._element.classList.contains(ClassName$a.SHOW)) {
  6492. this._element.classList.remove(ClassName$a.SHOW);
  6493. }
  6494. $(this._element).off(Event$a.CLICK_DISMISS);
  6495. $.removeData(this._element, DATA_KEY$a);
  6496. this._element = null;
  6497. this._config = null;
  6498. } // Private
  6499. ;
  6500. _proto._getConfig = function _getConfig(config) {
  6501. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  6502. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  6503. return config;
  6504. };
  6505. _proto._setListeners = function _setListeners() {
  6506. var _this2 = this;
  6507. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  6508. return _this2.hide();
  6509. });
  6510. };
  6511. _proto._close = function _close() {
  6512. var _this3 = this;
  6513. var complete = function complete() {
  6514. _this3._element.classList.add(ClassName$a.HIDE);
  6515. $(_this3._element).trigger(Event$a.HIDDEN);
  6516. };
  6517. this._element.classList.remove(ClassName$a.SHOW);
  6518. if (this._config.animation) {
  6519. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6520. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6521. } else {
  6522. complete();
  6523. }
  6524. } // Static
  6525. ;
  6526. Toast._jQueryInterface = function _jQueryInterface(config) {
  6527. return this.each(function () {
  6528. var $element = $(this);
  6529. var data = $element.data(DATA_KEY$a);
  6530. var _config = typeof config === 'object' && config;
  6531. if (!data) {
  6532. data = new Toast(this, _config);
  6533. $element.data(DATA_KEY$a, data);
  6534. }
  6535. if (typeof config === 'string') {
  6536. if (typeof data[config] === 'undefined') {
  6537. throw new TypeError("No method named \"" + config + "\"");
  6538. }
  6539. data[config](this);
  6540. }
  6541. });
  6542. };
  6543. _createClass(Toast, null, [{
  6544. key: "VERSION",
  6545. get: function get() {
  6546. return VERSION$a;
  6547. }
  6548. }, {
  6549. key: "DefaultType",
  6550. get: function get() {
  6551. return DefaultType$7;
  6552. }
  6553. }, {
  6554. key: "Default",
  6555. get: function get() {
  6556. return Default$7;
  6557. }
  6558. }]);
  6559. return Toast;
  6560. }();
  6561. /**
  6562. * ------------------------------------------------------------------------
  6563. * jQuery
  6564. * ------------------------------------------------------------------------
  6565. */
  6566. $.fn[NAME$a] = Toast._jQueryInterface;
  6567. $.fn[NAME$a].Constructor = Toast;
  6568. $.fn[NAME$a].noConflict = function () {
  6569. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  6570. return Toast._jQueryInterface;
  6571. };
  6572. exports.Alert = Alert;
  6573. exports.Button = Button;
  6574. exports.Carousel = Carousel;
  6575. exports.Collapse = Collapse;
  6576. exports.Dropdown = Dropdown;
  6577. exports.Modal = Modal;
  6578. exports.Popover = Popover;
  6579. exports.Scrollspy = ScrollSpy;
  6580. exports.Tab = Tab;
  6581. exports.Toast = Toast;
  6582. exports.Tooltip = Tooltip;
  6583. exports.Util = Util;
  6584. Object.defineProperty(exports, '__esModule', { value: true });
  6585. })));
  6586. //# sourceMappingURL=bootstrap.js.map
  6587. /***/ }),
  6588. /***/ "./node_modules/buffer/index.js":
  6589. /*!**************************************!*\
  6590. !*** ./node_modules/buffer/index.js ***!
  6591. \**************************************/
  6592. /*! no static exports found */
  6593. /***/ (function(module, exports, __webpack_require__) {
  6594. "use strict";
  6595. /* WEBPACK VAR INJECTION */(function(global) {/*!
  6596. * The buffer module from node.js, for the browser.
  6597. *
  6598. * @author Feross Aboukhadijeh <http://feross.org>
  6599. * @license MIT
  6600. */
  6601. /* eslint-disable no-proto */
  6602. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  6603. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  6604. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  6605. exports.Buffer = Buffer
  6606. exports.SlowBuffer = SlowBuffer
  6607. exports.INSPECT_MAX_BYTES = 50
  6608. /**
  6609. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  6610. * === true Use Uint8Array implementation (fastest)
  6611. * === false Use Object implementation (most compatible, even IE6)
  6612. *
  6613. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  6614. * Opera 11.6+, iOS 4.2+.
  6615. *
  6616. * Due to various browser bugs, sometimes the Object implementation will be used even
  6617. * when the browser supports typed arrays.
  6618. *
  6619. * Note:
  6620. *
  6621. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  6622. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  6623. *
  6624. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  6625. *
  6626. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  6627. * incorrect length in some situations.
  6628. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  6629. * get the Object implementation, which is slower but behaves correctly.
  6630. */
  6631. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  6632. ? global.TYPED_ARRAY_SUPPORT
  6633. : typedArraySupport()
  6634. /*
  6635. * Export kMaxLength after typed array support is determined.
  6636. */
  6637. exports.kMaxLength = kMaxLength()
  6638. function typedArraySupport () {
  6639. try {
  6640. var arr = new Uint8Array(1)
  6641. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  6642. return arr.foo() === 42 && // typed array instances can be augmented
  6643. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  6644. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  6645. } catch (e) {
  6646. return false
  6647. }
  6648. }
  6649. function kMaxLength () {
  6650. return Buffer.TYPED_ARRAY_SUPPORT
  6651. ? 0x7fffffff
  6652. : 0x3fffffff
  6653. }
  6654. function createBuffer (that, length) {
  6655. if (kMaxLength() < length) {
  6656. throw new RangeError('Invalid typed array length')
  6657. }
  6658. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6659. // Return an augmented `Uint8Array` instance, for best performance
  6660. that = new Uint8Array(length)
  6661. that.__proto__ = Buffer.prototype
  6662. } else {
  6663. // Fallback: Return an object instance of the Buffer class
  6664. if (that === null) {
  6665. that = new Buffer(length)
  6666. }
  6667. that.length = length
  6668. }
  6669. return that
  6670. }
  6671. /**
  6672. * The Buffer constructor returns instances of `Uint8Array` that have their
  6673. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  6674. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  6675. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  6676. * returns a single octet.
  6677. *
  6678. * The `Uint8Array` prototype remains unmodified.
  6679. */
  6680. function Buffer (arg, encodingOrOffset, length) {
  6681. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  6682. return new Buffer(arg, encodingOrOffset, length)
  6683. }
  6684. // Common case.
  6685. if (typeof arg === 'number') {
  6686. if (typeof encodingOrOffset === 'string') {
  6687. throw new Error(
  6688. 'If encoding is specified then the first argument must be a string'
  6689. )
  6690. }
  6691. return allocUnsafe(this, arg)
  6692. }
  6693. return from(this, arg, encodingOrOffset, length)
  6694. }
  6695. Buffer.poolSize = 8192 // not used by this implementation
  6696. // TODO: Legacy, not needed anymore. Remove in next major version.
  6697. Buffer._augment = function (arr) {
  6698. arr.__proto__ = Buffer.prototype
  6699. return arr
  6700. }
  6701. function from (that, value, encodingOrOffset, length) {
  6702. if (typeof value === 'number') {
  6703. throw new TypeError('"value" argument must not be a number')
  6704. }
  6705. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  6706. return fromArrayBuffer(that, value, encodingOrOffset, length)
  6707. }
  6708. if (typeof value === 'string') {
  6709. return fromString(that, value, encodingOrOffset)
  6710. }
  6711. return fromObject(that, value)
  6712. }
  6713. /**
  6714. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  6715. * if value is a number.
  6716. * Buffer.from(str[, encoding])
  6717. * Buffer.from(array)
  6718. * Buffer.from(buffer)
  6719. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  6720. **/
  6721. Buffer.from = function (value, encodingOrOffset, length) {
  6722. return from(null, value, encodingOrOffset, length)
  6723. }
  6724. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6725. Buffer.prototype.__proto__ = Uint8Array.prototype
  6726. Buffer.__proto__ = Uint8Array
  6727. if (typeof Symbol !== 'undefined' && Symbol.species &&
  6728. Buffer[Symbol.species] === Buffer) {
  6729. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  6730. Object.defineProperty(Buffer, Symbol.species, {
  6731. value: null,
  6732. configurable: true
  6733. })
  6734. }
  6735. }
  6736. function assertSize (size) {
  6737. if (typeof size !== 'number') {
  6738. throw new TypeError('"size" argument must be a number')
  6739. } else if (size < 0) {
  6740. throw new RangeError('"size" argument must not be negative')
  6741. }
  6742. }
  6743. function alloc (that, size, fill, encoding) {
  6744. assertSize(size)
  6745. if (size <= 0) {
  6746. return createBuffer(that, size)
  6747. }
  6748. if (fill !== undefined) {
  6749. // Only pay attention to encoding if it's a string. This
  6750. // prevents accidentally sending in a number that would
  6751. // be interpretted as a start offset.
  6752. return typeof encoding === 'string'
  6753. ? createBuffer(that, size).fill(fill, encoding)
  6754. : createBuffer(that, size).fill(fill)
  6755. }
  6756. return createBuffer(that, size)
  6757. }
  6758. /**
  6759. * Creates a new filled Buffer instance.
  6760. * alloc(size[, fill[, encoding]])
  6761. **/
  6762. Buffer.alloc = function (size, fill, encoding) {
  6763. return alloc(null, size, fill, encoding)
  6764. }
  6765. function allocUnsafe (that, size) {
  6766. assertSize(size)
  6767. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  6768. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  6769. for (var i = 0; i < size; ++i) {
  6770. that[i] = 0
  6771. }
  6772. }
  6773. return that
  6774. }
  6775. /**
  6776. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  6777. * */
  6778. Buffer.allocUnsafe = function (size) {
  6779. return allocUnsafe(null, size)
  6780. }
  6781. /**
  6782. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  6783. */
  6784. Buffer.allocUnsafeSlow = function (size) {
  6785. return allocUnsafe(null, size)
  6786. }
  6787. function fromString (that, string, encoding) {
  6788. if (typeof encoding !== 'string' || encoding === '') {
  6789. encoding = 'utf8'
  6790. }
  6791. if (!Buffer.isEncoding(encoding)) {
  6792. throw new TypeError('"encoding" must be a valid string encoding')
  6793. }
  6794. var length = byteLength(string, encoding) | 0
  6795. that = createBuffer(that, length)
  6796. var actual = that.write(string, encoding)
  6797. if (actual !== length) {
  6798. // Writing a hex string, for example, that contains invalid characters will
  6799. // cause everything after the first invalid character to be ignored. (e.g.
  6800. // 'abxxcd' will be treated as 'ab')
  6801. that = that.slice(0, actual)
  6802. }
  6803. return that
  6804. }
  6805. function fromArrayLike (that, array) {
  6806. var length = array.length < 0 ? 0 : checked(array.length) | 0
  6807. that = createBuffer(that, length)
  6808. for (var i = 0; i < length; i += 1) {
  6809. that[i] = array[i] & 255
  6810. }
  6811. return that
  6812. }
  6813. function fromArrayBuffer (that, array, byteOffset, length) {
  6814. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  6815. if (byteOffset < 0 || array.byteLength < byteOffset) {
  6816. throw new RangeError('\'offset\' is out of bounds')
  6817. }
  6818. if (array.byteLength < byteOffset + (length || 0)) {
  6819. throw new RangeError('\'length\' is out of bounds')
  6820. }
  6821. if (byteOffset === undefined && length === undefined) {
  6822. array = new Uint8Array(array)
  6823. } else if (length === undefined) {
  6824. array = new Uint8Array(array, byteOffset)
  6825. } else {
  6826. array = new Uint8Array(array, byteOffset, length)
  6827. }
  6828. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6829. // Return an augmented `Uint8Array` instance, for best performance
  6830. that = array
  6831. that.__proto__ = Buffer.prototype
  6832. } else {
  6833. // Fallback: Return an object instance of the Buffer class
  6834. that = fromArrayLike(that, array)
  6835. }
  6836. return that
  6837. }
  6838. function fromObject (that, obj) {
  6839. if (Buffer.isBuffer(obj)) {
  6840. var len = checked(obj.length) | 0
  6841. that = createBuffer(that, len)
  6842. if (that.length === 0) {
  6843. return that
  6844. }
  6845. obj.copy(that, 0, 0, len)
  6846. return that
  6847. }
  6848. if (obj) {
  6849. if ((typeof ArrayBuffer !== 'undefined' &&
  6850. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  6851. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  6852. return createBuffer(that, 0)
  6853. }
  6854. return fromArrayLike(that, obj)
  6855. }
  6856. if (obj.type === 'Buffer' && isArray(obj.data)) {
  6857. return fromArrayLike(that, obj.data)
  6858. }
  6859. }
  6860. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  6861. }
  6862. function checked (length) {
  6863. // Note: cannot use `length < kMaxLength()` here because that fails when
  6864. // length is NaN (which is otherwise coerced to zero.)
  6865. if (length >= kMaxLength()) {
  6866. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  6867. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  6868. }
  6869. return length | 0
  6870. }
  6871. function SlowBuffer (length) {
  6872. if (+length != length) { // eslint-disable-line eqeqeq
  6873. length = 0
  6874. }
  6875. return Buffer.alloc(+length)
  6876. }
  6877. Buffer.isBuffer = function isBuffer (b) {
  6878. return !!(b != null && b._isBuffer)
  6879. }
  6880. Buffer.compare = function compare (a, b) {
  6881. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  6882. throw new TypeError('Arguments must be Buffers')
  6883. }
  6884. if (a === b) return 0
  6885. var x = a.length
  6886. var y = b.length
  6887. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  6888. if (a[i] !== b[i]) {
  6889. x = a[i]
  6890. y = b[i]
  6891. break
  6892. }
  6893. }
  6894. if (x < y) return -1
  6895. if (y < x) return 1
  6896. return 0
  6897. }
  6898. Buffer.isEncoding = function isEncoding (encoding) {
  6899. switch (String(encoding).toLowerCase()) {
  6900. case 'hex':
  6901. case 'utf8':
  6902. case 'utf-8':
  6903. case 'ascii':
  6904. case 'latin1':
  6905. case 'binary':
  6906. case 'base64':
  6907. case 'ucs2':
  6908. case 'ucs-2':
  6909. case 'utf16le':
  6910. case 'utf-16le':
  6911. return true
  6912. default:
  6913. return false
  6914. }
  6915. }
  6916. Buffer.concat = function concat (list, length) {
  6917. if (!isArray(list)) {
  6918. throw new TypeError('"list" argument must be an Array of Buffers')
  6919. }
  6920. if (list.length === 0) {
  6921. return Buffer.alloc(0)
  6922. }
  6923. var i
  6924. if (length === undefined) {
  6925. length = 0
  6926. for (i = 0; i < list.length; ++i) {
  6927. length += list[i].length
  6928. }
  6929. }
  6930. var buffer = Buffer.allocUnsafe(length)
  6931. var pos = 0
  6932. for (i = 0; i < list.length; ++i) {
  6933. var buf = list[i]
  6934. if (!Buffer.isBuffer(buf)) {
  6935. throw new TypeError('"list" argument must be an Array of Buffers')
  6936. }
  6937. buf.copy(buffer, pos)
  6938. pos += buf.length
  6939. }
  6940. return buffer
  6941. }
  6942. function byteLength (string, encoding) {
  6943. if (Buffer.isBuffer(string)) {
  6944. return string.length
  6945. }
  6946. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  6947. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  6948. return string.byteLength
  6949. }
  6950. if (typeof string !== 'string') {
  6951. string = '' + string
  6952. }
  6953. var len = string.length
  6954. if (len === 0) return 0
  6955. // Use a for loop to avoid recursion
  6956. var loweredCase = false
  6957. for (;;) {
  6958. switch (encoding) {
  6959. case 'ascii':
  6960. case 'latin1':
  6961. case 'binary':
  6962. return len
  6963. case 'utf8':
  6964. case 'utf-8':
  6965. case undefined:
  6966. return utf8ToBytes(string).length
  6967. case 'ucs2':
  6968. case 'ucs-2':
  6969. case 'utf16le':
  6970. case 'utf-16le':
  6971. return len * 2
  6972. case 'hex':
  6973. return len >>> 1
  6974. case 'base64':
  6975. return base64ToBytes(string).length
  6976. default:
  6977. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  6978. encoding = ('' + encoding).toLowerCase()
  6979. loweredCase = true
  6980. }
  6981. }
  6982. }
  6983. Buffer.byteLength = byteLength
  6984. function slowToString (encoding, start, end) {
  6985. var loweredCase = false
  6986. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  6987. // property of a typed array.
  6988. // This behaves neither like String nor Uint8Array in that we set start/end
  6989. // to their upper/lower bounds if the value passed is out of range.
  6990. // undefined is handled specially as per ECMA-262 6th Edition,
  6991. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  6992. if (start === undefined || start < 0) {
  6993. start = 0
  6994. }
  6995. // Return early if start > this.length. Done here to prevent potential uint32
  6996. // coercion fail below.
  6997. if (start > this.length) {
  6998. return ''
  6999. }
  7000. if (end === undefined || end > this.length) {
  7001. end = this.length
  7002. }
  7003. if (end <= 0) {
  7004. return ''
  7005. }
  7006. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  7007. end >>>= 0
  7008. start >>>= 0
  7009. if (end <= start) {
  7010. return ''
  7011. }
  7012. if (!encoding) encoding = 'utf8'
  7013. while (true) {
  7014. switch (encoding) {
  7015. case 'hex':
  7016. return hexSlice(this, start, end)
  7017. case 'utf8':
  7018. case 'utf-8':
  7019. return utf8Slice(this, start, end)
  7020. case 'ascii':
  7021. return asciiSlice(this, start, end)
  7022. case 'latin1':
  7023. case 'binary':
  7024. return latin1Slice(this, start, end)
  7025. case 'base64':
  7026. return base64Slice(this, start, end)
  7027. case 'ucs2':
  7028. case 'ucs-2':
  7029. case 'utf16le':
  7030. case 'utf-16le':
  7031. return utf16leSlice(this, start, end)
  7032. default:
  7033. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  7034. encoding = (encoding + '').toLowerCase()
  7035. loweredCase = true
  7036. }
  7037. }
  7038. }
  7039. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  7040. // Buffer instances.
  7041. Buffer.prototype._isBuffer = true
  7042. function swap (b, n, m) {
  7043. var i = b[n]
  7044. b[n] = b[m]
  7045. b[m] = i
  7046. }
  7047. Buffer.prototype.swap16 = function swap16 () {
  7048. var len = this.length
  7049. if (len % 2 !== 0) {
  7050. throw new RangeError('Buffer size must be a multiple of 16-bits')
  7051. }
  7052. for (var i = 0; i < len; i += 2) {
  7053. swap(this, i, i + 1)
  7054. }
  7055. return this
  7056. }
  7057. Buffer.prototype.swap32 = function swap32 () {
  7058. var len = this.length
  7059. if (len % 4 !== 0) {
  7060. throw new RangeError('Buffer size must be a multiple of 32-bits')
  7061. }
  7062. for (var i = 0; i < len; i += 4) {
  7063. swap(this, i, i + 3)
  7064. swap(this, i + 1, i + 2)
  7065. }
  7066. return this
  7067. }
  7068. Buffer.prototype.swap64 = function swap64 () {
  7069. var len = this.length
  7070. if (len % 8 !== 0) {
  7071. throw new RangeError('Buffer size must be a multiple of 64-bits')
  7072. }
  7073. for (var i = 0; i < len; i += 8) {
  7074. swap(this, i, i + 7)
  7075. swap(this, i + 1, i + 6)
  7076. swap(this, i + 2, i + 5)
  7077. swap(this, i + 3, i + 4)
  7078. }
  7079. return this
  7080. }
  7081. Buffer.prototype.toString = function toString () {
  7082. var length = this.length | 0
  7083. if (length === 0) return ''
  7084. if (arguments.length === 0) return utf8Slice(this, 0, length)
  7085. return slowToString.apply(this, arguments)
  7086. }
  7087. Buffer.prototype.equals = function equals (b) {
  7088. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  7089. if (this === b) return true
  7090. return Buffer.compare(this, b) === 0
  7091. }
  7092. Buffer.prototype.inspect = function inspect () {
  7093. var str = ''
  7094. var max = exports.INSPECT_MAX_BYTES
  7095. if (this.length > 0) {
  7096. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  7097. if (this.length > max) str += ' ... '
  7098. }
  7099. return '<Buffer ' + str + '>'
  7100. }
  7101. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  7102. if (!Buffer.isBuffer(target)) {
  7103. throw new TypeError('Argument must be a Buffer')
  7104. }
  7105. if (start === undefined) {
  7106. start = 0
  7107. }
  7108. if (end === undefined) {
  7109. end = target ? target.length : 0
  7110. }
  7111. if (thisStart === undefined) {
  7112. thisStart = 0
  7113. }
  7114. if (thisEnd === undefined) {
  7115. thisEnd = this.length
  7116. }
  7117. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  7118. throw new RangeError('out of range index')
  7119. }
  7120. if (thisStart >= thisEnd && start >= end) {
  7121. return 0
  7122. }
  7123. if (thisStart >= thisEnd) {
  7124. return -1
  7125. }
  7126. if (start >= end) {
  7127. return 1
  7128. }
  7129. start >>>= 0
  7130. end >>>= 0
  7131. thisStart >>>= 0
  7132. thisEnd >>>= 0
  7133. if (this === target) return 0
  7134. var x = thisEnd - thisStart
  7135. var y = end - start
  7136. var len = Math.min(x, y)
  7137. var thisCopy = this.slice(thisStart, thisEnd)
  7138. var targetCopy = target.slice(start, end)
  7139. for (var i = 0; i < len; ++i) {
  7140. if (thisCopy[i] !== targetCopy[i]) {
  7141. x = thisCopy[i]
  7142. y = targetCopy[i]
  7143. break
  7144. }
  7145. }
  7146. if (x < y) return -1
  7147. if (y < x) return 1
  7148. return 0
  7149. }
  7150. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  7151. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  7152. //
  7153. // Arguments:
  7154. // - buffer - a Buffer to search
  7155. // - val - a string, Buffer, or number
  7156. // - byteOffset - an index into `buffer`; will be clamped to an int32
  7157. // - encoding - an optional encoding, relevant is val is a string
  7158. // - dir - true for indexOf, false for lastIndexOf
  7159. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  7160. // Empty buffer means no match
  7161. if (buffer.length === 0) return -1
  7162. // Normalize byteOffset
  7163. if (typeof byteOffset === 'string') {
  7164. encoding = byteOffset
  7165. byteOffset = 0
  7166. } else if (byteOffset > 0x7fffffff) {
  7167. byteOffset = 0x7fffffff
  7168. } else if (byteOffset < -0x80000000) {
  7169. byteOffset = -0x80000000
  7170. }
  7171. byteOffset = +byteOffset // Coerce to Number.
  7172. if (isNaN(byteOffset)) {
  7173. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  7174. byteOffset = dir ? 0 : (buffer.length - 1)
  7175. }
  7176. // Normalize byteOffset: negative offsets start from the end of the buffer
  7177. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  7178. if (byteOffset >= buffer.length) {
  7179. if (dir) return -1
  7180. else byteOffset = buffer.length - 1
  7181. } else if (byteOffset < 0) {
  7182. if (dir) byteOffset = 0
  7183. else return -1
  7184. }
  7185. // Normalize val
  7186. if (typeof val === 'string') {
  7187. val = Buffer.from(val, encoding)
  7188. }
  7189. // Finally, search either indexOf (if dir is true) or lastIndexOf
  7190. if (Buffer.isBuffer(val)) {
  7191. // Special case: looking for empty string/buffer always fails
  7192. if (val.length === 0) {
  7193. return -1
  7194. }
  7195. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  7196. } else if (typeof val === 'number') {
  7197. val = val & 0xFF // Search for a byte value [0-255]
  7198. if (Buffer.TYPED_ARRAY_SUPPORT &&
  7199. typeof Uint8Array.prototype.indexOf === 'function') {
  7200. if (dir) {
  7201. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  7202. } else {
  7203. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  7204. }
  7205. }
  7206. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  7207. }
  7208. throw new TypeError('val must be string, number or Buffer')
  7209. }
  7210. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  7211. var indexSize = 1
  7212. var arrLength = arr.length
  7213. var valLength = val.length
  7214. if (encoding !== undefined) {
  7215. encoding = String(encoding).toLowerCase()
  7216. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  7217. encoding === 'utf16le' || encoding === 'utf-16le') {
  7218. if (arr.length < 2 || val.length < 2) {
  7219. return -1
  7220. }
  7221. indexSize = 2
  7222. arrLength /= 2
  7223. valLength /= 2
  7224. byteOffset /= 2
  7225. }
  7226. }
  7227. function read (buf, i) {
  7228. if (indexSize === 1) {
  7229. return buf[i]
  7230. } else {
  7231. return buf.readUInt16BE(i * indexSize)
  7232. }
  7233. }
  7234. var i
  7235. if (dir) {
  7236. var foundIndex = -1
  7237. for (i = byteOffset; i < arrLength; i++) {
  7238. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  7239. if (foundIndex === -1) foundIndex = i
  7240. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  7241. } else {
  7242. if (foundIndex !== -1) i -= i - foundIndex
  7243. foundIndex = -1
  7244. }
  7245. }
  7246. } else {
  7247. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  7248. for (i = byteOffset; i >= 0; i--) {
  7249. var found = true
  7250. for (var j = 0; j < valLength; j++) {
  7251. if (read(arr, i + j) !== read(val, j)) {
  7252. found = false
  7253. break
  7254. }
  7255. }
  7256. if (found) return i
  7257. }
  7258. }
  7259. return -1
  7260. }
  7261. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  7262. return this.indexOf(val, byteOffset, encoding) !== -1
  7263. }
  7264. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  7265. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  7266. }
  7267. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  7268. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  7269. }
  7270. function hexWrite (buf, string, offset, length) {
  7271. offset = Number(offset) || 0
  7272. var remaining = buf.length - offset
  7273. if (!length) {
  7274. length = remaining
  7275. } else {
  7276. length = Number(length)
  7277. if (length > remaining) {
  7278. length = remaining
  7279. }
  7280. }
  7281. // must be an even number of digits
  7282. var strLen = string.length
  7283. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  7284. if (length > strLen / 2) {
  7285. length = strLen / 2
  7286. }
  7287. for (var i = 0; i < length; ++i) {
  7288. var parsed = parseInt(string.substr(i * 2, 2), 16)
  7289. if (isNaN(parsed)) return i
  7290. buf[offset + i] = parsed
  7291. }
  7292. return i
  7293. }
  7294. function utf8Write (buf, string, offset, length) {
  7295. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  7296. }
  7297. function asciiWrite (buf, string, offset, length) {
  7298. return blitBuffer(asciiToBytes(string), buf, offset, length)
  7299. }
  7300. function latin1Write (buf, string, offset, length) {
  7301. return asciiWrite(buf, string, offset, length)
  7302. }
  7303. function base64Write (buf, string, offset, length) {
  7304. return blitBuffer(base64ToBytes(string), buf, offset, length)
  7305. }
  7306. function ucs2Write (buf, string, offset, length) {
  7307. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  7308. }
  7309. Buffer.prototype.write = function write (string, offset, length, encoding) {
  7310. // Buffer#write(string)
  7311. if (offset === undefined) {
  7312. encoding = 'utf8'
  7313. length = this.length
  7314. offset = 0
  7315. // Buffer#write(string, encoding)
  7316. } else if (length === undefined && typeof offset === 'string') {
  7317. encoding = offset
  7318. length = this.length
  7319. offset = 0
  7320. // Buffer#write(string, offset[, length][, encoding])
  7321. } else if (isFinite(offset)) {
  7322. offset = offset | 0
  7323. if (isFinite(length)) {
  7324. length = length | 0
  7325. if (encoding === undefined) encoding = 'utf8'
  7326. } else {
  7327. encoding = length
  7328. length = undefined
  7329. }
  7330. // legacy write(string, encoding, offset, length) - remove in v0.13
  7331. } else {
  7332. throw new Error(
  7333. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  7334. )
  7335. }
  7336. var remaining = this.length - offset
  7337. if (length === undefined || length > remaining) length = remaining
  7338. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  7339. throw new RangeError('Attempt to write outside buffer bounds')
  7340. }
  7341. if (!encoding) encoding = 'utf8'
  7342. var loweredCase = false
  7343. for (;;) {
  7344. switch (encoding) {
  7345. case 'hex':
  7346. return hexWrite(this, string, offset, length)
  7347. case 'utf8':
  7348. case 'utf-8':
  7349. return utf8Write(this, string, offset, length)
  7350. case 'ascii':
  7351. return asciiWrite(this, string, offset, length)
  7352. case 'latin1':
  7353. case 'binary':
  7354. return latin1Write(this, string, offset, length)
  7355. case 'base64':
  7356. // Warning: maxLength not taken into account in base64Write
  7357. return base64Write(this, string, offset, length)
  7358. case 'ucs2':
  7359. case 'ucs-2':
  7360. case 'utf16le':
  7361. case 'utf-16le':
  7362. return ucs2Write(this, string, offset, length)
  7363. default:
  7364. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  7365. encoding = ('' + encoding).toLowerCase()
  7366. loweredCase = true
  7367. }
  7368. }
  7369. }
  7370. Buffer.prototype.toJSON = function toJSON () {
  7371. return {
  7372. type: 'Buffer',
  7373. data: Array.prototype.slice.call(this._arr || this, 0)
  7374. }
  7375. }
  7376. function base64Slice (buf, start, end) {
  7377. if (start === 0 && end === buf.length) {
  7378. return base64.fromByteArray(buf)
  7379. } else {
  7380. return base64.fromByteArray(buf.slice(start, end))
  7381. }
  7382. }
  7383. function utf8Slice (buf, start, end) {
  7384. end = Math.min(buf.length, end)
  7385. var res = []
  7386. var i = start
  7387. while (i < end) {
  7388. var firstByte = buf[i]
  7389. var codePoint = null
  7390. var bytesPerSequence = (firstByte > 0xEF) ? 4
  7391. : (firstByte > 0xDF) ? 3
  7392. : (firstByte > 0xBF) ? 2
  7393. : 1
  7394. if (i + bytesPerSequence <= end) {
  7395. var secondByte, thirdByte, fourthByte, tempCodePoint
  7396. switch (bytesPerSequence) {
  7397. case 1:
  7398. if (firstByte < 0x80) {
  7399. codePoint = firstByte
  7400. }
  7401. break
  7402. case 2:
  7403. secondByte = buf[i + 1]
  7404. if ((secondByte & 0xC0) === 0x80) {
  7405. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  7406. if (tempCodePoint > 0x7F) {
  7407. codePoint = tempCodePoint
  7408. }
  7409. }
  7410. break
  7411. case 3:
  7412. secondByte = buf[i + 1]
  7413. thirdByte = buf[i + 2]
  7414. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  7415. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  7416. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  7417. codePoint = tempCodePoint
  7418. }
  7419. }
  7420. break
  7421. case 4:
  7422. secondByte = buf[i + 1]
  7423. thirdByte = buf[i + 2]
  7424. fourthByte = buf[i + 3]
  7425. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  7426. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  7427. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  7428. codePoint = tempCodePoint
  7429. }
  7430. }
  7431. }
  7432. }
  7433. if (codePoint === null) {
  7434. // we did not generate a valid codePoint so insert a
  7435. // replacement char (U+FFFD) and advance only 1 byte
  7436. codePoint = 0xFFFD
  7437. bytesPerSequence = 1
  7438. } else if (codePoint > 0xFFFF) {
  7439. // encode to utf16 (surrogate pair dance)
  7440. codePoint -= 0x10000
  7441. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  7442. codePoint = 0xDC00 | codePoint & 0x3FF
  7443. }
  7444. res.push(codePoint)
  7445. i += bytesPerSequence
  7446. }
  7447. return decodeCodePointsArray(res)
  7448. }
  7449. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  7450. // the lowest limit is Chrome, with 0x10000 args.
  7451. // We go 1 magnitude less, for safety
  7452. var MAX_ARGUMENTS_LENGTH = 0x1000
  7453. function decodeCodePointsArray (codePoints) {
  7454. var len = codePoints.length
  7455. if (len <= MAX_ARGUMENTS_LENGTH) {
  7456. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  7457. }
  7458. // Decode in chunks to avoid "call stack size exceeded".
  7459. var res = ''
  7460. var i = 0
  7461. while (i < len) {
  7462. res += String.fromCharCode.apply(
  7463. String,
  7464. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  7465. )
  7466. }
  7467. return res
  7468. }
  7469. function asciiSlice (buf, start, end) {
  7470. var ret = ''
  7471. end = Math.min(buf.length, end)
  7472. for (var i = start; i < end; ++i) {
  7473. ret += String.fromCharCode(buf[i] & 0x7F)
  7474. }
  7475. return ret
  7476. }
  7477. function latin1Slice (buf, start, end) {
  7478. var ret = ''
  7479. end = Math.min(buf.length, end)
  7480. for (var i = start; i < end; ++i) {
  7481. ret += String.fromCharCode(buf[i])
  7482. }
  7483. return ret
  7484. }
  7485. function hexSlice (buf, start, end) {
  7486. var len = buf.length
  7487. if (!start || start < 0) start = 0
  7488. if (!end || end < 0 || end > len) end = len
  7489. var out = ''
  7490. for (var i = start; i < end; ++i) {
  7491. out += toHex(buf[i])
  7492. }
  7493. return out
  7494. }
  7495. function utf16leSlice (buf, start, end) {
  7496. var bytes = buf.slice(start, end)
  7497. var res = ''
  7498. for (var i = 0; i < bytes.length; i += 2) {
  7499. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  7500. }
  7501. return res
  7502. }
  7503. Buffer.prototype.slice = function slice (start, end) {
  7504. var len = this.length
  7505. start = ~~start
  7506. end = end === undefined ? len : ~~end
  7507. if (start < 0) {
  7508. start += len
  7509. if (start < 0) start = 0
  7510. } else if (start > len) {
  7511. start = len
  7512. }
  7513. if (end < 0) {
  7514. end += len
  7515. if (end < 0) end = 0
  7516. } else if (end > len) {
  7517. end = len
  7518. }
  7519. if (end < start) end = start
  7520. var newBuf
  7521. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7522. newBuf = this.subarray(start, end)
  7523. newBuf.__proto__ = Buffer.prototype
  7524. } else {
  7525. var sliceLen = end - start
  7526. newBuf = new Buffer(sliceLen, undefined)
  7527. for (var i = 0; i < sliceLen; ++i) {
  7528. newBuf[i] = this[i + start]
  7529. }
  7530. }
  7531. return newBuf
  7532. }
  7533. /*
  7534. * Need to make sure that buffer isn't trying to write out of bounds.
  7535. */
  7536. function checkOffset (offset, ext, length) {
  7537. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  7538. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  7539. }
  7540. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  7541. offset = offset | 0
  7542. byteLength = byteLength | 0
  7543. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7544. var val = this[offset]
  7545. var mul = 1
  7546. var i = 0
  7547. while (++i < byteLength && (mul *= 0x100)) {
  7548. val += this[offset + i] * mul
  7549. }
  7550. return val
  7551. }
  7552. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  7553. offset = offset | 0
  7554. byteLength = byteLength | 0
  7555. if (!noAssert) {
  7556. checkOffset(offset, byteLength, this.length)
  7557. }
  7558. var val = this[offset + --byteLength]
  7559. var mul = 1
  7560. while (byteLength > 0 && (mul *= 0x100)) {
  7561. val += this[offset + --byteLength] * mul
  7562. }
  7563. return val
  7564. }
  7565. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  7566. if (!noAssert) checkOffset(offset, 1, this.length)
  7567. return this[offset]
  7568. }
  7569. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  7570. if (!noAssert) checkOffset(offset, 2, this.length)
  7571. return this[offset] | (this[offset + 1] << 8)
  7572. }
  7573. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  7574. if (!noAssert) checkOffset(offset, 2, this.length)
  7575. return (this[offset] << 8) | this[offset + 1]
  7576. }
  7577. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  7578. if (!noAssert) checkOffset(offset, 4, this.length)
  7579. return ((this[offset]) |
  7580. (this[offset + 1] << 8) |
  7581. (this[offset + 2] << 16)) +
  7582. (this[offset + 3] * 0x1000000)
  7583. }
  7584. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  7585. if (!noAssert) checkOffset(offset, 4, this.length)
  7586. return (this[offset] * 0x1000000) +
  7587. ((this[offset + 1] << 16) |
  7588. (this[offset + 2] << 8) |
  7589. this[offset + 3])
  7590. }
  7591. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  7592. offset = offset | 0
  7593. byteLength = byteLength | 0
  7594. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7595. var val = this[offset]
  7596. var mul = 1
  7597. var i = 0
  7598. while (++i < byteLength && (mul *= 0x100)) {
  7599. val += this[offset + i] * mul
  7600. }
  7601. mul *= 0x80
  7602. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7603. return val
  7604. }
  7605. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  7606. offset = offset | 0
  7607. byteLength = byteLength | 0
  7608. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7609. var i = byteLength
  7610. var mul = 1
  7611. var val = this[offset + --i]
  7612. while (i > 0 && (mul *= 0x100)) {
  7613. val += this[offset + --i] * mul
  7614. }
  7615. mul *= 0x80
  7616. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7617. return val
  7618. }
  7619. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  7620. if (!noAssert) checkOffset(offset, 1, this.length)
  7621. if (!(this[offset] & 0x80)) return (this[offset])
  7622. return ((0xff - this[offset] + 1) * -1)
  7623. }
  7624. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  7625. if (!noAssert) checkOffset(offset, 2, this.length)
  7626. var val = this[offset] | (this[offset + 1] << 8)
  7627. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7628. }
  7629. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  7630. if (!noAssert) checkOffset(offset, 2, this.length)
  7631. var val = this[offset + 1] | (this[offset] << 8)
  7632. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7633. }
  7634. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  7635. if (!noAssert) checkOffset(offset, 4, this.length)
  7636. return (this[offset]) |
  7637. (this[offset + 1] << 8) |
  7638. (this[offset + 2] << 16) |
  7639. (this[offset + 3] << 24)
  7640. }
  7641. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  7642. if (!noAssert) checkOffset(offset, 4, this.length)
  7643. return (this[offset] << 24) |
  7644. (this[offset + 1] << 16) |
  7645. (this[offset + 2] << 8) |
  7646. (this[offset + 3])
  7647. }
  7648. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  7649. if (!noAssert) checkOffset(offset, 4, this.length)
  7650. return ieee754.read(this, offset, true, 23, 4)
  7651. }
  7652. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  7653. if (!noAssert) checkOffset(offset, 4, this.length)
  7654. return ieee754.read(this, offset, false, 23, 4)
  7655. }
  7656. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  7657. if (!noAssert) checkOffset(offset, 8, this.length)
  7658. return ieee754.read(this, offset, true, 52, 8)
  7659. }
  7660. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  7661. if (!noAssert) checkOffset(offset, 8, this.length)
  7662. return ieee754.read(this, offset, false, 52, 8)
  7663. }
  7664. function checkInt (buf, value, offset, ext, max, min) {
  7665. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  7666. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  7667. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7668. }
  7669. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  7670. value = +value
  7671. offset = offset | 0
  7672. byteLength = byteLength | 0
  7673. if (!noAssert) {
  7674. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7675. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7676. }
  7677. var mul = 1
  7678. var i = 0
  7679. this[offset] = value & 0xFF
  7680. while (++i < byteLength && (mul *= 0x100)) {
  7681. this[offset + i] = (value / mul) & 0xFF
  7682. }
  7683. return offset + byteLength
  7684. }
  7685. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  7686. value = +value
  7687. offset = offset | 0
  7688. byteLength = byteLength | 0
  7689. if (!noAssert) {
  7690. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7691. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7692. }
  7693. var i = byteLength - 1
  7694. var mul = 1
  7695. this[offset + i] = value & 0xFF
  7696. while (--i >= 0 && (mul *= 0x100)) {
  7697. this[offset + i] = (value / mul) & 0xFF
  7698. }
  7699. return offset + byteLength
  7700. }
  7701. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  7702. value = +value
  7703. offset = offset | 0
  7704. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  7705. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7706. this[offset] = (value & 0xff)
  7707. return offset + 1
  7708. }
  7709. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  7710. if (value < 0) value = 0xffff + value + 1
  7711. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  7712. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  7713. (littleEndian ? i : 1 - i) * 8
  7714. }
  7715. }
  7716. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  7717. value = +value
  7718. offset = offset | 0
  7719. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7720. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7721. this[offset] = (value & 0xff)
  7722. this[offset + 1] = (value >>> 8)
  7723. } else {
  7724. objectWriteUInt16(this, value, offset, true)
  7725. }
  7726. return offset + 2
  7727. }
  7728. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  7729. value = +value
  7730. offset = offset | 0
  7731. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7732. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7733. this[offset] = (value >>> 8)
  7734. this[offset + 1] = (value & 0xff)
  7735. } else {
  7736. objectWriteUInt16(this, value, offset, false)
  7737. }
  7738. return offset + 2
  7739. }
  7740. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  7741. if (value < 0) value = 0xffffffff + value + 1
  7742. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  7743. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  7744. }
  7745. }
  7746. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  7747. value = +value
  7748. offset = offset | 0
  7749. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7750. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7751. this[offset + 3] = (value >>> 24)
  7752. this[offset + 2] = (value >>> 16)
  7753. this[offset + 1] = (value >>> 8)
  7754. this[offset] = (value & 0xff)
  7755. } else {
  7756. objectWriteUInt32(this, value, offset, true)
  7757. }
  7758. return offset + 4
  7759. }
  7760. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  7761. value = +value
  7762. offset = offset | 0
  7763. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7764. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7765. this[offset] = (value >>> 24)
  7766. this[offset + 1] = (value >>> 16)
  7767. this[offset + 2] = (value >>> 8)
  7768. this[offset + 3] = (value & 0xff)
  7769. } else {
  7770. objectWriteUInt32(this, value, offset, false)
  7771. }
  7772. return offset + 4
  7773. }
  7774. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  7775. value = +value
  7776. offset = offset | 0
  7777. if (!noAssert) {
  7778. var limit = Math.pow(2, 8 * byteLength - 1)
  7779. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7780. }
  7781. var i = 0
  7782. var mul = 1
  7783. var sub = 0
  7784. this[offset] = value & 0xFF
  7785. while (++i < byteLength && (mul *= 0x100)) {
  7786. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  7787. sub = 1
  7788. }
  7789. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7790. }
  7791. return offset + byteLength
  7792. }
  7793. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  7794. value = +value
  7795. offset = offset | 0
  7796. if (!noAssert) {
  7797. var limit = Math.pow(2, 8 * byteLength - 1)
  7798. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7799. }
  7800. var i = byteLength - 1
  7801. var mul = 1
  7802. var sub = 0
  7803. this[offset + i] = value & 0xFF
  7804. while (--i >= 0 && (mul *= 0x100)) {
  7805. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  7806. sub = 1
  7807. }
  7808. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7809. }
  7810. return offset + byteLength
  7811. }
  7812. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  7813. value = +value
  7814. offset = offset | 0
  7815. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  7816. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7817. if (value < 0) value = 0xff + value + 1
  7818. this[offset] = (value & 0xff)
  7819. return offset + 1
  7820. }
  7821. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  7822. value = +value
  7823. offset = offset | 0
  7824. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7825. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7826. this[offset] = (value & 0xff)
  7827. this[offset + 1] = (value >>> 8)
  7828. } else {
  7829. objectWriteUInt16(this, value, offset, true)
  7830. }
  7831. return offset + 2
  7832. }
  7833. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  7834. value = +value
  7835. offset = offset | 0
  7836. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7837. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7838. this[offset] = (value >>> 8)
  7839. this[offset + 1] = (value & 0xff)
  7840. } else {
  7841. objectWriteUInt16(this, value, offset, false)
  7842. }
  7843. return offset + 2
  7844. }
  7845. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  7846. value = +value
  7847. offset = offset | 0
  7848. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7849. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7850. this[offset] = (value & 0xff)
  7851. this[offset + 1] = (value >>> 8)
  7852. this[offset + 2] = (value >>> 16)
  7853. this[offset + 3] = (value >>> 24)
  7854. } else {
  7855. objectWriteUInt32(this, value, offset, true)
  7856. }
  7857. return offset + 4
  7858. }
  7859. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  7860. value = +value
  7861. offset = offset | 0
  7862. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7863. if (value < 0) value = 0xffffffff + value + 1
  7864. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7865. this[offset] = (value >>> 24)
  7866. this[offset + 1] = (value >>> 16)
  7867. this[offset + 2] = (value >>> 8)
  7868. this[offset + 3] = (value & 0xff)
  7869. } else {
  7870. objectWriteUInt32(this, value, offset, false)
  7871. }
  7872. return offset + 4
  7873. }
  7874. function checkIEEE754 (buf, value, offset, ext, max, min) {
  7875. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7876. if (offset < 0) throw new RangeError('Index out of range')
  7877. }
  7878. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  7879. if (!noAssert) {
  7880. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  7881. }
  7882. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  7883. return offset + 4
  7884. }
  7885. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  7886. return writeFloat(this, value, offset, true, noAssert)
  7887. }
  7888. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  7889. return writeFloat(this, value, offset, false, noAssert)
  7890. }
  7891. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  7892. if (!noAssert) {
  7893. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  7894. }
  7895. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  7896. return offset + 8
  7897. }
  7898. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  7899. return writeDouble(this, value, offset, true, noAssert)
  7900. }
  7901. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  7902. return writeDouble(this, value, offset, false, noAssert)
  7903. }
  7904. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  7905. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  7906. if (!start) start = 0
  7907. if (!end && end !== 0) end = this.length
  7908. if (targetStart >= target.length) targetStart = target.length
  7909. if (!targetStart) targetStart = 0
  7910. if (end > 0 && end < start) end = start
  7911. // Copy 0 bytes; we're done
  7912. if (end === start) return 0
  7913. if (target.length === 0 || this.length === 0) return 0
  7914. // Fatal error conditions
  7915. if (targetStart < 0) {
  7916. throw new RangeError('targetStart out of bounds')
  7917. }
  7918. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  7919. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  7920. // Are we oob?
  7921. if (end > this.length) end = this.length
  7922. if (target.length - targetStart < end - start) {
  7923. end = target.length - targetStart + start
  7924. }
  7925. var len = end - start
  7926. var i
  7927. if (this === target && start < targetStart && targetStart < end) {
  7928. // descending copy from end
  7929. for (i = len - 1; i >= 0; --i) {
  7930. target[i + targetStart] = this[i + start]
  7931. }
  7932. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  7933. // ascending copy from start
  7934. for (i = 0; i < len; ++i) {
  7935. target[i + targetStart] = this[i + start]
  7936. }
  7937. } else {
  7938. Uint8Array.prototype.set.call(
  7939. target,
  7940. this.subarray(start, start + len),
  7941. targetStart
  7942. )
  7943. }
  7944. return len
  7945. }
  7946. // Usage:
  7947. // buffer.fill(number[, offset[, end]])
  7948. // buffer.fill(buffer[, offset[, end]])
  7949. // buffer.fill(string[, offset[, end]][, encoding])
  7950. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  7951. // Handle string cases:
  7952. if (typeof val === 'string') {
  7953. if (typeof start === 'string') {
  7954. encoding = start
  7955. start = 0
  7956. end = this.length
  7957. } else if (typeof end === 'string') {
  7958. encoding = end
  7959. end = this.length
  7960. }
  7961. if (val.length === 1) {
  7962. var code = val.charCodeAt(0)
  7963. if (code < 256) {
  7964. val = code
  7965. }
  7966. }
  7967. if (encoding !== undefined && typeof encoding !== 'string') {
  7968. throw new TypeError('encoding must be a string')
  7969. }
  7970. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  7971. throw new TypeError('Unknown encoding: ' + encoding)
  7972. }
  7973. } else if (typeof val === 'number') {
  7974. val = val & 255
  7975. }
  7976. // Invalid ranges are not set to a default, so can range check early.
  7977. if (start < 0 || this.length < start || this.length < end) {
  7978. throw new RangeError('Out of range index')
  7979. }
  7980. if (end <= start) {
  7981. return this
  7982. }
  7983. start = start >>> 0
  7984. end = end === undefined ? this.length : end >>> 0
  7985. if (!val) val = 0
  7986. var i
  7987. if (typeof val === 'number') {
  7988. for (i = start; i < end; ++i) {
  7989. this[i] = val
  7990. }
  7991. } else {
  7992. var bytes = Buffer.isBuffer(val)
  7993. ? val
  7994. : utf8ToBytes(new Buffer(val, encoding).toString())
  7995. var len = bytes.length
  7996. for (i = 0; i < end - start; ++i) {
  7997. this[i + start] = bytes[i % len]
  7998. }
  7999. }
  8000. return this
  8001. }
  8002. // HELPER FUNCTIONS
  8003. // ================
  8004. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  8005. function base64clean (str) {
  8006. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  8007. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  8008. // Node converts strings with length < 2 to ''
  8009. if (str.length < 2) return ''
  8010. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  8011. while (str.length % 4 !== 0) {
  8012. str = str + '='
  8013. }
  8014. return str
  8015. }
  8016. function stringtrim (str) {
  8017. if (str.trim) return str.trim()
  8018. return str.replace(/^\s+|\s+$/g, '')
  8019. }
  8020. function toHex (n) {
  8021. if (n < 16) return '0' + n.toString(16)
  8022. return n.toString(16)
  8023. }
  8024. function utf8ToBytes (string, units) {
  8025. units = units || Infinity
  8026. var codePoint
  8027. var length = string.length
  8028. var leadSurrogate = null
  8029. var bytes = []
  8030. for (var i = 0; i < length; ++i) {
  8031. codePoint = string.charCodeAt(i)
  8032. // is surrogate component
  8033. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  8034. // last char was a lead
  8035. if (!leadSurrogate) {
  8036. // no lead yet
  8037. if (codePoint > 0xDBFF) {
  8038. // unexpected trail
  8039. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8040. continue
  8041. } else if (i + 1 === length) {
  8042. // unpaired lead
  8043. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8044. continue
  8045. }
  8046. // valid lead
  8047. leadSurrogate = codePoint
  8048. continue
  8049. }
  8050. // 2 leads in a row
  8051. if (codePoint < 0xDC00) {
  8052. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8053. leadSurrogate = codePoint
  8054. continue
  8055. }
  8056. // valid surrogate pair
  8057. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  8058. } else if (leadSurrogate) {
  8059. // valid bmp char, but last char was a lead
  8060. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8061. }
  8062. leadSurrogate = null
  8063. // encode utf8
  8064. if (codePoint < 0x80) {
  8065. if ((units -= 1) < 0) break
  8066. bytes.push(codePoint)
  8067. } else if (codePoint < 0x800) {
  8068. if ((units -= 2) < 0) break
  8069. bytes.push(
  8070. codePoint >> 0x6 | 0xC0,
  8071. codePoint & 0x3F | 0x80
  8072. )
  8073. } else if (codePoint < 0x10000) {
  8074. if ((units -= 3) < 0) break
  8075. bytes.push(
  8076. codePoint >> 0xC | 0xE0,
  8077. codePoint >> 0x6 & 0x3F | 0x80,
  8078. codePoint & 0x3F | 0x80
  8079. )
  8080. } else if (codePoint < 0x110000) {
  8081. if ((units -= 4) < 0) break
  8082. bytes.push(
  8083. codePoint >> 0x12 | 0xF0,
  8084. codePoint >> 0xC & 0x3F | 0x80,
  8085. codePoint >> 0x6 & 0x3F | 0x80,
  8086. codePoint & 0x3F | 0x80
  8087. )
  8088. } else {
  8089. throw new Error('Invalid code point')
  8090. }
  8091. }
  8092. return bytes
  8093. }
  8094. function asciiToBytes (str) {
  8095. var byteArray = []
  8096. for (var i = 0; i < str.length; ++i) {
  8097. // Node's code seems to be doing this and not & 0x7F..
  8098. byteArray.push(str.charCodeAt(i) & 0xFF)
  8099. }
  8100. return byteArray
  8101. }
  8102. function utf16leToBytes (str, units) {
  8103. var c, hi, lo
  8104. var byteArray = []
  8105. for (var i = 0; i < str.length; ++i) {
  8106. if ((units -= 2) < 0) break
  8107. c = str.charCodeAt(i)
  8108. hi = c >> 8
  8109. lo = c % 256
  8110. byteArray.push(lo)
  8111. byteArray.push(hi)
  8112. }
  8113. return byteArray
  8114. }
  8115. function base64ToBytes (str) {
  8116. return base64.toByteArray(base64clean(str))
  8117. }
  8118. function blitBuffer (src, dst, offset, length) {
  8119. for (var i = 0; i < length; ++i) {
  8120. if ((i + offset >= dst.length) || (i >= src.length)) break
  8121. dst[i + offset] = src[i]
  8122. }
  8123. return i
  8124. }
  8125. function isnan (val) {
  8126. return val !== val // eslint-disable-line no-self-compare
  8127. }
  8128. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  8129. /***/ }),
  8130. /***/ "./node_modules/clipboard/dist/clipboard.js":
  8131. /*!**************************************************!*\
  8132. !*** ./node_modules/clipboard/dist/clipboard.js ***!
  8133. \**************************************************/
  8134. /*! no static exports found */
  8135. /***/ (function(module, exports, __webpack_require__) {
  8136. /*!
  8137. * clipboard.js v2.0.4
  8138. * https://zenorocha.github.io/clipboard.js
  8139. *
  8140. * Licensed MIT © Zeno Rocha
  8141. */
  8142. (function webpackUniversalModuleDefinition(root, factory) {
  8143. if(true)
  8144. module.exports = factory();
  8145. else {}
  8146. })(this, function() {
  8147. return /******/ (function(modules) { // webpackBootstrap
  8148. /******/ // The module cache
  8149. /******/ var installedModules = {};
  8150. /******/
  8151. /******/ // The require function
  8152. /******/ function __webpack_require__(moduleId) {
  8153. /******/
  8154. /******/ // Check if module is in cache
  8155. /******/ if(installedModules[moduleId]) {
  8156. /******/ return installedModules[moduleId].exports;
  8157. /******/ }
  8158. /******/ // Create a new module (and put it into the cache)
  8159. /******/ var module = installedModules[moduleId] = {
  8160. /******/ i: moduleId,
  8161. /******/ l: false,
  8162. /******/ exports: {}
  8163. /******/ };
  8164. /******/
  8165. /******/ // Execute the module function
  8166. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  8167. /******/
  8168. /******/ // Flag the module as loaded
  8169. /******/ module.l = true;
  8170. /******/
  8171. /******/ // Return the exports of the module
  8172. /******/ return module.exports;
  8173. /******/ }
  8174. /******/
  8175. /******/
  8176. /******/ // expose the modules object (__webpack_modules__)
  8177. /******/ __webpack_require__.m = modules;
  8178. /******/
  8179. /******/ // expose the module cache
  8180. /******/ __webpack_require__.c = installedModules;
  8181. /******/
  8182. /******/ // define getter function for harmony exports
  8183. /******/ __webpack_require__.d = function(exports, name, getter) {
  8184. /******/ if(!__webpack_require__.o(exports, name)) {
  8185. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  8186. /******/ }
  8187. /******/ };
  8188. /******/
  8189. /******/ // define __esModule on exports
  8190. /******/ __webpack_require__.r = function(exports) {
  8191. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  8192. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  8193. /******/ }
  8194. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  8195. /******/ };
  8196. /******/
  8197. /******/ // create a fake namespace object
  8198. /******/ // mode & 1: value is a module id, require it
  8199. /******/ // mode & 2: merge all properties of value into the ns
  8200. /******/ // mode & 4: return value when already ns object
  8201. /******/ // mode & 8|1: behave like require
  8202. /******/ __webpack_require__.t = function(value, mode) {
  8203. /******/ if(mode & 1) value = __webpack_require__(value);
  8204. /******/ if(mode & 8) return value;
  8205. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  8206. /******/ var ns = Object.create(null);
  8207. /******/ __webpack_require__.r(ns);
  8208. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  8209. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  8210. /******/ return ns;
  8211. /******/ };
  8212. /******/
  8213. /******/ // getDefaultExport function for compatibility with non-harmony modules
  8214. /******/ __webpack_require__.n = function(module) {
  8215. /******/ var getter = module && module.__esModule ?
  8216. /******/ function getDefault() { return module['default']; } :
  8217. /******/ function getModuleExports() { return module; };
  8218. /******/ __webpack_require__.d(getter, 'a', getter);
  8219. /******/ return getter;
  8220. /******/ };
  8221. /******/
  8222. /******/ // Object.prototype.hasOwnProperty.call
  8223. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  8224. /******/
  8225. /******/ // __webpack_public_path__
  8226. /******/ __webpack_require__.p = "";
  8227. /******/
  8228. /******/
  8229. /******/ // Load entry module and return exports
  8230. /******/ return __webpack_require__(__webpack_require__.s = 0);
  8231. /******/ })
  8232. /************************************************************************/
  8233. /******/ ([
  8234. /* 0 */
  8235. /***/ (function(module, exports, __webpack_require__) {
  8236. "use strict";
  8237. 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; };
  8238. 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; }; }();
  8239. var _clipboardAction = __webpack_require__(1);
  8240. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  8241. var _tinyEmitter = __webpack_require__(3);
  8242. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  8243. var _goodListener = __webpack_require__(4);
  8244. var _goodListener2 = _interopRequireDefault(_goodListener);
  8245. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8246. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8247. 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; }
  8248. 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; }
  8249. /**
  8250. * Base class which takes one or more elements, adds event listeners to them,
  8251. * and instantiates a new `ClipboardAction` on each click.
  8252. */
  8253. var Clipboard = function (_Emitter) {
  8254. _inherits(Clipboard, _Emitter);
  8255. /**
  8256. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  8257. * @param {Object} options
  8258. */
  8259. function Clipboard(trigger, options) {
  8260. _classCallCheck(this, Clipboard);
  8261. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  8262. _this.resolveOptions(options);
  8263. _this.listenClick(trigger);
  8264. return _this;
  8265. }
  8266. /**
  8267. * Defines if attributes would be resolved using internal setter functions
  8268. * or custom functions that were passed in the constructor.
  8269. * @param {Object} options
  8270. */
  8271. _createClass(Clipboard, [{
  8272. key: 'resolveOptions',
  8273. value: function resolveOptions() {
  8274. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  8275. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  8276. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  8277. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  8278. this.container = _typeof(options.container) === 'object' ? options.container : document.body;
  8279. }
  8280. /**
  8281. * Adds a click event listener to the passed trigger.
  8282. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  8283. */
  8284. }, {
  8285. key: 'listenClick',
  8286. value: function listenClick(trigger) {
  8287. var _this2 = this;
  8288. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  8289. return _this2.onClick(e);
  8290. });
  8291. }
  8292. /**
  8293. * Defines a new `ClipboardAction` on each click event.
  8294. * @param {Event} e
  8295. */
  8296. }, {
  8297. key: 'onClick',
  8298. value: function onClick(e) {
  8299. var trigger = e.delegateTarget || e.currentTarget;
  8300. if (this.clipboardAction) {
  8301. this.clipboardAction = null;
  8302. }
  8303. this.clipboardAction = new _clipboardAction2.default({
  8304. action: this.action(trigger),
  8305. target: this.target(trigger),
  8306. text: this.text(trigger),
  8307. container: this.container,
  8308. trigger: trigger,
  8309. emitter: this
  8310. });
  8311. }
  8312. /**
  8313. * Default `action` lookup function.
  8314. * @param {Element} trigger
  8315. */
  8316. }, {
  8317. key: 'defaultAction',
  8318. value: function defaultAction(trigger) {
  8319. return getAttributeValue('action', trigger);
  8320. }
  8321. /**
  8322. * Default `target` lookup function.
  8323. * @param {Element} trigger
  8324. */
  8325. }, {
  8326. key: 'defaultTarget',
  8327. value: function defaultTarget(trigger) {
  8328. var selector = getAttributeValue('target', trigger);
  8329. if (selector) {
  8330. return document.querySelector(selector);
  8331. }
  8332. }
  8333. /**
  8334. * Returns the support of the given action, or all actions if no action is
  8335. * given.
  8336. * @param {String} [action]
  8337. */
  8338. }, {
  8339. key: 'defaultText',
  8340. /**
  8341. * Default `text` lookup function.
  8342. * @param {Element} trigger
  8343. */
  8344. value: function defaultText(trigger) {
  8345. return getAttributeValue('text', trigger);
  8346. }
  8347. /**
  8348. * Destroy lifecycle.
  8349. */
  8350. }, {
  8351. key: 'destroy',
  8352. value: function destroy() {
  8353. this.listener.destroy();
  8354. if (this.clipboardAction) {
  8355. this.clipboardAction.destroy();
  8356. this.clipboardAction = null;
  8357. }
  8358. }
  8359. }], [{
  8360. key: 'isSupported',
  8361. value: function isSupported() {
  8362. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
  8363. var actions = typeof action === 'string' ? [action] : action;
  8364. var support = !!document.queryCommandSupported;
  8365. actions.forEach(function (action) {
  8366. support = support && !!document.queryCommandSupported(action);
  8367. });
  8368. return support;
  8369. }
  8370. }]);
  8371. return Clipboard;
  8372. }(_tinyEmitter2.default);
  8373. /**
  8374. * Helper function to retrieve attribute value.
  8375. * @param {String} suffix
  8376. * @param {Element} element
  8377. */
  8378. function getAttributeValue(suffix, element) {
  8379. var attribute = 'data-clipboard-' + suffix;
  8380. if (!element.hasAttribute(attribute)) {
  8381. return;
  8382. }
  8383. return element.getAttribute(attribute);
  8384. }
  8385. module.exports = Clipboard;
  8386. /***/ }),
  8387. /* 1 */
  8388. /***/ (function(module, exports, __webpack_require__) {
  8389. "use strict";
  8390. 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; };
  8391. 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; }; }();
  8392. var _select = __webpack_require__(2);
  8393. var _select2 = _interopRequireDefault(_select);
  8394. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8395. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8396. /**
  8397. * Inner class which performs selection from either `text` or `target`
  8398. * properties and then executes copy or cut operations.
  8399. */
  8400. var ClipboardAction = function () {
  8401. /**
  8402. * @param {Object} options
  8403. */
  8404. function ClipboardAction(options) {
  8405. _classCallCheck(this, ClipboardAction);
  8406. this.resolveOptions(options);
  8407. this.initSelection();
  8408. }
  8409. /**
  8410. * Defines base properties passed from constructor.
  8411. * @param {Object} options
  8412. */
  8413. _createClass(ClipboardAction, [{
  8414. key: 'resolveOptions',
  8415. value: function resolveOptions() {
  8416. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  8417. this.action = options.action;
  8418. this.container = options.container;
  8419. this.emitter = options.emitter;
  8420. this.target = options.target;
  8421. this.text = options.text;
  8422. this.trigger = options.trigger;
  8423. this.selectedText = '';
  8424. }
  8425. /**
  8426. * Decides which selection strategy is going to be applied based
  8427. * on the existence of `text` and `target` properties.
  8428. */
  8429. }, {
  8430. key: 'initSelection',
  8431. value: function initSelection() {
  8432. if (this.text) {
  8433. this.selectFake();
  8434. } else if (this.target) {
  8435. this.selectTarget();
  8436. }
  8437. }
  8438. /**
  8439. * Creates a fake textarea element, sets its value from `text` property,
  8440. * and makes a selection on it.
  8441. */
  8442. }, {
  8443. key: 'selectFake',
  8444. value: function selectFake() {
  8445. var _this = this;
  8446. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  8447. this.removeFake();
  8448. this.fakeHandlerCallback = function () {
  8449. return _this.removeFake();
  8450. };
  8451. this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
  8452. this.fakeElem = document.createElement('textarea');
  8453. // Prevent zooming on iOS
  8454. this.fakeElem.style.fontSize = '12pt';
  8455. // Reset box model
  8456. this.fakeElem.style.border = '0';
  8457. this.fakeElem.style.padding = '0';
  8458. this.fakeElem.style.margin = '0';
  8459. // Move element out of screen horizontally
  8460. this.fakeElem.style.position = 'absolute';
  8461. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  8462. // Move element to the same position vertically
  8463. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  8464. this.fakeElem.style.top = yPosition + 'px';
  8465. this.fakeElem.setAttribute('readonly', '');
  8466. this.fakeElem.value = this.text;
  8467. this.container.appendChild(this.fakeElem);
  8468. this.selectedText = (0, _select2.default)(this.fakeElem);
  8469. this.copyText();
  8470. }
  8471. /**
  8472. * Only removes the fake element after another click event, that way
  8473. * a user can hit `Ctrl+C` to copy because selection still exists.
  8474. */
  8475. }, {
  8476. key: 'removeFake',
  8477. value: function removeFake() {
  8478. if (this.fakeHandler) {
  8479. this.container.removeEventListener('click', this.fakeHandlerCallback);
  8480. this.fakeHandler = null;
  8481. this.fakeHandlerCallback = null;
  8482. }
  8483. if (this.fakeElem) {
  8484. this.container.removeChild(this.fakeElem);
  8485. this.fakeElem = null;
  8486. }
  8487. }
  8488. /**
  8489. * Selects the content from element passed on `target` property.
  8490. */
  8491. }, {
  8492. key: 'selectTarget',
  8493. value: function selectTarget() {
  8494. this.selectedText = (0, _select2.default)(this.target);
  8495. this.copyText();
  8496. }
  8497. /**
  8498. * Executes the copy operation based on the current selection.
  8499. */
  8500. }, {
  8501. key: 'copyText',
  8502. value: function copyText() {
  8503. var succeeded = void 0;
  8504. try {
  8505. succeeded = document.execCommand(this.action);
  8506. } catch (err) {
  8507. succeeded = false;
  8508. }
  8509. this.handleResult(succeeded);
  8510. }
  8511. /**
  8512. * Fires an event based on the copy operation result.
  8513. * @param {Boolean} succeeded
  8514. */
  8515. }, {
  8516. key: 'handleResult',
  8517. value: function handleResult(succeeded) {
  8518. this.emitter.emit(succeeded ? 'success' : 'error', {
  8519. action: this.action,
  8520. text: this.selectedText,
  8521. trigger: this.trigger,
  8522. clearSelection: this.clearSelection.bind(this)
  8523. });
  8524. }
  8525. /**
  8526. * Moves focus away from `target` and back to the trigger, removes current selection.
  8527. */
  8528. }, {
  8529. key: 'clearSelection',
  8530. value: function clearSelection() {
  8531. if (this.trigger) {
  8532. this.trigger.focus();
  8533. }
  8534. window.getSelection().removeAllRanges();
  8535. }
  8536. /**
  8537. * Sets the `action` to be performed which can be either 'copy' or 'cut'.
  8538. * @param {String} action
  8539. */
  8540. }, {
  8541. key: 'destroy',
  8542. /**
  8543. * Destroy lifecycle.
  8544. */
  8545. value: function destroy() {
  8546. this.removeFake();
  8547. }
  8548. }, {
  8549. key: 'action',
  8550. set: function set() {
  8551. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  8552. this._action = action;
  8553. if (this._action !== 'copy' && this._action !== 'cut') {
  8554. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  8555. }
  8556. }
  8557. /**
  8558. * Gets the `action` property.
  8559. * @return {String}
  8560. */
  8561. ,
  8562. get: function get() {
  8563. return this._action;
  8564. }
  8565. /**
  8566. * Sets the `target` property using an element
  8567. * that will be have its content copied.
  8568. * @param {Element} target
  8569. */
  8570. }, {
  8571. key: 'target',
  8572. set: function set(target) {
  8573. if (target !== undefined) {
  8574. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  8575. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  8576. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  8577. }
  8578. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  8579. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  8580. }
  8581. this._target = target;
  8582. } else {
  8583. throw new Error('Invalid "target" value, use a valid Element');
  8584. }
  8585. }
  8586. }
  8587. /**
  8588. * Gets the `target` property.
  8589. * @return {String|HTMLElement}
  8590. */
  8591. ,
  8592. get: function get() {
  8593. return this._target;
  8594. }
  8595. }]);
  8596. return ClipboardAction;
  8597. }();
  8598. module.exports = ClipboardAction;
  8599. /***/ }),
  8600. /* 2 */
  8601. /***/ (function(module, exports) {
  8602. function select(element) {
  8603. var selectedText;
  8604. if (element.nodeName === 'SELECT') {
  8605. element.focus();
  8606. selectedText = element.value;
  8607. }
  8608. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  8609. var isReadOnly = element.hasAttribute('readonly');
  8610. if (!isReadOnly) {
  8611. element.setAttribute('readonly', '');
  8612. }
  8613. element.select();
  8614. element.setSelectionRange(0, element.value.length);
  8615. if (!isReadOnly) {
  8616. element.removeAttribute('readonly');
  8617. }
  8618. selectedText = element.value;
  8619. }
  8620. else {
  8621. if (element.hasAttribute('contenteditable')) {
  8622. element.focus();
  8623. }
  8624. var selection = window.getSelection();
  8625. var range = document.createRange();
  8626. range.selectNodeContents(element);
  8627. selection.removeAllRanges();
  8628. selection.addRange(range);
  8629. selectedText = selection.toString();
  8630. }
  8631. return selectedText;
  8632. }
  8633. module.exports = select;
  8634. /***/ }),
  8635. /* 3 */
  8636. /***/ (function(module, exports) {
  8637. function E () {
  8638. // Keep this empty so it's easier to inherit from
  8639. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  8640. }
  8641. E.prototype = {
  8642. on: function (name, callback, ctx) {
  8643. var e = this.e || (this.e = {});
  8644. (e[name] || (e[name] = [])).push({
  8645. fn: callback,
  8646. ctx: ctx
  8647. });
  8648. return this;
  8649. },
  8650. once: function (name, callback, ctx) {
  8651. var self = this;
  8652. function listener () {
  8653. self.off(name, listener);
  8654. callback.apply(ctx, arguments);
  8655. };
  8656. listener._ = callback
  8657. return this.on(name, listener, ctx);
  8658. },
  8659. emit: function (name) {
  8660. var data = [].slice.call(arguments, 1);
  8661. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  8662. var i = 0;
  8663. var len = evtArr.length;
  8664. for (i; i < len; i++) {
  8665. evtArr[i].fn.apply(evtArr[i].ctx, data);
  8666. }
  8667. return this;
  8668. },
  8669. off: function (name, callback) {
  8670. var e = this.e || (this.e = {});
  8671. var evts = e[name];
  8672. var liveEvents = [];
  8673. if (evts && callback) {
  8674. for (var i = 0, len = evts.length; i < len; i++) {
  8675. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  8676. liveEvents.push(evts[i]);
  8677. }
  8678. }
  8679. // Remove event from queue to prevent memory leak
  8680. // Suggested by https://github.com/lazd
  8681. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  8682. (liveEvents.length)
  8683. ? e[name] = liveEvents
  8684. : delete e[name];
  8685. return this;
  8686. }
  8687. };
  8688. module.exports = E;
  8689. /***/ }),
  8690. /* 4 */
  8691. /***/ (function(module, exports, __webpack_require__) {
  8692. var is = __webpack_require__(5);
  8693. var delegate = __webpack_require__(6);
  8694. /**
  8695. * Validates all params and calls the right
  8696. * listener function based on its target type.
  8697. *
  8698. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  8699. * @param {String} type
  8700. * @param {Function} callback
  8701. * @return {Object}
  8702. */
  8703. function listen(target, type, callback) {
  8704. if (!target && !type && !callback) {
  8705. throw new Error('Missing required arguments');
  8706. }
  8707. if (!is.string(type)) {
  8708. throw new TypeError('Second argument must be a String');
  8709. }
  8710. if (!is.fn(callback)) {
  8711. throw new TypeError('Third argument must be a Function');
  8712. }
  8713. if (is.node(target)) {
  8714. return listenNode(target, type, callback);
  8715. }
  8716. else if (is.nodeList(target)) {
  8717. return listenNodeList(target, type, callback);
  8718. }
  8719. else if (is.string(target)) {
  8720. return listenSelector(target, type, callback);
  8721. }
  8722. else {
  8723. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  8724. }
  8725. }
  8726. /**
  8727. * Adds an event listener to a HTML element
  8728. * and returns a remove listener function.
  8729. *
  8730. * @param {HTMLElement} node
  8731. * @param {String} type
  8732. * @param {Function} callback
  8733. * @return {Object}
  8734. */
  8735. function listenNode(node, type, callback) {
  8736. node.addEventListener(type, callback);
  8737. return {
  8738. destroy: function() {
  8739. node.removeEventListener(type, callback);
  8740. }
  8741. }
  8742. }
  8743. /**
  8744. * Add an event listener to a list of HTML elements
  8745. * and returns a remove listener function.
  8746. *
  8747. * @param {NodeList|HTMLCollection} nodeList
  8748. * @param {String} type
  8749. * @param {Function} callback
  8750. * @return {Object}
  8751. */
  8752. function listenNodeList(nodeList, type, callback) {
  8753. Array.prototype.forEach.call(nodeList, function(node) {
  8754. node.addEventListener(type, callback);
  8755. });
  8756. return {
  8757. destroy: function() {
  8758. Array.prototype.forEach.call(nodeList, function(node) {
  8759. node.removeEventListener(type, callback);
  8760. });
  8761. }
  8762. }
  8763. }
  8764. /**
  8765. * Add an event listener to a selector
  8766. * and returns a remove listener function.
  8767. *
  8768. * @param {String} selector
  8769. * @param {String} type
  8770. * @param {Function} callback
  8771. * @return {Object}
  8772. */
  8773. function listenSelector(selector, type, callback) {
  8774. return delegate(document.body, selector, type, callback);
  8775. }
  8776. module.exports = listen;
  8777. /***/ }),
  8778. /* 5 */
  8779. /***/ (function(module, exports) {
  8780. /**
  8781. * Check if argument is a HTML element.
  8782. *
  8783. * @param {Object} value
  8784. * @return {Boolean}
  8785. */
  8786. exports.node = function(value) {
  8787. return value !== undefined
  8788. && value instanceof HTMLElement
  8789. && value.nodeType === 1;
  8790. };
  8791. /**
  8792. * Check if argument is a list of HTML elements.
  8793. *
  8794. * @param {Object} value
  8795. * @return {Boolean}
  8796. */
  8797. exports.nodeList = function(value) {
  8798. var type = Object.prototype.toString.call(value);
  8799. return value !== undefined
  8800. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  8801. && ('length' in value)
  8802. && (value.length === 0 || exports.node(value[0]));
  8803. };
  8804. /**
  8805. * Check if argument is a string.
  8806. *
  8807. * @param {Object} value
  8808. * @return {Boolean}
  8809. */
  8810. exports.string = function(value) {
  8811. return typeof value === 'string'
  8812. || value instanceof String;
  8813. };
  8814. /**
  8815. * Check if argument is a function.
  8816. *
  8817. * @param {Object} value
  8818. * @return {Boolean}
  8819. */
  8820. exports.fn = function(value) {
  8821. var type = Object.prototype.toString.call(value);
  8822. return type === '[object Function]';
  8823. };
  8824. /***/ }),
  8825. /* 6 */
  8826. /***/ (function(module, exports, __webpack_require__) {
  8827. var closest = __webpack_require__(7);
  8828. /**
  8829. * Delegates event to a selector.
  8830. *
  8831. * @param {Element} element
  8832. * @param {String} selector
  8833. * @param {String} type
  8834. * @param {Function} callback
  8835. * @param {Boolean} useCapture
  8836. * @return {Object}
  8837. */
  8838. function _delegate(element, selector, type, callback, useCapture) {
  8839. var listenerFn = listener.apply(this, arguments);
  8840. element.addEventListener(type, listenerFn, useCapture);
  8841. return {
  8842. destroy: function() {
  8843. element.removeEventListener(type, listenerFn, useCapture);
  8844. }
  8845. }
  8846. }
  8847. /**
  8848. * Delegates event to a selector.
  8849. *
  8850. * @param {Element|String|Array} [elements]
  8851. * @param {String} selector
  8852. * @param {String} type
  8853. * @param {Function} callback
  8854. * @param {Boolean} useCapture
  8855. * @return {Object}
  8856. */
  8857. function delegate(elements, selector, type, callback, useCapture) {
  8858. // Handle the regular Element usage
  8859. if (typeof elements.addEventListener === 'function') {
  8860. return _delegate.apply(null, arguments);
  8861. }
  8862. // Handle Element-less usage, it defaults to global delegation
  8863. if (typeof type === 'function') {
  8864. // Use `document` as the first parameter, then apply arguments
  8865. // This is a short way to .unshift `arguments` without running into deoptimizations
  8866. return _delegate.bind(null, document).apply(null, arguments);
  8867. }
  8868. // Handle Selector-based usage
  8869. if (typeof elements === 'string') {
  8870. elements = document.querySelectorAll(elements);
  8871. }
  8872. // Handle Array-like based usage
  8873. return Array.prototype.map.call(elements, function (element) {
  8874. return _delegate(element, selector, type, callback, useCapture);
  8875. });
  8876. }
  8877. /**
  8878. * Finds closest match and invokes callback.
  8879. *
  8880. * @param {Element} element
  8881. * @param {String} selector
  8882. * @param {String} type
  8883. * @param {Function} callback
  8884. * @return {Function}
  8885. */
  8886. function listener(element, selector, type, callback) {
  8887. return function(e) {
  8888. e.delegateTarget = closest(e.target, selector);
  8889. if (e.delegateTarget) {
  8890. callback.call(element, e);
  8891. }
  8892. }
  8893. }
  8894. module.exports = delegate;
  8895. /***/ }),
  8896. /* 7 */
  8897. /***/ (function(module, exports) {
  8898. var DOCUMENT_NODE_TYPE = 9;
  8899. /**
  8900. * A polyfill for Element.matches()
  8901. */
  8902. if (typeof Element !== 'undefined' && !Element.prototype.matches) {
  8903. var proto = Element.prototype;
  8904. proto.matches = proto.matchesSelector ||
  8905. proto.mozMatchesSelector ||
  8906. proto.msMatchesSelector ||
  8907. proto.oMatchesSelector ||
  8908. proto.webkitMatchesSelector;
  8909. }
  8910. /**
  8911. * Finds the closest parent that matches a selector.
  8912. *
  8913. * @param {Element} element
  8914. * @param {String} selector
  8915. * @return {Function}
  8916. */
  8917. function closest (element, selector) {
  8918. while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
  8919. if (typeof element.matches === 'function' &&
  8920. element.matches(selector)) {
  8921. return element;
  8922. }
  8923. element = element.parentNode;
  8924. }
  8925. }
  8926. module.exports = closest;
  8927. /***/ })
  8928. /******/ ]);
  8929. });
  8930. /***/ }),
  8931. /***/ "./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/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css&":
  8932. /*!*******************************************************************************************************************************************************************************************************************************************************************************************************!*\
  8933. !*** ./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/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css& ***!
  8934. \*******************************************************************************************************************************************************************************************************************************************************************************************************/
  8935. /*! no static exports found */
  8936. /***/ (function(module, exports, __webpack_require__) {
  8937. exports = module.exports = __webpack_require__(/*! ../../../node_modules/css-loader/lib/css-base.js */ "./node_modules/css-loader/lib/css-base.js")(false);
  8938. // imports
  8939. // module
  8940. exports.push([module.i, "\n.loader[data-v-9a543b64],\n.loader[data-v-9a543b64]:after {\n border-radius: 50%;\n width: 10em;\n height: 10em;\n}\n.loader[data-v-9a543b64] {\n margin: 0px auto;\n position: relative;\n text-indent: -9999em;\n border-top: 1.1em solid rgba(255, 255, 255, 0.2);\n border-right: 1.1em solid rgba(255, 255, 255, 0.2);\n border-bottom: 1.1em solid rgba(255, 255, 255, 0.2);\n transform: translateZ(0);\n -webkit-animation: load8-data-v-9a543b64 1.1s infinite linear;\n animation: load8-data-v-9a543b64 1.1s infinite linear;\n overflow: hidden;\n}\n@-webkit-keyframes load8-data-v-9a543b64 {\n0% {\n transform: rotate(0deg);\n}\n100% {\n transform: rotate(360deg);\n}\n}\n@keyframes load8-data-v-9a543b64 {\n0% {\n transform: rotate(0deg);\n}\n100% {\n transform: rotate(360deg);\n}\n}\n", ""]);
  8941. // exports
  8942. /***/ }),
  8943. /***/ "./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&":
  8944. /*!********************************************************************************************************************************************************************************************************************************************************************************************!*\
  8945. !*** ./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& ***!
  8946. \********************************************************************************************************************************************************************************************************************************************************************************************/
  8947. /*! no static exports found */
  8948. /***/ (function(module, exports, __webpack_require__) {
  8949. exports = module.exports = __webpack_require__(/*! ../../../node_modules/css-loader/lib/css-base.js */ "./node_modules/css-loader/lib/css-base.js")(false);
  8950. // imports
  8951. // module
  8952. 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", ""]);
  8953. // exports
  8954. /***/ }),
  8955. /***/ "./node_modules/css-loader/lib/css-base.js":
  8956. /*!*************************************************!*\
  8957. !*** ./node_modules/css-loader/lib/css-base.js ***!
  8958. \*************************************************/
  8959. /*! no static exports found */
  8960. /***/ (function(module, exports) {
  8961. /*
  8962. MIT License http://www.opensource.org/licenses/mit-license.php
  8963. Author Tobias Koppers @sokra
  8964. */
  8965. // css base code, injected by the css-loader
  8966. module.exports = function(useSourceMap) {
  8967. var list = [];
  8968. // return the list of modules as css string
  8969. list.toString = function toString() {
  8970. return this.map(function (item) {
  8971. var content = cssWithMappingToString(item, useSourceMap);
  8972. if(item[2]) {
  8973. return "@media " + item[2] + "{" + content + "}";
  8974. } else {
  8975. return content;
  8976. }
  8977. }).join("");
  8978. };
  8979. // import a list of modules into the list
  8980. list.i = function(modules, mediaQuery) {
  8981. if(typeof modules === "string")
  8982. modules = [[null, modules, ""]];
  8983. var alreadyImportedModules = {};
  8984. for(var i = 0; i < this.length; i++) {
  8985. var id = this[i][0];
  8986. if(typeof id === "number")
  8987. alreadyImportedModules[id] = true;
  8988. }
  8989. for(i = 0; i < modules.length; i++) {
  8990. var item = modules[i];
  8991. // skip already imported module
  8992. // this implementation is not 100% perfect for weird media query combinations
  8993. // when a module is imported multiple times with different media queries.
  8994. // I hope this will never occur (Hey this way we have smaller bundles)
  8995. if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
  8996. if(mediaQuery && !item[2]) {
  8997. item[2] = mediaQuery;
  8998. } else if(mediaQuery) {
  8999. item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
  9000. }
  9001. list.push(item);
  9002. }
  9003. }
  9004. };
  9005. return list;
  9006. };
  9007. function cssWithMappingToString(item, useSourceMap) {
  9008. var content = item[1] || '';
  9009. var cssMapping = item[3];
  9010. if (!cssMapping) {
  9011. return content;
  9012. }
  9013. if (useSourceMap && typeof btoa === 'function') {
  9014. var sourceMapping = toComment(cssMapping);
  9015. var sourceURLs = cssMapping.sources.map(function (source) {
  9016. return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'
  9017. });
  9018. return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
  9019. }
  9020. return [content].join('\n');
  9021. }
  9022. // Adapted from convert-source-map (MIT)
  9023. function toComment(sourceMap) {
  9024. // eslint-disable-next-line no-undef
  9025. var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
  9026. var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;
  9027. return '/*# ' + data + ' */';
  9028. }
  9029. /***/ }),
  9030. /***/ "./node_modules/ieee754/index.js":
  9031. /*!***************************************!*\
  9032. !*** ./node_modules/ieee754/index.js ***!
  9033. \***************************************/
  9034. /*! no static exports found */
  9035. /***/ (function(module, exports) {
  9036. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  9037. var e, m
  9038. var eLen = (nBytes * 8) - mLen - 1
  9039. var eMax = (1 << eLen) - 1
  9040. var eBias = eMax >> 1
  9041. var nBits = -7
  9042. var i = isLE ? (nBytes - 1) : 0
  9043. var d = isLE ? -1 : 1
  9044. var s = buffer[offset + i]
  9045. i += d
  9046. e = s & ((1 << (-nBits)) - 1)
  9047. s >>= (-nBits)
  9048. nBits += eLen
  9049. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  9050. m = e & ((1 << (-nBits)) - 1)
  9051. e >>= (-nBits)
  9052. nBits += mLen
  9053. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  9054. if (e === 0) {
  9055. e = 1 - eBias
  9056. } else if (e === eMax) {
  9057. return m ? NaN : ((s ? -1 : 1) * Infinity)
  9058. } else {
  9059. m = m + Math.pow(2, mLen)
  9060. e = e - eBias
  9061. }
  9062. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  9063. }
  9064. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  9065. var e, m, c
  9066. var eLen = (nBytes * 8) - mLen - 1
  9067. var eMax = (1 << eLen) - 1
  9068. var eBias = eMax >> 1
  9069. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  9070. var i = isLE ? 0 : (nBytes - 1)
  9071. var d = isLE ? 1 : -1
  9072. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  9073. value = Math.abs(value)
  9074. if (isNaN(value) || value === Infinity) {
  9075. m = isNaN(value) ? 1 : 0
  9076. e = eMax
  9077. } else {
  9078. e = Math.floor(Math.log(value) / Math.LN2)
  9079. if (value * (c = Math.pow(2, -e)) < 1) {
  9080. e--
  9081. c *= 2
  9082. }
  9083. if (e + eBias >= 1) {
  9084. value += rt / c
  9085. } else {
  9086. value += rt * Math.pow(2, 1 - eBias)
  9087. }
  9088. if (value * c >= 2) {
  9089. e++
  9090. c /= 2
  9091. }
  9092. if (e + eBias >= eMax) {
  9093. m = 0
  9094. e = eMax
  9095. } else if (e + eBias >= 1) {
  9096. m = ((value * c) - 1) * Math.pow(2, mLen)
  9097. e = e + eBias
  9098. } else {
  9099. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  9100. e = 0
  9101. }
  9102. }
  9103. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  9104. e = (e << mLen) | m
  9105. eLen += mLen
  9106. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  9107. buffer[offset + i - d] |= s * 128
  9108. }
  9109. /***/ }),
  9110. /***/ "./node_modules/isarray/index.js":
  9111. /*!***************************************!*\
  9112. !*** ./node_modules/isarray/index.js ***!
  9113. \***************************************/
  9114. /*! no static exports found */
  9115. /***/ (function(module, exports) {
  9116. var toString = {}.toString;
  9117. module.exports = Array.isArray || function (arr) {
  9118. return toString.call(arr) == '[object Array]';
  9119. };
  9120. /***/ }),
  9121. /***/ "./node_modules/jquery/dist/jquery.js":
  9122. /*!********************************************!*\
  9123. !*** ./node_modules/jquery/dist/jquery.js ***!
  9124. \********************************************/
  9125. /*! no static exports found */
  9126. /***/ (function(module, exports, __webpack_require__) {
  9127. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  9128. * jQuery JavaScript Library v3.4.1
  9129. * https://jquery.com/
  9130. *
  9131. * Includes Sizzle.js
  9132. * https://sizzlejs.com/
  9133. *
  9134. * Copyright JS Foundation and other contributors
  9135. * Released under the MIT license
  9136. * https://jquery.org/license
  9137. *
  9138. * Date: 2019-05-01T21:04Z
  9139. */
  9140. ( function( global, factory ) {
  9141. "use strict";
  9142. if ( true && typeof module.exports === "object" ) {
  9143. // For CommonJS and CommonJS-like environments where a proper `window`
  9144. // is present, execute the factory and get jQuery.
  9145. // For environments that do not have a `window` with a `document`
  9146. // (such as Node.js), expose a factory as module.exports.
  9147. // This accentuates the need for the creation of a real `window`.
  9148. // e.g. var jQuery = require("jquery")(window);
  9149. // See ticket #14549 for more info.
  9150. module.exports = global.document ?
  9151. factory( global, true ) :
  9152. function( w ) {
  9153. if ( !w.document ) {
  9154. throw new Error( "jQuery requires a window with a document" );
  9155. }
  9156. return factory( w );
  9157. };
  9158. } else {
  9159. factory( global );
  9160. }
  9161. // Pass this if window is not defined yet
  9162. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  9163. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  9164. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  9165. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  9166. // enough that all such attempts are guarded in a try block.
  9167. "use strict";
  9168. var arr = [];
  9169. var document = window.document;
  9170. var getProto = Object.getPrototypeOf;
  9171. var slice = arr.slice;
  9172. var concat = arr.concat;
  9173. var push = arr.push;
  9174. var indexOf = arr.indexOf;
  9175. var class2type = {};
  9176. var toString = class2type.toString;
  9177. var hasOwn = class2type.hasOwnProperty;
  9178. var fnToString = hasOwn.toString;
  9179. var ObjectFunctionString = fnToString.call( Object );
  9180. var support = {};
  9181. var isFunction = function isFunction( obj ) {
  9182. // Support: Chrome <=57, Firefox <=52
  9183. // In some browsers, typeof returns "function" for HTML <object> elements
  9184. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  9185. // We don't want to classify *any* DOM node as a function.
  9186. return typeof obj === "function" && typeof obj.nodeType !== "number";
  9187. };
  9188. var isWindow = function isWindow( obj ) {
  9189. return obj != null && obj === obj.window;
  9190. };
  9191. var preservedScriptAttributes = {
  9192. type: true,
  9193. src: true,
  9194. nonce: true,
  9195. noModule: true
  9196. };
  9197. function DOMEval( code, node, doc ) {
  9198. doc = doc || document;
  9199. var i, val,
  9200. script = doc.createElement( "script" );
  9201. script.text = code;
  9202. if ( node ) {
  9203. for ( i in preservedScriptAttributes ) {
  9204. // Support: Firefox 64+, Edge 18+
  9205. // Some browsers don't support the "nonce" property on scripts.
  9206. // On the other hand, just using `getAttribute` is not enough as
  9207. // the `nonce` attribute is reset to an empty string whenever it
  9208. // becomes browsing-context connected.
  9209. // See https://github.com/whatwg/html/issues/2369
  9210. // See https://html.spec.whatwg.org/#nonce-attributes
  9211. // The `node.getAttribute` check was added for the sake of
  9212. // `jQuery.globalEval` so that it can fake a nonce-containing node
  9213. // via an object.
  9214. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  9215. if ( val ) {
  9216. script.setAttribute( i, val );
  9217. }
  9218. }
  9219. }
  9220. doc.head.appendChild( script ).parentNode.removeChild( script );
  9221. }
  9222. function toType( obj ) {
  9223. if ( obj == null ) {
  9224. return obj + "";
  9225. }
  9226. // Support: Android <=2.3 only (functionish RegExp)
  9227. return typeof obj === "object" || typeof obj === "function" ?
  9228. class2type[ toString.call( obj ) ] || "object" :
  9229. typeof obj;
  9230. }
  9231. /* global Symbol */
  9232. // Defining this global in .eslintrc.json would create a danger of using the global
  9233. // unguarded in another place, it seems safer to define global only for this module
  9234. var
  9235. version = "3.4.1",
  9236. // Define a local copy of jQuery
  9237. jQuery = function( selector, context ) {
  9238. // The jQuery object is actually just the init constructor 'enhanced'
  9239. // Need init if jQuery is called (just allow error to be thrown if not included)
  9240. return new jQuery.fn.init( selector, context );
  9241. },
  9242. // Support: Android <=4.0 only
  9243. // Make sure we trim BOM and NBSP
  9244. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  9245. jQuery.fn = jQuery.prototype = {
  9246. // The current version of jQuery being used
  9247. jquery: version,
  9248. constructor: jQuery,
  9249. // The default length of a jQuery object is 0
  9250. length: 0,
  9251. toArray: function() {
  9252. return slice.call( this );
  9253. },
  9254. // Get the Nth element in the matched element set OR
  9255. // Get the whole matched element set as a clean array
  9256. get: function( num ) {
  9257. // Return all the elements in a clean array
  9258. if ( num == null ) {
  9259. return slice.call( this );
  9260. }
  9261. // Return just the one element from the set
  9262. return num < 0 ? this[ num + this.length ] : this[ num ];
  9263. },
  9264. // Take an array of elements and push it onto the stack
  9265. // (returning the new matched element set)
  9266. pushStack: function( elems ) {
  9267. // Build a new jQuery matched element set
  9268. var ret = jQuery.merge( this.constructor(), elems );
  9269. // Add the old object onto the stack (as a reference)
  9270. ret.prevObject = this;
  9271. // Return the newly-formed element set
  9272. return ret;
  9273. },
  9274. // Execute a callback for every element in the matched set.
  9275. each: function( callback ) {
  9276. return jQuery.each( this, callback );
  9277. },
  9278. map: function( callback ) {
  9279. return this.pushStack( jQuery.map( this, function( elem, i ) {
  9280. return callback.call( elem, i, elem );
  9281. } ) );
  9282. },
  9283. slice: function() {
  9284. return this.pushStack( slice.apply( this, arguments ) );
  9285. },
  9286. first: function() {
  9287. return this.eq( 0 );
  9288. },
  9289. last: function() {
  9290. return this.eq( -1 );
  9291. },
  9292. eq: function( i ) {
  9293. var len = this.length,
  9294. j = +i + ( i < 0 ? len : 0 );
  9295. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  9296. },
  9297. end: function() {
  9298. return this.prevObject || this.constructor();
  9299. },
  9300. // For internal use only.
  9301. // Behaves like an Array's method, not like a jQuery method.
  9302. push: push,
  9303. sort: arr.sort,
  9304. splice: arr.splice
  9305. };
  9306. jQuery.extend = jQuery.fn.extend = function() {
  9307. var options, name, src, copy, copyIsArray, clone,
  9308. target = arguments[ 0 ] || {},
  9309. i = 1,
  9310. length = arguments.length,
  9311. deep = false;
  9312. // Handle a deep copy situation
  9313. if ( typeof target === "boolean" ) {
  9314. deep = target;
  9315. // Skip the boolean and the target
  9316. target = arguments[ i ] || {};
  9317. i++;
  9318. }
  9319. // Handle case when target is a string or something (possible in deep copy)
  9320. if ( typeof target !== "object" && !isFunction( target ) ) {
  9321. target = {};
  9322. }
  9323. // Extend jQuery itself if only one argument is passed
  9324. if ( i === length ) {
  9325. target = this;
  9326. i--;
  9327. }
  9328. for ( ; i < length; i++ ) {
  9329. // Only deal with non-null/undefined values
  9330. if ( ( options = arguments[ i ] ) != null ) {
  9331. // Extend the base object
  9332. for ( name in options ) {
  9333. copy = options[ name ];
  9334. // Prevent Object.prototype pollution
  9335. // Prevent never-ending loop
  9336. if ( name === "__proto__" || target === copy ) {
  9337. continue;
  9338. }
  9339. // Recurse if we're merging plain objects or arrays
  9340. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  9341. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  9342. src = target[ name ];
  9343. // Ensure proper type for the source value
  9344. if ( copyIsArray && !Array.isArray( src ) ) {
  9345. clone = [];
  9346. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  9347. clone = {};
  9348. } else {
  9349. clone = src;
  9350. }
  9351. copyIsArray = false;
  9352. // Never move original objects, clone them
  9353. target[ name ] = jQuery.extend( deep, clone, copy );
  9354. // Don't bring in undefined values
  9355. } else if ( copy !== undefined ) {
  9356. target[ name ] = copy;
  9357. }
  9358. }
  9359. }
  9360. }
  9361. // Return the modified object
  9362. return target;
  9363. };
  9364. jQuery.extend( {
  9365. // Unique for each copy of jQuery on the page
  9366. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  9367. // Assume jQuery is ready without the ready module
  9368. isReady: true,
  9369. error: function( msg ) {
  9370. throw new Error( msg );
  9371. },
  9372. noop: function() {},
  9373. isPlainObject: function( obj ) {
  9374. var proto, Ctor;
  9375. // Detect obvious negatives
  9376. // Use toString instead of jQuery.type to catch host objects
  9377. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  9378. return false;
  9379. }
  9380. proto = getProto( obj );
  9381. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  9382. if ( !proto ) {
  9383. return true;
  9384. }
  9385. // Objects with prototype are plain iff they were constructed by a global Object function
  9386. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  9387. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  9388. },
  9389. isEmptyObject: function( obj ) {
  9390. var name;
  9391. for ( name in obj ) {
  9392. return false;
  9393. }
  9394. return true;
  9395. },
  9396. // Evaluates a script in a global context
  9397. globalEval: function( code, options ) {
  9398. DOMEval( code, { nonce: options && options.nonce } );
  9399. },
  9400. each: function( obj, callback ) {
  9401. var length, i = 0;
  9402. if ( isArrayLike( obj ) ) {
  9403. length = obj.length;
  9404. for ( ; i < length; i++ ) {
  9405. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  9406. break;
  9407. }
  9408. }
  9409. } else {
  9410. for ( i in obj ) {
  9411. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  9412. break;
  9413. }
  9414. }
  9415. }
  9416. return obj;
  9417. },
  9418. // Support: Android <=4.0 only
  9419. trim: function( text ) {
  9420. return text == null ?
  9421. "" :
  9422. ( text + "" ).replace( rtrim, "" );
  9423. },
  9424. // results is for internal usage only
  9425. makeArray: function( arr, results ) {
  9426. var ret = results || [];
  9427. if ( arr != null ) {
  9428. if ( isArrayLike( Object( arr ) ) ) {
  9429. jQuery.merge( ret,
  9430. typeof arr === "string" ?
  9431. [ arr ] : arr
  9432. );
  9433. } else {
  9434. push.call( ret, arr );
  9435. }
  9436. }
  9437. return ret;
  9438. },
  9439. inArray: function( elem, arr, i ) {
  9440. return arr == null ? -1 : indexOf.call( arr, elem, i );
  9441. },
  9442. // Support: Android <=4.0 only, PhantomJS 1 only
  9443. // push.apply(_, arraylike) throws on ancient WebKit
  9444. merge: function( first, second ) {
  9445. var len = +second.length,
  9446. j = 0,
  9447. i = first.length;
  9448. for ( ; j < len; j++ ) {
  9449. first[ i++ ] = second[ j ];
  9450. }
  9451. first.length = i;
  9452. return first;
  9453. },
  9454. grep: function( elems, callback, invert ) {
  9455. var callbackInverse,
  9456. matches = [],
  9457. i = 0,
  9458. length = elems.length,
  9459. callbackExpect = !invert;
  9460. // Go through the array, only saving the items
  9461. // that pass the validator function
  9462. for ( ; i < length; i++ ) {
  9463. callbackInverse = !callback( elems[ i ], i );
  9464. if ( callbackInverse !== callbackExpect ) {
  9465. matches.push( elems[ i ] );
  9466. }
  9467. }
  9468. return matches;
  9469. },
  9470. // arg is for internal usage only
  9471. map: function( elems, callback, arg ) {
  9472. var length, value,
  9473. i = 0,
  9474. ret = [];
  9475. // Go through the array, translating each of the items to their new values
  9476. if ( isArrayLike( elems ) ) {
  9477. length = elems.length;
  9478. for ( ; i < length; i++ ) {
  9479. value = callback( elems[ i ], i, arg );
  9480. if ( value != null ) {
  9481. ret.push( value );
  9482. }
  9483. }
  9484. // Go through every key on the object,
  9485. } else {
  9486. for ( i in elems ) {
  9487. value = callback( elems[ i ], i, arg );
  9488. if ( value != null ) {
  9489. ret.push( value );
  9490. }
  9491. }
  9492. }
  9493. // Flatten any nested arrays
  9494. return concat.apply( [], ret );
  9495. },
  9496. // A global GUID counter for objects
  9497. guid: 1,
  9498. // jQuery.support is not used in Core but other projects attach their
  9499. // properties to it so it needs to exist.
  9500. support: support
  9501. } );
  9502. if ( typeof Symbol === "function" ) {
  9503. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  9504. }
  9505. // Populate the class2type map
  9506. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  9507. function( i, name ) {
  9508. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  9509. } );
  9510. function isArrayLike( obj ) {
  9511. // Support: real iOS 8.2 only (not reproducible in simulator)
  9512. // `in` check used to prevent JIT error (gh-2145)
  9513. // hasOwn isn't used here due to false negatives
  9514. // regarding Nodelist length in IE
  9515. var length = !!obj && "length" in obj && obj.length,
  9516. type = toType( obj );
  9517. if ( isFunction( obj ) || isWindow( obj ) ) {
  9518. return false;
  9519. }
  9520. return type === "array" || length === 0 ||
  9521. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  9522. }
  9523. var Sizzle =
  9524. /*!
  9525. * Sizzle CSS Selector Engine v2.3.4
  9526. * https://sizzlejs.com/
  9527. *
  9528. * Copyright JS Foundation and other contributors
  9529. * Released under the MIT license
  9530. * https://js.foundation/
  9531. *
  9532. * Date: 2019-04-08
  9533. */
  9534. (function( window ) {
  9535. var i,
  9536. support,
  9537. Expr,
  9538. getText,
  9539. isXML,
  9540. tokenize,
  9541. compile,
  9542. select,
  9543. outermostContext,
  9544. sortInput,
  9545. hasDuplicate,
  9546. // Local document vars
  9547. setDocument,
  9548. document,
  9549. docElem,
  9550. documentIsHTML,
  9551. rbuggyQSA,
  9552. rbuggyMatches,
  9553. matches,
  9554. contains,
  9555. // Instance-specific data
  9556. expando = "sizzle" + 1 * new Date(),
  9557. preferredDoc = window.document,
  9558. dirruns = 0,
  9559. done = 0,
  9560. classCache = createCache(),
  9561. tokenCache = createCache(),
  9562. compilerCache = createCache(),
  9563. nonnativeSelectorCache = createCache(),
  9564. sortOrder = function( a, b ) {
  9565. if ( a === b ) {
  9566. hasDuplicate = true;
  9567. }
  9568. return 0;
  9569. },
  9570. // Instance methods
  9571. hasOwn = ({}).hasOwnProperty,
  9572. arr = [],
  9573. pop = arr.pop,
  9574. push_native = arr.push,
  9575. push = arr.push,
  9576. slice = arr.slice,
  9577. // Use a stripped-down indexOf as it's faster than native
  9578. // https://jsperf.com/thor-indexof-vs-for/5
  9579. indexOf = function( list, elem ) {
  9580. var i = 0,
  9581. len = list.length;
  9582. for ( ; i < len; i++ ) {
  9583. if ( list[i] === elem ) {
  9584. return i;
  9585. }
  9586. }
  9587. return -1;
  9588. },
  9589. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  9590. // Regular expressions
  9591. // http://www.w3.org/TR/css3-selectors/#whitespace
  9592. whitespace = "[\\x20\\t\\r\\n\\f]",
  9593. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  9594. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  9595. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  9596. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  9597. // Operator (capture 2)
  9598. "*([*^$|!~]?=)" + whitespace +
  9599. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  9600. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  9601. "*\\]",
  9602. pseudos = ":(" + identifier + ")(?:\\((" +
  9603. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  9604. // 1. quoted (capture 3; capture 4 or capture 5)
  9605. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  9606. // 2. simple (capture 6)
  9607. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  9608. // 3. anything else (capture 2)
  9609. ".*" +
  9610. ")\\)|)",
  9611. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  9612. rwhitespace = new RegExp( whitespace + "+", "g" ),
  9613. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  9614. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  9615. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  9616. rdescend = new RegExp( whitespace + "|>" ),
  9617. rpseudo = new RegExp( pseudos ),
  9618. ridentifier = new RegExp( "^" + identifier + "$" ),
  9619. matchExpr = {
  9620. "ID": new RegExp( "^#(" + identifier + ")" ),
  9621. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  9622. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  9623. "ATTR": new RegExp( "^" + attributes ),
  9624. "PSEUDO": new RegExp( "^" + pseudos ),
  9625. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  9626. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  9627. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  9628. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  9629. // For use in libraries implementing .is()
  9630. // We use this for POS matching in `select`
  9631. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  9632. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  9633. },
  9634. rhtml = /HTML$/i,
  9635. rinputs = /^(?:input|select|textarea|button)$/i,
  9636. rheader = /^h\d$/i,
  9637. rnative = /^[^{]+\{\s*\[native \w/,
  9638. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  9639. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  9640. rsibling = /[+~]/,
  9641. // CSS escapes
  9642. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  9643. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  9644. funescape = function( _, escaped, escapedWhitespace ) {
  9645. var high = "0x" + escaped - 0x10000;
  9646. // NaN means non-codepoint
  9647. // Support: Firefox<24
  9648. // Workaround erroneous numeric interpretation of +"0x"
  9649. return high !== high || escapedWhitespace ?
  9650. escaped :
  9651. high < 0 ?
  9652. // BMP codepoint
  9653. String.fromCharCode( high + 0x10000 ) :
  9654. // Supplemental Plane codepoint (surrogate pair)
  9655. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  9656. },
  9657. // CSS string/identifier serialization
  9658. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  9659. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  9660. fcssescape = function( ch, asCodePoint ) {
  9661. if ( asCodePoint ) {
  9662. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  9663. if ( ch === "\0" ) {
  9664. return "\uFFFD";
  9665. }
  9666. // Control characters and (dependent upon position) numbers get escaped as code points
  9667. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  9668. }
  9669. // Other potentially-special ASCII characters get backslash-escaped
  9670. return "\\" + ch;
  9671. },
  9672. // Used for iframes
  9673. // See setDocument()
  9674. // Removing the function wrapper causes a "Permission Denied"
  9675. // error in IE
  9676. unloadHandler = function() {
  9677. setDocument();
  9678. },
  9679. inDisabledFieldset = addCombinator(
  9680. function( elem ) {
  9681. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  9682. },
  9683. { dir: "parentNode", next: "legend" }
  9684. );
  9685. // Optimize for push.apply( _, NodeList )
  9686. try {
  9687. push.apply(
  9688. (arr = slice.call( preferredDoc.childNodes )),
  9689. preferredDoc.childNodes
  9690. );
  9691. // Support: Android<4.0
  9692. // Detect silently failing push.apply
  9693. arr[ preferredDoc.childNodes.length ].nodeType;
  9694. } catch ( e ) {
  9695. push = { apply: arr.length ?
  9696. // Leverage slice if possible
  9697. function( target, els ) {
  9698. push_native.apply( target, slice.call(els) );
  9699. } :
  9700. // Support: IE<9
  9701. // Otherwise append directly
  9702. function( target, els ) {
  9703. var j = target.length,
  9704. i = 0;
  9705. // Can't trust NodeList.length
  9706. while ( (target[j++] = els[i++]) ) {}
  9707. target.length = j - 1;
  9708. }
  9709. };
  9710. }
  9711. function Sizzle( selector, context, results, seed ) {
  9712. var m, i, elem, nid, match, groups, newSelector,
  9713. newContext = context && context.ownerDocument,
  9714. // nodeType defaults to 9, since context defaults to document
  9715. nodeType = context ? context.nodeType : 9;
  9716. results = results || [];
  9717. // Return early from calls with invalid selector or context
  9718. if ( typeof selector !== "string" || !selector ||
  9719. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  9720. return results;
  9721. }
  9722. // Try to shortcut find operations (as opposed to filters) in HTML documents
  9723. if ( !seed ) {
  9724. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  9725. setDocument( context );
  9726. }
  9727. context = context || document;
  9728. if ( documentIsHTML ) {
  9729. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  9730. // (excepting DocumentFragment context, where the methods don't exist)
  9731. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  9732. // ID selector
  9733. if ( (m = match[1]) ) {
  9734. // Document context
  9735. if ( nodeType === 9 ) {
  9736. if ( (elem = context.getElementById( m )) ) {
  9737. // Support: IE, Opera, Webkit
  9738. // TODO: identify versions
  9739. // getElementById can match elements by name instead of ID
  9740. if ( elem.id === m ) {
  9741. results.push( elem );
  9742. return results;
  9743. }
  9744. } else {
  9745. return results;
  9746. }
  9747. // Element context
  9748. } else {
  9749. // Support: IE, Opera, Webkit
  9750. // TODO: identify versions
  9751. // getElementById can match elements by name instead of ID
  9752. if ( newContext && (elem = newContext.getElementById( m )) &&
  9753. contains( context, elem ) &&
  9754. elem.id === m ) {
  9755. results.push( elem );
  9756. return results;
  9757. }
  9758. }
  9759. // Type selector
  9760. } else if ( match[2] ) {
  9761. push.apply( results, context.getElementsByTagName( selector ) );
  9762. return results;
  9763. // Class selector
  9764. } else if ( (m = match[3]) && support.getElementsByClassName &&
  9765. context.getElementsByClassName ) {
  9766. push.apply( results, context.getElementsByClassName( m ) );
  9767. return results;
  9768. }
  9769. }
  9770. // Take advantage of querySelectorAll
  9771. if ( support.qsa &&
  9772. !nonnativeSelectorCache[ selector + " " ] &&
  9773. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  9774. // Support: IE 8 only
  9775. // Exclude object elements
  9776. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  9777. newSelector = selector;
  9778. newContext = context;
  9779. // qSA considers elements outside a scoping root when evaluating child or
  9780. // descendant combinators, which is not what we want.
  9781. // In such cases, we work around the behavior by prefixing every selector in the
  9782. // list with an ID selector referencing the scope context.
  9783. // Thanks to Andrew Dupont for this technique.
  9784. if ( nodeType === 1 && rdescend.test( selector ) ) {
  9785. // Capture the context ID, setting it first if necessary
  9786. if ( (nid = context.getAttribute( "id" )) ) {
  9787. nid = nid.replace( rcssescape, fcssescape );
  9788. } else {
  9789. context.setAttribute( "id", (nid = expando) );
  9790. }
  9791. // Prefix every selector in the list
  9792. groups = tokenize( selector );
  9793. i = groups.length;
  9794. while ( i-- ) {
  9795. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  9796. }
  9797. newSelector = groups.join( "," );
  9798. // Expand context for sibling selectors
  9799. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  9800. context;
  9801. }
  9802. try {
  9803. push.apply( results,
  9804. newContext.querySelectorAll( newSelector )
  9805. );
  9806. return results;
  9807. } catch ( qsaError ) {
  9808. nonnativeSelectorCache( selector, true );
  9809. } finally {
  9810. if ( nid === expando ) {
  9811. context.removeAttribute( "id" );
  9812. }
  9813. }
  9814. }
  9815. }
  9816. }
  9817. // All others
  9818. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  9819. }
  9820. /**
  9821. * Create key-value caches of limited size
  9822. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  9823. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  9824. * deleting the oldest entry
  9825. */
  9826. function createCache() {
  9827. var keys = [];
  9828. function cache( key, value ) {
  9829. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  9830. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  9831. // Only keep the most recent entries
  9832. delete cache[ keys.shift() ];
  9833. }
  9834. return (cache[ key + " " ] = value);
  9835. }
  9836. return cache;
  9837. }
  9838. /**
  9839. * Mark a function for special use by Sizzle
  9840. * @param {Function} fn The function to mark
  9841. */
  9842. function markFunction( fn ) {
  9843. fn[ expando ] = true;
  9844. return fn;
  9845. }
  9846. /**
  9847. * Support testing using an element
  9848. * @param {Function} fn Passed the created element and returns a boolean result
  9849. */
  9850. function assert( fn ) {
  9851. var el = document.createElement("fieldset");
  9852. try {
  9853. return !!fn( el );
  9854. } catch (e) {
  9855. return false;
  9856. } finally {
  9857. // Remove from its parent by default
  9858. if ( el.parentNode ) {
  9859. el.parentNode.removeChild( el );
  9860. }
  9861. // release memory in IE
  9862. el = null;
  9863. }
  9864. }
  9865. /**
  9866. * Adds the same handler for all of the specified attrs
  9867. * @param {String} attrs Pipe-separated list of attributes
  9868. * @param {Function} handler The method that will be applied
  9869. */
  9870. function addHandle( attrs, handler ) {
  9871. var arr = attrs.split("|"),
  9872. i = arr.length;
  9873. while ( i-- ) {
  9874. Expr.attrHandle[ arr[i] ] = handler;
  9875. }
  9876. }
  9877. /**
  9878. * Checks document order of two siblings
  9879. * @param {Element} a
  9880. * @param {Element} b
  9881. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  9882. */
  9883. function siblingCheck( a, b ) {
  9884. var cur = b && a,
  9885. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  9886. a.sourceIndex - b.sourceIndex;
  9887. // Use IE sourceIndex if available on both nodes
  9888. if ( diff ) {
  9889. return diff;
  9890. }
  9891. // Check if b follows a
  9892. if ( cur ) {
  9893. while ( (cur = cur.nextSibling) ) {
  9894. if ( cur === b ) {
  9895. return -1;
  9896. }
  9897. }
  9898. }
  9899. return a ? 1 : -1;
  9900. }
  9901. /**
  9902. * Returns a function to use in pseudos for input types
  9903. * @param {String} type
  9904. */
  9905. function createInputPseudo( type ) {
  9906. return function( elem ) {
  9907. var name = elem.nodeName.toLowerCase();
  9908. return name === "input" && elem.type === type;
  9909. };
  9910. }
  9911. /**
  9912. * Returns a function to use in pseudos for buttons
  9913. * @param {String} type
  9914. */
  9915. function createButtonPseudo( type ) {
  9916. return function( elem ) {
  9917. var name = elem.nodeName.toLowerCase();
  9918. return (name === "input" || name === "button") && elem.type === type;
  9919. };
  9920. }
  9921. /**
  9922. * Returns a function to use in pseudos for :enabled/:disabled
  9923. * @param {Boolean} disabled true for :disabled; false for :enabled
  9924. */
  9925. function createDisabledPseudo( disabled ) {
  9926. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  9927. return function( elem ) {
  9928. // Only certain elements can match :enabled or :disabled
  9929. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  9930. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  9931. if ( "form" in elem ) {
  9932. // Check for inherited disabledness on relevant non-disabled elements:
  9933. // * listed form-associated elements in a disabled fieldset
  9934. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  9935. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  9936. // * option elements in a disabled optgroup
  9937. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  9938. // All such elements have a "form" property.
  9939. if ( elem.parentNode && elem.disabled === false ) {
  9940. // Option elements defer to a parent optgroup if present
  9941. if ( "label" in elem ) {
  9942. if ( "label" in elem.parentNode ) {
  9943. return elem.parentNode.disabled === disabled;
  9944. } else {
  9945. return elem.disabled === disabled;
  9946. }
  9947. }
  9948. // Support: IE 6 - 11
  9949. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  9950. return elem.isDisabled === disabled ||
  9951. // Where there is no isDisabled, check manually
  9952. /* jshint -W018 */
  9953. elem.isDisabled !== !disabled &&
  9954. inDisabledFieldset( elem ) === disabled;
  9955. }
  9956. return elem.disabled === disabled;
  9957. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  9958. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  9959. // even exist on them, let alone have a boolean value.
  9960. } else if ( "label" in elem ) {
  9961. return elem.disabled === disabled;
  9962. }
  9963. // Remaining elements are neither :enabled nor :disabled
  9964. return false;
  9965. };
  9966. }
  9967. /**
  9968. * Returns a function to use in pseudos for positionals
  9969. * @param {Function} fn
  9970. */
  9971. function createPositionalPseudo( fn ) {
  9972. return markFunction(function( argument ) {
  9973. argument = +argument;
  9974. return markFunction(function( seed, matches ) {
  9975. var j,
  9976. matchIndexes = fn( [], seed.length, argument ),
  9977. i = matchIndexes.length;
  9978. // Match elements found at the specified indexes
  9979. while ( i-- ) {
  9980. if ( seed[ (j = matchIndexes[i]) ] ) {
  9981. seed[j] = !(matches[j] = seed[j]);
  9982. }
  9983. }
  9984. });
  9985. });
  9986. }
  9987. /**
  9988. * Checks a node for validity as a Sizzle context
  9989. * @param {Element|Object=} context
  9990. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  9991. */
  9992. function testContext( context ) {
  9993. return context && typeof context.getElementsByTagName !== "undefined" && context;
  9994. }
  9995. // Expose support vars for convenience
  9996. support = Sizzle.support = {};
  9997. /**
  9998. * Detects XML nodes
  9999. * @param {Element|Object} elem An element or a document
  10000. * @returns {Boolean} True iff elem is a non-HTML XML node
  10001. */
  10002. isXML = Sizzle.isXML = function( elem ) {
  10003. var namespace = elem.namespaceURI,
  10004. docElem = (elem.ownerDocument || elem).documentElement;
  10005. // Support: IE <=8
  10006. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  10007. // https://bugs.jquery.com/ticket/4833
  10008. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  10009. };
  10010. /**
  10011. * Sets document-related variables once based on the current document
  10012. * @param {Element|Object} [doc] An element or document object to use to set the document
  10013. * @returns {Object} Returns the current document
  10014. */
  10015. setDocument = Sizzle.setDocument = function( node ) {
  10016. var hasCompare, subWindow,
  10017. doc = node ? node.ownerDocument || node : preferredDoc;
  10018. // Return early if doc is invalid or already selected
  10019. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  10020. return document;
  10021. }
  10022. // Update global variables
  10023. document = doc;
  10024. docElem = document.documentElement;
  10025. documentIsHTML = !isXML( document );
  10026. // Support: IE 9-11, Edge
  10027. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  10028. if ( preferredDoc !== document &&
  10029. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  10030. // Support: IE 11, Edge
  10031. if ( subWindow.addEventListener ) {
  10032. subWindow.addEventListener( "unload", unloadHandler, false );
  10033. // Support: IE 9 - 10 only
  10034. } else if ( subWindow.attachEvent ) {
  10035. subWindow.attachEvent( "onunload", unloadHandler );
  10036. }
  10037. }
  10038. /* Attributes
  10039. ---------------------------------------------------------------------- */
  10040. // Support: IE<8
  10041. // Verify that getAttribute really returns attributes and not properties
  10042. // (excepting IE8 booleans)
  10043. support.attributes = assert(function( el ) {
  10044. el.className = "i";
  10045. return !el.getAttribute("className");
  10046. });
  10047. /* getElement(s)By*
  10048. ---------------------------------------------------------------------- */
  10049. // Check if getElementsByTagName("*") returns only elements
  10050. support.getElementsByTagName = assert(function( el ) {
  10051. el.appendChild( document.createComment("") );
  10052. return !el.getElementsByTagName("*").length;
  10053. });
  10054. // Support: IE<9
  10055. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  10056. // Support: IE<10
  10057. // Check if getElementById returns elements by name
  10058. // The broken getElementById methods don't pick up programmatically-set names,
  10059. // so use a roundabout getElementsByName test
  10060. support.getById = assert(function( el ) {
  10061. docElem.appendChild( el ).id = expando;
  10062. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  10063. });
  10064. // ID filter and find
  10065. if ( support.getById ) {
  10066. Expr.filter["ID"] = function( id ) {
  10067. var attrId = id.replace( runescape, funescape );
  10068. return function( elem ) {
  10069. return elem.getAttribute("id") === attrId;
  10070. };
  10071. };
  10072. Expr.find["ID"] = function( id, context ) {
  10073. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  10074. var elem = context.getElementById( id );
  10075. return elem ? [ elem ] : [];
  10076. }
  10077. };
  10078. } else {
  10079. Expr.filter["ID"] = function( id ) {
  10080. var attrId = id.replace( runescape, funescape );
  10081. return function( elem ) {
  10082. var node = typeof elem.getAttributeNode !== "undefined" &&
  10083. elem.getAttributeNode("id");
  10084. return node && node.value === attrId;
  10085. };
  10086. };
  10087. // Support: IE 6 - 7 only
  10088. // getElementById is not reliable as a find shortcut
  10089. Expr.find["ID"] = function( id, context ) {
  10090. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  10091. var node, i, elems,
  10092. elem = context.getElementById( id );
  10093. if ( elem ) {
  10094. // Verify the id attribute
  10095. node = elem.getAttributeNode("id");
  10096. if ( node && node.value === id ) {
  10097. return [ elem ];
  10098. }
  10099. // Fall back on getElementsByName
  10100. elems = context.getElementsByName( id );
  10101. i = 0;
  10102. while ( (elem = elems[i++]) ) {
  10103. node = elem.getAttributeNode("id");
  10104. if ( node && node.value === id ) {
  10105. return [ elem ];
  10106. }
  10107. }
  10108. }
  10109. return [];
  10110. }
  10111. };
  10112. }
  10113. // Tag
  10114. Expr.find["TAG"] = support.getElementsByTagName ?
  10115. function( tag, context ) {
  10116. if ( typeof context.getElementsByTagName !== "undefined" ) {
  10117. return context.getElementsByTagName( tag );
  10118. // DocumentFragment nodes don't have gEBTN
  10119. } else if ( support.qsa ) {
  10120. return context.querySelectorAll( tag );
  10121. }
  10122. } :
  10123. function( tag, context ) {
  10124. var elem,
  10125. tmp = [],
  10126. i = 0,
  10127. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  10128. results = context.getElementsByTagName( tag );
  10129. // Filter out possible comments
  10130. if ( tag === "*" ) {
  10131. while ( (elem = results[i++]) ) {
  10132. if ( elem.nodeType === 1 ) {
  10133. tmp.push( elem );
  10134. }
  10135. }
  10136. return tmp;
  10137. }
  10138. return results;
  10139. };
  10140. // Class
  10141. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  10142. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  10143. return context.getElementsByClassName( className );
  10144. }
  10145. };
  10146. /* QSA/matchesSelector
  10147. ---------------------------------------------------------------------- */
  10148. // QSA and matchesSelector support
  10149. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  10150. rbuggyMatches = [];
  10151. // qSa(:focus) reports false when true (Chrome 21)
  10152. // We allow this because of a bug in IE8/9 that throws an error
  10153. // whenever `document.activeElement` is accessed on an iframe
  10154. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  10155. // See https://bugs.jquery.com/ticket/13378
  10156. rbuggyQSA = [];
  10157. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  10158. // Build QSA regex
  10159. // Regex strategy adopted from Diego Perini
  10160. assert(function( el ) {
  10161. // Select is set to empty string on purpose
  10162. // This is to test IE's treatment of not explicitly
  10163. // setting a boolean content attribute,
  10164. // since its presence should be enough
  10165. // https://bugs.jquery.com/ticket/12359
  10166. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  10167. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  10168. "<option selected=''></option></select>";
  10169. // Support: IE8, Opera 11-12.16
  10170. // Nothing should be selected when empty strings follow ^= or $= or *=
  10171. // The test attribute must be unknown in Opera but "safe" for WinRT
  10172. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  10173. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  10174. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  10175. }
  10176. // Support: IE8
  10177. // Boolean attributes and "value" are not treated correctly
  10178. if ( !el.querySelectorAll("[selected]").length ) {
  10179. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  10180. }
  10181. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  10182. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  10183. rbuggyQSA.push("~=");
  10184. }
  10185. // Webkit/Opera - :checked should return selected option elements
  10186. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  10187. // IE8 throws error here and will not see later tests
  10188. if ( !el.querySelectorAll(":checked").length ) {
  10189. rbuggyQSA.push(":checked");
  10190. }
  10191. // Support: Safari 8+, iOS 8+
  10192. // https://bugs.webkit.org/show_bug.cgi?id=136851
  10193. // In-page `selector#id sibling-combinator selector` fails
  10194. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  10195. rbuggyQSA.push(".#.+[+~]");
  10196. }
  10197. });
  10198. assert(function( el ) {
  10199. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  10200. "<select disabled='disabled'><option/></select>";
  10201. // Support: Windows 8 Native Apps
  10202. // The type and name attributes are restricted during .innerHTML assignment
  10203. var input = document.createElement("input");
  10204. input.setAttribute( "type", "hidden" );
  10205. el.appendChild( input ).setAttribute( "name", "D" );
  10206. // Support: IE8
  10207. // Enforce case-sensitivity of name attribute
  10208. if ( el.querySelectorAll("[name=d]").length ) {
  10209. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  10210. }
  10211. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  10212. // IE8 throws error here and will not see later tests
  10213. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  10214. rbuggyQSA.push( ":enabled", ":disabled" );
  10215. }
  10216. // Support: IE9-11+
  10217. // IE's :disabled selector does not pick up the children of disabled fieldsets
  10218. docElem.appendChild( el ).disabled = true;
  10219. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  10220. rbuggyQSA.push( ":enabled", ":disabled" );
  10221. }
  10222. // Opera 10-11 does not throw on post-comma invalid pseudos
  10223. el.querySelectorAll("*,:x");
  10224. rbuggyQSA.push(",.*:");
  10225. });
  10226. }
  10227. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  10228. docElem.webkitMatchesSelector ||
  10229. docElem.mozMatchesSelector ||
  10230. docElem.oMatchesSelector ||
  10231. docElem.msMatchesSelector) )) ) {
  10232. assert(function( el ) {
  10233. // Check to see if it's possible to do matchesSelector
  10234. // on a disconnected node (IE 9)
  10235. support.disconnectedMatch = matches.call( el, "*" );
  10236. // This should fail with an exception
  10237. // Gecko does not error, returns false instead
  10238. matches.call( el, "[s!='']:x" );
  10239. rbuggyMatches.push( "!=", pseudos );
  10240. });
  10241. }
  10242. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  10243. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  10244. /* Contains
  10245. ---------------------------------------------------------------------- */
  10246. hasCompare = rnative.test( docElem.compareDocumentPosition );
  10247. // Element contains another
  10248. // Purposefully self-exclusive
  10249. // As in, an element does not contain itself
  10250. contains = hasCompare || rnative.test( docElem.contains ) ?
  10251. function( a, b ) {
  10252. var adown = a.nodeType === 9 ? a.documentElement : a,
  10253. bup = b && b.parentNode;
  10254. return a === bup || !!( bup && bup.nodeType === 1 && (
  10255. adown.contains ?
  10256. adown.contains( bup ) :
  10257. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  10258. ));
  10259. } :
  10260. function( a, b ) {
  10261. if ( b ) {
  10262. while ( (b = b.parentNode) ) {
  10263. if ( b === a ) {
  10264. return true;
  10265. }
  10266. }
  10267. }
  10268. return false;
  10269. };
  10270. /* Sorting
  10271. ---------------------------------------------------------------------- */
  10272. // Document order sorting
  10273. sortOrder = hasCompare ?
  10274. function( a, b ) {
  10275. // Flag for duplicate removal
  10276. if ( a === b ) {
  10277. hasDuplicate = true;
  10278. return 0;
  10279. }
  10280. // Sort on method existence if only one input has compareDocumentPosition
  10281. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  10282. if ( compare ) {
  10283. return compare;
  10284. }
  10285. // Calculate position if both inputs belong to the same document
  10286. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  10287. a.compareDocumentPosition( b ) :
  10288. // Otherwise we know they are disconnected
  10289. 1;
  10290. // Disconnected nodes
  10291. if ( compare & 1 ||
  10292. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  10293. // Choose the first element that is related to our preferred document
  10294. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  10295. return -1;
  10296. }
  10297. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  10298. return 1;
  10299. }
  10300. // Maintain original order
  10301. return sortInput ?
  10302. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  10303. 0;
  10304. }
  10305. return compare & 4 ? -1 : 1;
  10306. } :
  10307. function( a, b ) {
  10308. // Exit early if the nodes are identical
  10309. if ( a === b ) {
  10310. hasDuplicate = true;
  10311. return 0;
  10312. }
  10313. var cur,
  10314. i = 0,
  10315. aup = a.parentNode,
  10316. bup = b.parentNode,
  10317. ap = [ a ],
  10318. bp = [ b ];
  10319. // Parentless nodes are either documents or disconnected
  10320. if ( !aup || !bup ) {
  10321. return a === document ? -1 :
  10322. b === document ? 1 :
  10323. aup ? -1 :
  10324. bup ? 1 :
  10325. sortInput ?
  10326. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  10327. 0;
  10328. // If the nodes are siblings, we can do a quick check
  10329. } else if ( aup === bup ) {
  10330. return siblingCheck( a, b );
  10331. }
  10332. // Otherwise we need full lists of their ancestors for comparison
  10333. cur = a;
  10334. while ( (cur = cur.parentNode) ) {
  10335. ap.unshift( cur );
  10336. }
  10337. cur = b;
  10338. while ( (cur = cur.parentNode) ) {
  10339. bp.unshift( cur );
  10340. }
  10341. // Walk down the tree looking for a discrepancy
  10342. while ( ap[i] === bp[i] ) {
  10343. i++;
  10344. }
  10345. return i ?
  10346. // Do a sibling check if the nodes have a common ancestor
  10347. siblingCheck( ap[i], bp[i] ) :
  10348. // Otherwise nodes in our document sort first
  10349. ap[i] === preferredDoc ? -1 :
  10350. bp[i] === preferredDoc ? 1 :
  10351. 0;
  10352. };
  10353. return document;
  10354. };
  10355. Sizzle.matches = function( expr, elements ) {
  10356. return Sizzle( expr, null, null, elements );
  10357. };
  10358. Sizzle.matchesSelector = function( elem, expr ) {
  10359. // Set document vars if needed
  10360. if ( ( elem.ownerDocument || elem ) !== document ) {
  10361. setDocument( elem );
  10362. }
  10363. if ( support.matchesSelector && documentIsHTML &&
  10364. !nonnativeSelectorCache[ expr + " " ] &&
  10365. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  10366. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  10367. try {
  10368. var ret = matches.call( elem, expr );
  10369. // IE 9's matchesSelector returns false on disconnected nodes
  10370. if ( ret || support.disconnectedMatch ||
  10371. // As well, disconnected nodes are said to be in a document
  10372. // fragment in IE 9
  10373. elem.document && elem.document.nodeType !== 11 ) {
  10374. return ret;
  10375. }
  10376. } catch (e) {
  10377. nonnativeSelectorCache( expr, true );
  10378. }
  10379. }
  10380. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  10381. };
  10382. Sizzle.contains = function( context, elem ) {
  10383. // Set document vars if needed
  10384. if ( ( context.ownerDocument || context ) !== document ) {
  10385. setDocument( context );
  10386. }
  10387. return contains( context, elem );
  10388. };
  10389. Sizzle.attr = function( elem, name ) {
  10390. // Set document vars if needed
  10391. if ( ( elem.ownerDocument || elem ) !== document ) {
  10392. setDocument( elem );
  10393. }
  10394. var fn = Expr.attrHandle[ name.toLowerCase() ],
  10395. // Don't get fooled by Object.prototype properties (jQuery #13807)
  10396. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  10397. fn( elem, name, !documentIsHTML ) :
  10398. undefined;
  10399. return val !== undefined ?
  10400. val :
  10401. support.attributes || !documentIsHTML ?
  10402. elem.getAttribute( name ) :
  10403. (val = elem.getAttributeNode(name)) && val.specified ?
  10404. val.value :
  10405. null;
  10406. };
  10407. Sizzle.escape = function( sel ) {
  10408. return (sel + "").replace( rcssescape, fcssescape );
  10409. };
  10410. Sizzle.error = function( msg ) {
  10411. throw new Error( "Syntax error, unrecognized expression: " + msg );
  10412. };
  10413. /**
  10414. * Document sorting and removing duplicates
  10415. * @param {ArrayLike} results
  10416. */
  10417. Sizzle.uniqueSort = function( results ) {
  10418. var elem,
  10419. duplicates = [],
  10420. j = 0,
  10421. i = 0;
  10422. // Unless we *know* we can detect duplicates, assume their presence
  10423. hasDuplicate = !support.detectDuplicates;
  10424. sortInput = !support.sortStable && results.slice( 0 );
  10425. results.sort( sortOrder );
  10426. if ( hasDuplicate ) {
  10427. while ( (elem = results[i++]) ) {
  10428. if ( elem === results[ i ] ) {
  10429. j = duplicates.push( i );
  10430. }
  10431. }
  10432. while ( j-- ) {
  10433. results.splice( duplicates[ j ], 1 );
  10434. }
  10435. }
  10436. // Clear input after sorting to release objects
  10437. // See https://github.com/jquery/sizzle/pull/225
  10438. sortInput = null;
  10439. return results;
  10440. };
  10441. /**
  10442. * Utility function for retrieving the text value of an array of DOM nodes
  10443. * @param {Array|Element} elem
  10444. */
  10445. getText = Sizzle.getText = function( elem ) {
  10446. var node,
  10447. ret = "",
  10448. i = 0,
  10449. nodeType = elem.nodeType;
  10450. if ( !nodeType ) {
  10451. // If no nodeType, this is expected to be an array
  10452. while ( (node = elem[i++]) ) {
  10453. // Do not traverse comment nodes
  10454. ret += getText( node );
  10455. }
  10456. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  10457. // Use textContent for elements
  10458. // innerText usage removed for consistency of new lines (jQuery #11153)
  10459. if ( typeof elem.textContent === "string" ) {
  10460. return elem.textContent;
  10461. } else {
  10462. // Traverse its children
  10463. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  10464. ret += getText( elem );
  10465. }
  10466. }
  10467. } else if ( nodeType === 3 || nodeType === 4 ) {
  10468. return elem.nodeValue;
  10469. }
  10470. // Do not include comment or processing instruction nodes
  10471. return ret;
  10472. };
  10473. Expr = Sizzle.selectors = {
  10474. // Can be adjusted by the user
  10475. cacheLength: 50,
  10476. createPseudo: markFunction,
  10477. match: matchExpr,
  10478. attrHandle: {},
  10479. find: {},
  10480. relative: {
  10481. ">": { dir: "parentNode", first: true },
  10482. " ": { dir: "parentNode" },
  10483. "+": { dir: "previousSibling", first: true },
  10484. "~": { dir: "previousSibling" }
  10485. },
  10486. preFilter: {
  10487. "ATTR": function( match ) {
  10488. match[1] = match[1].replace( runescape, funescape );
  10489. // Move the given value to match[3] whether quoted or unquoted
  10490. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  10491. if ( match[2] === "~=" ) {
  10492. match[3] = " " + match[3] + " ";
  10493. }
  10494. return match.slice( 0, 4 );
  10495. },
  10496. "CHILD": function( match ) {
  10497. /* matches from matchExpr["CHILD"]
  10498. 1 type (only|nth|...)
  10499. 2 what (child|of-type)
  10500. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  10501. 4 xn-component of xn+y argument ([+-]?\d*n|)
  10502. 5 sign of xn-component
  10503. 6 x of xn-component
  10504. 7 sign of y-component
  10505. 8 y of y-component
  10506. */
  10507. match[1] = match[1].toLowerCase();
  10508. if ( match[1].slice( 0, 3 ) === "nth" ) {
  10509. // nth-* requires argument
  10510. if ( !match[3] ) {
  10511. Sizzle.error( match[0] );
  10512. }
  10513. // numeric x and y parameters for Expr.filter.CHILD
  10514. // remember that false/true cast respectively to 0/1
  10515. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  10516. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  10517. // other types prohibit arguments
  10518. } else if ( match[3] ) {
  10519. Sizzle.error( match[0] );
  10520. }
  10521. return match;
  10522. },
  10523. "PSEUDO": function( match ) {
  10524. var excess,
  10525. unquoted = !match[6] && match[2];
  10526. if ( matchExpr["CHILD"].test( match[0] ) ) {
  10527. return null;
  10528. }
  10529. // Accept quoted arguments as-is
  10530. if ( match[3] ) {
  10531. match[2] = match[4] || match[5] || "";
  10532. // Strip excess characters from unquoted arguments
  10533. } else if ( unquoted && rpseudo.test( unquoted ) &&
  10534. // Get excess from tokenize (recursively)
  10535. (excess = tokenize( unquoted, true )) &&
  10536. // advance to the next closing parenthesis
  10537. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  10538. // excess is a negative index
  10539. match[0] = match[0].slice( 0, excess );
  10540. match[2] = unquoted.slice( 0, excess );
  10541. }
  10542. // Return only captures needed by the pseudo filter method (type and argument)
  10543. return match.slice( 0, 3 );
  10544. }
  10545. },
  10546. filter: {
  10547. "TAG": function( nodeNameSelector ) {
  10548. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  10549. return nodeNameSelector === "*" ?
  10550. function() { return true; } :
  10551. function( elem ) {
  10552. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  10553. };
  10554. },
  10555. "CLASS": function( className ) {
  10556. var pattern = classCache[ className + " " ];
  10557. return pattern ||
  10558. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  10559. classCache( className, function( elem ) {
  10560. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  10561. });
  10562. },
  10563. "ATTR": function( name, operator, check ) {
  10564. return function( elem ) {
  10565. var result = Sizzle.attr( elem, name );
  10566. if ( result == null ) {
  10567. return operator === "!=";
  10568. }
  10569. if ( !operator ) {
  10570. return true;
  10571. }
  10572. result += "";
  10573. return operator === "=" ? result === check :
  10574. operator === "!=" ? result !== check :
  10575. operator === "^=" ? check && result.indexOf( check ) === 0 :
  10576. operator === "*=" ? check && result.indexOf( check ) > -1 :
  10577. operator === "$=" ? check && result.slice( -check.length ) === check :
  10578. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  10579. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  10580. false;
  10581. };
  10582. },
  10583. "CHILD": function( type, what, argument, first, last ) {
  10584. var simple = type.slice( 0, 3 ) !== "nth",
  10585. forward = type.slice( -4 ) !== "last",
  10586. ofType = what === "of-type";
  10587. return first === 1 && last === 0 ?
  10588. // Shortcut for :nth-*(n)
  10589. function( elem ) {
  10590. return !!elem.parentNode;
  10591. } :
  10592. function( elem, context, xml ) {
  10593. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  10594. dir = simple !== forward ? "nextSibling" : "previousSibling",
  10595. parent = elem.parentNode,
  10596. name = ofType && elem.nodeName.toLowerCase(),
  10597. useCache = !xml && !ofType,
  10598. diff = false;
  10599. if ( parent ) {
  10600. // :(first|last|only)-(child|of-type)
  10601. if ( simple ) {
  10602. while ( dir ) {
  10603. node = elem;
  10604. while ( (node = node[ dir ]) ) {
  10605. if ( ofType ?
  10606. node.nodeName.toLowerCase() === name :
  10607. node.nodeType === 1 ) {
  10608. return false;
  10609. }
  10610. }
  10611. // Reverse direction for :only-* (if we haven't yet done so)
  10612. start = dir = type === "only" && !start && "nextSibling";
  10613. }
  10614. return true;
  10615. }
  10616. start = [ forward ? parent.firstChild : parent.lastChild ];
  10617. // non-xml :nth-child(...) stores cache data on `parent`
  10618. if ( forward && useCache ) {
  10619. // Seek `elem` from a previously-cached index
  10620. // ...in a gzip-friendly way
  10621. node = parent;
  10622. outerCache = node[ expando ] || (node[ expando ] = {});
  10623. // Support: IE <9 only
  10624. // Defend against cloned attroperties (jQuery gh-1709)
  10625. uniqueCache = outerCache[ node.uniqueID ] ||
  10626. (outerCache[ node.uniqueID ] = {});
  10627. cache = uniqueCache[ type ] || [];
  10628. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10629. diff = nodeIndex && cache[ 2 ];
  10630. node = nodeIndex && parent.childNodes[ nodeIndex ];
  10631. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10632. // Fallback to seeking `elem` from the start
  10633. (diff = nodeIndex = 0) || start.pop()) ) {
  10634. // When found, cache indexes on `parent` and break
  10635. if ( node.nodeType === 1 && ++diff && node === elem ) {
  10636. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  10637. break;
  10638. }
  10639. }
  10640. } else {
  10641. // Use previously-cached element index if available
  10642. if ( useCache ) {
  10643. // ...in a gzip-friendly way
  10644. node = elem;
  10645. outerCache = node[ expando ] || (node[ expando ] = {});
  10646. // Support: IE <9 only
  10647. // Defend against cloned attroperties (jQuery gh-1709)
  10648. uniqueCache = outerCache[ node.uniqueID ] ||
  10649. (outerCache[ node.uniqueID ] = {});
  10650. cache = uniqueCache[ type ] || [];
  10651. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10652. diff = nodeIndex;
  10653. }
  10654. // xml :nth-child(...)
  10655. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  10656. if ( diff === false ) {
  10657. // Use the same loop as above to seek `elem` from the start
  10658. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10659. (diff = nodeIndex = 0) || start.pop()) ) {
  10660. if ( ( ofType ?
  10661. node.nodeName.toLowerCase() === name :
  10662. node.nodeType === 1 ) &&
  10663. ++diff ) {
  10664. // Cache the index of each encountered element
  10665. if ( useCache ) {
  10666. outerCache = node[ expando ] || (node[ expando ] = {});
  10667. // Support: IE <9 only
  10668. // Defend against cloned attroperties (jQuery gh-1709)
  10669. uniqueCache = outerCache[ node.uniqueID ] ||
  10670. (outerCache[ node.uniqueID ] = {});
  10671. uniqueCache[ type ] = [ dirruns, diff ];
  10672. }
  10673. if ( node === elem ) {
  10674. break;
  10675. }
  10676. }
  10677. }
  10678. }
  10679. }
  10680. // Incorporate the offset, then check against cycle size
  10681. diff -= last;
  10682. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  10683. }
  10684. };
  10685. },
  10686. "PSEUDO": function( pseudo, argument ) {
  10687. // pseudo-class names are case-insensitive
  10688. // http://www.w3.org/TR/selectors/#pseudo-classes
  10689. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  10690. // Remember that setFilters inherits from pseudos
  10691. var args,
  10692. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  10693. Sizzle.error( "unsupported pseudo: " + pseudo );
  10694. // The user may use createPseudo to indicate that
  10695. // arguments are needed to create the filter function
  10696. // just as Sizzle does
  10697. if ( fn[ expando ] ) {
  10698. return fn( argument );
  10699. }
  10700. // But maintain support for old signatures
  10701. if ( fn.length > 1 ) {
  10702. args = [ pseudo, pseudo, "", argument ];
  10703. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  10704. markFunction(function( seed, matches ) {
  10705. var idx,
  10706. matched = fn( seed, argument ),
  10707. i = matched.length;
  10708. while ( i-- ) {
  10709. idx = indexOf( seed, matched[i] );
  10710. seed[ idx ] = !( matches[ idx ] = matched[i] );
  10711. }
  10712. }) :
  10713. function( elem ) {
  10714. return fn( elem, 0, args );
  10715. };
  10716. }
  10717. return fn;
  10718. }
  10719. },
  10720. pseudos: {
  10721. // Potentially complex pseudos
  10722. "not": markFunction(function( selector ) {
  10723. // Trim the selector passed to compile
  10724. // to avoid treating leading and trailing
  10725. // spaces as combinators
  10726. var input = [],
  10727. results = [],
  10728. matcher = compile( selector.replace( rtrim, "$1" ) );
  10729. return matcher[ expando ] ?
  10730. markFunction(function( seed, matches, context, xml ) {
  10731. var elem,
  10732. unmatched = matcher( seed, null, xml, [] ),
  10733. i = seed.length;
  10734. // Match elements unmatched by `matcher`
  10735. while ( i-- ) {
  10736. if ( (elem = unmatched[i]) ) {
  10737. seed[i] = !(matches[i] = elem);
  10738. }
  10739. }
  10740. }) :
  10741. function( elem, context, xml ) {
  10742. input[0] = elem;
  10743. matcher( input, null, xml, results );
  10744. // Don't keep the element (issue #299)
  10745. input[0] = null;
  10746. return !results.pop();
  10747. };
  10748. }),
  10749. "has": markFunction(function( selector ) {
  10750. return function( elem ) {
  10751. return Sizzle( selector, elem ).length > 0;
  10752. };
  10753. }),
  10754. "contains": markFunction(function( text ) {
  10755. text = text.replace( runescape, funescape );
  10756. return function( elem ) {
  10757. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  10758. };
  10759. }),
  10760. // "Whether an element is represented by a :lang() selector
  10761. // is based solely on the element's language value
  10762. // being equal to the identifier C,
  10763. // or beginning with the identifier C immediately followed by "-".
  10764. // The matching of C against the element's language value is performed case-insensitively.
  10765. // The identifier C does not have to be a valid language name."
  10766. // http://www.w3.org/TR/selectors/#lang-pseudo
  10767. "lang": markFunction( function( lang ) {
  10768. // lang value must be a valid identifier
  10769. if ( !ridentifier.test(lang || "") ) {
  10770. Sizzle.error( "unsupported lang: " + lang );
  10771. }
  10772. lang = lang.replace( runescape, funescape ).toLowerCase();
  10773. return function( elem ) {
  10774. var elemLang;
  10775. do {
  10776. if ( (elemLang = documentIsHTML ?
  10777. elem.lang :
  10778. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  10779. elemLang = elemLang.toLowerCase();
  10780. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  10781. }
  10782. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  10783. return false;
  10784. };
  10785. }),
  10786. // Miscellaneous
  10787. "target": function( elem ) {
  10788. var hash = window.location && window.location.hash;
  10789. return hash && hash.slice( 1 ) === elem.id;
  10790. },
  10791. "root": function( elem ) {
  10792. return elem === docElem;
  10793. },
  10794. "focus": function( elem ) {
  10795. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  10796. },
  10797. // Boolean properties
  10798. "enabled": createDisabledPseudo( false ),
  10799. "disabled": createDisabledPseudo( true ),
  10800. "checked": function( elem ) {
  10801. // In CSS3, :checked should return both checked and selected elements
  10802. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  10803. var nodeName = elem.nodeName.toLowerCase();
  10804. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  10805. },
  10806. "selected": function( elem ) {
  10807. // Accessing this property makes selected-by-default
  10808. // options in Safari work properly
  10809. if ( elem.parentNode ) {
  10810. elem.parentNode.selectedIndex;
  10811. }
  10812. return elem.selected === true;
  10813. },
  10814. // Contents
  10815. "empty": function( elem ) {
  10816. // http://www.w3.org/TR/selectors/#empty-pseudo
  10817. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  10818. // but not by others (comment: 8; processing instruction: 7; etc.)
  10819. // nodeType < 6 works because attributes (2) do not appear as children
  10820. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  10821. if ( elem.nodeType < 6 ) {
  10822. return false;
  10823. }
  10824. }
  10825. return true;
  10826. },
  10827. "parent": function( elem ) {
  10828. return !Expr.pseudos["empty"]( elem );
  10829. },
  10830. // Element/input types
  10831. "header": function( elem ) {
  10832. return rheader.test( elem.nodeName );
  10833. },
  10834. "input": function( elem ) {
  10835. return rinputs.test( elem.nodeName );
  10836. },
  10837. "button": function( elem ) {
  10838. var name = elem.nodeName.toLowerCase();
  10839. return name === "input" && elem.type === "button" || name === "button";
  10840. },
  10841. "text": function( elem ) {
  10842. var attr;
  10843. return elem.nodeName.toLowerCase() === "input" &&
  10844. elem.type === "text" &&
  10845. // Support: IE<8
  10846. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  10847. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  10848. },
  10849. // Position-in-collection
  10850. "first": createPositionalPseudo(function() {
  10851. return [ 0 ];
  10852. }),
  10853. "last": createPositionalPseudo(function( matchIndexes, length ) {
  10854. return [ length - 1 ];
  10855. }),
  10856. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10857. return [ argument < 0 ? argument + length : argument ];
  10858. }),
  10859. "even": createPositionalPseudo(function( matchIndexes, length ) {
  10860. var i = 0;
  10861. for ( ; i < length; i += 2 ) {
  10862. matchIndexes.push( i );
  10863. }
  10864. return matchIndexes;
  10865. }),
  10866. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  10867. var i = 1;
  10868. for ( ; i < length; i += 2 ) {
  10869. matchIndexes.push( i );
  10870. }
  10871. return matchIndexes;
  10872. }),
  10873. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10874. var i = argument < 0 ?
  10875. argument + length :
  10876. argument > length ?
  10877. length :
  10878. argument;
  10879. for ( ; --i >= 0; ) {
  10880. matchIndexes.push( i );
  10881. }
  10882. return matchIndexes;
  10883. }),
  10884. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10885. var i = argument < 0 ? argument + length : argument;
  10886. for ( ; ++i < length; ) {
  10887. matchIndexes.push( i );
  10888. }
  10889. return matchIndexes;
  10890. })
  10891. }
  10892. };
  10893. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  10894. // Add button/input type pseudos
  10895. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  10896. Expr.pseudos[ i ] = createInputPseudo( i );
  10897. }
  10898. for ( i in { submit: true, reset: true } ) {
  10899. Expr.pseudos[ i ] = createButtonPseudo( i );
  10900. }
  10901. // Easy API for creating new setFilters
  10902. function setFilters() {}
  10903. setFilters.prototype = Expr.filters = Expr.pseudos;
  10904. Expr.setFilters = new setFilters();
  10905. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  10906. var matched, match, tokens, type,
  10907. soFar, groups, preFilters,
  10908. cached = tokenCache[ selector + " " ];
  10909. if ( cached ) {
  10910. return parseOnly ? 0 : cached.slice( 0 );
  10911. }
  10912. soFar = selector;
  10913. groups = [];
  10914. preFilters = Expr.preFilter;
  10915. while ( soFar ) {
  10916. // Comma and first run
  10917. if ( !matched || (match = rcomma.exec( soFar )) ) {
  10918. if ( match ) {
  10919. // Don't consume trailing commas as valid
  10920. soFar = soFar.slice( match[0].length ) || soFar;
  10921. }
  10922. groups.push( (tokens = []) );
  10923. }
  10924. matched = false;
  10925. // Combinators
  10926. if ( (match = rcombinators.exec( soFar )) ) {
  10927. matched = match.shift();
  10928. tokens.push({
  10929. value: matched,
  10930. // Cast descendant combinators to space
  10931. type: match[0].replace( rtrim, " " )
  10932. });
  10933. soFar = soFar.slice( matched.length );
  10934. }
  10935. // Filters
  10936. for ( type in Expr.filter ) {
  10937. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  10938. (match = preFilters[ type ]( match ))) ) {
  10939. matched = match.shift();
  10940. tokens.push({
  10941. value: matched,
  10942. type: type,
  10943. matches: match
  10944. });
  10945. soFar = soFar.slice( matched.length );
  10946. }
  10947. }
  10948. if ( !matched ) {
  10949. break;
  10950. }
  10951. }
  10952. // Return the length of the invalid excess
  10953. // if we're just parsing
  10954. // Otherwise, throw an error or return tokens
  10955. return parseOnly ?
  10956. soFar.length :
  10957. soFar ?
  10958. Sizzle.error( selector ) :
  10959. // Cache the tokens
  10960. tokenCache( selector, groups ).slice( 0 );
  10961. };
  10962. function toSelector( tokens ) {
  10963. var i = 0,
  10964. len = tokens.length,
  10965. selector = "";
  10966. for ( ; i < len; i++ ) {
  10967. selector += tokens[i].value;
  10968. }
  10969. return selector;
  10970. }
  10971. function addCombinator( matcher, combinator, base ) {
  10972. var dir = combinator.dir,
  10973. skip = combinator.next,
  10974. key = skip || dir,
  10975. checkNonElements = base && key === "parentNode",
  10976. doneName = done++;
  10977. return combinator.first ?
  10978. // Check against closest ancestor/preceding element
  10979. function( elem, context, xml ) {
  10980. while ( (elem = elem[ dir ]) ) {
  10981. if ( elem.nodeType === 1 || checkNonElements ) {
  10982. return matcher( elem, context, xml );
  10983. }
  10984. }
  10985. return false;
  10986. } :
  10987. // Check against all ancestor/preceding elements
  10988. function( elem, context, xml ) {
  10989. var oldCache, uniqueCache, outerCache,
  10990. newCache = [ dirruns, doneName ];
  10991. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  10992. if ( xml ) {
  10993. while ( (elem = elem[ dir ]) ) {
  10994. if ( elem.nodeType === 1 || checkNonElements ) {
  10995. if ( matcher( elem, context, xml ) ) {
  10996. return true;
  10997. }
  10998. }
  10999. }
  11000. } else {
  11001. while ( (elem = elem[ dir ]) ) {
  11002. if ( elem.nodeType === 1 || checkNonElements ) {
  11003. outerCache = elem[ expando ] || (elem[ expando ] = {});
  11004. // Support: IE <9 only
  11005. // Defend against cloned attroperties (jQuery gh-1709)
  11006. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  11007. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  11008. elem = elem[ dir ] || elem;
  11009. } else if ( (oldCache = uniqueCache[ key ]) &&
  11010. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  11011. // Assign to newCache so results back-propagate to previous elements
  11012. return (newCache[ 2 ] = oldCache[ 2 ]);
  11013. } else {
  11014. // Reuse newcache so results back-propagate to previous elements
  11015. uniqueCache[ key ] = newCache;
  11016. // A match means we're done; a fail means we have to keep checking
  11017. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  11018. return true;
  11019. }
  11020. }
  11021. }
  11022. }
  11023. }
  11024. return false;
  11025. };
  11026. }
  11027. function elementMatcher( matchers ) {
  11028. return matchers.length > 1 ?
  11029. function( elem, context, xml ) {
  11030. var i = matchers.length;
  11031. while ( i-- ) {
  11032. if ( !matchers[i]( elem, context, xml ) ) {
  11033. return false;
  11034. }
  11035. }
  11036. return true;
  11037. } :
  11038. matchers[0];
  11039. }
  11040. function multipleContexts( selector, contexts, results ) {
  11041. var i = 0,
  11042. len = contexts.length;
  11043. for ( ; i < len; i++ ) {
  11044. Sizzle( selector, contexts[i], results );
  11045. }
  11046. return results;
  11047. }
  11048. function condense( unmatched, map, filter, context, xml ) {
  11049. var elem,
  11050. newUnmatched = [],
  11051. i = 0,
  11052. len = unmatched.length,
  11053. mapped = map != null;
  11054. for ( ; i < len; i++ ) {
  11055. if ( (elem = unmatched[i]) ) {
  11056. if ( !filter || filter( elem, context, xml ) ) {
  11057. newUnmatched.push( elem );
  11058. if ( mapped ) {
  11059. map.push( i );
  11060. }
  11061. }
  11062. }
  11063. }
  11064. return newUnmatched;
  11065. }
  11066. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  11067. if ( postFilter && !postFilter[ expando ] ) {
  11068. postFilter = setMatcher( postFilter );
  11069. }
  11070. if ( postFinder && !postFinder[ expando ] ) {
  11071. postFinder = setMatcher( postFinder, postSelector );
  11072. }
  11073. return markFunction(function( seed, results, context, xml ) {
  11074. var temp, i, elem,
  11075. preMap = [],
  11076. postMap = [],
  11077. preexisting = results.length,
  11078. // Get initial elements from seed or context
  11079. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  11080. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  11081. matcherIn = preFilter && ( seed || !selector ) ?
  11082. condense( elems, preMap, preFilter, context, xml ) :
  11083. elems,
  11084. matcherOut = matcher ?
  11085. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  11086. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  11087. // ...intermediate processing is necessary
  11088. [] :
  11089. // ...otherwise use results directly
  11090. results :
  11091. matcherIn;
  11092. // Find primary matches
  11093. if ( matcher ) {
  11094. matcher( matcherIn, matcherOut, context, xml );
  11095. }
  11096. // Apply postFilter
  11097. if ( postFilter ) {
  11098. temp = condense( matcherOut, postMap );
  11099. postFilter( temp, [], context, xml );
  11100. // Un-match failing elements by moving them back to matcherIn
  11101. i = temp.length;
  11102. while ( i-- ) {
  11103. if ( (elem = temp[i]) ) {
  11104. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  11105. }
  11106. }
  11107. }
  11108. if ( seed ) {
  11109. if ( postFinder || preFilter ) {
  11110. if ( postFinder ) {
  11111. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  11112. temp = [];
  11113. i = matcherOut.length;
  11114. while ( i-- ) {
  11115. if ( (elem = matcherOut[i]) ) {
  11116. // Restore matcherIn since elem is not yet a final match
  11117. temp.push( (matcherIn[i] = elem) );
  11118. }
  11119. }
  11120. postFinder( null, (matcherOut = []), temp, xml );
  11121. }
  11122. // Move matched elements from seed to results to keep them synchronized
  11123. i = matcherOut.length;
  11124. while ( i-- ) {
  11125. if ( (elem = matcherOut[i]) &&
  11126. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  11127. seed[temp] = !(results[temp] = elem);
  11128. }
  11129. }
  11130. }
  11131. // Add elements to results, through postFinder if defined
  11132. } else {
  11133. matcherOut = condense(
  11134. matcherOut === results ?
  11135. matcherOut.splice( preexisting, matcherOut.length ) :
  11136. matcherOut
  11137. );
  11138. if ( postFinder ) {
  11139. postFinder( null, results, matcherOut, xml );
  11140. } else {
  11141. push.apply( results, matcherOut );
  11142. }
  11143. }
  11144. });
  11145. }
  11146. function matcherFromTokens( tokens ) {
  11147. var checkContext, matcher, j,
  11148. len = tokens.length,
  11149. leadingRelative = Expr.relative[ tokens[0].type ],
  11150. implicitRelative = leadingRelative || Expr.relative[" "],
  11151. i = leadingRelative ? 1 : 0,
  11152. // The foundational matcher ensures that elements are reachable from top-level context(s)
  11153. matchContext = addCombinator( function( elem ) {
  11154. return elem === checkContext;
  11155. }, implicitRelative, true ),
  11156. matchAnyContext = addCombinator( function( elem ) {
  11157. return indexOf( checkContext, elem ) > -1;
  11158. }, implicitRelative, true ),
  11159. matchers = [ function( elem, context, xml ) {
  11160. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  11161. (checkContext = context).nodeType ?
  11162. matchContext( elem, context, xml ) :
  11163. matchAnyContext( elem, context, xml ) );
  11164. // Avoid hanging onto element (issue #299)
  11165. checkContext = null;
  11166. return ret;
  11167. } ];
  11168. for ( ; i < len; i++ ) {
  11169. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  11170. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  11171. } else {
  11172. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  11173. // Return special upon seeing a positional matcher
  11174. if ( matcher[ expando ] ) {
  11175. // Find the next relative operator (if any) for proper handling
  11176. j = ++i;
  11177. for ( ; j < len; j++ ) {
  11178. if ( Expr.relative[ tokens[j].type ] ) {
  11179. break;
  11180. }
  11181. }
  11182. return setMatcher(
  11183. i > 1 && elementMatcher( matchers ),
  11184. i > 1 && toSelector(
  11185. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  11186. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  11187. ).replace( rtrim, "$1" ),
  11188. matcher,
  11189. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  11190. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  11191. j < len && toSelector( tokens )
  11192. );
  11193. }
  11194. matchers.push( matcher );
  11195. }
  11196. }
  11197. return elementMatcher( matchers );
  11198. }
  11199. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  11200. var bySet = setMatchers.length > 0,
  11201. byElement = elementMatchers.length > 0,
  11202. superMatcher = function( seed, context, xml, results, outermost ) {
  11203. var elem, j, matcher,
  11204. matchedCount = 0,
  11205. i = "0",
  11206. unmatched = seed && [],
  11207. setMatched = [],
  11208. contextBackup = outermostContext,
  11209. // We must always have either seed elements or outermost context
  11210. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  11211. // Use integer dirruns iff this is the outermost matcher
  11212. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  11213. len = elems.length;
  11214. if ( outermost ) {
  11215. outermostContext = context === document || context || outermost;
  11216. }
  11217. // Add elements passing elementMatchers directly to results
  11218. // Support: IE<9, Safari
  11219. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  11220. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  11221. if ( byElement && elem ) {
  11222. j = 0;
  11223. if ( !context && elem.ownerDocument !== document ) {
  11224. setDocument( elem );
  11225. xml = !documentIsHTML;
  11226. }
  11227. while ( (matcher = elementMatchers[j++]) ) {
  11228. if ( matcher( elem, context || document, xml) ) {
  11229. results.push( elem );
  11230. break;
  11231. }
  11232. }
  11233. if ( outermost ) {
  11234. dirruns = dirrunsUnique;
  11235. }
  11236. }
  11237. // Track unmatched elements for set filters
  11238. if ( bySet ) {
  11239. // They will have gone through all possible matchers
  11240. if ( (elem = !matcher && elem) ) {
  11241. matchedCount--;
  11242. }
  11243. // Lengthen the array for every element, matched or not
  11244. if ( seed ) {
  11245. unmatched.push( elem );
  11246. }
  11247. }
  11248. }
  11249. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  11250. // makes the latter nonnegative.
  11251. matchedCount += i;
  11252. // Apply set filters to unmatched elements
  11253. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  11254. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  11255. // no element matchers and no seed.
  11256. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  11257. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  11258. // numerically zero.
  11259. if ( bySet && i !== matchedCount ) {
  11260. j = 0;
  11261. while ( (matcher = setMatchers[j++]) ) {
  11262. matcher( unmatched, setMatched, context, xml );
  11263. }
  11264. if ( seed ) {
  11265. // Reintegrate element matches to eliminate the need for sorting
  11266. if ( matchedCount > 0 ) {
  11267. while ( i-- ) {
  11268. if ( !(unmatched[i] || setMatched[i]) ) {
  11269. setMatched[i] = pop.call( results );
  11270. }
  11271. }
  11272. }
  11273. // Discard index placeholder values to get only actual matches
  11274. setMatched = condense( setMatched );
  11275. }
  11276. // Add matches to results
  11277. push.apply( results, setMatched );
  11278. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  11279. if ( outermost && !seed && setMatched.length > 0 &&
  11280. ( matchedCount + setMatchers.length ) > 1 ) {
  11281. Sizzle.uniqueSort( results );
  11282. }
  11283. }
  11284. // Override manipulation of globals by nested matchers
  11285. if ( outermost ) {
  11286. dirruns = dirrunsUnique;
  11287. outermostContext = contextBackup;
  11288. }
  11289. return unmatched;
  11290. };
  11291. return bySet ?
  11292. markFunction( superMatcher ) :
  11293. superMatcher;
  11294. }
  11295. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  11296. var i,
  11297. setMatchers = [],
  11298. elementMatchers = [],
  11299. cached = compilerCache[ selector + " " ];
  11300. if ( !cached ) {
  11301. // Generate a function of recursive functions that can be used to check each element
  11302. if ( !match ) {
  11303. match = tokenize( selector );
  11304. }
  11305. i = match.length;
  11306. while ( i-- ) {
  11307. cached = matcherFromTokens( match[i] );
  11308. if ( cached[ expando ] ) {
  11309. setMatchers.push( cached );
  11310. } else {
  11311. elementMatchers.push( cached );
  11312. }
  11313. }
  11314. // Cache the compiled function
  11315. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  11316. // Save selector and tokenization
  11317. cached.selector = selector;
  11318. }
  11319. return cached;
  11320. };
  11321. /**
  11322. * A low-level selection function that works with Sizzle's compiled
  11323. * selector functions
  11324. * @param {String|Function} selector A selector or a pre-compiled
  11325. * selector function built with Sizzle.compile
  11326. * @param {Element} context
  11327. * @param {Array} [results]
  11328. * @param {Array} [seed] A set of elements to match against
  11329. */
  11330. select = Sizzle.select = function( selector, context, results, seed ) {
  11331. var i, tokens, token, type, find,
  11332. compiled = typeof selector === "function" && selector,
  11333. match = !seed && tokenize( (selector = compiled.selector || selector) );
  11334. results = results || [];
  11335. // Try to minimize operations if there is only one selector in the list and no seed
  11336. // (the latter of which guarantees us context)
  11337. if ( match.length === 1 ) {
  11338. // Reduce context if the leading compound selector is an ID
  11339. tokens = match[0] = match[0].slice( 0 );
  11340. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  11341. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  11342. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  11343. if ( !context ) {
  11344. return results;
  11345. // Precompiled matchers will still verify ancestry, so step up a level
  11346. } else if ( compiled ) {
  11347. context = context.parentNode;
  11348. }
  11349. selector = selector.slice( tokens.shift().value.length );
  11350. }
  11351. // Fetch a seed set for right-to-left matching
  11352. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  11353. while ( i-- ) {
  11354. token = tokens[i];
  11355. // Abort if we hit a combinator
  11356. if ( Expr.relative[ (type = token.type) ] ) {
  11357. break;
  11358. }
  11359. if ( (find = Expr.find[ type ]) ) {
  11360. // Search, expanding context for leading sibling combinators
  11361. if ( (seed = find(
  11362. token.matches[0].replace( runescape, funescape ),
  11363. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  11364. )) ) {
  11365. // If seed is empty or no tokens remain, we can return early
  11366. tokens.splice( i, 1 );
  11367. selector = seed.length && toSelector( tokens );
  11368. if ( !selector ) {
  11369. push.apply( results, seed );
  11370. return results;
  11371. }
  11372. break;
  11373. }
  11374. }
  11375. }
  11376. }
  11377. // Compile and execute a filtering function if one is not provided
  11378. // Provide `match` to avoid retokenization if we modified the selector above
  11379. ( compiled || compile( selector, match ) )(
  11380. seed,
  11381. context,
  11382. !documentIsHTML,
  11383. results,
  11384. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  11385. );
  11386. return results;
  11387. };
  11388. // One-time assignments
  11389. // Sort stability
  11390. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  11391. // Support: Chrome 14-35+
  11392. // Always assume duplicates if they aren't passed to the comparison function
  11393. support.detectDuplicates = !!hasDuplicate;
  11394. // Initialize against the default document
  11395. setDocument();
  11396. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  11397. // Detached nodes confoundingly follow *each other*
  11398. support.sortDetached = assert(function( el ) {
  11399. // Should return 1, but returns 4 (following)
  11400. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  11401. });
  11402. // Support: IE<8
  11403. // Prevent attribute/property "interpolation"
  11404. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  11405. if ( !assert(function( el ) {
  11406. el.innerHTML = "<a href='#'></a>";
  11407. return el.firstChild.getAttribute("href") === "#" ;
  11408. }) ) {
  11409. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  11410. if ( !isXML ) {
  11411. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  11412. }
  11413. });
  11414. }
  11415. // Support: IE<9
  11416. // Use defaultValue in place of getAttribute("value")
  11417. if ( !support.attributes || !assert(function( el ) {
  11418. el.innerHTML = "<input/>";
  11419. el.firstChild.setAttribute( "value", "" );
  11420. return el.firstChild.getAttribute( "value" ) === "";
  11421. }) ) {
  11422. addHandle( "value", function( elem, name, isXML ) {
  11423. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  11424. return elem.defaultValue;
  11425. }
  11426. });
  11427. }
  11428. // Support: IE<9
  11429. // Use getAttributeNode to fetch booleans when getAttribute lies
  11430. if ( !assert(function( el ) {
  11431. return el.getAttribute("disabled") == null;
  11432. }) ) {
  11433. addHandle( booleans, function( elem, name, isXML ) {
  11434. var val;
  11435. if ( !isXML ) {
  11436. return elem[ name ] === true ? name.toLowerCase() :
  11437. (val = elem.getAttributeNode( name )) && val.specified ?
  11438. val.value :
  11439. null;
  11440. }
  11441. });
  11442. }
  11443. return Sizzle;
  11444. })( window );
  11445. jQuery.find = Sizzle;
  11446. jQuery.expr = Sizzle.selectors;
  11447. // Deprecated
  11448. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  11449. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  11450. jQuery.text = Sizzle.getText;
  11451. jQuery.isXMLDoc = Sizzle.isXML;
  11452. jQuery.contains = Sizzle.contains;
  11453. jQuery.escapeSelector = Sizzle.escape;
  11454. var dir = function( elem, dir, until ) {
  11455. var matched = [],
  11456. truncate = until !== undefined;
  11457. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  11458. if ( elem.nodeType === 1 ) {
  11459. if ( truncate && jQuery( elem ).is( until ) ) {
  11460. break;
  11461. }
  11462. matched.push( elem );
  11463. }
  11464. }
  11465. return matched;
  11466. };
  11467. var siblings = function( n, elem ) {
  11468. var matched = [];
  11469. for ( ; n; n = n.nextSibling ) {
  11470. if ( n.nodeType === 1 && n !== elem ) {
  11471. matched.push( n );
  11472. }
  11473. }
  11474. return matched;
  11475. };
  11476. var rneedsContext = jQuery.expr.match.needsContext;
  11477. function nodeName( elem, name ) {
  11478. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  11479. };
  11480. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  11481. // Implement the identical functionality for filter and not
  11482. function winnow( elements, qualifier, not ) {
  11483. if ( isFunction( qualifier ) ) {
  11484. return jQuery.grep( elements, function( elem, i ) {
  11485. return !!qualifier.call( elem, i, elem ) !== not;
  11486. } );
  11487. }
  11488. // Single element
  11489. if ( qualifier.nodeType ) {
  11490. return jQuery.grep( elements, function( elem ) {
  11491. return ( elem === qualifier ) !== not;
  11492. } );
  11493. }
  11494. // Arraylike of elements (jQuery, arguments, Array)
  11495. if ( typeof qualifier !== "string" ) {
  11496. return jQuery.grep( elements, function( elem ) {
  11497. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  11498. } );
  11499. }
  11500. // Filtered directly for both simple and complex selectors
  11501. return jQuery.filter( qualifier, elements, not );
  11502. }
  11503. jQuery.filter = function( expr, elems, not ) {
  11504. var elem = elems[ 0 ];
  11505. if ( not ) {
  11506. expr = ":not(" + expr + ")";
  11507. }
  11508. if ( elems.length === 1 && elem.nodeType === 1 ) {
  11509. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  11510. }
  11511. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  11512. return elem.nodeType === 1;
  11513. } ) );
  11514. };
  11515. jQuery.fn.extend( {
  11516. find: function( selector ) {
  11517. var i, ret,
  11518. len = this.length,
  11519. self = this;
  11520. if ( typeof selector !== "string" ) {
  11521. return this.pushStack( jQuery( selector ).filter( function() {
  11522. for ( i = 0; i < len; i++ ) {
  11523. if ( jQuery.contains( self[ i ], this ) ) {
  11524. return true;
  11525. }
  11526. }
  11527. } ) );
  11528. }
  11529. ret = this.pushStack( [] );
  11530. for ( i = 0; i < len; i++ ) {
  11531. jQuery.find( selector, self[ i ], ret );
  11532. }
  11533. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  11534. },
  11535. filter: function( selector ) {
  11536. return this.pushStack( winnow( this, selector || [], false ) );
  11537. },
  11538. not: function( selector ) {
  11539. return this.pushStack( winnow( this, selector || [], true ) );
  11540. },
  11541. is: function( selector ) {
  11542. return !!winnow(
  11543. this,
  11544. // If this is a positional/relative selector, check membership in the returned set
  11545. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  11546. typeof selector === "string" && rneedsContext.test( selector ) ?
  11547. jQuery( selector ) :
  11548. selector || [],
  11549. false
  11550. ).length;
  11551. }
  11552. } );
  11553. // Initialize a jQuery object
  11554. // A central reference to the root jQuery(document)
  11555. var rootjQuery,
  11556. // A simple way to check for HTML strings
  11557. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  11558. // Strict HTML recognition (#11290: must start with <)
  11559. // Shortcut simple #id case for speed
  11560. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  11561. init = jQuery.fn.init = function( selector, context, root ) {
  11562. var match, elem;
  11563. // HANDLE: $(""), $(null), $(undefined), $(false)
  11564. if ( !selector ) {
  11565. return this;
  11566. }
  11567. // Method init() accepts an alternate rootjQuery
  11568. // so migrate can support jQuery.sub (gh-2101)
  11569. root = root || rootjQuery;
  11570. // Handle HTML strings
  11571. if ( typeof selector === "string" ) {
  11572. if ( selector[ 0 ] === "<" &&
  11573. selector[ selector.length - 1 ] === ">" &&
  11574. selector.length >= 3 ) {
  11575. // Assume that strings that start and end with <> are HTML and skip the regex check
  11576. match = [ null, selector, null ];
  11577. } else {
  11578. match = rquickExpr.exec( selector );
  11579. }
  11580. // Match html or make sure no context is specified for #id
  11581. if ( match && ( match[ 1 ] || !context ) ) {
  11582. // HANDLE: $(html) -> $(array)
  11583. if ( match[ 1 ] ) {
  11584. context = context instanceof jQuery ? context[ 0 ] : context;
  11585. // Option to run scripts is true for back-compat
  11586. // Intentionally let the error be thrown if parseHTML is not present
  11587. jQuery.merge( this, jQuery.parseHTML(
  11588. match[ 1 ],
  11589. context && context.nodeType ? context.ownerDocument || context : document,
  11590. true
  11591. ) );
  11592. // HANDLE: $(html, props)
  11593. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  11594. for ( match in context ) {
  11595. // Properties of context are called as methods if possible
  11596. if ( isFunction( this[ match ] ) ) {
  11597. this[ match ]( context[ match ] );
  11598. // ...and otherwise set as attributes
  11599. } else {
  11600. this.attr( match, context[ match ] );
  11601. }
  11602. }
  11603. }
  11604. return this;
  11605. // HANDLE: $(#id)
  11606. } else {
  11607. elem = document.getElementById( match[ 2 ] );
  11608. if ( elem ) {
  11609. // Inject the element directly into the jQuery object
  11610. this[ 0 ] = elem;
  11611. this.length = 1;
  11612. }
  11613. return this;
  11614. }
  11615. // HANDLE: $(expr, $(...))
  11616. } else if ( !context || context.jquery ) {
  11617. return ( context || root ).find( selector );
  11618. // HANDLE: $(expr, context)
  11619. // (which is just equivalent to: $(context).find(expr)
  11620. } else {
  11621. return this.constructor( context ).find( selector );
  11622. }
  11623. // HANDLE: $(DOMElement)
  11624. } else if ( selector.nodeType ) {
  11625. this[ 0 ] = selector;
  11626. this.length = 1;
  11627. return this;
  11628. // HANDLE: $(function)
  11629. // Shortcut for document ready
  11630. } else if ( isFunction( selector ) ) {
  11631. return root.ready !== undefined ?
  11632. root.ready( selector ) :
  11633. // Execute immediately if ready is not present
  11634. selector( jQuery );
  11635. }
  11636. return jQuery.makeArray( selector, this );
  11637. };
  11638. // Give the init function the jQuery prototype for later instantiation
  11639. init.prototype = jQuery.fn;
  11640. // Initialize central reference
  11641. rootjQuery = jQuery( document );
  11642. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  11643. // Methods guaranteed to produce a unique set when starting from a unique set
  11644. guaranteedUnique = {
  11645. children: true,
  11646. contents: true,
  11647. next: true,
  11648. prev: true
  11649. };
  11650. jQuery.fn.extend( {
  11651. has: function( target ) {
  11652. var targets = jQuery( target, this ),
  11653. l = targets.length;
  11654. return this.filter( function() {
  11655. var i = 0;
  11656. for ( ; i < l; i++ ) {
  11657. if ( jQuery.contains( this, targets[ i ] ) ) {
  11658. return true;
  11659. }
  11660. }
  11661. } );
  11662. },
  11663. closest: function( selectors, context ) {
  11664. var cur,
  11665. i = 0,
  11666. l = this.length,
  11667. matched = [],
  11668. targets = typeof selectors !== "string" && jQuery( selectors );
  11669. // Positional selectors never match, since there's no _selection_ context
  11670. if ( !rneedsContext.test( selectors ) ) {
  11671. for ( ; i < l; i++ ) {
  11672. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  11673. // Always skip document fragments
  11674. if ( cur.nodeType < 11 && ( targets ?
  11675. targets.index( cur ) > -1 :
  11676. // Don't pass non-elements to Sizzle
  11677. cur.nodeType === 1 &&
  11678. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  11679. matched.push( cur );
  11680. break;
  11681. }
  11682. }
  11683. }
  11684. }
  11685. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  11686. },
  11687. // Determine the position of an element within the set
  11688. index: function( elem ) {
  11689. // No argument, return index in parent
  11690. if ( !elem ) {
  11691. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  11692. }
  11693. // Index in selector
  11694. if ( typeof elem === "string" ) {
  11695. return indexOf.call( jQuery( elem ), this[ 0 ] );
  11696. }
  11697. // Locate the position of the desired element
  11698. return indexOf.call( this,
  11699. // If it receives a jQuery object, the first element is used
  11700. elem.jquery ? elem[ 0 ] : elem
  11701. );
  11702. },
  11703. add: function( selector, context ) {
  11704. return this.pushStack(
  11705. jQuery.uniqueSort(
  11706. jQuery.merge( this.get(), jQuery( selector, context ) )
  11707. )
  11708. );
  11709. },
  11710. addBack: function( selector ) {
  11711. return this.add( selector == null ?
  11712. this.prevObject : this.prevObject.filter( selector )
  11713. );
  11714. }
  11715. } );
  11716. function sibling( cur, dir ) {
  11717. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  11718. return cur;
  11719. }
  11720. jQuery.each( {
  11721. parent: function( elem ) {
  11722. var parent = elem.parentNode;
  11723. return parent && parent.nodeType !== 11 ? parent : null;
  11724. },
  11725. parents: function( elem ) {
  11726. return dir( elem, "parentNode" );
  11727. },
  11728. parentsUntil: function( elem, i, until ) {
  11729. return dir( elem, "parentNode", until );
  11730. },
  11731. next: function( elem ) {
  11732. return sibling( elem, "nextSibling" );
  11733. },
  11734. prev: function( elem ) {
  11735. return sibling( elem, "previousSibling" );
  11736. },
  11737. nextAll: function( elem ) {
  11738. return dir( elem, "nextSibling" );
  11739. },
  11740. prevAll: function( elem ) {
  11741. return dir( elem, "previousSibling" );
  11742. },
  11743. nextUntil: function( elem, i, until ) {
  11744. return dir( elem, "nextSibling", until );
  11745. },
  11746. prevUntil: function( elem, i, until ) {
  11747. return dir( elem, "previousSibling", until );
  11748. },
  11749. siblings: function( elem ) {
  11750. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  11751. },
  11752. children: function( elem ) {
  11753. return siblings( elem.firstChild );
  11754. },
  11755. contents: function( elem ) {
  11756. if ( typeof elem.contentDocument !== "undefined" ) {
  11757. return elem.contentDocument;
  11758. }
  11759. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  11760. // Treat the template element as a regular one in browsers that
  11761. // don't support it.
  11762. if ( nodeName( elem, "template" ) ) {
  11763. elem = elem.content || elem;
  11764. }
  11765. return jQuery.merge( [], elem.childNodes );
  11766. }
  11767. }, function( name, fn ) {
  11768. jQuery.fn[ name ] = function( until, selector ) {
  11769. var matched = jQuery.map( this, fn, until );
  11770. if ( name.slice( -5 ) !== "Until" ) {
  11771. selector = until;
  11772. }
  11773. if ( selector && typeof selector === "string" ) {
  11774. matched = jQuery.filter( selector, matched );
  11775. }
  11776. if ( this.length > 1 ) {
  11777. // Remove duplicates
  11778. if ( !guaranteedUnique[ name ] ) {
  11779. jQuery.uniqueSort( matched );
  11780. }
  11781. // Reverse order for parents* and prev-derivatives
  11782. if ( rparentsprev.test( name ) ) {
  11783. matched.reverse();
  11784. }
  11785. }
  11786. return this.pushStack( matched );
  11787. };
  11788. } );
  11789. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  11790. // Convert String-formatted options into Object-formatted ones
  11791. function createOptions( options ) {
  11792. var object = {};
  11793. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  11794. object[ flag ] = true;
  11795. } );
  11796. return object;
  11797. }
  11798. /*
  11799. * Create a callback list using the following parameters:
  11800. *
  11801. * options: an optional list of space-separated options that will change how
  11802. * the callback list behaves or a more traditional option object
  11803. *
  11804. * By default a callback list will act like an event callback list and can be
  11805. * "fired" multiple times.
  11806. *
  11807. * Possible options:
  11808. *
  11809. * once: will ensure the callback list can only be fired once (like a Deferred)
  11810. *
  11811. * memory: will keep track of previous values and will call any callback added
  11812. * after the list has been fired right away with the latest "memorized"
  11813. * values (like a Deferred)
  11814. *
  11815. * unique: will ensure a callback can only be added once (no duplicate in the list)
  11816. *
  11817. * stopOnFalse: interrupt callings when a callback returns false
  11818. *
  11819. */
  11820. jQuery.Callbacks = function( options ) {
  11821. // Convert options from String-formatted to Object-formatted if needed
  11822. // (we check in cache first)
  11823. options = typeof options === "string" ?
  11824. createOptions( options ) :
  11825. jQuery.extend( {}, options );
  11826. var // Flag to know if list is currently firing
  11827. firing,
  11828. // Last fire value for non-forgettable lists
  11829. memory,
  11830. // Flag to know if list was already fired
  11831. fired,
  11832. // Flag to prevent firing
  11833. locked,
  11834. // Actual callback list
  11835. list = [],
  11836. // Queue of execution data for repeatable lists
  11837. queue = [],
  11838. // Index of currently firing callback (modified by add/remove as needed)
  11839. firingIndex = -1,
  11840. // Fire callbacks
  11841. fire = function() {
  11842. // Enforce single-firing
  11843. locked = locked || options.once;
  11844. // Execute callbacks for all pending executions,
  11845. // respecting firingIndex overrides and runtime changes
  11846. fired = firing = true;
  11847. for ( ; queue.length; firingIndex = -1 ) {
  11848. memory = queue.shift();
  11849. while ( ++firingIndex < list.length ) {
  11850. // Run callback and check for early termination
  11851. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  11852. options.stopOnFalse ) {
  11853. // Jump to end and forget the data so .add doesn't re-fire
  11854. firingIndex = list.length;
  11855. memory = false;
  11856. }
  11857. }
  11858. }
  11859. // Forget the data if we're done with it
  11860. if ( !options.memory ) {
  11861. memory = false;
  11862. }
  11863. firing = false;
  11864. // Clean up if we're done firing for good
  11865. if ( locked ) {
  11866. // Keep an empty list if we have data for future add calls
  11867. if ( memory ) {
  11868. list = [];
  11869. // Otherwise, this object is spent
  11870. } else {
  11871. list = "";
  11872. }
  11873. }
  11874. },
  11875. // Actual Callbacks object
  11876. self = {
  11877. // Add a callback or a collection of callbacks to the list
  11878. add: function() {
  11879. if ( list ) {
  11880. // If we have memory from a past run, we should fire after adding
  11881. if ( memory && !firing ) {
  11882. firingIndex = list.length - 1;
  11883. queue.push( memory );
  11884. }
  11885. ( function add( args ) {
  11886. jQuery.each( args, function( _, arg ) {
  11887. if ( isFunction( arg ) ) {
  11888. if ( !options.unique || !self.has( arg ) ) {
  11889. list.push( arg );
  11890. }
  11891. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  11892. // Inspect recursively
  11893. add( arg );
  11894. }
  11895. } );
  11896. } )( arguments );
  11897. if ( memory && !firing ) {
  11898. fire();
  11899. }
  11900. }
  11901. return this;
  11902. },
  11903. // Remove a callback from the list
  11904. remove: function() {
  11905. jQuery.each( arguments, function( _, arg ) {
  11906. var index;
  11907. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  11908. list.splice( index, 1 );
  11909. // Handle firing indexes
  11910. if ( index <= firingIndex ) {
  11911. firingIndex--;
  11912. }
  11913. }
  11914. } );
  11915. return this;
  11916. },
  11917. // Check if a given callback is in the list.
  11918. // If no argument is given, return whether or not list has callbacks attached.
  11919. has: function( fn ) {
  11920. return fn ?
  11921. jQuery.inArray( fn, list ) > -1 :
  11922. list.length > 0;
  11923. },
  11924. // Remove all callbacks from the list
  11925. empty: function() {
  11926. if ( list ) {
  11927. list = [];
  11928. }
  11929. return this;
  11930. },
  11931. // Disable .fire and .add
  11932. // Abort any current/pending executions
  11933. // Clear all callbacks and values
  11934. disable: function() {
  11935. locked = queue = [];
  11936. list = memory = "";
  11937. return this;
  11938. },
  11939. disabled: function() {
  11940. return !list;
  11941. },
  11942. // Disable .fire
  11943. // Also disable .add unless we have memory (since it would have no effect)
  11944. // Abort any pending executions
  11945. lock: function() {
  11946. locked = queue = [];
  11947. if ( !memory && !firing ) {
  11948. list = memory = "";
  11949. }
  11950. return this;
  11951. },
  11952. locked: function() {
  11953. return !!locked;
  11954. },
  11955. // Call all callbacks with the given context and arguments
  11956. fireWith: function( context, args ) {
  11957. if ( !locked ) {
  11958. args = args || [];
  11959. args = [ context, args.slice ? args.slice() : args ];
  11960. queue.push( args );
  11961. if ( !firing ) {
  11962. fire();
  11963. }
  11964. }
  11965. return this;
  11966. },
  11967. // Call all the callbacks with the given arguments
  11968. fire: function() {
  11969. self.fireWith( this, arguments );
  11970. return this;
  11971. },
  11972. // To know if the callbacks have already been called at least once
  11973. fired: function() {
  11974. return !!fired;
  11975. }
  11976. };
  11977. return self;
  11978. };
  11979. function Identity( v ) {
  11980. return v;
  11981. }
  11982. function Thrower( ex ) {
  11983. throw ex;
  11984. }
  11985. function adoptValue( value, resolve, reject, noValue ) {
  11986. var method;
  11987. try {
  11988. // Check for promise aspect first to privilege synchronous behavior
  11989. if ( value && isFunction( ( method = value.promise ) ) ) {
  11990. method.call( value ).done( resolve ).fail( reject );
  11991. // Other thenables
  11992. } else if ( value && isFunction( ( method = value.then ) ) ) {
  11993. method.call( value, resolve, reject );
  11994. // Other non-thenables
  11995. } else {
  11996. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  11997. // * false: [ value ].slice( 0 ) => resolve( value )
  11998. // * true: [ value ].slice( 1 ) => resolve()
  11999. resolve.apply( undefined, [ value ].slice( noValue ) );
  12000. }
  12001. // For Promises/A+, convert exceptions into rejections
  12002. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  12003. // Deferred#then to conditionally suppress rejection.
  12004. } catch ( value ) {
  12005. // Support: Android 4.0 only
  12006. // Strict mode functions invoked without .call/.apply get global-object context
  12007. reject.apply( undefined, [ value ] );
  12008. }
  12009. }
  12010. jQuery.extend( {
  12011. Deferred: function( func ) {
  12012. var tuples = [
  12013. // action, add listener, callbacks,
  12014. // ... .then handlers, argument index, [final state]
  12015. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  12016. jQuery.Callbacks( "memory" ), 2 ],
  12017. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  12018. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  12019. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  12020. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  12021. ],
  12022. state = "pending",
  12023. promise = {
  12024. state: function() {
  12025. return state;
  12026. },
  12027. always: function() {
  12028. deferred.done( arguments ).fail( arguments );
  12029. return this;
  12030. },
  12031. "catch": function( fn ) {
  12032. return promise.then( null, fn );
  12033. },
  12034. // Keep pipe for back-compat
  12035. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  12036. var fns = arguments;
  12037. return jQuery.Deferred( function( newDefer ) {
  12038. jQuery.each( tuples, function( i, tuple ) {
  12039. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  12040. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  12041. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  12042. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  12043. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  12044. deferred[ tuple[ 1 ] ]( function() {
  12045. var returned = fn && fn.apply( this, arguments );
  12046. if ( returned && isFunction( returned.promise ) ) {
  12047. returned.promise()
  12048. .progress( newDefer.notify )
  12049. .done( newDefer.resolve )
  12050. .fail( newDefer.reject );
  12051. } else {
  12052. newDefer[ tuple[ 0 ] + "With" ](
  12053. this,
  12054. fn ? [ returned ] : arguments
  12055. );
  12056. }
  12057. } );
  12058. } );
  12059. fns = null;
  12060. } ).promise();
  12061. },
  12062. then: function( onFulfilled, onRejected, onProgress ) {
  12063. var maxDepth = 0;
  12064. function resolve( depth, deferred, handler, special ) {
  12065. return function() {
  12066. var that = this,
  12067. args = arguments,
  12068. mightThrow = function() {
  12069. var returned, then;
  12070. // Support: Promises/A+ section 2.3.3.3.3
  12071. // https://promisesaplus.com/#point-59
  12072. // Ignore double-resolution attempts
  12073. if ( depth < maxDepth ) {
  12074. return;
  12075. }
  12076. returned = handler.apply( that, args );
  12077. // Support: Promises/A+ section 2.3.1
  12078. // https://promisesaplus.com/#point-48
  12079. if ( returned === deferred.promise() ) {
  12080. throw new TypeError( "Thenable self-resolution" );
  12081. }
  12082. // Support: Promises/A+ sections 2.3.3.1, 3.5
  12083. // https://promisesaplus.com/#point-54
  12084. // https://promisesaplus.com/#point-75
  12085. // Retrieve `then` only once
  12086. then = returned &&
  12087. // Support: Promises/A+ section 2.3.4
  12088. // https://promisesaplus.com/#point-64
  12089. // Only check objects and functions for thenability
  12090. ( typeof returned === "object" ||
  12091. typeof returned === "function" ) &&
  12092. returned.then;
  12093. // Handle a returned thenable
  12094. if ( isFunction( then ) ) {
  12095. // Special processors (notify) just wait for resolution
  12096. if ( special ) {
  12097. then.call(
  12098. returned,
  12099. resolve( maxDepth, deferred, Identity, special ),
  12100. resolve( maxDepth, deferred, Thrower, special )
  12101. );
  12102. // Normal processors (resolve) also hook into progress
  12103. } else {
  12104. // ...and disregard older resolution values
  12105. maxDepth++;
  12106. then.call(
  12107. returned,
  12108. resolve( maxDepth, deferred, Identity, special ),
  12109. resolve( maxDepth, deferred, Thrower, special ),
  12110. resolve( maxDepth, deferred, Identity,
  12111. deferred.notifyWith )
  12112. );
  12113. }
  12114. // Handle all other returned values
  12115. } else {
  12116. // Only substitute handlers pass on context
  12117. // and multiple values (non-spec behavior)
  12118. if ( handler !== Identity ) {
  12119. that = undefined;
  12120. args = [ returned ];
  12121. }
  12122. // Process the value(s)
  12123. // Default process is resolve
  12124. ( special || deferred.resolveWith )( that, args );
  12125. }
  12126. },
  12127. // Only normal processors (resolve) catch and reject exceptions
  12128. process = special ?
  12129. mightThrow :
  12130. function() {
  12131. try {
  12132. mightThrow();
  12133. } catch ( e ) {
  12134. if ( jQuery.Deferred.exceptionHook ) {
  12135. jQuery.Deferred.exceptionHook( e,
  12136. process.stackTrace );
  12137. }
  12138. // Support: Promises/A+ section 2.3.3.3.4.1
  12139. // https://promisesaplus.com/#point-61
  12140. // Ignore post-resolution exceptions
  12141. if ( depth + 1 >= maxDepth ) {
  12142. // Only substitute handlers pass on context
  12143. // and multiple values (non-spec behavior)
  12144. if ( handler !== Thrower ) {
  12145. that = undefined;
  12146. args = [ e ];
  12147. }
  12148. deferred.rejectWith( that, args );
  12149. }
  12150. }
  12151. };
  12152. // Support: Promises/A+ section 2.3.3.3.1
  12153. // https://promisesaplus.com/#point-57
  12154. // Re-resolve promises immediately to dodge false rejection from
  12155. // subsequent errors
  12156. if ( depth ) {
  12157. process();
  12158. } else {
  12159. // Call an optional hook to record the stack, in case of exception
  12160. // since it's otherwise lost when execution goes async
  12161. if ( jQuery.Deferred.getStackHook ) {
  12162. process.stackTrace = jQuery.Deferred.getStackHook();
  12163. }
  12164. window.setTimeout( process );
  12165. }
  12166. };
  12167. }
  12168. return jQuery.Deferred( function( newDefer ) {
  12169. // progress_handlers.add( ... )
  12170. tuples[ 0 ][ 3 ].add(
  12171. resolve(
  12172. 0,
  12173. newDefer,
  12174. isFunction( onProgress ) ?
  12175. onProgress :
  12176. Identity,
  12177. newDefer.notifyWith
  12178. )
  12179. );
  12180. // fulfilled_handlers.add( ... )
  12181. tuples[ 1 ][ 3 ].add(
  12182. resolve(
  12183. 0,
  12184. newDefer,
  12185. isFunction( onFulfilled ) ?
  12186. onFulfilled :
  12187. Identity
  12188. )
  12189. );
  12190. // rejected_handlers.add( ... )
  12191. tuples[ 2 ][ 3 ].add(
  12192. resolve(
  12193. 0,
  12194. newDefer,
  12195. isFunction( onRejected ) ?
  12196. onRejected :
  12197. Thrower
  12198. )
  12199. );
  12200. } ).promise();
  12201. },
  12202. // Get a promise for this deferred
  12203. // If obj is provided, the promise aspect is added to the object
  12204. promise: function( obj ) {
  12205. return obj != null ? jQuery.extend( obj, promise ) : promise;
  12206. }
  12207. },
  12208. deferred = {};
  12209. // Add list-specific methods
  12210. jQuery.each( tuples, function( i, tuple ) {
  12211. var list = tuple[ 2 ],
  12212. stateString = tuple[ 5 ];
  12213. // promise.progress = list.add
  12214. // promise.done = list.add
  12215. // promise.fail = list.add
  12216. promise[ tuple[ 1 ] ] = list.add;
  12217. // Handle state
  12218. if ( stateString ) {
  12219. list.add(
  12220. function() {
  12221. // state = "resolved" (i.e., fulfilled)
  12222. // state = "rejected"
  12223. state = stateString;
  12224. },
  12225. // rejected_callbacks.disable
  12226. // fulfilled_callbacks.disable
  12227. tuples[ 3 - i ][ 2 ].disable,
  12228. // rejected_handlers.disable
  12229. // fulfilled_handlers.disable
  12230. tuples[ 3 - i ][ 3 ].disable,
  12231. // progress_callbacks.lock
  12232. tuples[ 0 ][ 2 ].lock,
  12233. // progress_handlers.lock
  12234. tuples[ 0 ][ 3 ].lock
  12235. );
  12236. }
  12237. // progress_handlers.fire
  12238. // fulfilled_handlers.fire
  12239. // rejected_handlers.fire
  12240. list.add( tuple[ 3 ].fire );
  12241. // deferred.notify = function() { deferred.notifyWith(...) }
  12242. // deferred.resolve = function() { deferred.resolveWith(...) }
  12243. // deferred.reject = function() { deferred.rejectWith(...) }
  12244. deferred[ tuple[ 0 ] ] = function() {
  12245. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  12246. return this;
  12247. };
  12248. // deferred.notifyWith = list.fireWith
  12249. // deferred.resolveWith = list.fireWith
  12250. // deferred.rejectWith = list.fireWith
  12251. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  12252. } );
  12253. // Make the deferred a promise
  12254. promise.promise( deferred );
  12255. // Call given func if any
  12256. if ( func ) {
  12257. func.call( deferred, deferred );
  12258. }
  12259. // All done!
  12260. return deferred;
  12261. },
  12262. // Deferred helper
  12263. when: function( singleValue ) {
  12264. var
  12265. // count of uncompleted subordinates
  12266. remaining = arguments.length,
  12267. // count of unprocessed arguments
  12268. i = remaining,
  12269. // subordinate fulfillment data
  12270. resolveContexts = Array( i ),
  12271. resolveValues = slice.call( arguments ),
  12272. // the master Deferred
  12273. master = jQuery.Deferred(),
  12274. // subordinate callback factory
  12275. updateFunc = function( i ) {
  12276. return function( value ) {
  12277. resolveContexts[ i ] = this;
  12278. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  12279. if ( !( --remaining ) ) {
  12280. master.resolveWith( resolveContexts, resolveValues );
  12281. }
  12282. };
  12283. };
  12284. // Single- and empty arguments are adopted like Promise.resolve
  12285. if ( remaining <= 1 ) {
  12286. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  12287. !remaining );
  12288. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  12289. if ( master.state() === "pending" ||
  12290. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  12291. return master.then();
  12292. }
  12293. }
  12294. // Multiple arguments are aggregated like Promise.all array elements
  12295. while ( i-- ) {
  12296. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  12297. }
  12298. return master.promise();
  12299. }
  12300. } );
  12301. // These usually indicate a programmer mistake during development,
  12302. // warn about them ASAP rather than swallowing them by default.
  12303. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  12304. jQuery.Deferred.exceptionHook = function( error, stack ) {
  12305. // Support: IE 8 - 9 only
  12306. // Console exists when dev tools are open, which can happen at any time
  12307. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  12308. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  12309. }
  12310. };
  12311. jQuery.readyException = function( error ) {
  12312. window.setTimeout( function() {
  12313. throw error;
  12314. } );
  12315. };
  12316. // The deferred used on DOM ready
  12317. var readyList = jQuery.Deferred();
  12318. jQuery.fn.ready = function( fn ) {
  12319. readyList
  12320. .then( fn )
  12321. // Wrap jQuery.readyException in a function so that the lookup
  12322. // happens at the time of error handling instead of callback
  12323. // registration.
  12324. .catch( function( error ) {
  12325. jQuery.readyException( error );
  12326. } );
  12327. return this;
  12328. };
  12329. jQuery.extend( {
  12330. // Is the DOM ready to be used? Set to true once it occurs.
  12331. isReady: false,
  12332. // A counter to track how many items to wait for before
  12333. // the ready event fires. See #6781
  12334. readyWait: 1,
  12335. // Handle when the DOM is ready
  12336. ready: function( wait ) {
  12337. // Abort if there are pending holds or we're already ready
  12338. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  12339. return;
  12340. }
  12341. // Remember that the DOM is ready
  12342. jQuery.isReady = true;
  12343. // If a normal DOM Ready event fired, decrement, and wait if need be
  12344. if ( wait !== true && --jQuery.readyWait > 0 ) {
  12345. return;
  12346. }
  12347. // If there are functions bound, to execute
  12348. readyList.resolveWith( document, [ jQuery ] );
  12349. }
  12350. } );
  12351. jQuery.ready.then = readyList.then;
  12352. // The ready event handler and self cleanup method
  12353. function completed() {
  12354. document.removeEventListener( "DOMContentLoaded", completed );
  12355. window.removeEventListener( "load", completed );
  12356. jQuery.ready();
  12357. }
  12358. // Catch cases where $(document).ready() is called
  12359. // after the browser event has already occurred.
  12360. // Support: IE <=9 - 10 only
  12361. // Older IE sometimes signals "interactive" too soon
  12362. if ( document.readyState === "complete" ||
  12363. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  12364. // Handle it asynchronously to allow scripts the opportunity to delay ready
  12365. window.setTimeout( jQuery.ready );
  12366. } else {
  12367. // Use the handy event callback
  12368. document.addEventListener( "DOMContentLoaded", completed );
  12369. // A fallback to window.onload, that will always work
  12370. window.addEventListener( "load", completed );
  12371. }
  12372. // Multifunctional method to get and set values of a collection
  12373. // The value/s can optionally be executed if it's a function
  12374. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  12375. var i = 0,
  12376. len = elems.length,
  12377. bulk = key == null;
  12378. // Sets many values
  12379. if ( toType( key ) === "object" ) {
  12380. chainable = true;
  12381. for ( i in key ) {
  12382. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  12383. }
  12384. // Sets one value
  12385. } else if ( value !== undefined ) {
  12386. chainable = true;
  12387. if ( !isFunction( value ) ) {
  12388. raw = true;
  12389. }
  12390. if ( bulk ) {
  12391. // Bulk operations run against the entire set
  12392. if ( raw ) {
  12393. fn.call( elems, value );
  12394. fn = null;
  12395. // ...except when executing function values
  12396. } else {
  12397. bulk = fn;
  12398. fn = function( elem, key, value ) {
  12399. return bulk.call( jQuery( elem ), value );
  12400. };
  12401. }
  12402. }
  12403. if ( fn ) {
  12404. for ( ; i < len; i++ ) {
  12405. fn(
  12406. elems[ i ], key, raw ?
  12407. value :
  12408. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  12409. );
  12410. }
  12411. }
  12412. }
  12413. if ( chainable ) {
  12414. return elems;
  12415. }
  12416. // Gets
  12417. if ( bulk ) {
  12418. return fn.call( elems );
  12419. }
  12420. return len ? fn( elems[ 0 ], key ) : emptyGet;
  12421. };
  12422. // Matches dashed string for camelizing
  12423. var rmsPrefix = /^-ms-/,
  12424. rdashAlpha = /-([a-z])/g;
  12425. // Used by camelCase as callback to replace()
  12426. function fcamelCase( all, letter ) {
  12427. return letter.toUpperCase();
  12428. }
  12429. // Convert dashed to camelCase; used by the css and data modules
  12430. // Support: IE <=9 - 11, Edge 12 - 15
  12431. // Microsoft forgot to hump their vendor prefix (#9572)
  12432. function camelCase( string ) {
  12433. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  12434. }
  12435. var acceptData = function( owner ) {
  12436. // Accepts only:
  12437. // - Node
  12438. // - Node.ELEMENT_NODE
  12439. // - Node.DOCUMENT_NODE
  12440. // - Object
  12441. // - Any
  12442. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  12443. };
  12444. function Data() {
  12445. this.expando = jQuery.expando + Data.uid++;
  12446. }
  12447. Data.uid = 1;
  12448. Data.prototype = {
  12449. cache: function( owner ) {
  12450. // Check if the owner object already has a cache
  12451. var value = owner[ this.expando ];
  12452. // If not, create one
  12453. if ( !value ) {
  12454. value = {};
  12455. // We can accept data for non-element nodes in modern browsers,
  12456. // but we should not, see #8335.
  12457. // Always return an empty object.
  12458. if ( acceptData( owner ) ) {
  12459. // If it is a node unlikely to be stringify-ed or looped over
  12460. // use plain assignment
  12461. if ( owner.nodeType ) {
  12462. owner[ this.expando ] = value;
  12463. // Otherwise secure it in a non-enumerable property
  12464. // configurable must be true to allow the property to be
  12465. // deleted when data is removed
  12466. } else {
  12467. Object.defineProperty( owner, this.expando, {
  12468. value: value,
  12469. configurable: true
  12470. } );
  12471. }
  12472. }
  12473. }
  12474. return value;
  12475. },
  12476. set: function( owner, data, value ) {
  12477. var prop,
  12478. cache = this.cache( owner );
  12479. // Handle: [ owner, key, value ] args
  12480. // Always use camelCase key (gh-2257)
  12481. if ( typeof data === "string" ) {
  12482. cache[ camelCase( data ) ] = value;
  12483. // Handle: [ owner, { properties } ] args
  12484. } else {
  12485. // Copy the properties one-by-one to the cache object
  12486. for ( prop in data ) {
  12487. cache[ camelCase( prop ) ] = data[ prop ];
  12488. }
  12489. }
  12490. return cache;
  12491. },
  12492. get: function( owner, key ) {
  12493. return key === undefined ?
  12494. this.cache( owner ) :
  12495. // Always use camelCase key (gh-2257)
  12496. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  12497. },
  12498. access: function( owner, key, value ) {
  12499. // In cases where either:
  12500. //
  12501. // 1. No key was specified
  12502. // 2. A string key was specified, but no value provided
  12503. //
  12504. // Take the "read" path and allow the get method to determine
  12505. // which value to return, respectively either:
  12506. //
  12507. // 1. The entire cache object
  12508. // 2. The data stored at the key
  12509. //
  12510. if ( key === undefined ||
  12511. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  12512. return this.get( owner, key );
  12513. }
  12514. // When the key is not a string, or both a key and value
  12515. // are specified, set or extend (existing objects) with either:
  12516. //
  12517. // 1. An object of properties
  12518. // 2. A key and value
  12519. //
  12520. this.set( owner, key, value );
  12521. // Since the "set" path can have two possible entry points
  12522. // return the expected data based on which path was taken[*]
  12523. return value !== undefined ? value : key;
  12524. },
  12525. remove: function( owner, key ) {
  12526. var i,
  12527. cache = owner[ this.expando ];
  12528. if ( cache === undefined ) {
  12529. return;
  12530. }
  12531. if ( key !== undefined ) {
  12532. // Support array or space separated string of keys
  12533. if ( Array.isArray( key ) ) {
  12534. // If key is an array of keys...
  12535. // We always set camelCase keys, so remove that.
  12536. key = key.map( camelCase );
  12537. } else {
  12538. key = camelCase( key );
  12539. // If a key with the spaces exists, use it.
  12540. // Otherwise, create an array by matching non-whitespace
  12541. key = key in cache ?
  12542. [ key ] :
  12543. ( key.match( rnothtmlwhite ) || [] );
  12544. }
  12545. i = key.length;
  12546. while ( i-- ) {
  12547. delete cache[ key[ i ] ];
  12548. }
  12549. }
  12550. // Remove the expando if there's no more data
  12551. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  12552. // Support: Chrome <=35 - 45
  12553. // Webkit & Blink performance suffers when deleting properties
  12554. // from DOM nodes, so set to undefined instead
  12555. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  12556. if ( owner.nodeType ) {
  12557. owner[ this.expando ] = undefined;
  12558. } else {
  12559. delete owner[ this.expando ];
  12560. }
  12561. }
  12562. },
  12563. hasData: function( owner ) {
  12564. var cache = owner[ this.expando ];
  12565. return cache !== undefined && !jQuery.isEmptyObject( cache );
  12566. }
  12567. };
  12568. var dataPriv = new Data();
  12569. var dataUser = new Data();
  12570. // Implementation Summary
  12571. //
  12572. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  12573. // 2. Improve the module's maintainability by reducing the storage
  12574. // paths to a single mechanism.
  12575. // 3. Use the same single mechanism to support "private" and "user" data.
  12576. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  12577. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  12578. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  12579. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  12580. rmultiDash = /[A-Z]/g;
  12581. function getData( data ) {
  12582. if ( data === "true" ) {
  12583. return true;
  12584. }
  12585. if ( data === "false" ) {
  12586. return false;
  12587. }
  12588. if ( data === "null" ) {
  12589. return null;
  12590. }
  12591. // Only convert to a number if it doesn't change the string
  12592. if ( data === +data + "" ) {
  12593. return +data;
  12594. }
  12595. if ( rbrace.test( data ) ) {
  12596. return JSON.parse( data );
  12597. }
  12598. return data;
  12599. }
  12600. function dataAttr( elem, key, data ) {
  12601. var name;
  12602. // If nothing was found internally, try to fetch any
  12603. // data from the HTML5 data-* attribute
  12604. if ( data === undefined && elem.nodeType === 1 ) {
  12605. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  12606. data = elem.getAttribute( name );
  12607. if ( typeof data === "string" ) {
  12608. try {
  12609. data = getData( data );
  12610. } catch ( e ) {}
  12611. // Make sure we set the data so it isn't changed later
  12612. dataUser.set( elem, key, data );
  12613. } else {
  12614. data = undefined;
  12615. }
  12616. }
  12617. return data;
  12618. }
  12619. jQuery.extend( {
  12620. hasData: function( elem ) {
  12621. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  12622. },
  12623. data: function( elem, name, data ) {
  12624. return dataUser.access( elem, name, data );
  12625. },
  12626. removeData: function( elem, name ) {
  12627. dataUser.remove( elem, name );
  12628. },
  12629. // TODO: Now that all calls to _data and _removeData have been replaced
  12630. // with direct calls to dataPriv methods, these can be deprecated.
  12631. _data: function( elem, name, data ) {
  12632. return dataPriv.access( elem, name, data );
  12633. },
  12634. _removeData: function( elem, name ) {
  12635. dataPriv.remove( elem, name );
  12636. }
  12637. } );
  12638. jQuery.fn.extend( {
  12639. data: function( key, value ) {
  12640. var i, name, data,
  12641. elem = this[ 0 ],
  12642. attrs = elem && elem.attributes;
  12643. // Gets all values
  12644. if ( key === undefined ) {
  12645. if ( this.length ) {
  12646. data = dataUser.get( elem );
  12647. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  12648. i = attrs.length;
  12649. while ( i-- ) {
  12650. // Support: IE 11 only
  12651. // The attrs elements can be null (#14894)
  12652. if ( attrs[ i ] ) {
  12653. name = attrs[ i ].name;
  12654. if ( name.indexOf( "data-" ) === 0 ) {
  12655. name = camelCase( name.slice( 5 ) );
  12656. dataAttr( elem, name, data[ name ] );
  12657. }
  12658. }
  12659. }
  12660. dataPriv.set( elem, "hasDataAttrs", true );
  12661. }
  12662. }
  12663. return data;
  12664. }
  12665. // Sets multiple values
  12666. if ( typeof key === "object" ) {
  12667. return this.each( function() {
  12668. dataUser.set( this, key );
  12669. } );
  12670. }
  12671. return access( this, function( value ) {
  12672. var data;
  12673. // The calling jQuery object (element matches) is not empty
  12674. // (and therefore has an element appears at this[ 0 ]) and the
  12675. // `value` parameter was not undefined. An empty jQuery object
  12676. // will result in `undefined` for elem = this[ 0 ] which will
  12677. // throw an exception if an attempt to read a data cache is made.
  12678. if ( elem && value === undefined ) {
  12679. // Attempt to get data from the cache
  12680. // The key will always be camelCased in Data
  12681. data = dataUser.get( elem, key );
  12682. if ( data !== undefined ) {
  12683. return data;
  12684. }
  12685. // Attempt to "discover" the data in
  12686. // HTML5 custom data-* attrs
  12687. data = dataAttr( elem, key );
  12688. if ( data !== undefined ) {
  12689. return data;
  12690. }
  12691. // We tried really hard, but the data doesn't exist.
  12692. return;
  12693. }
  12694. // Set the data...
  12695. this.each( function() {
  12696. // We always store the camelCased key
  12697. dataUser.set( this, key, value );
  12698. } );
  12699. }, null, value, arguments.length > 1, null, true );
  12700. },
  12701. removeData: function( key ) {
  12702. return this.each( function() {
  12703. dataUser.remove( this, key );
  12704. } );
  12705. }
  12706. } );
  12707. jQuery.extend( {
  12708. queue: function( elem, type, data ) {
  12709. var queue;
  12710. if ( elem ) {
  12711. type = ( type || "fx" ) + "queue";
  12712. queue = dataPriv.get( elem, type );
  12713. // Speed up dequeue by getting out quickly if this is just a lookup
  12714. if ( data ) {
  12715. if ( !queue || Array.isArray( data ) ) {
  12716. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  12717. } else {
  12718. queue.push( data );
  12719. }
  12720. }
  12721. return queue || [];
  12722. }
  12723. },
  12724. dequeue: function( elem, type ) {
  12725. type = type || "fx";
  12726. var queue = jQuery.queue( elem, type ),
  12727. startLength = queue.length,
  12728. fn = queue.shift(),
  12729. hooks = jQuery._queueHooks( elem, type ),
  12730. next = function() {
  12731. jQuery.dequeue( elem, type );
  12732. };
  12733. // If the fx queue is dequeued, always remove the progress sentinel
  12734. if ( fn === "inprogress" ) {
  12735. fn = queue.shift();
  12736. startLength--;
  12737. }
  12738. if ( fn ) {
  12739. // Add a progress sentinel to prevent the fx queue from being
  12740. // automatically dequeued
  12741. if ( type === "fx" ) {
  12742. queue.unshift( "inprogress" );
  12743. }
  12744. // Clear up the last queue stop function
  12745. delete hooks.stop;
  12746. fn.call( elem, next, hooks );
  12747. }
  12748. if ( !startLength && hooks ) {
  12749. hooks.empty.fire();
  12750. }
  12751. },
  12752. // Not public - generate a queueHooks object, or return the current one
  12753. _queueHooks: function( elem, type ) {
  12754. var key = type + "queueHooks";
  12755. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  12756. empty: jQuery.Callbacks( "once memory" ).add( function() {
  12757. dataPriv.remove( elem, [ type + "queue", key ] );
  12758. } )
  12759. } );
  12760. }
  12761. } );
  12762. jQuery.fn.extend( {
  12763. queue: function( type, data ) {
  12764. var setter = 2;
  12765. if ( typeof type !== "string" ) {
  12766. data = type;
  12767. type = "fx";
  12768. setter--;
  12769. }
  12770. if ( arguments.length < setter ) {
  12771. return jQuery.queue( this[ 0 ], type );
  12772. }
  12773. return data === undefined ?
  12774. this :
  12775. this.each( function() {
  12776. var queue = jQuery.queue( this, type, data );
  12777. // Ensure a hooks for this queue
  12778. jQuery._queueHooks( this, type );
  12779. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  12780. jQuery.dequeue( this, type );
  12781. }
  12782. } );
  12783. },
  12784. dequeue: function( type ) {
  12785. return this.each( function() {
  12786. jQuery.dequeue( this, type );
  12787. } );
  12788. },
  12789. clearQueue: function( type ) {
  12790. return this.queue( type || "fx", [] );
  12791. },
  12792. // Get a promise resolved when queues of a certain type
  12793. // are emptied (fx is the type by default)
  12794. promise: function( type, obj ) {
  12795. var tmp,
  12796. count = 1,
  12797. defer = jQuery.Deferred(),
  12798. elements = this,
  12799. i = this.length,
  12800. resolve = function() {
  12801. if ( !( --count ) ) {
  12802. defer.resolveWith( elements, [ elements ] );
  12803. }
  12804. };
  12805. if ( typeof type !== "string" ) {
  12806. obj = type;
  12807. type = undefined;
  12808. }
  12809. type = type || "fx";
  12810. while ( i-- ) {
  12811. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  12812. if ( tmp && tmp.empty ) {
  12813. count++;
  12814. tmp.empty.add( resolve );
  12815. }
  12816. }
  12817. resolve();
  12818. return defer.promise( obj );
  12819. }
  12820. } );
  12821. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  12822. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  12823. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  12824. var documentElement = document.documentElement;
  12825. var isAttached = function( elem ) {
  12826. return jQuery.contains( elem.ownerDocument, elem );
  12827. },
  12828. composed = { composed: true };
  12829. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  12830. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  12831. // Support: iOS 10.0-10.2 only
  12832. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  12833. // leading to errors. We need to check for `getRootNode`.
  12834. if ( documentElement.getRootNode ) {
  12835. isAttached = function( elem ) {
  12836. return jQuery.contains( elem.ownerDocument, elem ) ||
  12837. elem.getRootNode( composed ) === elem.ownerDocument;
  12838. };
  12839. }
  12840. var isHiddenWithinTree = function( elem, el ) {
  12841. // isHiddenWithinTree might be called from jQuery#filter function;
  12842. // in that case, element will be second argument
  12843. elem = el || elem;
  12844. // Inline style trumps all
  12845. return elem.style.display === "none" ||
  12846. elem.style.display === "" &&
  12847. // Otherwise, check computed style
  12848. // Support: Firefox <=43 - 45
  12849. // Disconnected elements can have computed display: none, so first confirm that elem is
  12850. // in the document.
  12851. isAttached( elem ) &&
  12852. jQuery.css( elem, "display" ) === "none";
  12853. };
  12854. var swap = function( elem, options, callback, args ) {
  12855. var ret, name,
  12856. old = {};
  12857. // Remember the old values, and insert the new ones
  12858. for ( name in options ) {
  12859. old[ name ] = elem.style[ name ];
  12860. elem.style[ name ] = options[ name ];
  12861. }
  12862. ret = callback.apply( elem, args || [] );
  12863. // Revert the old values
  12864. for ( name in options ) {
  12865. elem.style[ name ] = old[ name ];
  12866. }
  12867. return ret;
  12868. };
  12869. function adjustCSS( elem, prop, valueParts, tween ) {
  12870. var adjusted, scale,
  12871. maxIterations = 20,
  12872. currentValue = tween ?
  12873. function() {
  12874. return tween.cur();
  12875. } :
  12876. function() {
  12877. return jQuery.css( elem, prop, "" );
  12878. },
  12879. initial = currentValue(),
  12880. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  12881. // Starting value computation is required for potential unit mismatches
  12882. initialInUnit = elem.nodeType &&
  12883. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  12884. rcssNum.exec( jQuery.css( elem, prop ) );
  12885. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  12886. // Support: Firefox <=54
  12887. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  12888. initial = initial / 2;
  12889. // Trust units reported by jQuery.css
  12890. unit = unit || initialInUnit[ 3 ];
  12891. // Iteratively approximate from a nonzero starting point
  12892. initialInUnit = +initial || 1;
  12893. while ( maxIterations-- ) {
  12894. // Evaluate and update our best guess (doubling guesses that zero out).
  12895. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  12896. jQuery.style( elem, prop, initialInUnit + unit );
  12897. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  12898. maxIterations = 0;
  12899. }
  12900. initialInUnit = initialInUnit / scale;
  12901. }
  12902. initialInUnit = initialInUnit * 2;
  12903. jQuery.style( elem, prop, initialInUnit + unit );
  12904. // Make sure we update the tween properties later on
  12905. valueParts = valueParts || [];
  12906. }
  12907. if ( valueParts ) {
  12908. initialInUnit = +initialInUnit || +initial || 0;
  12909. // Apply relative offset (+=/-=) if specified
  12910. adjusted = valueParts[ 1 ] ?
  12911. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  12912. +valueParts[ 2 ];
  12913. if ( tween ) {
  12914. tween.unit = unit;
  12915. tween.start = initialInUnit;
  12916. tween.end = adjusted;
  12917. }
  12918. }
  12919. return adjusted;
  12920. }
  12921. var defaultDisplayMap = {};
  12922. function getDefaultDisplay( elem ) {
  12923. var temp,
  12924. doc = elem.ownerDocument,
  12925. nodeName = elem.nodeName,
  12926. display = defaultDisplayMap[ nodeName ];
  12927. if ( display ) {
  12928. return display;
  12929. }
  12930. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  12931. display = jQuery.css( temp, "display" );
  12932. temp.parentNode.removeChild( temp );
  12933. if ( display === "none" ) {
  12934. display = "block";
  12935. }
  12936. defaultDisplayMap[ nodeName ] = display;
  12937. return display;
  12938. }
  12939. function showHide( elements, show ) {
  12940. var display, elem,
  12941. values = [],
  12942. index = 0,
  12943. length = elements.length;
  12944. // Determine new display value for elements that need to change
  12945. for ( ; index < length; index++ ) {
  12946. elem = elements[ index ];
  12947. if ( !elem.style ) {
  12948. continue;
  12949. }
  12950. display = elem.style.display;
  12951. if ( show ) {
  12952. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  12953. // check is required in this first loop unless we have a nonempty display value (either
  12954. // inline or about-to-be-restored)
  12955. if ( display === "none" ) {
  12956. values[ index ] = dataPriv.get( elem, "display" ) || null;
  12957. if ( !values[ index ] ) {
  12958. elem.style.display = "";
  12959. }
  12960. }
  12961. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  12962. values[ index ] = getDefaultDisplay( elem );
  12963. }
  12964. } else {
  12965. if ( display !== "none" ) {
  12966. values[ index ] = "none";
  12967. // Remember what we're overwriting
  12968. dataPriv.set( elem, "display", display );
  12969. }
  12970. }
  12971. }
  12972. // Set the display of the elements in a second loop to avoid constant reflow
  12973. for ( index = 0; index < length; index++ ) {
  12974. if ( values[ index ] != null ) {
  12975. elements[ index ].style.display = values[ index ];
  12976. }
  12977. }
  12978. return elements;
  12979. }
  12980. jQuery.fn.extend( {
  12981. show: function() {
  12982. return showHide( this, true );
  12983. },
  12984. hide: function() {
  12985. return showHide( this );
  12986. },
  12987. toggle: function( state ) {
  12988. if ( typeof state === "boolean" ) {
  12989. return state ? this.show() : this.hide();
  12990. }
  12991. return this.each( function() {
  12992. if ( isHiddenWithinTree( this ) ) {
  12993. jQuery( this ).show();
  12994. } else {
  12995. jQuery( this ).hide();
  12996. }
  12997. } );
  12998. }
  12999. } );
  13000. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  13001. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  13002. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  13003. // We have to close these tags to support XHTML (#13200)
  13004. var wrapMap = {
  13005. // Support: IE <=9 only
  13006. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  13007. // XHTML parsers do not magically insert elements in the
  13008. // same way that tag soup parsers do. So we cannot shorten
  13009. // this by omitting <tbody> or other required elements.
  13010. thead: [ 1, "<table>", "</table>" ],
  13011. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  13012. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  13013. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  13014. _default: [ 0, "", "" ]
  13015. };
  13016. // Support: IE <=9 only
  13017. wrapMap.optgroup = wrapMap.option;
  13018. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  13019. wrapMap.th = wrapMap.td;
  13020. function getAll( context, tag ) {
  13021. // Support: IE <=9 - 11 only
  13022. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  13023. var ret;
  13024. if ( typeof context.getElementsByTagName !== "undefined" ) {
  13025. ret = context.getElementsByTagName( tag || "*" );
  13026. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  13027. ret = context.querySelectorAll( tag || "*" );
  13028. } else {
  13029. ret = [];
  13030. }
  13031. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  13032. return jQuery.merge( [ context ], ret );
  13033. }
  13034. return ret;
  13035. }
  13036. // Mark scripts as having already been evaluated
  13037. function setGlobalEval( elems, refElements ) {
  13038. var i = 0,
  13039. l = elems.length;
  13040. for ( ; i < l; i++ ) {
  13041. dataPriv.set(
  13042. elems[ i ],
  13043. "globalEval",
  13044. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  13045. );
  13046. }
  13047. }
  13048. var rhtml = /<|&#?\w+;/;
  13049. function buildFragment( elems, context, scripts, selection, ignored ) {
  13050. var elem, tmp, tag, wrap, attached, j,
  13051. fragment = context.createDocumentFragment(),
  13052. nodes = [],
  13053. i = 0,
  13054. l = elems.length;
  13055. for ( ; i < l; i++ ) {
  13056. elem = elems[ i ];
  13057. if ( elem || elem === 0 ) {
  13058. // Add nodes directly
  13059. if ( toType( elem ) === "object" ) {
  13060. // Support: Android <=4.0 only, PhantomJS 1 only
  13061. // push.apply(_, arraylike) throws on ancient WebKit
  13062. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  13063. // Convert non-html into a text node
  13064. } else if ( !rhtml.test( elem ) ) {
  13065. nodes.push( context.createTextNode( elem ) );
  13066. // Convert html into DOM nodes
  13067. } else {
  13068. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  13069. // Deserialize a standard representation
  13070. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  13071. wrap = wrapMap[ tag ] || wrapMap._default;
  13072. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  13073. // Descend through wrappers to the right content
  13074. j = wrap[ 0 ];
  13075. while ( j-- ) {
  13076. tmp = tmp.lastChild;
  13077. }
  13078. // Support: Android <=4.0 only, PhantomJS 1 only
  13079. // push.apply(_, arraylike) throws on ancient WebKit
  13080. jQuery.merge( nodes, tmp.childNodes );
  13081. // Remember the top-level container
  13082. tmp = fragment.firstChild;
  13083. // Ensure the created nodes are orphaned (#12392)
  13084. tmp.textContent = "";
  13085. }
  13086. }
  13087. }
  13088. // Remove wrapper from fragment
  13089. fragment.textContent = "";
  13090. i = 0;
  13091. while ( ( elem = nodes[ i++ ] ) ) {
  13092. // Skip elements already in the context collection (trac-4087)
  13093. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  13094. if ( ignored ) {
  13095. ignored.push( elem );
  13096. }
  13097. continue;
  13098. }
  13099. attached = isAttached( elem );
  13100. // Append to fragment
  13101. tmp = getAll( fragment.appendChild( elem ), "script" );
  13102. // Preserve script evaluation history
  13103. if ( attached ) {
  13104. setGlobalEval( tmp );
  13105. }
  13106. // Capture executables
  13107. if ( scripts ) {
  13108. j = 0;
  13109. while ( ( elem = tmp[ j++ ] ) ) {
  13110. if ( rscriptType.test( elem.type || "" ) ) {
  13111. scripts.push( elem );
  13112. }
  13113. }
  13114. }
  13115. }
  13116. return fragment;
  13117. }
  13118. ( function() {
  13119. var fragment = document.createDocumentFragment(),
  13120. div = fragment.appendChild( document.createElement( "div" ) ),
  13121. input = document.createElement( "input" );
  13122. // Support: Android 4.0 - 4.3 only
  13123. // Check state lost if the name is set (#11217)
  13124. // Support: Windows Web Apps (WWA)
  13125. // `name` and `type` must use .setAttribute for WWA (#14901)
  13126. input.setAttribute( "type", "radio" );
  13127. input.setAttribute( "checked", "checked" );
  13128. input.setAttribute( "name", "t" );
  13129. div.appendChild( input );
  13130. // Support: Android <=4.1 only
  13131. // Older WebKit doesn't clone checked state correctly in fragments
  13132. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  13133. // Support: IE <=11 only
  13134. // Make sure textarea (and checkbox) defaultValue is properly cloned
  13135. div.innerHTML = "<textarea>x</textarea>";
  13136. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  13137. } )();
  13138. var
  13139. rkeyEvent = /^key/,
  13140. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  13141. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  13142. function returnTrue() {
  13143. return true;
  13144. }
  13145. function returnFalse() {
  13146. return false;
  13147. }
  13148. // Support: IE <=9 - 11+
  13149. // focus() and blur() are asynchronous, except when they are no-op.
  13150. // So expect focus to be synchronous when the element is already active,
  13151. // and blur to be synchronous when the element is not already active.
  13152. // (focus and blur are always synchronous in other supported browsers,
  13153. // this just defines when we can count on it).
  13154. function expectSync( elem, type ) {
  13155. return ( elem === safeActiveElement() ) === ( type === "focus" );
  13156. }
  13157. // Support: IE <=9 only
  13158. // Accessing document.activeElement can throw unexpectedly
  13159. // https://bugs.jquery.com/ticket/13393
  13160. function safeActiveElement() {
  13161. try {
  13162. return document.activeElement;
  13163. } catch ( err ) { }
  13164. }
  13165. function on( elem, types, selector, data, fn, one ) {
  13166. var origFn, type;
  13167. // Types can be a map of types/handlers
  13168. if ( typeof types === "object" ) {
  13169. // ( types-Object, selector, data )
  13170. if ( typeof selector !== "string" ) {
  13171. // ( types-Object, data )
  13172. data = data || selector;
  13173. selector = undefined;
  13174. }
  13175. for ( type in types ) {
  13176. on( elem, type, selector, data, types[ type ], one );
  13177. }
  13178. return elem;
  13179. }
  13180. if ( data == null && fn == null ) {
  13181. // ( types, fn )
  13182. fn = selector;
  13183. data = selector = undefined;
  13184. } else if ( fn == null ) {
  13185. if ( typeof selector === "string" ) {
  13186. // ( types, selector, fn )
  13187. fn = data;
  13188. data = undefined;
  13189. } else {
  13190. // ( types, data, fn )
  13191. fn = data;
  13192. data = selector;
  13193. selector = undefined;
  13194. }
  13195. }
  13196. if ( fn === false ) {
  13197. fn = returnFalse;
  13198. } else if ( !fn ) {
  13199. return elem;
  13200. }
  13201. if ( one === 1 ) {
  13202. origFn = fn;
  13203. fn = function( event ) {
  13204. // Can use an empty set, since event contains the info
  13205. jQuery().off( event );
  13206. return origFn.apply( this, arguments );
  13207. };
  13208. // Use same guid so caller can remove using origFn
  13209. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  13210. }
  13211. return elem.each( function() {
  13212. jQuery.event.add( this, types, fn, data, selector );
  13213. } );
  13214. }
  13215. /*
  13216. * Helper functions for managing events -- not part of the public interface.
  13217. * Props to Dean Edwards' addEvent library for many of the ideas.
  13218. */
  13219. jQuery.event = {
  13220. global: {},
  13221. add: function( elem, types, handler, data, selector ) {
  13222. var handleObjIn, eventHandle, tmp,
  13223. events, t, handleObj,
  13224. special, handlers, type, namespaces, origType,
  13225. elemData = dataPriv.get( elem );
  13226. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  13227. if ( !elemData ) {
  13228. return;
  13229. }
  13230. // Caller can pass in an object of custom data in lieu of the handler
  13231. if ( handler.handler ) {
  13232. handleObjIn = handler;
  13233. handler = handleObjIn.handler;
  13234. selector = handleObjIn.selector;
  13235. }
  13236. // Ensure that invalid selectors throw exceptions at attach time
  13237. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  13238. if ( selector ) {
  13239. jQuery.find.matchesSelector( documentElement, selector );
  13240. }
  13241. // Make sure that the handler has a unique ID, used to find/remove it later
  13242. if ( !handler.guid ) {
  13243. handler.guid = jQuery.guid++;
  13244. }
  13245. // Init the element's event structure and main handler, if this is the first
  13246. if ( !( events = elemData.events ) ) {
  13247. events = elemData.events = {};
  13248. }
  13249. if ( !( eventHandle = elemData.handle ) ) {
  13250. eventHandle = elemData.handle = function( e ) {
  13251. // Discard the second event of a jQuery.event.trigger() and
  13252. // when an event is called after a page has unloaded
  13253. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  13254. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  13255. };
  13256. }
  13257. // Handle multiple events separated by a space
  13258. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  13259. t = types.length;
  13260. while ( t-- ) {
  13261. tmp = rtypenamespace.exec( types[ t ] ) || [];
  13262. type = origType = tmp[ 1 ];
  13263. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  13264. // There *must* be a type, no attaching namespace-only handlers
  13265. if ( !type ) {
  13266. continue;
  13267. }
  13268. // If event changes its type, use the special event handlers for the changed type
  13269. special = jQuery.event.special[ type ] || {};
  13270. // If selector defined, determine special event api type, otherwise given type
  13271. type = ( selector ? special.delegateType : special.bindType ) || type;
  13272. // Update special based on newly reset type
  13273. special = jQuery.event.special[ type ] || {};
  13274. // handleObj is passed to all event handlers
  13275. handleObj = jQuery.extend( {
  13276. type: type,
  13277. origType: origType,
  13278. data: data,
  13279. handler: handler,
  13280. guid: handler.guid,
  13281. selector: selector,
  13282. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  13283. namespace: namespaces.join( "." )
  13284. }, handleObjIn );
  13285. // Init the event handler queue if we're the first
  13286. if ( !( handlers = events[ type ] ) ) {
  13287. handlers = events[ type ] = [];
  13288. handlers.delegateCount = 0;
  13289. // Only use addEventListener if the special events handler returns false
  13290. if ( !special.setup ||
  13291. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  13292. if ( elem.addEventListener ) {
  13293. elem.addEventListener( type, eventHandle );
  13294. }
  13295. }
  13296. }
  13297. if ( special.add ) {
  13298. special.add.call( elem, handleObj );
  13299. if ( !handleObj.handler.guid ) {
  13300. handleObj.handler.guid = handler.guid;
  13301. }
  13302. }
  13303. // Add to the element's handler list, delegates in front
  13304. if ( selector ) {
  13305. handlers.splice( handlers.delegateCount++, 0, handleObj );
  13306. } else {
  13307. handlers.push( handleObj );
  13308. }
  13309. // Keep track of which events have ever been used, for event optimization
  13310. jQuery.event.global[ type ] = true;
  13311. }
  13312. },
  13313. // Detach an event or set of events from an element
  13314. remove: function( elem, types, handler, selector, mappedTypes ) {
  13315. var j, origCount, tmp,
  13316. events, t, handleObj,
  13317. special, handlers, type, namespaces, origType,
  13318. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  13319. if ( !elemData || !( events = elemData.events ) ) {
  13320. return;
  13321. }
  13322. // Once for each type.namespace in types; type may be omitted
  13323. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  13324. t = types.length;
  13325. while ( t-- ) {
  13326. tmp = rtypenamespace.exec( types[ t ] ) || [];
  13327. type = origType = tmp[ 1 ];
  13328. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  13329. // Unbind all events (on this namespace, if provided) for the element
  13330. if ( !type ) {
  13331. for ( type in events ) {
  13332. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  13333. }
  13334. continue;
  13335. }
  13336. special = jQuery.event.special[ type ] || {};
  13337. type = ( selector ? special.delegateType : special.bindType ) || type;
  13338. handlers = events[ type ] || [];
  13339. tmp = tmp[ 2 ] &&
  13340. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  13341. // Remove matching events
  13342. origCount = j = handlers.length;
  13343. while ( j-- ) {
  13344. handleObj = handlers[ j ];
  13345. if ( ( mappedTypes || origType === handleObj.origType ) &&
  13346. ( !handler || handler.guid === handleObj.guid ) &&
  13347. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  13348. ( !selector || selector === handleObj.selector ||
  13349. selector === "**" && handleObj.selector ) ) {
  13350. handlers.splice( j, 1 );
  13351. if ( handleObj.selector ) {
  13352. handlers.delegateCount--;
  13353. }
  13354. if ( special.remove ) {
  13355. special.remove.call( elem, handleObj );
  13356. }
  13357. }
  13358. }
  13359. // Remove generic event handler if we removed something and no more handlers exist
  13360. // (avoids potential for endless recursion during removal of special event handlers)
  13361. if ( origCount && !handlers.length ) {
  13362. if ( !special.teardown ||
  13363. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  13364. jQuery.removeEvent( elem, type, elemData.handle );
  13365. }
  13366. delete events[ type ];
  13367. }
  13368. }
  13369. // Remove data and the expando if it's no longer used
  13370. if ( jQuery.isEmptyObject( events ) ) {
  13371. dataPriv.remove( elem, "handle events" );
  13372. }
  13373. },
  13374. dispatch: function( nativeEvent ) {
  13375. // Make a writable jQuery.Event from the native event object
  13376. var event = jQuery.event.fix( nativeEvent );
  13377. var i, j, ret, matched, handleObj, handlerQueue,
  13378. args = new Array( arguments.length ),
  13379. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  13380. special = jQuery.event.special[ event.type ] || {};
  13381. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  13382. args[ 0 ] = event;
  13383. for ( i = 1; i < arguments.length; i++ ) {
  13384. args[ i ] = arguments[ i ];
  13385. }
  13386. event.delegateTarget = this;
  13387. // Call the preDispatch hook for the mapped type, and let it bail if desired
  13388. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  13389. return;
  13390. }
  13391. // Determine handlers
  13392. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  13393. // Run delegates first; they may want to stop propagation beneath us
  13394. i = 0;
  13395. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  13396. event.currentTarget = matched.elem;
  13397. j = 0;
  13398. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  13399. !event.isImmediatePropagationStopped() ) {
  13400. // If the event is namespaced, then each handler is only invoked if it is
  13401. // specially universal or its namespaces are a superset of the event's.
  13402. if ( !event.rnamespace || handleObj.namespace === false ||
  13403. event.rnamespace.test( handleObj.namespace ) ) {
  13404. event.handleObj = handleObj;
  13405. event.data = handleObj.data;
  13406. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  13407. handleObj.handler ).apply( matched.elem, args );
  13408. if ( ret !== undefined ) {
  13409. if ( ( event.result = ret ) === false ) {
  13410. event.preventDefault();
  13411. event.stopPropagation();
  13412. }
  13413. }
  13414. }
  13415. }
  13416. }
  13417. // Call the postDispatch hook for the mapped type
  13418. if ( special.postDispatch ) {
  13419. special.postDispatch.call( this, event );
  13420. }
  13421. return event.result;
  13422. },
  13423. handlers: function( event, handlers ) {
  13424. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  13425. handlerQueue = [],
  13426. delegateCount = handlers.delegateCount,
  13427. cur = event.target;
  13428. // Find delegate handlers
  13429. if ( delegateCount &&
  13430. // Support: IE <=9
  13431. // Black-hole SVG <use> instance trees (trac-13180)
  13432. cur.nodeType &&
  13433. // Support: Firefox <=42
  13434. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  13435. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  13436. // Support: IE 11 only
  13437. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  13438. !( event.type === "click" && event.button >= 1 ) ) {
  13439. for ( ; cur !== this; cur = cur.parentNode || this ) {
  13440. // Don't check non-elements (#13208)
  13441. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  13442. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  13443. matchedHandlers = [];
  13444. matchedSelectors = {};
  13445. for ( i = 0; i < delegateCount; i++ ) {
  13446. handleObj = handlers[ i ];
  13447. // Don't conflict with Object.prototype properties (#13203)
  13448. sel = handleObj.selector + " ";
  13449. if ( matchedSelectors[ sel ] === undefined ) {
  13450. matchedSelectors[ sel ] = handleObj.needsContext ?
  13451. jQuery( sel, this ).index( cur ) > -1 :
  13452. jQuery.find( sel, this, null, [ cur ] ).length;
  13453. }
  13454. if ( matchedSelectors[ sel ] ) {
  13455. matchedHandlers.push( handleObj );
  13456. }
  13457. }
  13458. if ( matchedHandlers.length ) {
  13459. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  13460. }
  13461. }
  13462. }
  13463. }
  13464. // Add the remaining (directly-bound) handlers
  13465. cur = this;
  13466. if ( delegateCount < handlers.length ) {
  13467. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  13468. }
  13469. return handlerQueue;
  13470. },
  13471. addProp: function( name, hook ) {
  13472. Object.defineProperty( jQuery.Event.prototype, name, {
  13473. enumerable: true,
  13474. configurable: true,
  13475. get: isFunction( hook ) ?
  13476. function() {
  13477. if ( this.originalEvent ) {
  13478. return hook( this.originalEvent );
  13479. }
  13480. } :
  13481. function() {
  13482. if ( this.originalEvent ) {
  13483. return this.originalEvent[ name ];
  13484. }
  13485. },
  13486. set: function( value ) {
  13487. Object.defineProperty( this, name, {
  13488. enumerable: true,
  13489. configurable: true,
  13490. writable: true,
  13491. value: value
  13492. } );
  13493. }
  13494. } );
  13495. },
  13496. fix: function( originalEvent ) {
  13497. return originalEvent[ jQuery.expando ] ?
  13498. originalEvent :
  13499. new jQuery.Event( originalEvent );
  13500. },
  13501. special: {
  13502. load: {
  13503. // Prevent triggered image.load events from bubbling to window.load
  13504. noBubble: true
  13505. },
  13506. click: {
  13507. // Utilize native event to ensure correct state for checkable inputs
  13508. setup: function( data ) {
  13509. // For mutual compressibility with _default, replace `this` access with a local var.
  13510. // `|| data` is dead code meant only to preserve the variable through minification.
  13511. var el = this || data;
  13512. // Claim the first handler
  13513. if ( rcheckableType.test( el.type ) &&
  13514. el.click && nodeName( el, "input" ) ) {
  13515. // dataPriv.set( el, "click", ... )
  13516. leverageNative( el, "click", returnTrue );
  13517. }
  13518. // Return false to allow normal processing in the caller
  13519. return false;
  13520. },
  13521. trigger: function( data ) {
  13522. // For mutual compressibility with _default, replace `this` access with a local var.
  13523. // `|| data` is dead code meant only to preserve the variable through minification.
  13524. var el = this || data;
  13525. // Force setup before triggering a click
  13526. if ( rcheckableType.test( el.type ) &&
  13527. el.click && nodeName( el, "input" ) ) {
  13528. leverageNative( el, "click" );
  13529. }
  13530. // Return non-false to allow normal event-path propagation
  13531. return true;
  13532. },
  13533. // For cross-browser consistency, suppress native .click() on links
  13534. // Also prevent it if we're currently inside a leveraged native-event stack
  13535. _default: function( event ) {
  13536. var target = event.target;
  13537. return rcheckableType.test( target.type ) &&
  13538. target.click && nodeName( target, "input" ) &&
  13539. dataPriv.get( target, "click" ) ||
  13540. nodeName( target, "a" );
  13541. }
  13542. },
  13543. beforeunload: {
  13544. postDispatch: function( event ) {
  13545. // Support: Firefox 20+
  13546. // Firefox doesn't alert if the returnValue field is not set.
  13547. if ( event.result !== undefined && event.originalEvent ) {
  13548. event.originalEvent.returnValue = event.result;
  13549. }
  13550. }
  13551. }
  13552. }
  13553. };
  13554. // Ensure the presence of an event listener that handles manually-triggered
  13555. // synthetic events by interrupting progress until reinvoked in response to
  13556. // *native* events that it fires directly, ensuring that state changes have
  13557. // already occurred before other listeners are invoked.
  13558. function leverageNative( el, type, expectSync ) {
  13559. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  13560. if ( !expectSync ) {
  13561. if ( dataPriv.get( el, type ) === undefined ) {
  13562. jQuery.event.add( el, type, returnTrue );
  13563. }
  13564. return;
  13565. }
  13566. // Register the controller as a special universal handler for all event namespaces
  13567. dataPriv.set( el, type, false );
  13568. jQuery.event.add( el, type, {
  13569. namespace: false,
  13570. handler: function( event ) {
  13571. var notAsync, result,
  13572. saved = dataPriv.get( this, type );
  13573. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  13574. // Interrupt processing of the outer synthetic .trigger()ed event
  13575. // Saved data should be false in such cases, but might be a leftover capture object
  13576. // from an async native handler (gh-4350)
  13577. if ( !saved.length ) {
  13578. // Store arguments for use when handling the inner native event
  13579. // There will always be at least one argument (an event object), so this array
  13580. // will not be confused with a leftover capture object.
  13581. saved = slice.call( arguments );
  13582. dataPriv.set( this, type, saved );
  13583. // Trigger the native event and capture its result
  13584. // Support: IE <=9 - 11+
  13585. // focus() and blur() are asynchronous
  13586. notAsync = expectSync( this, type );
  13587. this[ type ]();
  13588. result = dataPriv.get( this, type );
  13589. if ( saved !== result || notAsync ) {
  13590. dataPriv.set( this, type, false );
  13591. } else {
  13592. result = {};
  13593. }
  13594. if ( saved !== result ) {
  13595. // Cancel the outer synthetic event
  13596. event.stopImmediatePropagation();
  13597. event.preventDefault();
  13598. return result.value;
  13599. }
  13600. // If this is an inner synthetic event for an event with a bubbling surrogate
  13601. // (focus or blur), assume that the surrogate already propagated from triggering the
  13602. // native event and prevent that from happening again here.
  13603. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  13604. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  13605. // less bad than duplication.
  13606. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  13607. event.stopPropagation();
  13608. }
  13609. // If this is a native event triggered above, everything is now in order
  13610. // Fire an inner synthetic event with the original arguments
  13611. } else if ( saved.length ) {
  13612. // ...and capture the result
  13613. dataPriv.set( this, type, {
  13614. value: jQuery.event.trigger(
  13615. // Support: IE <=9 - 11+
  13616. // Extend with the prototype to reset the above stopImmediatePropagation()
  13617. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  13618. saved.slice( 1 ),
  13619. this
  13620. )
  13621. } );
  13622. // Abort handling of the native event
  13623. event.stopImmediatePropagation();
  13624. }
  13625. }
  13626. } );
  13627. }
  13628. jQuery.removeEvent = function( elem, type, handle ) {
  13629. // This "if" is needed for plain objects
  13630. if ( elem.removeEventListener ) {
  13631. elem.removeEventListener( type, handle );
  13632. }
  13633. };
  13634. jQuery.Event = function( src, props ) {
  13635. // Allow instantiation without the 'new' keyword
  13636. if ( !( this instanceof jQuery.Event ) ) {
  13637. return new jQuery.Event( src, props );
  13638. }
  13639. // Event object
  13640. if ( src && src.type ) {
  13641. this.originalEvent = src;
  13642. this.type = src.type;
  13643. // Events bubbling up the document may have been marked as prevented
  13644. // by a handler lower down the tree; reflect the correct value.
  13645. this.isDefaultPrevented = src.defaultPrevented ||
  13646. src.defaultPrevented === undefined &&
  13647. // Support: Android <=2.3 only
  13648. src.returnValue === false ?
  13649. returnTrue :
  13650. returnFalse;
  13651. // Create target properties
  13652. // Support: Safari <=6 - 7 only
  13653. // Target should not be a text node (#504, #13143)
  13654. this.target = ( src.target && src.target.nodeType === 3 ) ?
  13655. src.target.parentNode :
  13656. src.target;
  13657. this.currentTarget = src.currentTarget;
  13658. this.relatedTarget = src.relatedTarget;
  13659. // Event type
  13660. } else {
  13661. this.type = src;
  13662. }
  13663. // Put explicitly provided properties onto the event object
  13664. if ( props ) {
  13665. jQuery.extend( this, props );
  13666. }
  13667. // Create a timestamp if incoming event doesn't have one
  13668. this.timeStamp = src && src.timeStamp || Date.now();
  13669. // Mark it as fixed
  13670. this[ jQuery.expando ] = true;
  13671. };
  13672. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  13673. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  13674. jQuery.Event.prototype = {
  13675. constructor: jQuery.Event,
  13676. isDefaultPrevented: returnFalse,
  13677. isPropagationStopped: returnFalse,
  13678. isImmediatePropagationStopped: returnFalse,
  13679. isSimulated: false,
  13680. preventDefault: function() {
  13681. var e = this.originalEvent;
  13682. this.isDefaultPrevented = returnTrue;
  13683. if ( e && !this.isSimulated ) {
  13684. e.preventDefault();
  13685. }
  13686. },
  13687. stopPropagation: function() {
  13688. var e = this.originalEvent;
  13689. this.isPropagationStopped = returnTrue;
  13690. if ( e && !this.isSimulated ) {
  13691. e.stopPropagation();
  13692. }
  13693. },
  13694. stopImmediatePropagation: function() {
  13695. var e = this.originalEvent;
  13696. this.isImmediatePropagationStopped = returnTrue;
  13697. if ( e && !this.isSimulated ) {
  13698. e.stopImmediatePropagation();
  13699. }
  13700. this.stopPropagation();
  13701. }
  13702. };
  13703. // Includes all common event props including KeyEvent and MouseEvent specific props
  13704. jQuery.each( {
  13705. altKey: true,
  13706. bubbles: true,
  13707. cancelable: true,
  13708. changedTouches: true,
  13709. ctrlKey: true,
  13710. detail: true,
  13711. eventPhase: true,
  13712. metaKey: true,
  13713. pageX: true,
  13714. pageY: true,
  13715. shiftKey: true,
  13716. view: true,
  13717. "char": true,
  13718. code: true,
  13719. charCode: true,
  13720. key: true,
  13721. keyCode: true,
  13722. button: true,
  13723. buttons: true,
  13724. clientX: true,
  13725. clientY: true,
  13726. offsetX: true,
  13727. offsetY: true,
  13728. pointerId: true,
  13729. pointerType: true,
  13730. screenX: true,
  13731. screenY: true,
  13732. targetTouches: true,
  13733. toElement: true,
  13734. touches: true,
  13735. which: function( event ) {
  13736. var button = event.button;
  13737. // Add which for key events
  13738. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  13739. return event.charCode != null ? event.charCode : event.keyCode;
  13740. }
  13741. // Add which for click: 1 === left; 2 === middle; 3 === right
  13742. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  13743. if ( button & 1 ) {
  13744. return 1;
  13745. }
  13746. if ( button & 2 ) {
  13747. return 3;
  13748. }
  13749. if ( button & 4 ) {
  13750. return 2;
  13751. }
  13752. return 0;
  13753. }
  13754. return event.which;
  13755. }
  13756. }, jQuery.event.addProp );
  13757. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  13758. jQuery.event.special[ type ] = {
  13759. // Utilize native event if possible so blur/focus sequence is correct
  13760. setup: function() {
  13761. // Claim the first handler
  13762. // dataPriv.set( this, "focus", ... )
  13763. // dataPriv.set( this, "blur", ... )
  13764. leverageNative( this, type, expectSync );
  13765. // Return false to allow normal processing in the caller
  13766. return false;
  13767. },
  13768. trigger: function() {
  13769. // Force setup before trigger
  13770. leverageNative( this, type );
  13771. // Return non-false to allow normal event-path propagation
  13772. return true;
  13773. },
  13774. delegateType: delegateType
  13775. };
  13776. } );
  13777. // Create mouseenter/leave events using mouseover/out and event-time checks
  13778. // so that event delegation works in jQuery.
  13779. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  13780. //
  13781. // Support: Safari 7 only
  13782. // Safari sends mouseenter too often; see:
  13783. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  13784. // for the description of the bug (it existed in older Chrome versions as well).
  13785. jQuery.each( {
  13786. mouseenter: "mouseover",
  13787. mouseleave: "mouseout",
  13788. pointerenter: "pointerover",
  13789. pointerleave: "pointerout"
  13790. }, function( orig, fix ) {
  13791. jQuery.event.special[ orig ] = {
  13792. delegateType: fix,
  13793. bindType: fix,
  13794. handle: function( event ) {
  13795. var ret,
  13796. target = this,
  13797. related = event.relatedTarget,
  13798. handleObj = event.handleObj;
  13799. // For mouseenter/leave call the handler if related is outside the target.
  13800. // NB: No relatedTarget if the mouse left/entered the browser window
  13801. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  13802. event.type = handleObj.origType;
  13803. ret = handleObj.handler.apply( this, arguments );
  13804. event.type = fix;
  13805. }
  13806. return ret;
  13807. }
  13808. };
  13809. } );
  13810. jQuery.fn.extend( {
  13811. on: function( types, selector, data, fn ) {
  13812. return on( this, types, selector, data, fn );
  13813. },
  13814. one: function( types, selector, data, fn ) {
  13815. return on( this, types, selector, data, fn, 1 );
  13816. },
  13817. off: function( types, selector, fn ) {
  13818. var handleObj, type;
  13819. if ( types && types.preventDefault && types.handleObj ) {
  13820. // ( event ) dispatched jQuery.Event
  13821. handleObj = types.handleObj;
  13822. jQuery( types.delegateTarget ).off(
  13823. handleObj.namespace ?
  13824. handleObj.origType + "." + handleObj.namespace :
  13825. handleObj.origType,
  13826. handleObj.selector,
  13827. handleObj.handler
  13828. );
  13829. return this;
  13830. }
  13831. if ( typeof types === "object" ) {
  13832. // ( types-object [, selector] )
  13833. for ( type in types ) {
  13834. this.off( type, selector, types[ type ] );
  13835. }
  13836. return this;
  13837. }
  13838. if ( selector === false || typeof selector === "function" ) {
  13839. // ( types [, fn] )
  13840. fn = selector;
  13841. selector = undefined;
  13842. }
  13843. if ( fn === false ) {
  13844. fn = returnFalse;
  13845. }
  13846. return this.each( function() {
  13847. jQuery.event.remove( this, types, fn, selector );
  13848. } );
  13849. }
  13850. } );
  13851. var
  13852. /* eslint-disable max-len */
  13853. // See https://github.com/eslint/eslint/issues/3229
  13854. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  13855. /* eslint-enable */
  13856. // Support: IE <=10 - 11, Edge 12 - 13 only
  13857. // In IE/Edge using regex groups here causes severe slowdowns.
  13858. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  13859. rnoInnerhtml = /<script|<style|<link/i,
  13860. // checked="checked" or checked
  13861. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  13862. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  13863. // Prefer a tbody over its parent table for containing new rows
  13864. function manipulationTarget( elem, content ) {
  13865. if ( nodeName( elem, "table" ) &&
  13866. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  13867. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  13868. }
  13869. return elem;
  13870. }
  13871. // Replace/restore the type attribute of script elements for safe DOM manipulation
  13872. function disableScript( elem ) {
  13873. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  13874. return elem;
  13875. }
  13876. function restoreScript( elem ) {
  13877. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  13878. elem.type = elem.type.slice( 5 );
  13879. } else {
  13880. elem.removeAttribute( "type" );
  13881. }
  13882. return elem;
  13883. }
  13884. function cloneCopyEvent( src, dest ) {
  13885. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  13886. if ( dest.nodeType !== 1 ) {
  13887. return;
  13888. }
  13889. // 1. Copy private data: events, handlers, etc.
  13890. if ( dataPriv.hasData( src ) ) {
  13891. pdataOld = dataPriv.access( src );
  13892. pdataCur = dataPriv.set( dest, pdataOld );
  13893. events = pdataOld.events;
  13894. if ( events ) {
  13895. delete pdataCur.handle;
  13896. pdataCur.events = {};
  13897. for ( type in events ) {
  13898. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  13899. jQuery.event.add( dest, type, events[ type ][ i ] );
  13900. }
  13901. }
  13902. }
  13903. }
  13904. // 2. Copy user data
  13905. if ( dataUser.hasData( src ) ) {
  13906. udataOld = dataUser.access( src );
  13907. udataCur = jQuery.extend( {}, udataOld );
  13908. dataUser.set( dest, udataCur );
  13909. }
  13910. }
  13911. // Fix IE bugs, see support tests
  13912. function fixInput( src, dest ) {
  13913. var nodeName = dest.nodeName.toLowerCase();
  13914. // Fails to persist the checked state of a cloned checkbox or radio button.
  13915. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  13916. dest.checked = src.checked;
  13917. // Fails to return the selected option to the default selected state when cloning options
  13918. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  13919. dest.defaultValue = src.defaultValue;
  13920. }
  13921. }
  13922. function domManip( collection, args, callback, ignored ) {
  13923. // Flatten any nested arrays
  13924. args = concat.apply( [], args );
  13925. var fragment, first, scripts, hasScripts, node, doc,
  13926. i = 0,
  13927. l = collection.length,
  13928. iNoClone = l - 1,
  13929. value = args[ 0 ],
  13930. valueIsFunction = isFunction( value );
  13931. // We can't cloneNode fragments that contain checked, in WebKit
  13932. if ( valueIsFunction ||
  13933. ( l > 1 && typeof value === "string" &&
  13934. !support.checkClone && rchecked.test( value ) ) ) {
  13935. return collection.each( function( index ) {
  13936. var self = collection.eq( index );
  13937. if ( valueIsFunction ) {
  13938. args[ 0 ] = value.call( this, index, self.html() );
  13939. }
  13940. domManip( self, args, callback, ignored );
  13941. } );
  13942. }
  13943. if ( l ) {
  13944. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  13945. first = fragment.firstChild;
  13946. if ( fragment.childNodes.length === 1 ) {
  13947. fragment = first;
  13948. }
  13949. // Require either new content or an interest in ignored elements to invoke the callback
  13950. if ( first || ignored ) {
  13951. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  13952. hasScripts = scripts.length;
  13953. // Use the original fragment for the last item
  13954. // instead of the first because it can end up
  13955. // being emptied incorrectly in certain situations (#8070).
  13956. for ( ; i < l; i++ ) {
  13957. node = fragment;
  13958. if ( i !== iNoClone ) {
  13959. node = jQuery.clone( node, true, true );
  13960. // Keep references to cloned scripts for later restoration
  13961. if ( hasScripts ) {
  13962. // Support: Android <=4.0 only, PhantomJS 1 only
  13963. // push.apply(_, arraylike) throws on ancient WebKit
  13964. jQuery.merge( scripts, getAll( node, "script" ) );
  13965. }
  13966. }
  13967. callback.call( collection[ i ], node, i );
  13968. }
  13969. if ( hasScripts ) {
  13970. doc = scripts[ scripts.length - 1 ].ownerDocument;
  13971. // Reenable scripts
  13972. jQuery.map( scripts, restoreScript );
  13973. // Evaluate executable scripts on first document insertion
  13974. for ( i = 0; i < hasScripts; i++ ) {
  13975. node = scripts[ i ];
  13976. if ( rscriptType.test( node.type || "" ) &&
  13977. !dataPriv.access( node, "globalEval" ) &&
  13978. jQuery.contains( doc, node ) ) {
  13979. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  13980. // Optional AJAX dependency, but won't run scripts if not present
  13981. if ( jQuery._evalUrl && !node.noModule ) {
  13982. jQuery._evalUrl( node.src, {
  13983. nonce: node.nonce || node.getAttribute( "nonce" )
  13984. } );
  13985. }
  13986. } else {
  13987. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  13988. }
  13989. }
  13990. }
  13991. }
  13992. }
  13993. }
  13994. return collection;
  13995. }
  13996. function remove( elem, selector, keepData ) {
  13997. var node,
  13998. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  13999. i = 0;
  14000. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  14001. if ( !keepData && node.nodeType === 1 ) {
  14002. jQuery.cleanData( getAll( node ) );
  14003. }
  14004. if ( node.parentNode ) {
  14005. if ( keepData && isAttached( node ) ) {
  14006. setGlobalEval( getAll( node, "script" ) );
  14007. }
  14008. node.parentNode.removeChild( node );
  14009. }
  14010. }
  14011. return elem;
  14012. }
  14013. jQuery.extend( {
  14014. htmlPrefilter: function( html ) {
  14015. return html.replace( rxhtmlTag, "<$1></$2>" );
  14016. },
  14017. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  14018. var i, l, srcElements, destElements,
  14019. clone = elem.cloneNode( true ),
  14020. inPage = isAttached( elem );
  14021. // Fix IE cloning issues
  14022. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  14023. !jQuery.isXMLDoc( elem ) ) {
  14024. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  14025. destElements = getAll( clone );
  14026. srcElements = getAll( elem );
  14027. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  14028. fixInput( srcElements[ i ], destElements[ i ] );
  14029. }
  14030. }
  14031. // Copy the events from the original to the clone
  14032. if ( dataAndEvents ) {
  14033. if ( deepDataAndEvents ) {
  14034. srcElements = srcElements || getAll( elem );
  14035. destElements = destElements || getAll( clone );
  14036. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  14037. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  14038. }
  14039. } else {
  14040. cloneCopyEvent( elem, clone );
  14041. }
  14042. }
  14043. // Preserve script evaluation history
  14044. destElements = getAll( clone, "script" );
  14045. if ( destElements.length > 0 ) {
  14046. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  14047. }
  14048. // Return the cloned set
  14049. return clone;
  14050. },
  14051. cleanData: function( elems ) {
  14052. var data, elem, type,
  14053. special = jQuery.event.special,
  14054. i = 0;
  14055. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  14056. if ( acceptData( elem ) ) {
  14057. if ( ( data = elem[ dataPriv.expando ] ) ) {
  14058. if ( data.events ) {
  14059. for ( type in data.events ) {
  14060. if ( special[ type ] ) {
  14061. jQuery.event.remove( elem, type );
  14062. // This is a shortcut to avoid jQuery.event.remove's overhead
  14063. } else {
  14064. jQuery.removeEvent( elem, type, data.handle );
  14065. }
  14066. }
  14067. }
  14068. // Support: Chrome <=35 - 45+
  14069. // Assign undefined instead of using delete, see Data#remove
  14070. elem[ dataPriv.expando ] = undefined;
  14071. }
  14072. if ( elem[ dataUser.expando ] ) {
  14073. // Support: Chrome <=35 - 45+
  14074. // Assign undefined instead of using delete, see Data#remove
  14075. elem[ dataUser.expando ] = undefined;
  14076. }
  14077. }
  14078. }
  14079. }
  14080. } );
  14081. jQuery.fn.extend( {
  14082. detach: function( selector ) {
  14083. return remove( this, selector, true );
  14084. },
  14085. remove: function( selector ) {
  14086. return remove( this, selector );
  14087. },
  14088. text: function( value ) {
  14089. return access( this, function( value ) {
  14090. return value === undefined ?
  14091. jQuery.text( this ) :
  14092. this.empty().each( function() {
  14093. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  14094. this.textContent = value;
  14095. }
  14096. } );
  14097. }, null, value, arguments.length );
  14098. },
  14099. append: function() {
  14100. return domManip( this, arguments, function( elem ) {
  14101. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  14102. var target = manipulationTarget( this, elem );
  14103. target.appendChild( elem );
  14104. }
  14105. } );
  14106. },
  14107. prepend: function() {
  14108. return domManip( this, arguments, function( elem ) {
  14109. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  14110. var target = manipulationTarget( this, elem );
  14111. target.insertBefore( elem, target.firstChild );
  14112. }
  14113. } );
  14114. },
  14115. before: function() {
  14116. return domManip( this, arguments, function( elem ) {
  14117. if ( this.parentNode ) {
  14118. this.parentNode.insertBefore( elem, this );
  14119. }
  14120. } );
  14121. },
  14122. after: function() {
  14123. return domManip( this, arguments, function( elem ) {
  14124. if ( this.parentNode ) {
  14125. this.parentNode.insertBefore( elem, this.nextSibling );
  14126. }
  14127. } );
  14128. },
  14129. empty: function() {
  14130. var elem,
  14131. i = 0;
  14132. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  14133. if ( elem.nodeType === 1 ) {
  14134. // Prevent memory leaks
  14135. jQuery.cleanData( getAll( elem, false ) );
  14136. // Remove any remaining nodes
  14137. elem.textContent = "";
  14138. }
  14139. }
  14140. return this;
  14141. },
  14142. clone: function( dataAndEvents, deepDataAndEvents ) {
  14143. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  14144. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  14145. return this.map( function() {
  14146. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  14147. } );
  14148. },
  14149. html: function( value ) {
  14150. return access( this, function( value ) {
  14151. var elem = this[ 0 ] || {},
  14152. i = 0,
  14153. l = this.length;
  14154. if ( value === undefined && elem.nodeType === 1 ) {
  14155. return elem.innerHTML;
  14156. }
  14157. // See if we can take a shortcut and just use innerHTML
  14158. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  14159. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  14160. value = jQuery.htmlPrefilter( value );
  14161. try {
  14162. for ( ; i < l; i++ ) {
  14163. elem = this[ i ] || {};
  14164. // Remove element nodes and prevent memory leaks
  14165. if ( elem.nodeType === 1 ) {
  14166. jQuery.cleanData( getAll( elem, false ) );
  14167. elem.innerHTML = value;
  14168. }
  14169. }
  14170. elem = 0;
  14171. // If using innerHTML throws an exception, use the fallback method
  14172. } catch ( e ) {}
  14173. }
  14174. if ( elem ) {
  14175. this.empty().append( value );
  14176. }
  14177. }, null, value, arguments.length );
  14178. },
  14179. replaceWith: function() {
  14180. var ignored = [];
  14181. // Make the changes, replacing each non-ignored context element with the new content
  14182. return domManip( this, arguments, function( elem ) {
  14183. var parent = this.parentNode;
  14184. if ( jQuery.inArray( this, ignored ) < 0 ) {
  14185. jQuery.cleanData( getAll( this ) );
  14186. if ( parent ) {
  14187. parent.replaceChild( elem, this );
  14188. }
  14189. }
  14190. // Force callback invocation
  14191. }, ignored );
  14192. }
  14193. } );
  14194. jQuery.each( {
  14195. appendTo: "append",
  14196. prependTo: "prepend",
  14197. insertBefore: "before",
  14198. insertAfter: "after",
  14199. replaceAll: "replaceWith"
  14200. }, function( name, original ) {
  14201. jQuery.fn[ name ] = function( selector ) {
  14202. var elems,
  14203. ret = [],
  14204. insert = jQuery( selector ),
  14205. last = insert.length - 1,
  14206. i = 0;
  14207. for ( ; i <= last; i++ ) {
  14208. elems = i === last ? this : this.clone( true );
  14209. jQuery( insert[ i ] )[ original ]( elems );
  14210. // Support: Android <=4.0 only, PhantomJS 1 only
  14211. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  14212. push.apply( ret, elems.get() );
  14213. }
  14214. return this.pushStack( ret );
  14215. };
  14216. } );
  14217. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  14218. var getStyles = function( elem ) {
  14219. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  14220. // IE throws on elements created in popups
  14221. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  14222. var view = elem.ownerDocument.defaultView;
  14223. if ( !view || !view.opener ) {
  14224. view = window;
  14225. }
  14226. return view.getComputedStyle( elem );
  14227. };
  14228. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  14229. ( function() {
  14230. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  14231. // so they're executed at the same time to save the second computation.
  14232. function computeStyleTests() {
  14233. // This is a singleton, we need to execute it only once
  14234. if ( !div ) {
  14235. return;
  14236. }
  14237. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  14238. "margin-top:1px;padding:0;border:0";
  14239. div.style.cssText =
  14240. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  14241. "margin:auto;border:1px;padding:1px;" +
  14242. "width:60%;top:1%";
  14243. documentElement.appendChild( container ).appendChild( div );
  14244. var divStyle = window.getComputedStyle( div );
  14245. pixelPositionVal = divStyle.top !== "1%";
  14246. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  14247. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  14248. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  14249. // Some styles come back with percentage values, even though they shouldn't
  14250. div.style.right = "60%";
  14251. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  14252. // Support: IE 9 - 11 only
  14253. // Detect misreporting of content dimensions for box-sizing:border-box elements
  14254. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  14255. // Support: IE 9 only
  14256. // Detect overflow:scroll screwiness (gh-3699)
  14257. // Support: Chrome <=64
  14258. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  14259. div.style.position = "absolute";
  14260. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  14261. documentElement.removeChild( container );
  14262. // Nullify the div so it wouldn't be stored in the memory and
  14263. // it will also be a sign that checks already performed
  14264. div = null;
  14265. }
  14266. function roundPixelMeasures( measure ) {
  14267. return Math.round( parseFloat( measure ) );
  14268. }
  14269. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  14270. reliableMarginLeftVal,
  14271. container = document.createElement( "div" ),
  14272. div = document.createElement( "div" );
  14273. // Finish early in limited (non-browser) environments
  14274. if ( !div.style ) {
  14275. return;
  14276. }
  14277. // Support: IE <=9 - 11 only
  14278. // Style of cloned element affects source element cloned (#8908)
  14279. div.style.backgroundClip = "content-box";
  14280. div.cloneNode( true ).style.backgroundClip = "";
  14281. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  14282. jQuery.extend( support, {
  14283. boxSizingReliable: function() {
  14284. computeStyleTests();
  14285. return boxSizingReliableVal;
  14286. },
  14287. pixelBoxStyles: function() {
  14288. computeStyleTests();
  14289. return pixelBoxStylesVal;
  14290. },
  14291. pixelPosition: function() {
  14292. computeStyleTests();
  14293. return pixelPositionVal;
  14294. },
  14295. reliableMarginLeft: function() {
  14296. computeStyleTests();
  14297. return reliableMarginLeftVal;
  14298. },
  14299. scrollboxSize: function() {
  14300. computeStyleTests();
  14301. return scrollboxSizeVal;
  14302. }
  14303. } );
  14304. } )();
  14305. function curCSS( elem, name, computed ) {
  14306. var width, minWidth, maxWidth, ret,
  14307. // Support: Firefox 51+
  14308. // Retrieving style before computed somehow
  14309. // fixes an issue with getting wrong values
  14310. // on detached elements
  14311. style = elem.style;
  14312. computed = computed || getStyles( elem );
  14313. // getPropertyValue is needed for:
  14314. // .css('filter') (IE 9 only, #12537)
  14315. // .css('--customProperty) (#3144)
  14316. if ( computed ) {
  14317. ret = computed.getPropertyValue( name ) || computed[ name ];
  14318. if ( ret === "" && !isAttached( elem ) ) {
  14319. ret = jQuery.style( elem, name );
  14320. }
  14321. // A tribute to the "awesome hack by Dean Edwards"
  14322. // Android Browser returns percentage for some values,
  14323. // but width seems to be reliably pixels.
  14324. // This is against the CSSOM draft spec:
  14325. // https://drafts.csswg.org/cssom/#resolved-values
  14326. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  14327. // Remember the original values
  14328. width = style.width;
  14329. minWidth = style.minWidth;
  14330. maxWidth = style.maxWidth;
  14331. // Put in the new values to get a computed value out
  14332. style.minWidth = style.maxWidth = style.width = ret;
  14333. ret = computed.width;
  14334. // Revert the changed values
  14335. style.width = width;
  14336. style.minWidth = minWidth;
  14337. style.maxWidth = maxWidth;
  14338. }
  14339. }
  14340. return ret !== undefined ?
  14341. // Support: IE <=9 - 11 only
  14342. // IE returns zIndex value as an integer.
  14343. ret + "" :
  14344. ret;
  14345. }
  14346. function addGetHookIf( conditionFn, hookFn ) {
  14347. // Define the hook, we'll check on the first run if it's really needed.
  14348. return {
  14349. get: function() {
  14350. if ( conditionFn() ) {
  14351. // Hook not needed (or it's not possible to use it due
  14352. // to missing dependency), remove it.
  14353. delete this.get;
  14354. return;
  14355. }
  14356. // Hook needed; redefine it so that the support test is not executed again.
  14357. return ( this.get = hookFn ).apply( this, arguments );
  14358. }
  14359. };
  14360. }
  14361. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  14362. emptyStyle = document.createElement( "div" ).style,
  14363. vendorProps = {};
  14364. // Return a vendor-prefixed property or undefined
  14365. function vendorPropName( name ) {
  14366. // Check for vendor prefixed names
  14367. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  14368. i = cssPrefixes.length;
  14369. while ( i-- ) {
  14370. name = cssPrefixes[ i ] + capName;
  14371. if ( name in emptyStyle ) {
  14372. return name;
  14373. }
  14374. }
  14375. }
  14376. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  14377. function finalPropName( name ) {
  14378. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  14379. if ( final ) {
  14380. return final;
  14381. }
  14382. if ( name in emptyStyle ) {
  14383. return name;
  14384. }
  14385. return vendorProps[ name ] = vendorPropName( name ) || name;
  14386. }
  14387. var
  14388. // Swappable if display is none or starts with table
  14389. // except "table", "table-cell", or "table-caption"
  14390. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  14391. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  14392. rcustomProp = /^--/,
  14393. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  14394. cssNormalTransform = {
  14395. letterSpacing: "0",
  14396. fontWeight: "400"
  14397. };
  14398. function setPositiveNumber( elem, value, subtract ) {
  14399. // Any relative (+/-) values have already been
  14400. // normalized at this point
  14401. var matches = rcssNum.exec( value );
  14402. return matches ?
  14403. // Guard against undefined "subtract", e.g., when used as in cssHooks
  14404. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  14405. value;
  14406. }
  14407. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  14408. var i = dimension === "width" ? 1 : 0,
  14409. extra = 0,
  14410. delta = 0;
  14411. // Adjustment may not be necessary
  14412. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  14413. return 0;
  14414. }
  14415. for ( ; i < 4; i += 2 ) {
  14416. // Both box models exclude margin
  14417. if ( box === "margin" ) {
  14418. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  14419. }
  14420. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  14421. if ( !isBorderBox ) {
  14422. // Add padding
  14423. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  14424. // For "border" or "margin", add border
  14425. if ( box !== "padding" ) {
  14426. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  14427. // But still keep track of it otherwise
  14428. } else {
  14429. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  14430. }
  14431. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  14432. // "padding" or "margin"
  14433. } else {
  14434. // For "content", subtract padding
  14435. if ( box === "content" ) {
  14436. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  14437. }
  14438. // For "content" or "padding", subtract border
  14439. if ( box !== "margin" ) {
  14440. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  14441. }
  14442. }
  14443. }
  14444. // Account for positive content-box scroll gutter when requested by providing computedVal
  14445. if ( !isBorderBox && computedVal >= 0 ) {
  14446. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  14447. // Assuming integer scroll gutter, subtract the rest and round down
  14448. delta += Math.max( 0, Math.ceil(
  14449. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  14450. computedVal -
  14451. delta -
  14452. extra -
  14453. 0.5
  14454. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  14455. // Use an explicit zero to avoid NaN (gh-3964)
  14456. ) ) || 0;
  14457. }
  14458. return delta;
  14459. }
  14460. function getWidthOrHeight( elem, dimension, extra ) {
  14461. // Start with computed style
  14462. var styles = getStyles( elem ),
  14463. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  14464. // Fake content-box until we know it's needed to know the true value.
  14465. boxSizingNeeded = !support.boxSizingReliable() || extra,
  14466. isBorderBox = boxSizingNeeded &&
  14467. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14468. valueIsBorderBox = isBorderBox,
  14469. val = curCSS( elem, dimension, styles ),
  14470. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  14471. // Support: Firefox <=54
  14472. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  14473. if ( rnumnonpx.test( val ) ) {
  14474. if ( !extra ) {
  14475. return val;
  14476. }
  14477. val = "auto";
  14478. }
  14479. // Fall back to offsetWidth/offsetHeight when value is "auto"
  14480. // This happens for inline elements with no explicit setting (gh-3571)
  14481. // Support: Android <=4.1 - 4.3 only
  14482. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  14483. // Support: IE 9-11 only
  14484. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  14485. // We use getClientRects() to check for hidden/disconnected.
  14486. // In those cases, the computed value can be trusted to be border-box
  14487. if ( ( !support.boxSizingReliable() && isBorderBox ||
  14488. val === "auto" ||
  14489. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  14490. elem.getClientRects().length ) {
  14491. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  14492. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  14493. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  14494. // retrieved value as a content box dimension.
  14495. valueIsBorderBox = offsetProp in elem;
  14496. if ( valueIsBorderBox ) {
  14497. val = elem[ offsetProp ];
  14498. }
  14499. }
  14500. // Normalize "" and auto
  14501. val = parseFloat( val ) || 0;
  14502. // Adjust for the element's box model
  14503. return ( val +
  14504. boxModelAdjustment(
  14505. elem,
  14506. dimension,
  14507. extra || ( isBorderBox ? "border" : "content" ),
  14508. valueIsBorderBox,
  14509. styles,
  14510. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  14511. val
  14512. )
  14513. ) + "px";
  14514. }
  14515. jQuery.extend( {
  14516. // Add in style property hooks for overriding the default
  14517. // behavior of getting and setting a style property
  14518. cssHooks: {
  14519. opacity: {
  14520. get: function( elem, computed ) {
  14521. if ( computed ) {
  14522. // We should always get a number back from opacity
  14523. var ret = curCSS( elem, "opacity" );
  14524. return ret === "" ? "1" : ret;
  14525. }
  14526. }
  14527. }
  14528. },
  14529. // Don't automatically add "px" to these possibly-unitless properties
  14530. cssNumber: {
  14531. "animationIterationCount": true,
  14532. "columnCount": true,
  14533. "fillOpacity": true,
  14534. "flexGrow": true,
  14535. "flexShrink": true,
  14536. "fontWeight": true,
  14537. "gridArea": true,
  14538. "gridColumn": true,
  14539. "gridColumnEnd": true,
  14540. "gridColumnStart": true,
  14541. "gridRow": true,
  14542. "gridRowEnd": true,
  14543. "gridRowStart": true,
  14544. "lineHeight": true,
  14545. "opacity": true,
  14546. "order": true,
  14547. "orphans": true,
  14548. "widows": true,
  14549. "zIndex": true,
  14550. "zoom": true
  14551. },
  14552. // Add in properties whose names you wish to fix before
  14553. // setting or getting the value
  14554. cssProps: {},
  14555. // Get and set the style property on a DOM Node
  14556. style: function( elem, name, value, extra ) {
  14557. // Don't set styles on text and comment nodes
  14558. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  14559. return;
  14560. }
  14561. // Make sure that we're working with the right name
  14562. var ret, type, hooks,
  14563. origName = camelCase( name ),
  14564. isCustomProp = rcustomProp.test( name ),
  14565. style = elem.style;
  14566. // Make sure that we're working with the right name. We don't
  14567. // want to query the value if it is a CSS custom property
  14568. // since they are user-defined.
  14569. if ( !isCustomProp ) {
  14570. name = finalPropName( origName );
  14571. }
  14572. // Gets hook for the prefixed version, then unprefixed version
  14573. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14574. // Check if we're setting a value
  14575. if ( value !== undefined ) {
  14576. type = typeof value;
  14577. // Convert "+=" or "-=" to relative numbers (#7345)
  14578. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  14579. value = adjustCSS( elem, name, ret );
  14580. // Fixes bug #9237
  14581. type = "number";
  14582. }
  14583. // Make sure that null and NaN values aren't set (#7116)
  14584. if ( value == null || value !== value ) {
  14585. return;
  14586. }
  14587. // If a number was passed in, add the unit (except for certain CSS properties)
  14588. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  14589. // "px" to a few hardcoded values.
  14590. if ( type === "number" && !isCustomProp ) {
  14591. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  14592. }
  14593. // background-* props affect original clone's values
  14594. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  14595. style[ name ] = "inherit";
  14596. }
  14597. // If a hook was provided, use that value, otherwise just set the specified value
  14598. if ( !hooks || !( "set" in hooks ) ||
  14599. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  14600. if ( isCustomProp ) {
  14601. style.setProperty( name, value );
  14602. } else {
  14603. style[ name ] = value;
  14604. }
  14605. }
  14606. } else {
  14607. // If a hook was provided get the non-computed value from there
  14608. if ( hooks && "get" in hooks &&
  14609. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  14610. return ret;
  14611. }
  14612. // Otherwise just get the value from the style object
  14613. return style[ name ];
  14614. }
  14615. },
  14616. css: function( elem, name, extra, styles ) {
  14617. var val, num, hooks,
  14618. origName = camelCase( name ),
  14619. isCustomProp = rcustomProp.test( name );
  14620. // Make sure that we're working with the right name. We don't
  14621. // want to modify the value if it is a CSS custom property
  14622. // since they are user-defined.
  14623. if ( !isCustomProp ) {
  14624. name = finalPropName( origName );
  14625. }
  14626. // Try prefixed name followed by the unprefixed name
  14627. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14628. // If a hook was provided get the computed value from there
  14629. if ( hooks && "get" in hooks ) {
  14630. val = hooks.get( elem, true, extra );
  14631. }
  14632. // Otherwise, if a way to get the computed value exists, use that
  14633. if ( val === undefined ) {
  14634. val = curCSS( elem, name, styles );
  14635. }
  14636. // Convert "normal" to computed value
  14637. if ( val === "normal" && name in cssNormalTransform ) {
  14638. val = cssNormalTransform[ name ];
  14639. }
  14640. // Make numeric if forced or a qualifier was provided and val looks numeric
  14641. if ( extra === "" || extra ) {
  14642. num = parseFloat( val );
  14643. return extra === true || isFinite( num ) ? num || 0 : val;
  14644. }
  14645. return val;
  14646. }
  14647. } );
  14648. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  14649. jQuery.cssHooks[ dimension ] = {
  14650. get: function( elem, computed, extra ) {
  14651. if ( computed ) {
  14652. // Certain elements can have dimension info if we invisibly show them
  14653. // but it must have a current display style that would benefit
  14654. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  14655. // Support: Safari 8+
  14656. // Table columns in Safari have non-zero offsetWidth & zero
  14657. // getBoundingClientRect().width unless display is changed.
  14658. // Support: IE <=11 only
  14659. // Running getBoundingClientRect on a disconnected node
  14660. // in IE throws an error.
  14661. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  14662. swap( elem, cssShow, function() {
  14663. return getWidthOrHeight( elem, dimension, extra );
  14664. } ) :
  14665. getWidthOrHeight( elem, dimension, extra );
  14666. }
  14667. },
  14668. set: function( elem, value, extra ) {
  14669. var matches,
  14670. styles = getStyles( elem ),
  14671. // Only read styles.position if the test has a chance to fail
  14672. // to avoid forcing a reflow.
  14673. scrollboxSizeBuggy = !support.scrollboxSize() &&
  14674. styles.position === "absolute",
  14675. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  14676. boxSizingNeeded = scrollboxSizeBuggy || extra,
  14677. isBorderBox = boxSizingNeeded &&
  14678. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14679. subtract = extra ?
  14680. boxModelAdjustment(
  14681. elem,
  14682. dimension,
  14683. extra,
  14684. isBorderBox,
  14685. styles
  14686. ) :
  14687. 0;
  14688. // Account for unreliable border-box dimensions by comparing offset* to computed and
  14689. // faking a content-box to get border and padding (gh-3699)
  14690. if ( isBorderBox && scrollboxSizeBuggy ) {
  14691. subtract -= Math.ceil(
  14692. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  14693. parseFloat( styles[ dimension ] ) -
  14694. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  14695. 0.5
  14696. );
  14697. }
  14698. // Convert to pixels if value adjustment is needed
  14699. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  14700. ( matches[ 3 ] || "px" ) !== "px" ) {
  14701. elem.style[ dimension ] = value;
  14702. value = jQuery.css( elem, dimension );
  14703. }
  14704. return setPositiveNumber( elem, value, subtract );
  14705. }
  14706. };
  14707. } );
  14708. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  14709. function( elem, computed ) {
  14710. if ( computed ) {
  14711. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  14712. elem.getBoundingClientRect().left -
  14713. swap( elem, { marginLeft: 0 }, function() {
  14714. return elem.getBoundingClientRect().left;
  14715. } )
  14716. ) + "px";
  14717. }
  14718. }
  14719. );
  14720. // These hooks are used by animate to expand properties
  14721. jQuery.each( {
  14722. margin: "",
  14723. padding: "",
  14724. border: "Width"
  14725. }, function( prefix, suffix ) {
  14726. jQuery.cssHooks[ prefix + suffix ] = {
  14727. expand: function( value ) {
  14728. var i = 0,
  14729. expanded = {},
  14730. // Assumes a single number if not a string
  14731. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  14732. for ( ; i < 4; i++ ) {
  14733. expanded[ prefix + cssExpand[ i ] + suffix ] =
  14734. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  14735. }
  14736. return expanded;
  14737. }
  14738. };
  14739. if ( prefix !== "margin" ) {
  14740. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  14741. }
  14742. } );
  14743. jQuery.fn.extend( {
  14744. css: function( name, value ) {
  14745. return access( this, function( elem, name, value ) {
  14746. var styles, len,
  14747. map = {},
  14748. i = 0;
  14749. if ( Array.isArray( name ) ) {
  14750. styles = getStyles( elem );
  14751. len = name.length;
  14752. for ( ; i < len; i++ ) {
  14753. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  14754. }
  14755. return map;
  14756. }
  14757. return value !== undefined ?
  14758. jQuery.style( elem, name, value ) :
  14759. jQuery.css( elem, name );
  14760. }, name, value, arguments.length > 1 );
  14761. }
  14762. } );
  14763. function Tween( elem, options, prop, end, easing ) {
  14764. return new Tween.prototype.init( elem, options, prop, end, easing );
  14765. }
  14766. jQuery.Tween = Tween;
  14767. Tween.prototype = {
  14768. constructor: Tween,
  14769. init: function( elem, options, prop, end, easing, unit ) {
  14770. this.elem = elem;
  14771. this.prop = prop;
  14772. this.easing = easing || jQuery.easing._default;
  14773. this.options = options;
  14774. this.start = this.now = this.cur();
  14775. this.end = end;
  14776. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  14777. },
  14778. cur: function() {
  14779. var hooks = Tween.propHooks[ this.prop ];
  14780. return hooks && hooks.get ?
  14781. hooks.get( this ) :
  14782. Tween.propHooks._default.get( this );
  14783. },
  14784. run: function( percent ) {
  14785. var eased,
  14786. hooks = Tween.propHooks[ this.prop ];
  14787. if ( this.options.duration ) {
  14788. this.pos = eased = jQuery.easing[ this.easing ](
  14789. percent, this.options.duration * percent, 0, 1, this.options.duration
  14790. );
  14791. } else {
  14792. this.pos = eased = percent;
  14793. }
  14794. this.now = ( this.end - this.start ) * eased + this.start;
  14795. if ( this.options.step ) {
  14796. this.options.step.call( this.elem, this.now, this );
  14797. }
  14798. if ( hooks && hooks.set ) {
  14799. hooks.set( this );
  14800. } else {
  14801. Tween.propHooks._default.set( this );
  14802. }
  14803. return this;
  14804. }
  14805. };
  14806. Tween.prototype.init.prototype = Tween.prototype;
  14807. Tween.propHooks = {
  14808. _default: {
  14809. get: function( tween ) {
  14810. var result;
  14811. // Use a property on the element directly when it is not a DOM element,
  14812. // or when there is no matching style property that exists.
  14813. if ( tween.elem.nodeType !== 1 ||
  14814. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  14815. return tween.elem[ tween.prop ];
  14816. }
  14817. // Passing an empty string as a 3rd parameter to .css will automatically
  14818. // attempt a parseFloat and fallback to a string if the parse fails.
  14819. // Simple values such as "10px" are parsed to Float;
  14820. // complex values such as "rotate(1rad)" are returned as-is.
  14821. result = jQuery.css( tween.elem, tween.prop, "" );
  14822. // Empty strings, null, undefined and "auto" are converted to 0.
  14823. return !result || result === "auto" ? 0 : result;
  14824. },
  14825. set: function( tween ) {
  14826. // Use step hook for back compat.
  14827. // Use cssHook if its there.
  14828. // Use .style if available and use plain properties where available.
  14829. if ( jQuery.fx.step[ tween.prop ] ) {
  14830. jQuery.fx.step[ tween.prop ]( tween );
  14831. } else if ( tween.elem.nodeType === 1 && (
  14832. jQuery.cssHooks[ tween.prop ] ||
  14833. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  14834. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  14835. } else {
  14836. tween.elem[ tween.prop ] = tween.now;
  14837. }
  14838. }
  14839. }
  14840. };
  14841. // Support: IE <=9 only
  14842. // Panic based approach to setting things on disconnected nodes
  14843. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  14844. set: function( tween ) {
  14845. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  14846. tween.elem[ tween.prop ] = tween.now;
  14847. }
  14848. }
  14849. };
  14850. jQuery.easing = {
  14851. linear: function( p ) {
  14852. return p;
  14853. },
  14854. swing: function( p ) {
  14855. return 0.5 - Math.cos( p * Math.PI ) / 2;
  14856. },
  14857. _default: "swing"
  14858. };
  14859. jQuery.fx = Tween.prototype.init;
  14860. // Back compat <1.8 extension point
  14861. jQuery.fx.step = {};
  14862. var
  14863. fxNow, inProgress,
  14864. rfxtypes = /^(?:toggle|show|hide)$/,
  14865. rrun = /queueHooks$/;
  14866. function schedule() {
  14867. if ( inProgress ) {
  14868. if ( document.hidden === false && window.requestAnimationFrame ) {
  14869. window.requestAnimationFrame( schedule );
  14870. } else {
  14871. window.setTimeout( schedule, jQuery.fx.interval );
  14872. }
  14873. jQuery.fx.tick();
  14874. }
  14875. }
  14876. // Animations created synchronously will run synchronously
  14877. function createFxNow() {
  14878. window.setTimeout( function() {
  14879. fxNow = undefined;
  14880. } );
  14881. return ( fxNow = Date.now() );
  14882. }
  14883. // Generate parameters to create a standard animation
  14884. function genFx( type, includeWidth ) {
  14885. var which,
  14886. i = 0,
  14887. attrs = { height: type };
  14888. // If we include width, step value is 1 to do all cssExpand values,
  14889. // otherwise step value is 2 to skip over Left and Right
  14890. includeWidth = includeWidth ? 1 : 0;
  14891. for ( ; i < 4; i += 2 - includeWidth ) {
  14892. which = cssExpand[ i ];
  14893. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  14894. }
  14895. if ( includeWidth ) {
  14896. attrs.opacity = attrs.width = type;
  14897. }
  14898. return attrs;
  14899. }
  14900. function createTween( value, prop, animation ) {
  14901. var tween,
  14902. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  14903. index = 0,
  14904. length = collection.length;
  14905. for ( ; index < length; index++ ) {
  14906. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  14907. // We're done with this property
  14908. return tween;
  14909. }
  14910. }
  14911. }
  14912. function defaultPrefilter( elem, props, opts ) {
  14913. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  14914. isBox = "width" in props || "height" in props,
  14915. anim = this,
  14916. orig = {},
  14917. style = elem.style,
  14918. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  14919. dataShow = dataPriv.get( elem, "fxshow" );
  14920. // Queue-skipping animations hijack the fx hooks
  14921. if ( !opts.queue ) {
  14922. hooks = jQuery._queueHooks( elem, "fx" );
  14923. if ( hooks.unqueued == null ) {
  14924. hooks.unqueued = 0;
  14925. oldfire = hooks.empty.fire;
  14926. hooks.empty.fire = function() {
  14927. if ( !hooks.unqueued ) {
  14928. oldfire();
  14929. }
  14930. };
  14931. }
  14932. hooks.unqueued++;
  14933. anim.always( function() {
  14934. // Ensure the complete handler is called before this completes
  14935. anim.always( function() {
  14936. hooks.unqueued--;
  14937. if ( !jQuery.queue( elem, "fx" ).length ) {
  14938. hooks.empty.fire();
  14939. }
  14940. } );
  14941. } );
  14942. }
  14943. // Detect show/hide animations
  14944. for ( prop in props ) {
  14945. value = props[ prop ];
  14946. if ( rfxtypes.test( value ) ) {
  14947. delete props[ prop ];
  14948. toggle = toggle || value === "toggle";
  14949. if ( value === ( hidden ? "hide" : "show" ) ) {
  14950. // Pretend to be hidden if this is a "show" and
  14951. // there is still data from a stopped show/hide
  14952. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  14953. hidden = true;
  14954. // Ignore all other no-op show/hide data
  14955. } else {
  14956. continue;
  14957. }
  14958. }
  14959. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  14960. }
  14961. }
  14962. // Bail out if this is a no-op like .hide().hide()
  14963. propTween = !jQuery.isEmptyObject( props );
  14964. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  14965. return;
  14966. }
  14967. // Restrict "overflow" and "display" styles during box animations
  14968. if ( isBox && elem.nodeType === 1 ) {
  14969. // Support: IE <=9 - 11, Edge 12 - 15
  14970. // Record all 3 overflow attributes because IE does not infer the shorthand
  14971. // from identically-valued overflowX and overflowY and Edge just mirrors
  14972. // the overflowX value there.
  14973. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  14974. // Identify a display type, preferring old show/hide data over the CSS cascade
  14975. restoreDisplay = dataShow && dataShow.display;
  14976. if ( restoreDisplay == null ) {
  14977. restoreDisplay = dataPriv.get( elem, "display" );
  14978. }
  14979. display = jQuery.css( elem, "display" );
  14980. if ( display === "none" ) {
  14981. if ( restoreDisplay ) {
  14982. display = restoreDisplay;
  14983. } else {
  14984. // Get nonempty value(s) by temporarily forcing visibility
  14985. showHide( [ elem ], true );
  14986. restoreDisplay = elem.style.display || restoreDisplay;
  14987. display = jQuery.css( elem, "display" );
  14988. showHide( [ elem ] );
  14989. }
  14990. }
  14991. // Animate inline elements as inline-block
  14992. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  14993. if ( jQuery.css( elem, "float" ) === "none" ) {
  14994. // Restore the original display value at the end of pure show/hide animations
  14995. if ( !propTween ) {
  14996. anim.done( function() {
  14997. style.display = restoreDisplay;
  14998. } );
  14999. if ( restoreDisplay == null ) {
  15000. display = style.display;
  15001. restoreDisplay = display === "none" ? "" : display;
  15002. }
  15003. }
  15004. style.display = "inline-block";
  15005. }
  15006. }
  15007. }
  15008. if ( opts.overflow ) {
  15009. style.overflow = "hidden";
  15010. anim.always( function() {
  15011. style.overflow = opts.overflow[ 0 ];
  15012. style.overflowX = opts.overflow[ 1 ];
  15013. style.overflowY = opts.overflow[ 2 ];
  15014. } );
  15015. }
  15016. // Implement show/hide animations
  15017. propTween = false;
  15018. for ( prop in orig ) {
  15019. // General show/hide setup for this element animation
  15020. if ( !propTween ) {
  15021. if ( dataShow ) {
  15022. if ( "hidden" in dataShow ) {
  15023. hidden = dataShow.hidden;
  15024. }
  15025. } else {
  15026. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  15027. }
  15028. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  15029. if ( toggle ) {
  15030. dataShow.hidden = !hidden;
  15031. }
  15032. // Show elements before animating them
  15033. if ( hidden ) {
  15034. showHide( [ elem ], true );
  15035. }
  15036. /* eslint-disable no-loop-func */
  15037. anim.done( function() {
  15038. /* eslint-enable no-loop-func */
  15039. // The final step of a "hide" animation is actually hiding the element
  15040. if ( !hidden ) {
  15041. showHide( [ elem ] );
  15042. }
  15043. dataPriv.remove( elem, "fxshow" );
  15044. for ( prop in orig ) {
  15045. jQuery.style( elem, prop, orig[ prop ] );
  15046. }
  15047. } );
  15048. }
  15049. // Per-property setup
  15050. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  15051. if ( !( prop in dataShow ) ) {
  15052. dataShow[ prop ] = propTween.start;
  15053. if ( hidden ) {
  15054. propTween.end = propTween.start;
  15055. propTween.start = 0;
  15056. }
  15057. }
  15058. }
  15059. }
  15060. function propFilter( props, specialEasing ) {
  15061. var index, name, easing, value, hooks;
  15062. // camelCase, specialEasing and expand cssHook pass
  15063. for ( index in props ) {
  15064. name = camelCase( index );
  15065. easing = specialEasing[ name ];
  15066. value = props[ index ];
  15067. if ( Array.isArray( value ) ) {
  15068. easing = value[ 1 ];
  15069. value = props[ index ] = value[ 0 ];
  15070. }
  15071. if ( index !== name ) {
  15072. props[ name ] = value;
  15073. delete props[ index ];
  15074. }
  15075. hooks = jQuery.cssHooks[ name ];
  15076. if ( hooks && "expand" in hooks ) {
  15077. value = hooks.expand( value );
  15078. delete props[ name ];
  15079. // Not quite $.extend, this won't overwrite existing keys.
  15080. // Reusing 'index' because we have the correct "name"
  15081. for ( index in value ) {
  15082. if ( !( index in props ) ) {
  15083. props[ index ] = value[ index ];
  15084. specialEasing[ index ] = easing;
  15085. }
  15086. }
  15087. } else {
  15088. specialEasing[ name ] = easing;
  15089. }
  15090. }
  15091. }
  15092. function Animation( elem, properties, options ) {
  15093. var result,
  15094. stopped,
  15095. index = 0,
  15096. length = Animation.prefilters.length,
  15097. deferred = jQuery.Deferred().always( function() {
  15098. // Don't match elem in the :animated selector
  15099. delete tick.elem;
  15100. } ),
  15101. tick = function() {
  15102. if ( stopped ) {
  15103. return false;
  15104. }
  15105. var currentTime = fxNow || createFxNow(),
  15106. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  15107. // Support: Android 2.3 only
  15108. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  15109. temp = remaining / animation.duration || 0,
  15110. percent = 1 - temp,
  15111. index = 0,
  15112. length = animation.tweens.length;
  15113. for ( ; index < length; index++ ) {
  15114. animation.tweens[ index ].run( percent );
  15115. }
  15116. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  15117. // If there's more to do, yield
  15118. if ( percent < 1 && length ) {
  15119. return remaining;
  15120. }
  15121. // If this was an empty animation, synthesize a final progress notification
  15122. if ( !length ) {
  15123. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  15124. }
  15125. // Resolve the animation and report its conclusion
  15126. deferred.resolveWith( elem, [ animation ] );
  15127. return false;
  15128. },
  15129. animation = deferred.promise( {
  15130. elem: elem,
  15131. props: jQuery.extend( {}, properties ),
  15132. opts: jQuery.extend( true, {
  15133. specialEasing: {},
  15134. easing: jQuery.easing._default
  15135. }, options ),
  15136. originalProperties: properties,
  15137. originalOptions: options,
  15138. startTime: fxNow || createFxNow(),
  15139. duration: options.duration,
  15140. tweens: [],
  15141. createTween: function( prop, end ) {
  15142. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  15143. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  15144. animation.tweens.push( tween );
  15145. return tween;
  15146. },
  15147. stop: function( gotoEnd ) {
  15148. var index = 0,
  15149. // If we are going to the end, we want to run all the tweens
  15150. // otherwise we skip this part
  15151. length = gotoEnd ? animation.tweens.length : 0;
  15152. if ( stopped ) {
  15153. return this;
  15154. }
  15155. stopped = true;
  15156. for ( ; index < length; index++ ) {
  15157. animation.tweens[ index ].run( 1 );
  15158. }
  15159. // Resolve when we played the last frame; otherwise, reject
  15160. if ( gotoEnd ) {
  15161. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  15162. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  15163. } else {
  15164. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  15165. }
  15166. return this;
  15167. }
  15168. } ),
  15169. props = animation.props;
  15170. propFilter( props, animation.opts.specialEasing );
  15171. for ( ; index < length; index++ ) {
  15172. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  15173. if ( result ) {
  15174. if ( isFunction( result.stop ) ) {
  15175. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  15176. result.stop.bind( result );
  15177. }
  15178. return result;
  15179. }
  15180. }
  15181. jQuery.map( props, createTween, animation );
  15182. if ( isFunction( animation.opts.start ) ) {
  15183. animation.opts.start.call( elem, animation );
  15184. }
  15185. // Attach callbacks from options
  15186. animation
  15187. .progress( animation.opts.progress )
  15188. .done( animation.opts.done, animation.opts.complete )
  15189. .fail( animation.opts.fail )
  15190. .always( animation.opts.always );
  15191. jQuery.fx.timer(
  15192. jQuery.extend( tick, {
  15193. elem: elem,
  15194. anim: animation,
  15195. queue: animation.opts.queue
  15196. } )
  15197. );
  15198. return animation;
  15199. }
  15200. jQuery.Animation = jQuery.extend( Animation, {
  15201. tweeners: {
  15202. "*": [ function( prop, value ) {
  15203. var tween = this.createTween( prop, value );
  15204. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  15205. return tween;
  15206. } ]
  15207. },
  15208. tweener: function( props, callback ) {
  15209. if ( isFunction( props ) ) {
  15210. callback = props;
  15211. props = [ "*" ];
  15212. } else {
  15213. props = props.match( rnothtmlwhite );
  15214. }
  15215. var prop,
  15216. index = 0,
  15217. length = props.length;
  15218. for ( ; index < length; index++ ) {
  15219. prop = props[ index ];
  15220. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  15221. Animation.tweeners[ prop ].unshift( callback );
  15222. }
  15223. },
  15224. prefilters: [ defaultPrefilter ],
  15225. prefilter: function( callback, prepend ) {
  15226. if ( prepend ) {
  15227. Animation.prefilters.unshift( callback );
  15228. } else {
  15229. Animation.prefilters.push( callback );
  15230. }
  15231. }
  15232. } );
  15233. jQuery.speed = function( speed, easing, fn ) {
  15234. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  15235. complete: fn || !fn && easing ||
  15236. isFunction( speed ) && speed,
  15237. duration: speed,
  15238. easing: fn && easing || easing && !isFunction( easing ) && easing
  15239. };
  15240. // Go to the end state if fx are off
  15241. if ( jQuery.fx.off ) {
  15242. opt.duration = 0;
  15243. } else {
  15244. if ( typeof opt.duration !== "number" ) {
  15245. if ( opt.duration in jQuery.fx.speeds ) {
  15246. opt.duration = jQuery.fx.speeds[ opt.duration ];
  15247. } else {
  15248. opt.duration = jQuery.fx.speeds._default;
  15249. }
  15250. }
  15251. }
  15252. // Normalize opt.queue - true/undefined/null -> "fx"
  15253. if ( opt.queue == null || opt.queue === true ) {
  15254. opt.queue = "fx";
  15255. }
  15256. // Queueing
  15257. opt.old = opt.complete;
  15258. opt.complete = function() {
  15259. if ( isFunction( opt.old ) ) {
  15260. opt.old.call( this );
  15261. }
  15262. if ( opt.queue ) {
  15263. jQuery.dequeue( this, opt.queue );
  15264. }
  15265. };
  15266. return opt;
  15267. };
  15268. jQuery.fn.extend( {
  15269. fadeTo: function( speed, to, easing, callback ) {
  15270. // Show any hidden elements after setting opacity to 0
  15271. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  15272. // Animate to the value specified
  15273. .end().animate( { opacity: to }, speed, easing, callback );
  15274. },
  15275. animate: function( prop, speed, easing, callback ) {
  15276. var empty = jQuery.isEmptyObject( prop ),
  15277. optall = jQuery.speed( speed, easing, callback ),
  15278. doAnimation = function() {
  15279. // Operate on a copy of prop so per-property easing won't be lost
  15280. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  15281. // Empty animations, or finishing resolves immediately
  15282. if ( empty || dataPriv.get( this, "finish" ) ) {
  15283. anim.stop( true );
  15284. }
  15285. };
  15286. doAnimation.finish = doAnimation;
  15287. return empty || optall.queue === false ?
  15288. this.each( doAnimation ) :
  15289. this.queue( optall.queue, doAnimation );
  15290. },
  15291. stop: function( type, clearQueue, gotoEnd ) {
  15292. var stopQueue = function( hooks ) {
  15293. var stop = hooks.stop;
  15294. delete hooks.stop;
  15295. stop( gotoEnd );
  15296. };
  15297. if ( typeof type !== "string" ) {
  15298. gotoEnd = clearQueue;
  15299. clearQueue = type;
  15300. type = undefined;
  15301. }
  15302. if ( clearQueue && type !== false ) {
  15303. this.queue( type || "fx", [] );
  15304. }
  15305. return this.each( function() {
  15306. var dequeue = true,
  15307. index = type != null && type + "queueHooks",
  15308. timers = jQuery.timers,
  15309. data = dataPriv.get( this );
  15310. if ( index ) {
  15311. if ( data[ index ] && data[ index ].stop ) {
  15312. stopQueue( data[ index ] );
  15313. }
  15314. } else {
  15315. for ( index in data ) {
  15316. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  15317. stopQueue( data[ index ] );
  15318. }
  15319. }
  15320. }
  15321. for ( index = timers.length; index--; ) {
  15322. if ( timers[ index ].elem === this &&
  15323. ( type == null || timers[ index ].queue === type ) ) {
  15324. timers[ index ].anim.stop( gotoEnd );
  15325. dequeue = false;
  15326. timers.splice( index, 1 );
  15327. }
  15328. }
  15329. // Start the next in the queue if the last step wasn't forced.
  15330. // Timers currently will call their complete callbacks, which
  15331. // will dequeue but only if they were gotoEnd.
  15332. if ( dequeue || !gotoEnd ) {
  15333. jQuery.dequeue( this, type );
  15334. }
  15335. } );
  15336. },
  15337. finish: function( type ) {
  15338. if ( type !== false ) {
  15339. type = type || "fx";
  15340. }
  15341. return this.each( function() {
  15342. var index,
  15343. data = dataPriv.get( this ),
  15344. queue = data[ type + "queue" ],
  15345. hooks = data[ type + "queueHooks" ],
  15346. timers = jQuery.timers,
  15347. length = queue ? queue.length : 0;
  15348. // Enable finishing flag on private data
  15349. data.finish = true;
  15350. // Empty the queue first
  15351. jQuery.queue( this, type, [] );
  15352. if ( hooks && hooks.stop ) {
  15353. hooks.stop.call( this, true );
  15354. }
  15355. // Look for any active animations, and finish them
  15356. for ( index = timers.length; index--; ) {
  15357. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  15358. timers[ index ].anim.stop( true );
  15359. timers.splice( index, 1 );
  15360. }
  15361. }
  15362. // Look for any animations in the old queue and finish them
  15363. for ( index = 0; index < length; index++ ) {
  15364. if ( queue[ index ] && queue[ index ].finish ) {
  15365. queue[ index ].finish.call( this );
  15366. }
  15367. }
  15368. // Turn off finishing flag
  15369. delete data.finish;
  15370. } );
  15371. }
  15372. } );
  15373. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  15374. var cssFn = jQuery.fn[ name ];
  15375. jQuery.fn[ name ] = function( speed, easing, callback ) {
  15376. return speed == null || typeof speed === "boolean" ?
  15377. cssFn.apply( this, arguments ) :
  15378. this.animate( genFx( name, true ), speed, easing, callback );
  15379. };
  15380. } );
  15381. // Generate shortcuts for custom animations
  15382. jQuery.each( {
  15383. slideDown: genFx( "show" ),
  15384. slideUp: genFx( "hide" ),
  15385. slideToggle: genFx( "toggle" ),
  15386. fadeIn: { opacity: "show" },
  15387. fadeOut: { opacity: "hide" },
  15388. fadeToggle: { opacity: "toggle" }
  15389. }, function( name, props ) {
  15390. jQuery.fn[ name ] = function( speed, easing, callback ) {
  15391. return this.animate( props, speed, easing, callback );
  15392. };
  15393. } );
  15394. jQuery.timers = [];
  15395. jQuery.fx.tick = function() {
  15396. var timer,
  15397. i = 0,
  15398. timers = jQuery.timers;
  15399. fxNow = Date.now();
  15400. for ( ; i < timers.length; i++ ) {
  15401. timer = timers[ i ];
  15402. // Run the timer and safely remove it when done (allowing for external removal)
  15403. if ( !timer() && timers[ i ] === timer ) {
  15404. timers.splice( i--, 1 );
  15405. }
  15406. }
  15407. if ( !timers.length ) {
  15408. jQuery.fx.stop();
  15409. }
  15410. fxNow = undefined;
  15411. };
  15412. jQuery.fx.timer = function( timer ) {
  15413. jQuery.timers.push( timer );
  15414. jQuery.fx.start();
  15415. };
  15416. jQuery.fx.interval = 13;
  15417. jQuery.fx.start = function() {
  15418. if ( inProgress ) {
  15419. return;
  15420. }
  15421. inProgress = true;
  15422. schedule();
  15423. };
  15424. jQuery.fx.stop = function() {
  15425. inProgress = null;
  15426. };
  15427. jQuery.fx.speeds = {
  15428. slow: 600,
  15429. fast: 200,
  15430. // Default speed
  15431. _default: 400
  15432. };
  15433. // Based off of the plugin by Clint Helfers, with permission.
  15434. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  15435. jQuery.fn.delay = function( time, type ) {
  15436. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  15437. type = type || "fx";
  15438. return this.queue( type, function( next, hooks ) {
  15439. var timeout = window.setTimeout( next, time );
  15440. hooks.stop = function() {
  15441. window.clearTimeout( timeout );
  15442. };
  15443. } );
  15444. };
  15445. ( function() {
  15446. var input = document.createElement( "input" ),
  15447. select = document.createElement( "select" ),
  15448. opt = select.appendChild( document.createElement( "option" ) );
  15449. input.type = "checkbox";
  15450. // Support: Android <=4.3 only
  15451. // Default value for a checkbox should be "on"
  15452. support.checkOn = input.value !== "";
  15453. // Support: IE <=11 only
  15454. // Must access selectedIndex to make default options select
  15455. support.optSelected = opt.selected;
  15456. // Support: IE <=11 only
  15457. // An input loses its value after becoming a radio
  15458. input = document.createElement( "input" );
  15459. input.value = "t";
  15460. input.type = "radio";
  15461. support.radioValue = input.value === "t";
  15462. } )();
  15463. var boolHook,
  15464. attrHandle = jQuery.expr.attrHandle;
  15465. jQuery.fn.extend( {
  15466. attr: function( name, value ) {
  15467. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  15468. },
  15469. removeAttr: function( name ) {
  15470. return this.each( function() {
  15471. jQuery.removeAttr( this, name );
  15472. } );
  15473. }
  15474. } );
  15475. jQuery.extend( {
  15476. attr: function( elem, name, value ) {
  15477. var ret, hooks,
  15478. nType = elem.nodeType;
  15479. // Don't get/set attributes on text, comment and attribute nodes
  15480. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15481. return;
  15482. }
  15483. // Fallback to prop when attributes are not supported
  15484. if ( typeof elem.getAttribute === "undefined" ) {
  15485. return jQuery.prop( elem, name, value );
  15486. }
  15487. // Attribute hooks are determined by the lowercase version
  15488. // Grab necessary hook if one is defined
  15489. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15490. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  15491. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  15492. }
  15493. if ( value !== undefined ) {
  15494. if ( value === null ) {
  15495. jQuery.removeAttr( elem, name );
  15496. return;
  15497. }
  15498. if ( hooks && "set" in hooks &&
  15499. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15500. return ret;
  15501. }
  15502. elem.setAttribute( name, value + "" );
  15503. return value;
  15504. }
  15505. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15506. return ret;
  15507. }
  15508. ret = jQuery.find.attr( elem, name );
  15509. // Non-existent attributes return null, we normalize to undefined
  15510. return ret == null ? undefined : ret;
  15511. },
  15512. attrHooks: {
  15513. type: {
  15514. set: function( elem, value ) {
  15515. if ( !support.radioValue && value === "radio" &&
  15516. nodeName( elem, "input" ) ) {
  15517. var val = elem.value;
  15518. elem.setAttribute( "type", value );
  15519. if ( val ) {
  15520. elem.value = val;
  15521. }
  15522. return value;
  15523. }
  15524. }
  15525. }
  15526. },
  15527. removeAttr: function( elem, value ) {
  15528. var name,
  15529. i = 0,
  15530. // Attribute names can contain non-HTML whitespace characters
  15531. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  15532. attrNames = value && value.match( rnothtmlwhite );
  15533. if ( attrNames && elem.nodeType === 1 ) {
  15534. while ( ( name = attrNames[ i++ ] ) ) {
  15535. elem.removeAttribute( name );
  15536. }
  15537. }
  15538. }
  15539. } );
  15540. // Hooks for boolean attributes
  15541. boolHook = {
  15542. set: function( elem, value, name ) {
  15543. if ( value === false ) {
  15544. // Remove boolean attributes when set to false
  15545. jQuery.removeAttr( elem, name );
  15546. } else {
  15547. elem.setAttribute( name, name );
  15548. }
  15549. return name;
  15550. }
  15551. };
  15552. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  15553. var getter = attrHandle[ name ] || jQuery.find.attr;
  15554. attrHandle[ name ] = function( elem, name, isXML ) {
  15555. var ret, handle,
  15556. lowercaseName = name.toLowerCase();
  15557. if ( !isXML ) {
  15558. // Avoid an infinite loop by temporarily removing this function from the getter
  15559. handle = attrHandle[ lowercaseName ];
  15560. attrHandle[ lowercaseName ] = ret;
  15561. ret = getter( elem, name, isXML ) != null ?
  15562. lowercaseName :
  15563. null;
  15564. attrHandle[ lowercaseName ] = handle;
  15565. }
  15566. return ret;
  15567. };
  15568. } );
  15569. var rfocusable = /^(?:input|select|textarea|button)$/i,
  15570. rclickable = /^(?:a|area)$/i;
  15571. jQuery.fn.extend( {
  15572. prop: function( name, value ) {
  15573. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  15574. },
  15575. removeProp: function( name ) {
  15576. return this.each( function() {
  15577. delete this[ jQuery.propFix[ name ] || name ];
  15578. } );
  15579. }
  15580. } );
  15581. jQuery.extend( {
  15582. prop: function( elem, name, value ) {
  15583. var ret, hooks,
  15584. nType = elem.nodeType;
  15585. // Don't get/set properties on text, comment and attribute nodes
  15586. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15587. return;
  15588. }
  15589. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15590. // Fix name and attach hooks
  15591. name = jQuery.propFix[ name ] || name;
  15592. hooks = jQuery.propHooks[ name ];
  15593. }
  15594. if ( value !== undefined ) {
  15595. if ( hooks && "set" in hooks &&
  15596. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15597. return ret;
  15598. }
  15599. return ( elem[ name ] = value );
  15600. }
  15601. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15602. return ret;
  15603. }
  15604. return elem[ name ];
  15605. },
  15606. propHooks: {
  15607. tabIndex: {
  15608. get: function( elem ) {
  15609. // Support: IE <=9 - 11 only
  15610. // elem.tabIndex doesn't always return the
  15611. // correct value when it hasn't been explicitly set
  15612. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  15613. // Use proper attribute retrieval(#12072)
  15614. var tabindex = jQuery.find.attr( elem, "tabindex" );
  15615. if ( tabindex ) {
  15616. return parseInt( tabindex, 10 );
  15617. }
  15618. if (
  15619. rfocusable.test( elem.nodeName ) ||
  15620. rclickable.test( elem.nodeName ) &&
  15621. elem.href
  15622. ) {
  15623. return 0;
  15624. }
  15625. return -1;
  15626. }
  15627. }
  15628. },
  15629. propFix: {
  15630. "for": "htmlFor",
  15631. "class": "className"
  15632. }
  15633. } );
  15634. // Support: IE <=11 only
  15635. // Accessing the selectedIndex property
  15636. // forces the browser to respect setting selected
  15637. // on the option
  15638. // The getter ensures a default option is selected
  15639. // when in an optgroup
  15640. // eslint rule "no-unused-expressions" is disabled for this code
  15641. // since it considers such accessions noop
  15642. if ( !support.optSelected ) {
  15643. jQuery.propHooks.selected = {
  15644. get: function( elem ) {
  15645. /* eslint no-unused-expressions: "off" */
  15646. var parent = elem.parentNode;
  15647. if ( parent && parent.parentNode ) {
  15648. parent.parentNode.selectedIndex;
  15649. }
  15650. return null;
  15651. },
  15652. set: function( elem ) {
  15653. /* eslint no-unused-expressions: "off" */
  15654. var parent = elem.parentNode;
  15655. if ( parent ) {
  15656. parent.selectedIndex;
  15657. if ( parent.parentNode ) {
  15658. parent.parentNode.selectedIndex;
  15659. }
  15660. }
  15661. }
  15662. };
  15663. }
  15664. jQuery.each( [
  15665. "tabIndex",
  15666. "readOnly",
  15667. "maxLength",
  15668. "cellSpacing",
  15669. "cellPadding",
  15670. "rowSpan",
  15671. "colSpan",
  15672. "useMap",
  15673. "frameBorder",
  15674. "contentEditable"
  15675. ], function() {
  15676. jQuery.propFix[ this.toLowerCase() ] = this;
  15677. } );
  15678. // Strip and collapse whitespace according to HTML spec
  15679. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  15680. function stripAndCollapse( value ) {
  15681. var tokens = value.match( rnothtmlwhite ) || [];
  15682. return tokens.join( " " );
  15683. }
  15684. function getClass( elem ) {
  15685. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  15686. }
  15687. function classesToArray( value ) {
  15688. if ( Array.isArray( value ) ) {
  15689. return value;
  15690. }
  15691. if ( typeof value === "string" ) {
  15692. return value.match( rnothtmlwhite ) || [];
  15693. }
  15694. return [];
  15695. }
  15696. jQuery.fn.extend( {
  15697. addClass: function( value ) {
  15698. var classes, elem, cur, curValue, clazz, j, finalValue,
  15699. i = 0;
  15700. if ( isFunction( value ) ) {
  15701. return this.each( function( j ) {
  15702. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  15703. } );
  15704. }
  15705. classes = classesToArray( value );
  15706. if ( classes.length ) {
  15707. while ( ( elem = this[ i++ ] ) ) {
  15708. curValue = getClass( elem );
  15709. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15710. if ( cur ) {
  15711. j = 0;
  15712. while ( ( clazz = classes[ j++ ] ) ) {
  15713. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  15714. cur += clazz + " ";
  15715. }
  15716. }
  15717. // Only assign if different to avoid unneeded rendering.
  15718. finalValue = stripAndCollapse( cur );
  15719. if ( curValue !== finalValue ) {
  15720. elem.setAttribute( "class", finalValue );
  15721. }
  15722. }
  15723. }
  15724. }
  15725. return this;
  15726. },
  15727. removeClass: function( value ) {
  15728. var classes, elem, cur, curValue, clazz, j, finalValue,
  15729. i = 0;
  15730. if ( isFunction( value ) ) {
  15731. return this.each( function( j ) {
  15732. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  15733. } );
  15734. }
  15735. if ( !arguments.length ) {
  15736. return this.attr( "class", "" );
  15737. }
  15738. classes = classesToArray( value );
  15739. if ( classes.length ) {
  15740. while ( ( elem = this[ i++ ] ) ) {
  15741. curValue = getClass( elem );
  15742. // This expression is here for better compressibility (see addClass)
  15743. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15744. if ( cur ) {
  15745. j = 0;
  15746. while ( ( clazz = classes[ j++ ] ) ) {
  15747. // Remove *all* instances
  15748. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  15749. cur = cur.replace( " " + clazz + " ", " " );
  15750. }
  15751. }
  15752. // Only assign if different to avoid unneeded rendering.
  15753. finalValue = stripAndCollapse( cur );
  15754. if ( curValue !== finalValue ) {
  15755. elem.setAttribute( "class", finalValue );
  15756. }
  15757. }
  15758. }
  15759. }
  15760. return this;
  15761. },
  15762. toggleClass: function( value, stateVal ) {
  15763. var type = typeof value,
  15764. isValidValue = type === "string" || Array.isArray( value );
  15765. if ( typeof stateVal === "boolean" && isValidValue ) {
  15766. return stateVal ? this.addClass( value ) : this.removeClass( value );
  15767. }
  15768. if ( isFunction( value ) ) {
  15769. return this.each( function( i ) {
  15770. jQuery( this ).toggleClass(
  15771. value.call( this, i, getClass( this ), stateVal ),
  15772. stateVal
  15773. );
  15774. } );
  15775. }
  15776. return this.each( function() {
  15777. var className, i, self, classNames;
  15778. if ( isValidValue ) {
  15779. // Toggle individual class names
  15780. i = 0;
  15781. self = jQuery( this );
  15782. classNames = classesToArray( value );
  15783. while ( ( className = classNames[ i++ ] ) ) {
  15784. // Check each className given, space separated list
  15785. if ( self.hasClass( className ) ) {
  15786. self.removeClass( className );
  15787. } else {
  15788. self.addClass( className );
  15789. }
  15790. }
  15791. // Toggle whole class name
  15792. } else if ( value === undefined || type === "boolean" ) {
  15793. className = getClass( this );
  15794. if ( className ) {
  15795. // Store className if set
  15796. dataPriv.set( this, "__className__", className );
  15797. }
  15798. // If the element has a class name or if we're passed `false`,
  15799. // then remove the whole classname (if there was one, the above saved it).
  15800. // Otherwise bring back whatever was previously saved (if anything),
  15801. // falling back to the empty string if nothing was stored.
  15802. if ( this.setAttribute ) {
  15803. this.setAttribute( "class",
  15804. className || value === false ?
  15805. "" :
  15806. dataPriv.get( this, "__className__" ) || ""
  15807. );
  15808. }
  15809. }
  15810. } );
  15811. },
  15812. hasClass: function( selector ) {
  15813. var className, elem,
  15814. i = 0;
  15815. className = " " + selector + " ";
  15816. while ( ( elem = this[ i++ ] ) ) {
  15817. if ( elem.nodeType === 1 &&
  15818. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  15819. return true;
  15820. }
  15821. }
  15822. return false;
  15823. }
  15824. } );
  15825. var rreturn = /\r/g;
  15826. jQuery.fn.extend( {
  15827. val: function( value ) {
  15828. var hooks, ret, valueIsFunction,
  15829. elem = this[ 0 ];
  15830. if ( !arguments.length ) {
  15831. if ( elem ) {
  15832. hooks = jQuery.valHooks[ elem.type ] ||
  15833. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  15834. if ( hooks &&
  15835. "get" in hooks &&
  15836. ( ret = hooks.get( elem, "value" ) ) !== undefined
  15837. ) {
  15838. return ret;
  15839. }
  15840. ret = elem.value;
  15841. // Handle most common string cases
  15842. if ( typeof ret === "string" ) {
  15843. return ret.replace( rreturn, "" );
  15844. }
  15845. // Handle cases where value is null/undef or number
  15846. return ret == null ? "" : ret;
  15847. }
  15848. return;
  15849. }
  15850. valueIsFunction = isFunction( value );
  15851. return this.each( function( i ) {
  15852. var val;
  15853. if ( this.nodeType !== 1 ) {
  15854. return;
  15855. }
  15856. if ( valueIsFunction ) {
  15857. val = value.call( this, i, jQuery( this ).val() );
  15858. } else {
  15859. val = value;
  15860. }
  15861. // Treat null/undefined as ""; convert numbers to string
  15862. if ( val == null ) {
  15863. val = "";
  15864. } else if ( typeof val === "number" ) {
  15865. val += "";
  15866. } else if ( Array.isArray( val ) ) {
  15867. val = jQuery.map( val, function( value ) {
  15868. return value == null ? "" : value + "";
  15869. } );
  15870. }
  15871. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  15872. // If set returns undefined, fall back to normal setting
  15873. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  15874. this.value = val;
  15875. }
  15876. } );
  15877. }
  15878. } );
  15879. jQuery.extend( {
  15880. valHooks: {
  15881. option: {
  15882. get: function( elem ) {
  15883. var val = jQuery.find.attr( elem, "value" );
  15884. return val != null ?
  15885. val :
  15886. // Support: IE <=10 - 11 only
  15887. // option.text throws exceptions (#14686, #14858)
  15888. // Strip and collapse whitespace
  15889. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  15890. stripAndCollapse( jQuery.text( elem ) );
  15891. }
  15892. },
  15893. select: {
  15894. get: function( elem ) {
  15895. var value, option, i,
  15896. options = elem.options,
  15897. index = elem.selectedIndex,
  15898. one = elem.type === "select-one",
  15899. values = one ? null : [],
  15900. max = one ? index + 1 : options.length;
  15901. if ( index < 0 ) {
  15902. i = max;
  15903. } else {
  15904. i = one ? index : 0;
  15905. }
  15906. // Loop through all the selected options
  15907. for ( ; i < max; i++ ) {
  15908. option = options[ i ];
  15909. // Support: IE <=9 only
  15910. // IE8-9 doesn't update selected after form reset (#2551)
  15911. if ( ( option.selected || i === index ) &&
  15912. // Don't return options that are disabled or in a disabled optgroup
  15913. !option.disabled &&
  15914. ( !option.parentNode.disabled ||
  15915. !nodeName( option.parentNode, "optgroup" ) ) ) {
  15916. // Get the specific value for the option
  15917. value = jQuery( option ).val();
  15918. // We don't need an array for one selects
  15919. if ( one ) {
  15920. return value;
  15921. }
  15922. // Multi-Selects return an array
  15923. values.push( value );
  15924. }
  15925. }
  15926. return values;
  15927. },
  15928. set: function( elem, value ) {
  15929. var optionSet, option,
  15930. options = elem.options,
  15931. values = jQuery.makeArray( value ),
  15932. i = options.length;
  15933. while ( i-- ) {
  15934. option = options[ i ];
  15935. /* eslint-disable no-cond-assign */
  15936. if ( option.selected =
  15937. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  15938. ) {
  15939. optionSet = true;
  15940. }
  15941. /* eslint-enable no-cond-assign */
  15942. }
  15943. // Force browsers to behave consistently when non-matching value is set
  15944. if ( !optionSet ) {
  15945. elem.selectedIndex = -1;
  15946. }
  15947. return values;
  15948. }
  15949. }
  15950. }
  15951. } );
  15952. // Radios and checkboxes getter/setter
  15953. jQuery.each( [ "radio", "checkbox" ], function() {
  15954. jQuery.valHooks[ this ] = {
  15955. set: function( elem, value ) {
  15956. if ( Array.isArray( value ) ) {
  15957. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  15958. }
  15959. }
  15960. };
  15961. if ( !support.checkOn ) {
  15962. jQuery.valHooks[ this ].get = function( elem ) {
  15963. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  15964. };
  15965. }
  15966. } );
  15967. // Return jQuery for attributes-only inclusion
  15968. support.focusin = "onfocusin" in window;
  15969. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  15970. stopPropagationCallback = function( e ) {
  15971. e.stopPropagation();
  15972. };
  15973. jQuery.extend( jQuery.event, {
  15974. trigger: function( event, data, elem, onlyHandlers ) {
  15975. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  15976. eventPath = [ elem || document ],
  15977. type = hasOwn.call( event, "type" ) ? event.type : event,
  15978. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  15979. cur = lastElement = tmp = elem = elem || document;
  15980. // Don't do events on text and comment nodes
  15981. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  15982. return;
  15983. }
  15984. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  15985. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  15986. return;
  15987. }
  15988. if ( type.indexOf( "." ) > -1 ) {
  15989. // Namespaced trigger; create a regexp to match event type in handle()
  15990. namespaces = type.split( "." );
  15991. type = namespaces.shift();
  15992. namespaces.sort();
  15993. }
  15994. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  15995. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  15996. event = event[ jQuery.expando ] ?
  15997. event :
  15998. new jQuery.Event( type, typeof event === "object" && event );
  15999. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  16000. event.isTrigger = onlyHandlers ? 2 : 3;
  16001. event.namespace = namespaces.join( "." );
  16002. event.rnamespace = event.namespace ?
  16003. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  16004. null;
  16005. // Clean up the event in case it is being reused
  16006. event.result = undefined;
  16007. if ( !event.target ) {
  16008. event.target = elem;
  16009. }
  16010. // Clone any incoming data and prepend the event, creating the handler arg list
  16011. data = data == null ?
  16012. [ event ] :
  16013. jQuery.makeArray( data, [ event ] );
  16014. // Allow special events to draw outside the lines
  16015. special = jQuery.event.special[ type ] || {};
  16016. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  16017. return;
  16018. }
  16019. // Determine event propagation path in advance, per W3C events spec (#9951)
  16020. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  16021. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  16022. bubbleType = special.delegateType || type;
  16023. if ( !rfocusMorph.test( bubbleType + type ) ) {
  16024. cur = cur.parentNode;
  16025. }
  16026. for ( ; cur; cur = cur.parentNode ) {
  16027. eventPath.push( cur );
  16028. tmp = cur;
  16029. }
  16030. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  16031. if ( tmp === ( elem.ownerDocument || document ) ) {
  16032. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  16033. }
  16034. }
  16035. // Fire handlers on the event path
  16036. i = 0;
  16037. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  16038. lastElement = cur;
  16039. event.type = i > 1 ?
  16040. bubbleType :
  16041. special.bindType || type;
  16042. // jQuery handler
  16043. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  16044. dataPriv.get( cur, "handle" );
  16045. if ( handle ) {
  16046. handle.apply( cur, data );
  16047. }
  16048. // Native handler
  16049. handle = ontype && cur[ ontype ];
  16050. if ( handle && handle.apply && acceptData( cur ) ) {
  16051. event.result = handle.apply( cur, data );
  16052. if ( event.result === false ) {
  16053. event.preventDefault();
  16054. }
  16055. }
  16056. }
  16057. event.type = type;
  16058. // If nobody prevented the default action, do it now
  16059. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  16060. if ( ( !special._default ||
  16061. special._default.apply( eventPath.pop(), data ) === false ) &&
  16062. acceptData( elem ) ) {
  16063. // Call a native DOM method on the target with the same name as the event.
  16064. // Don't do default actions on window, that's where global variables be (#6170)
  16065. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  16066. // Don't re-trigger an onFOO event when we call its FOO() method
  16067. tmp = elem[ ontype ];
  16068. if ( tmp ) {
  16069. elem[ ontype ] = null;
  16070. }
  16071. // Prevent re-triggering of the same event, since we already bubbled it above
  16072. jQuery.event.triggered = type;
  16073. if ( event.isPropagationStopped() ) {
  16074. lastElement.addEventListener( type, stopPropagationCallback );
  16075. }
  16076. elem[ type ]();
  16077. if ( event.isPropagationStopped() ) {
  16078. lastElement.removeEventListener( type, stopPropagationCallback );
  16079. }
  16080. jQuery.event.triggered = undefined;
  16081. if ( tmp ) {
  16082. elem[ ontype ] = tmp;
  16083. }
  16084. }
  16085. }
  16086. }
  16087. return event.result;
  16088. },
  16089. // Piggyback on a donor event to simulate a different one
  16090. // Used only for `focus(in | out)` events
  16091. simulate: function( type, elem, event ) {
  16092. var e = jQuery.extend(
  16093. new jQuery.Event(),
  16094. event,
  16095. {
  16096. type: type,
  16097. isSimulated: true
  16098. }
  16099. );
  16100. jQuery.event.trigger( e, null, elem );
  16101. }
  16102. } );
  16103. jQuery.fn.extend( {
  16104. trigger: function( type, data ) {
  16105. return this.each( function() {
  16106. jQuery.event.trigger( type, data, this );
  16107. } );
  16108. },
  16109. triggerHandler: function( type, data ) {
  16110. var elem = this[ 0 ];
  16111. if ( elem ) {
  16112. return jQuery.event.trigger( type, data, elem, true );
  16113. }
  16114. }
  16115. } );
  16116. // Support: Firefox <=44
  16117. // Firefox doesn't have focus(in | out) events
  16118. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  16119. //
  16120. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  16121. // focus(in | out) events fire after focus & blur events,
  16122. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  16123. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  16124. if ( !support.focusin ) {
  16125. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  16126. // Attach a single capturing handler on the document while someone wants focusin/focusout
  16127. var handler = function( event ) {
  16128. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  16129. };
  16130. jQuery.event.special[ fix ] = {
  16131. setup: function() {
  16132. var doc = this.ownerDocument || this,
  16133. attaches = dataPriv.access( doc, fix );
  16134. if ( !attaches ) {
  16135. doc.addEventListener( orig, handler, true );
  16136. }
  16137. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  16138. },
  16139. teardown: function() {
  16140. var doc = this.ownerDocument || this,
  16141. attaches = dataPriv.access( doc, fix ) - 1;
  16142. if ( !attaches ) {
  16143. doc.removeEventListener( orig, handler, true );
  16144. dataPriv.remove( doc, fix );
  16145. } else {
  16146. dataPriv.access( doc, fix, attaches );
  16147. }
  16148. }
  16149. };
  16150. } );
  16151. }
  16152. var location = window.location;
  16153. var nonce = Date.now();
  16154. var rquery = ( /\?/ );
  16155. // Cross-browser xml parsing
  16156. jQuery.parseXML = function( data ) {
  16157. var xml;
  16158. if ( !data || typeof data !== "string" ) {
  16159. return null;
  16160. }
  16161. // Support: IE 9 - 11 only
  16162. // IE throws on parseFromString with invalid input.
  16163. try {
  16164. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  16165. } catch ( e ) {
  16166. xml = undefined;
  16167. }
  16168. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  16169. jQuery.error( "Invalid XML: " + data );
  16170. }
  16171. return xml;
  16172. };
  16173. var
  16174. rbracket = /\[\]$/,
  16175. rCRLF = /\r?\n/g,
  16176. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  16177. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  16178. function buildParams( prefix, obj, traditional, add ) {
  16179. var name;
  16180. if ( Array.isArray( obj ) ) {
  16181. // Serialize array item.
  16182. jQuery.each( obj, function( i, v ) {
  16183. if ( traditional || rbracket.test( prefix ) ) {
  16184. // Treat each array item as a scalar.
  16185. add( prefix, v );
  16186. } else {
  16187. // Item is non-scalar (array or object), encode its numeric index.
  16188. buildParams(
  16189. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  16190. v,
  16191. traditional,
  16192. add
  16193. );
  16194. }
  16195. } );
  16196. } else if ( !traditional && toType( obj ) === "object" ) {
  16197. // Serialize object item.
  16198. for ( name in obj ) {
  16199. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  16200. }
  16201. } else {
  16202. // Serialize scalar item.
  16203. add( prefix, obj );
  16204. }
  16205. }
  16206. // Serialize an array of form elements or a set of
  16207. // key/values into a query string
  16208. jQuery.param = function( a, traditional ) {
  16209. var prefix,
  16210. s = [],
  16211. add = function( key, valueOrFunction ) {
  16212. // If value is a function, invoke it and use its return value
  16213. var value = isFunction( valueOrFunction ) ?
  16214. valueOrFunction() :
  16215. valueOrFunction;
  16216. s[ s.length ] = encodeURIComponent( key ) + "=" +
  16217. encodeURIComponent( value == null ? "" : value );
  16218. };
  16219. if ( a == null ) {
  16220. return "";
  16221. }
  16222. // If an array was passed in, assume that it is an array of form elements.
  16223. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  16224. // Serialize the form elements
  16225. jQuery.each( a, function() {
  16226. add( this.name, this.value );
  16227. } );
  16228. } else {
  16229. // If traditional, encode the "old" way (the way 1.3.2 or older
  16230. // did it), otherwise encode params recursively.
  16231. for ( prefix in a ) {
  16232. buildParams( prefix, a[ prefix ], traditional, add );
  16233. }
  16234. }
  16235. // Return the resulting serialization
  16236. return s.join( "&" );
  16237. };
  16238. jQuery.fn.extend( {
  16239. serialize: function() {
  16240. return jQuery.param( this.serializeArray() );
  16241. },
  16242. serializeArray: function() {
  16243. return this.map( function() {
  16244. // Can add propHook for "elements" to filter or add form elements
  16245. var elements = jQuery.prop( this, "elements" );
  16246. return elements ? jQuery.makeArray( elements ) : this;
  16247. } )
  16248. .filter( function() {
  16249. var type = this.type;
  16250. // Use .is( ":disabled" ) so that fieldset[disabled] works
  16251. return this.name && !jQuery( this ).is( ":disabled" ) &&
  16252. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  16253. ( this.checked || !rcheckableType.test( type ) );
  16254. } )
  16255. .map( function( i, elem ) {
  16256. var val = jQuery( this ).val();
  16257. if ( val == null ) {
  16258. return null;
  16259. }
  16260. if ( Array.isArray( val ) ) {
  16261. return jQuery.map( val, function( val ) {
  16262. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  16263. } );
  16264. }
  16265. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  16266. } ).get();
  16267. }
  16268. } );
  16269. var
  16270. r20 = /%20/g,
  16271. rhash = /#.*$/,
  16272. rantiCache = /([?&])_=[^&]*/,
  16273. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  16274. // #7653, #8125, #8152: local protocol detection
  16275. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  16276. rnoContent = /^(?:GET|HEAD)$/,
  16277. rprotocol = /^\/\//,
  16278. /* Prefilters
  16279. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  16280. * 2) These are called:
  16281. * - BEFORE asking for a transport
  16282. * - AFTER param serialization (s.data is a string if s.processData is true)
  16283. * 3) key is the dataType
  16284. * 4) the catchall symbol "*" can be used
  16285. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  16286. */
  16287. prefilters = {},
  16288. /* Transports bindings
  16289. * 1) key is the dataType
  16290. * 2) the catchall symbol "*" can be used
  16291. * 3) selection will start with transport dataType and THEN go to "*" if needed
  16292. */
  16293. transports = {},
  16294. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  16295. allTypes = "*/".concat( "*" ),
  16296. // Anchor tag for parsing the document origin
  16297. originAnchor = document.createElement( "a" );
  16298. originAnchor.href = location.href;
  16299. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  16300. function addToPrefiltersOrTransports( structure ) {
  16301. // dataTypeExpression is optional and defaults to "*"
  16302. return function( dataTypeExpression, func ) {
  16303. if ( typeof dataTypeExpression !== "string" ) {
  16304. func = dataTypeExpression;
  16305. dataTypeExpression = "*";
  16306. }
  16307. var dataType,
  16308. i = 0,
  16309. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  16310. if ( isFunction( func ) ) {
  16311. // For each dataType in the dataTypeExpression
  16312. while ( ( dataType = dataTypes[ i++ ] ) ) {
  16313. // Prepend if requested
  16314. if ( dataType[ 0 ] === "+" ) {
  16315. dataType = dataType.slice( 1 ) || "*";
  16316. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  16317. // Otherwise append
  16318. } else {
  16319. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  16320. }
  16321. }
  16322. }
  16323. };
  16324. }
  16325. // Base inspection function for prefilters and transports
  16326. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  16327. var inspected = {},
  16328. seekingTransport = ( structure === transports );
  16329. function inspect( dataType ) {
  16330. var selected;
  16331. inspected[ dataType ] = true;
  16332. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  16333. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  16334. if ( typeof dataTypeOrTransport === "string" &&
  16335. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  16336. options.dataTypes.unshift( dataTypeOrTransport );
  16337. inspect( dataTypeOrTransport );
  16338. return false;
  16339. } else if ( seekingTransport ) {
  16340. return !( selected = dataTypeOrTransport );
  16341. }
  16342. } );
  16343. return selected;
  16344. }
  16345. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  16346. }
  16347. // A special extend for ajax options
  16348. // that takes "flat" options (not to be deep extended)
  16349. // Fixes #9887
  16350. function ajaxExtend( target, src ) {
  16351. var key, deep,
  16352. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  16353. for ( key in src ) {
  16354. if ( src[ key ] !== undefined ) {
  16355. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  16356. }
  16357. }
  16358. if ( deep ) {
  16359. jQuery.extend( true, target, deep );
  16360. }
  16361. return target;
  16362. }
  16363. /* Handles responses to an ajax request:
  16364. * - finds the right dataType (mediates between content-type and expected dataType)
  16365. * - returns the corresponding response
  16366. */
  16367. function ajaxHandleResponses( s, jqXHR, responses ) {
  16368. var ct, type, finalDataType, firstDataType,
  16369. contents = s.contents,
  16370. dataTypes = s.dataTypes;
  16371. // Remove auto dataType and get content-type in the process
  16372. while ( dataTypes[ 0 ] === "*" ) {
  16373. dataTypes.shift();
  16374. if ( ct === undefined ) {
  16375. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  16376. }
  16377. }
  16378. // Check if we're dealing with a known content-type
  16379. if ( ct ) {
  16380. for ( type in contents ) {
  16381. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  16382. dataTypes.unshift( type );
  16383. break;
  16384. }
  16385. }
  16386. }
  16387. // Check to see if we have a response for the expected dataType
  16388. if ( dataTypes[ 0 ] in responses ) {
  16389. finalDataType = dataTypes[ 0 ];
  16390. } else {
  16391. // Try convertible dataTypes
  16392. for ( type in responses ) {
  16393. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  16394. finalDataType = type;
  16395. break;
  16396. }
  16397. if ( !firstDataType ) {
  16398. firstDataType = type;
  16399. }
  16400. }
  16401. // Or just use first one
  16402. finalDataType = finalDataType || firstDataType;
  16403. }
  16404. // If we found a dataType
  16405. // We add the dataType to the list if needed
  16406. // and return the corresponding response
  16407. if ( finalDataType ) {
  16408. if ( finalDataType !== dataTypes[ 0 ] ) {
  16409. dataTypes.unshift( finalDataType );
  16410. }
  16411. return responses[ finalDataType ];
  16412. }
  16413. }
  16414. /* Chain conversions given the request and the original response
  16415. * Also sets the responseXXX fields on the jqXHR instance
  16416. */
  16417. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  16418. var conv2, current, conv, tmp, prev,
  16419. converters = {},
  16420. // Work with a copy of dataTypes in case we need to modify it for conversion
  16421. dataTypes = s.dataTypes.slice();
  16422. // Create converters map with lowercased keys
  16423. if ( dataTypes[ 1 ] ) {
  16424. for ( conv in s.converters ) {
  16425. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  16426. }
  16427. }
  16428. current = dataTypes.shift();
  16429. // Convert to each sequential dataType
  16430. while ( current ) {
  16431. if ( s.responseFields[ current ] ) {
  16432. jqXHR[ s.responseFields[ current ] ] = response;
  16433. }
  16434. // Apply the dataFilter if provided
  16435. if ( !prev && isSuccess && s.dataFilter ) {
  16436. response = s.dataFilter( response, s.dataType );
  16437. }
  16438. prev = current;
  16439. current = dataTypes.shift();
  16440. if ( current ) {
  16441. // There's only work to do if current dataType is non-auto
  16442. if ( current === "*" ) {
  16443. current = prev;
  16444. // Convert response if prev dataType is non-auto and differs from current
  16445. } else if ( prev !== "*" && prev !== current ) {
  16446. // Seek a direct converter
  16447. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  16448. // If none found, seek a pair
  16449. if ( !conv ) {
  16450. for ( conv2 in converters ) {
  16451. // If conv2 outputs current
  16452. tmp = conv2.split( " " );
  16453. if ( tmp[ 1 ] === current ) {
  16454. // If prev can be converted to accepted input
  16455. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  16456. converters[ "* " + tmp[ 0 ] ];
  16457. if ( conv ) {
  16458. // Condense equivalence converters
  16459. if ( conv === true ) {
  16460. conv = converters[ conv2 ];
  16461. // Otherwise, insert the intermediate dataType
  16462. } else if ( converters[ conv2 ] !== true ) {
  16463. current = tmp[ 0 ];
  16464. dataTypes.unshift( tmp[ 1 ] );
  16465. }
  16466. break;
  16467. }
  16468. }
  16469. }
  16470. }
  16471. // Apply converter (if not an equivalence)
  16472. if ( conv !== true ) {
  16473. // Unless errors are allowed to bubble, catch and return them
  16474. if ( conv && s.throws ) {
  16475. response = conv( response );
  16476. } else {
  16477. try {
  16478. response = conv( response );
  16479. } catch ( e ) {
  16480. return {
  16481. state: "parsererror",
  16482. error: conv ? e : "No conversion from " + prev + " to " + current
  16483. };
  16484. }
  16485. }
  16486. }
  16487. }
  16488. }
  16489. }
  16490. return { state: "success", data: response };
  16491. }
  16492. jQuery.extend( {
  16493. // Counter for holding the number of active queries
  16494. active: 0,
  16495. // Last-Modified header cache for next request
  16496. lastModified: {},
  16497. etag: {},
  16498. ajaxSettings: {
  16499. url: location.href,
  16500. type: "GET",
  16501. isLocal: rlocalProtocol.test( location.protocol ),
  16502. global: true,
  16503. processData: true,
  16504. async: true,
  16505. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  16506. /*
  16507. timeout: 0,
  16508. data: null,
  16509. dataType: null,
  16510. username: null,
  16511. password: null,
  16512. cache: null,
  16513. throws: false,
  16514. traditional: false,
  16515. headers: {},
  16516. */
  16517. accepts: {
  16518. "*": allTypes,
  16519. text: "text/plain",
  16520. html: "text/html",
  16521. xml: "application/xml, text/xml",
  16522. json: "application/json, text/javascript"
  16523. },
  16524. contents: {
  16525. xml: /\bxml\b/,
  16526. html: /\bhtml/,
  16527. json: /\bjson\b/
  16528. },
  16529. responseFields: {
  16530. xml: "responseXML",
  16531. text: "responseText",
  16532. json: "responseJSON"
  16533. },
  16534. // Data converters
  16535. // Keys separate source (or catchall "*") and destination types with a single space
  16536. converters: {
  16537. // Convert anything to text
  16538. "* text": String,
  16539. // Text to html (true = no transformation)
  16540. "text html": true,
  16541. // Evaluate text as a json expression
  16542. "text json": JSON.parse,
  16543. // Parse text as xml
  16544. "text xml": jQuery.parseXML
  16545. },
  16546. // For options that shouldn't be deep extended:
  16547. // you can add your own custom options here if
  16548. // and when you create one that shouldn't be
  16549. // deep extended (see ajaxExtend)
  16550. flatOptions: {
  16551. url: true,
  16552. context: true
  16553. }
  16554. },
  16555. // Creates a full fledged settings object into target
  16556. // with both ajaxSettings and settings fields.
  16557. // If target is omitted, writes into ajaxSettings.
  16558. ajaxSetup: function( target, settings ) {
  16559. return settings ?
  16560. // Building a settings object
  16561. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  16562. // Extending ajaxSettings
  16563. ajaxExtend( jQuery.ajaxSettings, target );
  16564. },
  16565. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  16566. ajaxTransport: addToPrefiltersOrTransports( transports ),
  16567. // Main method
  16568. ajax: function( url, options ) {
  16569. // If url is an object, simulate pre-1.5 signature
  16570. if ( typeof url === "object" ) {
  16571. options = url;
  16572. url = undefined;
  16573. }
  16574. // Force options to be an object
  16575. options = options || {};
  16576. var transport,
  16577. // URL without anti-cache param
  16578. cacheURL,
  16579. // Response headers
  16580. responseHeadersString,
  16581. responseHeaders,
  16582. // timeout handle
  16583. timeoutTimer,
  16584. // Url cleanup var
  16585. urlAnchor,
  16586. // Request state (becomes false upon send and true upon completion)
  16587. completed,
  16588. // To know if global events are to be dispatched
  16589. fireGlobals,
  16590. // Loop variable
  16591. i,
  16592. // uncached part of the url
  16593. uncached,
  16594. // Create the final options object
  16595. s = jQuery.ajaxSetup( {}, options ),
  16596. // Callbacks context
  16597. callbackContext = s.context || s,
  16598. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  16599. globalEventContext = s.context &&
  16600. ( callbackContext.nodeType || callbackContext.jquery ) ?
  16601. jQuery( callbackContext ) :
  16602. jQuery.event,
  16603. // Deferreds
  16604. deferred = jQuery.Deferred(),
  16605. completeDeferred = jQuery.Callbacks( "once memory" ),
  16606. // Status-dependent callbacks
  16607. statusCode = s.statusCode || {},
  16608. // Headers (they are sent all at once)
  16609. requestHeaders = {},
  16610. requestHeadersNames = {},
  16611. // Default abort message
  16612. strAbort = "canceled",
  16613. // Fake xhr
  16614. jqXHR = {
  16615. readyState: 0,
  16616. // Builds headers hashtable if needed
  16617. getResponseHeader: function( key ) {
  16618. var match;
  16619. if ( completed ) {
  16620. if ( !responseHeaders ) {
  16621. responseHeaders = {};
  16622. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  16623. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  16624. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  16625. .concat( match[ 2 ] );
  16626. }
  16627. }
  16628. match = responseHeaders[ key.toLowerCase() + " " ];
  16629. }
  16630. return match == null ? null : match.join( ", " );
  16631. },
  16632. // Raw string
  16633. getAllResponseHeaders: function() {
  16634. return completed ? responseHeadersString : null;
  16635. },
  16636. // Caches the header
  16637. setRequestHeader: function( name, value ) {
  16638. if ( completed == null ) {
  16639. name = requestHeadersNames[ name.toLowerCase() ] =
  16640. requestHeadersNames[ name.toLowerCase() ] || name;
  16641. requestHeaders[ name ] = value;
  16642. }
  16643. return this;
  16644. },
  16645. // Overrides response content-type header
  16646. overrideMimeType: function( type ) {
  16647. if ( completed == null ) {
  16648. s.mimeType = type;
  16649. }
  16650. return this;
  16651. },
  16652. // Status-dependent callbacks
  16653. statusCode: function( map ) {
  16654. var code;
  16655. if ( map ) {
  16656. if ( completed ) {
  16657. // Execute the appropriate callbacks
  16658. jqXHR.always( map[ jqXHR.status ] );
  16659. } else {
  16660. // Lazy-add the new callbacks in a way that preserves old ones
  16661. for ( code in map ) {
  16662. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  16663. }
  16664. }
  16665. }
  16666. return this;
  16667. },
  16668. // Cancel the request
  16669. abort: function( statusText ) {
  16670. var finalText = statusText || strAbort;
  16671. if ( transport ) {
  16672. transport.abort( finalText );
  16673. }
  16674. done( 0, finalText );
  16675. return this;
  16676. }
  16677. };
  16678. // Attach deferreds
  16679. deferred.promise( jqXHR );
  16680. // Add protocol if not provided (prefilters might expect it)
  16681. // Handle falsy url in the settings object (#10093: consistency with old signature)
  16682. // We also use the url parameter if available
  16683. s.url = ( ( url || s.url || location.href ) + "" )
  16684. .replace( rprotocol, location.protocol + "//" );
  16685. // Alias method option to type as per ticket #12004
  16686. s.type = options.method || options.type || s.method || s.type;
  16687. // Extract dataTypes list
  16688. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  16689. // A cross-domain request is in order when the origin doesn't match the current origin.
  16690. if ( s.crossDomain == null ) {
  16691. urlAnchor = document.createElement( "a" );
  16692. // Support: IE <=8 - 11, Edge 12 - 15
  16693. // IE throws exception on accessing the href property if url is malformed,
  16694. // e.g. http://example.com:80x/
  16695. try {
  16696. urlAnchor.href = s.url;
  16697. // Support: IE <=8 - 11 only
  16698. // Anchor's host property isn't correctly set when s.url is relative
  16699. urlAnchor.href = urlAnchor.href;
  16700. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  16701. urlAnchor.protocol + "//" + urlAnchor.host;
  16702. } catch ( e ) {
  16703. // If there is an error parsing the URL, assume it is crossDomain,
  16704. // it can be rejected by the transport if it is invalid
  16705. s.crossDomain = true;
  16706. }
  16707. }
  16708. // Convert data if not already a string
  16709. if ( s.data && s.processData && typeof s.data !== "string" ) {
  16710. s.data = jQuery.param( s.data, s.traditional );
  16711. }
  16712. // Apply prefilters
  16713. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  16714. // If request was aborted inside a prefilter, stop there
  16715. if ( completed ) {
  16716. return jqXHR;
  16717. }
  16718. // We can fire global events as of now if asked to
  16719. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  16720. fireGlobals = jQuery.event && s.global;
  16721. // Watch for a new set of requests
  16722. if ( fireGlobals && jQuery.active++ === 0 ) {
  16723. jQuery.event.trigger( "ajaxStart" );
  16724. }
  16725. // Uppercase the type
  16726. s.type = s.type.toUpperCase();
  16727. // Determine if request has content
  16728. s.hasContent = !rnoContent.test( s.type );
  16729. // Save the URL in case we're toying with the If-Modified-Since
  16730. // and/or If-None-Match header later on
  16731. // Remove hash to simplify url manipulation
  16732. cacheURL = s.url.replace( rhash, "" );
  16733. // More options handling for requests with no content
  16734. if ( !s.hasContent ) {
  16735. // Remember the hash so we can put it back
  16736. uncached = s.url.slice( cacheURL.length );
  16737. // If data is available and should be processed, append data to url
  16738. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  16739. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  16740. // #9682: remove data so that it's not used in an eventual retry
  16741. delete s.data;
  16742. }
  16743. // Add or update anti-cache param if needed
  16744. if ( s.cache === false ) {
  16745. cacheURL = cacheURL.replace( rantiCache, "$1" );
  16746. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  16747. }
  16748. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  16749. s.url = cacheURL + uncached;
  16750. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  16751. } else if ( s.data && s.processData &&
  16752. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  16753. s.data = s.data.replace( r20, "+" );
  16754. }
  16755. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16756. if ( s.ifModified ) {
  16757. if ( jQuery.lastModified[ cacheURL ] ) {
  16758. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  16759. }
  16760. if ( jQuery.etag[ cacheURL ] ) {
  16761. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  16762. }
  16763. }
  16764. // Set the correct header, if data is being sent
  16765. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  16766. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  16767. }
  16768. // Set the Accepts header for the server, depending on the dataType
  16769. jqXHR.setRequestHeader(
  16770. "Accept",
  16771. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  16772. s.accepts[ s.dataTypes[ 0 ] ] +
  16773. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  16774. s.accepts[ "*" ]
  16775. );
  16776. // Check for headers option
  16777. for ( i in s.headers ) {
  16778. jqXHR.setRequestHeader( i, s.headers[ i ] );
  16779. }
  16780. // Allow custom headers/mimetypes and early abort
  16781. if ( s.beforeSend &&
  16782. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  16783. // Abort if not done already and return
  16784. return jqXHR.abort();
  16785. }
  16786. // Aborting is no longer a cancellation
  16787. strAbort = "abort";
  16788. // Install callbacks on deferreds
  16789. completeDeferred.add( s.complete );
  16790. jqXHR.done( s.success );
  16791. jqXHR.fail( s.error );
  16792. // Get transport
  16793. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  16794. // If no transport, we auto-abort
  16795. if ( !transport ) {
  16796. done( -1, "No Transport" );
  16797. } else {
  16798. jqXHR.readyState = 1;
  16799. // Send global event
  16800. if ( fireGlobals ) {
  16801. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  16802. }
  16803. // If request was aborted inside ajaxSend, stop there
  16804. if ( completed ) {
  16805. return jqXHR;
  16806. }
  16807. // Timeout
  16808. if ( s.async && s.timeout > 0 ) {
  16809. timeoutTimer = window.setTimeout( function() {
  16810. jqXHR.abort( "timeout" );
  16811. }, s.timeout );
  16812. }
  16813. try {
  16814. completed = false;
  16815. transport.send( requestHeaders, done );
  16816. } catch ( e ) {
  16817. // Rethrow post-completion exceptions
  16818. if ( completed ) {
  16819. throw e;
  16820. }
  16821. // Propagate others as results
  16822. done( -1, e );
  16823. }
  16824. }
  16825. // Callback for when everything is done
  16826. function done( status, nativeStatusText, responses, headers ) {
  16827. var isSuccess, success, error, response, modified,
  16828. statusText = nativeStatusText;
  16829. // Ignore repeat invocations
  16830. if ( completed ) {
  16831. return;
  16832. }
  16833. completed = true;
  16834. // Clear timeout if it exists
  16835. if ( timeoutTimer ) {
  16836. window.clearTimeout( timeoutTimer );
  16837. }
  16838. // Dereference transport for early garbage collection
  16839. // (no matter how long the jqXHR object will be used)
  16840. transport = undefined;
  16841. // Cache response headers
  16842. responseHeadersString = headers || "";
  16843. // Set readyState
  16844. jqXHR.readyState = status > 0 ? 4 : 0;
  16845. // Determine if successful
  16846. isSuccess = status >= 200 && status < 300 || status === 304;
  16847. // Get response data
  16848. if ( responses ) {
  16849. response = ajaxHandleResponses( s, jqXHR, responses );
  16850. }
  16851. // Convert no matter what (that way responseXXX fields are always set)
  16852. response = ajaxConvert( s, response, jqXHR, isSuccess );
  16853. // If successful, handle type chaining
  16854. if ( isSuccess ) {
  16855. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16856. if ( s.ifModified ) {
  16857. modified = jqXHR.getResponseHeader( "Last-Modified" );
  16858. if ( modified ) {
  16859. jQuery.lastModified[ cacheURL ] = modified;
  16860. }
  16861. modified = jqXHR.getResponseHeader( "etag" );
  16862. if ( modified ) {
  16863. jQuery.etag[ cacheURL ] = modified;
  16864. }
  16865. }
  16866. // if no content
  16867. if ( status === 204 || s.type === "HEAD" ) {
  16868. statusText = "nocontent";
  16869. // if not modified
  16870. } else if ( status === 304 ) {
  16871. statusText = "notmodified";
  16872. // If we have data, let's convert it
  16873. } else {
  16874. statusText = response.state;
  16875. success = response.data;
  16876. error = response.error;
  16877. isSuccess = !error;
  16878. }
  16879. } else {
  16880. // Extract error from statusText and normalize for non-aborts
  16881. error = statusText;
  16882. if ( status || !statusText ) {
  16883. statusText = "error";
  16884. if ( status < 0 ) {
  16885. status = 0;
  16886. }
  16887. }
  16888. }
  16889. // Set data for the fake xhr object
  16890. jqXHR.status = status;
  16891. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  16892. // Success/Error
  16893. if ( isSuccess ) {
  16894. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  16895. } else {
  16896. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  16897. }
  16898. // Status-dependent callbacks
  16899. jqXHR.statusCode( statusCode );
  16900. statusCode = undefined;
  16901. if ( fireGlobals ) {
  16902. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  16903. [ jqXHR, s, isSuccess ? success : error ] );
  16904. }
  16905. // Complete
  16906. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  16907. if ( fireGlobals ) {
  16908. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  16909. // Handle the global AJAX counter
  16910. if ( !( --jQuery.active ) ) {
  16911. jQuery.event.trigger( "ajaxStop" );
  16912. }
  16913. }
  16914. }
  16915. return jqXHR;
  16916. },
  16917. getJSON: function( url, data, callback ) {
  16918. return jQuery.get( url, data, callback, "json" );
  16919. },
  16920. getScript: function( url, callback ) {
  16921. return jQuery.get( url, undefined, callback, "script" );
  16922. }
  16923. } );
  16924. jQuery.each( [ "get", "post" ], function( i, method ) {
  16925. jQuery[ method ] = function( url, data, callback, type ) {
  16926. // Shift arguments if data argument was omitted
  16927. if ( isFunction( data ) ) {
  16928. type = type || callback;
  16929. callback = data;
  16930. data = undefined;
  16931. }
  16932. // The url can be an options object (which then must have .url)
  16933. return jQuery.ajax( jQuery.extend( {
  16934. url: url,
  16935. type: method,
  16936. dataType: type,
  16937. data: data,
  16938. success: callback
  16939. }, jQuery.isPlainObject( url ) && url ) );
  16940. };
  16941. } );
  16942. jQuery._evalUrl = function( url, options ) {
  16943. return jQuery.ajax( {
  16944. url: url,
  16945. // Make this explicit, since user can override this through ajaxSetup (#11264)
  16946. type: "GET",
  16947. dataType: "script",
  16948. cache: true,
  16949. async: false,
  16950. global: false,
  16951. // Only evaluate the response if it is successful (gh-4126)
  16952. // dataFilter is not invoked for failure responses, so using it instead
  16953. // of the default converter is kludgy but it works.
  16954. converters: {
  16955. "text script": function() {}
  16956. },
  16957. dataFilter: function( response ) {
  16958. jQuery.globalEval( response, options );
  16959. }
  16960. } );
  16961. };
  16962. jQuery.fn.extend( {
  16963. wrapAll: function( html ) {
  16964. var wrap;
  16965. if ( this[ 0 ] ) {
  16966. if ( isFunction( html ) ) {
  16967. html = html.call( this[ 0 ] );
  16968. }
  16969. // The elements to wrap the target around
  16970. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  16971. if ( this[ 0 ].parentNode ) {
  16972. wrap.insertBefore( this[ 0 ] );
  16973. }
  16974. wrap.map( function() {
  16975. var elem = this;
  16976. while ( elem.firstElementChild ) {
  16977. elem = elem.firstElementChild;
  16978. }
  16979. return elem;
  16980. } ).append( this );
  16981. }
  16982. return this;
  16983. },
  16984. wrapInner: function( html ) {
  16985. if ( isFunction( html ) ) {
  16986. return this.each( function( i ) {
  16987. jQuery( this ).wrapInner( html.call( this, i ) );
  16988. } );
  16989. }
  16990. return this.each( function() {
  16991. var self = jQuery( this ),
  16992. contents = self.contents();
  16993. if ( contents.length ) {
  16994. contents.wrapAll( html );
  16995. } else {
  16996. self.append( html );
  16997. }
  16998. } );
  16999. },
  17000. wrap: function( html ) {
  17001. var htmlIsFunction = isFunction( html );
  17002. return this.each( function( i ) {
  17003. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  17004. } );
  17005. },
  17006. unwrap: function( selector ) {
  17007. this.parent( selector ).not( "body" ).each( function() {
  17008. jQuery( this ).replaceWith( this.childNodes );
  17009. } );
  17010. return this;
  17011. }
  17012. } );
  17013. jQuery.expr.pseudos.hidden = function( elem ) {
  17014. return !jQuery.expr.pseudos.visible( elem );
  17015. };
  17016. jQuery.expr.pseudos.visible = function( elem ) {
  17017. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  17018. };
  17019. jQuery.ajaxSettings.xhr = function() {
  17020. try {
  17021. return new window.XMLHttpRequest();
  17022. } catch ( e ) {}
  17023. };
  17024. var xhrSuccessStatus = {
  17025. // File protocol always yields status code 0, assume 200
  17026. 0: 200,
  17027. // Support: IE <=9 only
  17028. // #1450: sometimes IE returns 1223 when it should be 204
  17029. 1223: 204
  17030. },
  17031. xhrSupported = jQuery.ajaxSettings.xhr();
  17032. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  17033. support.ajax = xhrSupported = !!xhrSupported;
  17034. jQuery.ajaxTransport( function( options ) {
  17035. var callback, errorCallback;
  17036. // Cross domain only allowed if supported through XMLHttpRequest
  17037. if ( support.cors || xhrSupported && !options.crossDomain ) {
  17038. return {
  17039. send: function( headers, complete ) {
  17040. var i,
  17041. xhr = options.xhr();
  17042. xhr.open(
  17043. options.type,
  17044. options.url,
  17045. options.async,
  17046. options.username,
  17047. options.password
  17048. );
  17049. // Apply custom fields if provided
  17050. if ( options.xhrFields ) {
  17051. for ( i in options.xhrFields ) {
  17052. xhr[ i ] = options.xhrFields[ i ];
  17053. }
  17054. }
  17055. // Override mime type if needed
  17056. if ( options.mimeType && xhr.overrideMimeType ) {
  17057. xhr.overrideMimeType( options.mimeType );
  17058. }
  17059. // X-Requested-With header
  17060. // For cross-domain requests, seeing as conditions for a preflight are
  17061. // akin to a jigsaw puzzle, we simply never set it to be sure.
  17062. // (it can always be set on a per-request basis or even using ajaxSetup)
  17063. // For same-domain requests, won't change header if already provided.
  17064. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  17065. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  17066. }
  17067. // Set headers
  17068. for ( i in headers ) {
  17069. xhr.setRequestHeader( i, headers[ i ] );
  17070. }
  17071. // Callback
  17072. callback = function( type ) {
  17073. return function() {
  17074. if ( callback ) {
  17075. callback = errorCallback = xhr.onload =
  17076. xhr.onerror = xhr.onabort = xhr.ontimeout =
  17077. xhr.onreadystatechange = null;
  17078. if ( type === "abort" ) {
  17079. xhr.abort();
  17080. } else if ( type === "error" ) {
  17081. // Support: IE <=9 only
  17082. // On a manual native abort, IE9 throws
  17083. // errors on any property access that is not readyState
  17084. if ( typeof xhr.status !== "number" ) {
  17085. complete( 0, "error" );
  17086. } else {
  17087. complete(
  17088. // File: protocol always yields status 0; see #8605, #14207
  17089. xhr.status,
  17090. xhr.statusText
  17091. );
  17092. }
  17093. } else {
  17094. complete(
  17095. xhrSuccessStatus[ xhr.status ] || xhr.status,
  17096. xhr.statusText,
  17097. // Support: IE <=9 only
  17098. // IE9 has no XHR2 but throws on binary (trac-11426)
  17099. // For XHR2 non-text, let the caller handle it (gh-2498)
  17100. ( xhr.responseType || "text" ) !== "text" ||
  17101. typeof xhr.responseText !== "string" ?
  17102. { binary: xhr.response } :
  17103. { text: xhr.responseText },
  17104. xhr.getAllResponseHeaders()
  17105. );
  17106. }
  17107. }
  17108. };
  17109. };
  17110. // Listen to events
  17111. xhr.onload = callback();
  17112. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  17113. // Support: IE 9 only
  17114. // Use onreadystatechange to replace onabort
  17115. // to handle uncaught aborts
  17116. if ( xhr.onabort !== undefined ) {
  17117. xhr.onabort = errorCallback;
  17118. } else {
  17119. xhr.onreadystatechange = function() {
  17120. // Check readyState before timeout as it changes
  17121. if ( xhr.readyState === 4 ) {
  17122. // Allow onerror to be called first,
  17123. // but that will not handle a native abort
  17124. // Also, save errorCallback to a variable
  17125. // as xhr.onerror cannot be accessed
  17126. window.setTimeout( function() {
  17127. if ( callback ) {
  17128. errorCallback();
  17129. }
  17130. } );
  17131. }
  17132. };
  17133. }
  17134. // Create the abort callback
  17135. callback = callback( "abort" );
  17136. try {
  17137. // Do send the request (this may raise an exception)
  17138. xhr.send( options.hasContent && options.data || null );
  17139. } catch ( e ) {
  17140. // #14683: Only rethrow if this hasn't been notified as an error yet
  17141. if ( callback ) {
  17142. throw e;
  17143. }
  17144. }
  17145. },
  17146. abort: function() {
  17147. if ( callback ) {
  17148. callback();
  17149. }
  17150. }
  17151. };
  17152. }
  17153. } );
  17154. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  17155. jQuery.ajaxPrefilter( function( s ) {
  17156. if ( s.crossDomain ) {
  17157. s.contents.script = false;
  17158. }
  17159. } );
  17160. // Install script dataType
  17161. jQuery.ajaxSetup( {
  17162. accepts: {
  17163. script: "text/javascript, application/javascript, " +
  17164. "application/ecmascript, application/x-ecmascript"
  17165. },
  17166. contents: {
  17167. script: /\b(?:java|ecma)script\b/
  17168. },
  17169. converters: {
  17170. "text script": function( text ) {
  17171. jQuery.globalEval( text );
  17172. return text;
  17173. }
  17174. }
  17175. } );
  17176. // Handle cache's special case and crossDomain
  17177. jQuery.ajaxPrefilter( "script", function( s ) {
  17178. if ( s.cache === undefined ) {
  17179. s.cache = false;
  17180. }
  17181. if ( s.crossDomain ) {
  17182. s.type = "GET";
  17183. }
  17184. } );
  17185. // Bind script tag hack transport
  17186. jQuery.ajaxTransport( "script", function( s ) {
  17187. // This transport only deals with cross domain or forced-by-attrs requests
  17188. if ( s.crossDomain || s.scriptAttrs ) {
  17189. var script, callback;
  17190. return {
  17191. send: function( _, complete ) {
  17192. script = jQuery( "<script>" )
  17193. .attr( s.scriptAttrs || {} )
  17194. .prop( { charset: s.scriptCharset, src: s.url } )
  17195. .on( "load error", callback = function( evt ) {
  17196. script.remove();
  17197. callback = null;
  17198. if ( evt ) {
  17199. complete( evt.type === "error" ? 404 : 200, evt.type );
  17200. }
  17201. } );
  17202. // Use native DOM manipulation to avoid our domManip AJAX trickery
  17203. document.head.appendChild( script[ 0 ] );
  17204. },
  17205. abort: function() {
  17206. if ( callback ) {
  17207. callback();
  17208. }
  17209. }
  17210. };
  17211. }
  17212. } );
  17213. var oldCallbacks = [],
  17214. rjsonp = /(=)\?(?=&|$)|\?\?/;
  17215. // Default jsonp settings
  17216. jQuery.ajaxSetup( {
  17217. jsonp: "callback",
  17218. jsonpCallback: function() {
  17219. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  17220. this[ callback ] = true;
  17221. return callback;
  17222. }
  17223. } );
  17224. // Detect, normalize options and install callbacks for jsonp requests
  17225. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  17226. var callbackName, overwritten, responseContainer,
  17227. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  17228. "url" :
  17229. typeof s.data === "string" &&
  17230. ( s.contentType || "" )
  17231. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  17232. rjsonp.test( s.data ) && "data"
  17233. );
  17234. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  17235. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  17236. // Get callback name, remembering preexisting value associated with it
  17237. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  17238. s.jsonpCallback() :
  17239. s.jsonpCallback;
  17240. // Insert callback into url or form data
  17241. if ( jsonProp ) {
  17242. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  17243. } else if ( s.jsonp !== false ) {
  17244. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  17245. }
  17246. // Use data converter to retrieve json after script execution
  17247. s.converters[ "script json" ] = function() {
  17248. if ( !responseContainer ) {
  17249. jQuery.error( callbackName + " was not called" );
  17250. }
  17251. return responseContainer[ 0 ];
  17252. };
  17253. // Force json dataType
  17254. s.dataTypes[ 0 ] = "json";
  17255. // Install callback
  17256. overwritten = window[ callbackName ];
  17257. window[ callbackName ] = function() {
  17258. responseContainer = arguments;
  17259. };
  17260. // Clean-up function (fires after converters)
  17261. jqXHR.always( function() {
  17262. // If previous value didn't exist - remove it
  17263. if ( overwritten === undefined ) {
  17264. jQuery( window ).removeProp( callbackName );
  17265. // Otherwise restore preexisting value
  17266. } else {
  17267. window[ callbackName ] = overwritten;
  17268. }
  17269. // Save back as free
  17270. if ( s[ callbackName ] ) {
  17271. // Make sure that re-using the options doesn't screw things around
  17272. s.jsonpCallback = originalSettings.jsonpCallback;
  17273. // Save the callback name for future use
  17274. oldCallbacks.push( callbackName );
  17275. }
  17276. // Call if it was a function and we have a response
  17277. if ( responseContainer && isFunction( overwritten ) ) {
  17278. overwritten( responseContainer[ 0 ] );
  17279. }
  17280. responseContainer = overwritten = undefined;
  17281. } );
  17282. // Delegate to script
  17283. return "script";
  17284. }
  17285. } );
  17286. // Support: Safari 8 only
  17287. // In Safari 8 documents created via document.implementation.createHTMLDocument
  17288. // collapse sibling forms: the second one becomes a child of the first one.
  17289. // Because of that, this security measure has to be disabled in Safari 8.
  17290. // https://bugs.webkit.org/show_bug.cgi?id=137337
  17291. support.createHTMLDocument = ( function() {
  17292. var body = document.implementation.createHTMLDocument( "" ).body;
  17293. body.innerHTML = "<form></form><form></form>";
  17294. return body.childNodes.length === 2;
  17295. } )();
  17296. // Argument "data" should be string of html
  17297. // context (optional): If specified, the fragment will be created in this context,
  17298. // defaults to document
  17299. // keepScripts (optional): If true, will include scripts passed in the html string
  17300. jQuery.parseHTML = function( data, context, keepScripts ) {
  17301. if ( typeof data !== "string" ) {
  17302. return [];
  17303. }
  17304. if ( typeof context === "boolean" ) {
  17305. keepScripts = context;
  17306. context = false;
  17307. }
  17308. var base, parsed, scripts;
  17309. if ( !context ) {
  17310. // Stop scripts or inline event handlers from being executed immediately
  17311. // by using document.implementation
  17312. if ( support.createHTMLDocument ) {
  17313. context = document.implementation.createHTMLDocument( "" );
  17314. // Set the base href for the created document
  17315. // so any parsed elements with URLs
  17316. // are based on the document's URL (gh-2965)
  17317. base = context.createElement( "base" );
  17318. base.href = document.location.href;
  17319. context.head.appendChild( base );
  17320. } else {
  17321. context = document;
  17322. }
  17323. }
  17324. parsed = rsingleTag.exec( data );
  17325. scripts = !keepScripts && [];
  17326. // Single tag
  17327. if ( parsed ) {
  17328. return [ context.createElement( parsed[ 1 ] ) ];
  17329. }
  17330. parsed = buildFragment( [ data ], context, scripts );
  17331. if ( scripts && scripts.length ) {
  17332. jQuery( scripts ).remove();
  17333. }
  17334. return jQuery.merge( [], parsed.childNodes );
  17335. };
  17336. /**
  17337. * Load a url into a page
  17338. */
  17339. jQuery.fn.load = function( url, params, callback ) {
  17340. var selector, type, response,
  17341. self = this,
  17342. off = url.indexOf( " " );
  17343. if ( off > -1 ) {
  17344. selector = stripAndCollapse( url.slice( off ) );
  17345. url = url.slice( 0, off );
  17346. }
  17347. // If it's a function
  17348. if ( isFunction( params ) ) {
  17349. // We assume that it's the callback
  17350. callback = params;
  17351. params = undefined;
  17352. // Otherwise, build a param string
  17353. } else if ( params && typeof params === "object" ) {
  17354. type = "POST";
  17355. }
  17356. // If we have elements to modify, make the request
  17357. if ( self.length > 0 ) {
  17358. jQuery.ajax( {
  17359. url: url,
  17360. // If "type" variable is undefined, then "GET" method will be used.
  17361. // Make value of this field explicit since
  17362. // user can override it through ajaxSetup method
  17363. type: type || "GET",
  17364. dataType: "html",
  17365. data: params
  17366. } ).done( function( responseText ) {
  17367. // Save response for use in complete callback
  17368. response = arguments;
  17369. self.html( selector ?
  17370. // If a selector was specified, locate the right elements in a dummy div
  17371. // Exclude scripts to avoid IE 'Permission Denied' errors
  17372. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  17373. // Otherwise use the full result
  17374. responseText );
  17375. // If the request succeeds, this function gets "data", "status", "jqXHR"
  17376. // but they are ignored because response was set above.
  17377. // If it fails, this function gets "jqXHR", "status", "error"
  17378. } ).always( callback && function( jqXHR, status ) {
  17379. self.each( function() {
  17380. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  17381. } );
  17382. } );
  17383. }
  17384. return this;
  17385. };
  17386. // Attach a bunch of functions for handling common AJAX events
  17387. jQuery.each( [
  17388. "ajaxStart",
  17389. "ajaxStop",
  17390. "ajaxComplete",
  17391. "ajaxError",
  17392. "ajaxSuccess",
  17393. "ajaxSend"
  17394. ], function( i, type ) {
  17395. jQuery.fn[ type ] = function( fn ) {
  17396. return this.on( type, fn );
  17397. };
  17398. } );
  17399. jQuery.expr.pseudos.animated = function( elem ) {
  17400. return jQuery.grep( jQuery.timers, function( fn ) {
  17401. return elem === fn.elem;
  17402. } ).length;
  17403. };
  17404. jQuery.offset = {
  17405. setOffset: function( elem, options, i ) {
  17406. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  17407. position = jQuery.css( elem, "position" ),
  17408. curElem = jQuery( elem ),
  17409. props = {};
  17410. // Set position first, in-case top/left are set even on static elem
  17411. if ( position === "static" ) {
  17412. elem.style.position = "relative";
  17413. }
  17414. curOffset = curElem.offset();
  17415. curCSSTop = jQuery.css( elem, "top" );
  17416. curCSSLeft = jQuery.css( elem, "left" );
  17417. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  17418. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  17419. // Need to be able to calculate position if either
  17420. // top or left is auto and position is either absolute or fixed
  17421. if ( calculatePosition ) {
  17422. curPosition = curElem.position();
  17423. curTop = curPosition.top;
  17424. curLeft = curPosition.left;
  17425. } else {
  17426. curTop = parseFloat( curCSSTop ) || 0;
  17427. curLeft = parseFloat( curCSSLeft ) || 0;
  17428. }
  17429. if ( isFunction( options ) ) {
  17430. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  17431. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  17432. }
  17433. if ( options.top != null ) {
  17434. props.top = ( options.top - curOffset.top ) + curTop;
  17435. }
  17436. if ( options.left != null ) {
  17437. props.left = ( options.left - curOffset.left ) + curLeft;
  17438. }
  17439. if ( "using" in options ) {
  17440. options.using.call( elem, props );
  17441. } else {
  17442. curElem.css( props );
  17443. }
  17444. }
  17445. };
  17446. jQuery.fn.extend( {
  17447. // offset() relates an element's border box to the document origin
  17448. offset: function( options ) {
  17449. // Preserve chaining for setter
  17450. if ( arguments.length ) {
  17451. return options === undefined ?
  17452. this :
  17453. this.each( function( i ) {
  17454. jQuery.offset.setOffset( this, options, i );
  17455. } );
  17456. }
  17457. var rect, win,
  17458. elem = this[ 0 ];
  17459. if ( !elem ) {
  17460. return;
  17461. }
  17462. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  17463. // Support: IE <=11 only
  17464. // Running getBoundingClientRect on a
  17465. // disconnected node in IE throws an error
  17466. if ( !elem.getClientRects().length ) {
  17467. return { top: 0, left: 0 };
  17468. }
  17469. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  17470. rect = elem.getBoundingClientRect();
  17471. win = elem.ownerDocument.defaultView;
  17472. return {
  17473. top: rect.top + win.pageYOffset,
  17474. left: rect.left + win.pageXOffset
  17475. };
  17476. },
  17477. // position() relates an element's margin box to its offset parent's padding box
  17478. // This corresponds to the behavior of CSS absolute positioning
  17479. position: function() {
  17480. if ( !this[ 0 ] ) {
  17481. return;
  17482. }
  17483. var offsetParent, offset, doc,
  17484. elem = this[ 0 ],
  17485. parentOffset = { top: 0, left: 0 };
  17486. // position:fixed elements are offset from the viewport, which itself always has zero offset
  17487. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  17488. // Assume position:fixed implies availability of getBoundingClientRect
  17489. offset = elem.getBoundingClientRect();
  17490. } else {
  17491. offset = this.offset();
  17492. // Account for the *real* offset parent, which can be the document or its root element
  17493. // when a statically positioned element is identified
  17494. doc = elem.ownerDocument;
  17495. offsetParent = elem.offsetParent || doc.documentElement;
  17496. while ( offsetParent &&
  17497. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  17498. jQuery.css( offsetParent, "position" ) === "static" ) {
  17499. offsetParent = offsetParent.parentNode;
  17500. }
  17501. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  17502. // Incorporate borders into its offset, since they are outside its content origin
  17503. parentOffset = jQuery( offsetParent ).offset();
  17504. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  17505. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  17506. }
  17507. }
  17508. // Subtract parent offsets and element margins
  17509. return {
  17510. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  17511. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  17512. };
  17513. },
  17514. // This method will return documentElement in the following cases:
  17515. // 1) For the element inside the iframe without offsetParent, this method will return
  17516. // documentElement of the parent window
  17517. // 2) For the hidden or detached element
  17518. // 3) For body or html element, i.e. in case of the html node - it will return itself
  17519. //
  17520. // but those exceptions were never presented as a real life use-cases
  17521. // and might be considered as more preferable results.
  17522. //
  17523. // This logic, however, is not guaranteed and can change at any point in the future
  17524. offsetParent: function() {
  17525. return this.map( function() {
  17526. var offsetParent = this.offsetParent;
  17527. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  17528. offsetParent = offsetParent.offsetParent;
  17529. }
  17530. return offsetParent || documentElement;
  17531. } );
  17532. }
  17533. } );
  17534. // Create scrollLeft and scrollTop methods
  17535. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  17536. var top = "pageYOffset" === prop;
  17537. jQuery.fn[ method ] = function( val ) {
  17538. return access( this, function( elem, method, val ) {
  17539. // Coalesce documents and windows
  17540. var win;
  17541. if ( isWindow( elem ) ) {
  17542. win = elem;
  17543. } else if ( elem.nodeType === 9 ) {
  17544. win = elem.defaultView;
  17545. }
  17546. if ( val === undefined ) {
  17547. return win ? win[ prop ] : elem[ method ];
  17548. }
  17549. if ( win ) {
  17550. win.scrollTo(
  17551. !top ? val : win.pageXOffset,
  17552. top ? val : win.pageYOffset
  17553. );
  17554. } else {
  17555. elem[ method ] = val;
  17556. }
  17557. }, method, val, arguments.length );
  17558. };
  17559. } );
  17560. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  17561. // Add the top/left cssHooks using jQuery.fn.position
  17562. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  17563. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  17564. // getComputedStyle returns percent when specified for top/left/bottom/right;
  17565. // rather than make the css module depend on the offset module, just check for it here
  17566. jQuery.each( [ "top", "left" ], function( i, prop ) {
  17567. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  17568. function( elem, computed ) {
  17569. if ( computed ) {
  17570. computed = curCSS( elem, prop );
  17571. // If curCSS returns percentage, fallback to offset
  17572. return rnumnonpx.test( computed ) ?
  17573. jQuery( elem ).position()[ prop ] + "px" :
  17574. computed;
  17575. }
  17576. }
  17577. );
  17578. } );
  17579. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  17580. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  17581. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  17582. function( defaultExtra, funcName ) {
  17583. // Margin is only for outerHeight, outerWidth
  17584. jQuery.fn[ funcName ] = function( margin, value ) {
  17585. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  17586. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  17587. return access( this, function( elem, type, value ) {
  17588. var doc;
  17589. if ( isWindow( elem ) ) {
  17590. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  17591. return funcName.indexOf( "outer" ) === 0 ?
  17592. elem[ "inner" + name ] :
  17593. elem.document.documentElement[ "client" + name ];
  17594. }
  17595. // Get document width or height
  17596. if ( elem.nodeType === 9 ) {
  17597. doc = elem.documentElement;
  17598. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  17599. // whichever is greatest
  17600. return Math.max(
  17601. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  17602. elem.body[ "offset" + name ], doc[ "offset" + name ],
  17603. doc[ "client" + name ]
  17604. );
  17605. }
  17606. return value === undefined ?
  17607. // Get width or height on the element, requesting but not forcing parseFloat
  17608. jQuery.css( elem, type, extra ) :
  17609. // Set width or height on the element
  17610. jQuery.style( elem, type, value, extra );
  17611. }, type, chainable ? margin : undefined, chainable );
  17612. };
  17613. } );
  17614. } );
  17615. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  17616. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  17617. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  17618. function( i, name ) {
  17619. // Handle event binding
  17620. jQuery.fn[ name ] = function( data, fn ) {
  17621. return arguments.length > 0 ?
  17622. this.on( name, null, data, fn ) :
  17623. this.trigger( name );
  17624. };
  17625. } );
  17626. jQuery.fn.extend( {
  17627. hover: function( fnOver, fnOut ) {
  17628. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  17629. }
  17630. } );
  17631. jQuery.fn.extend( {
  17632. bind: function( types, data, fn ) {
  17633. return this.on( types, null, data, fn );
  17634. },
  17635. unbind: function( types, fn ) {
  17636. return this.off( types, null, fn );
  17637. },
  17638. delegate: function( selector, types, data, fn ) {
  17639. return this.on( types, selector, data, fn );
  17640. },
  17641. undelegate: function( selector, types, fn ) {
  17642. // ( namespace ) or ( selector, types [, fn] )
  17643. return arguments.length === 1 ?
  17644. this.off( selector, "**" ) :
  17645. this.off( types, selector || "**", fn );
  17646. }
  17647. } );
  17648. // Bind a function to a context, optionally partially applying any
  17649. // arguments.
  17650. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  17651. // However, it is not slated for removal any time soon
  17652. jQuery.proxy = function( fn, context ) {
  17653. var tmp, args, proxy;
  17654. if ( typeof context === "string" ) {
  17655. tmp = fn[ context ];
  17656. context = fn;
  17657. fn = tmp;
  17658. }
  17659. // Quick check to determine if target is callable, in the spec
  17660. // this throws a TypeError, but we will just return undefined.
  17661. if ( !isFunction( fn ) ) {
  17662. return undefined;
  17663. }
  17664. // Simulated bind
  17665. args = slice.call( arguments, 2 );
  17666. proxy = function() {
  17667. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  17668. };
  17669. // Set the guid of unique handler to the same of original handler, so it can be removed
  17670. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  17671. return proxy;
  17672. };
  17673. jQuery.holdReady = function( hold ) {
  17674. if ( hold ) {
  17675. jQuery.readyWait++;
  17676. } else {
  17677. jQuery.ready( true );
  17678. }
  17679. };
  17680. jQuery.isArray = Array.isArray;
  17681. jQuery.parseJSON = JSON.parse;
  17682. jQuery.nodeName = nodeName;
  17683. jQuery.isFunction = isFunction;
  17684. jQuery.isWindow = isWindow;
  17685. jQuery.camelCase = camelCase;
  17686. jQuery.type = toType;
  17687. jQuery.now = Date.now;
  17688. jQuery.isNumeric = function( obj ) {
  17689. // As of jQuery 3.0, isNumeric is limited to
  17690. // strings and numbers (primitives or objects)
  17691. // that can be coerced to finite numbers (gh-2662)
  17692. var type = jQuery.type( obj );
  17693. return ( type === "number" || type === "string" ) &&
  17694. // parseFloat NaNs numeric-cast false positives ("")
  17695. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  17696. // subtraction forces infinities to NaN
  17697. !isNaN( obj - parseFloat( obj ) );
  17698. };
  17699. // Register as a named AMD module, since jQuery can be concatenated with other
  17700. // files that may use define, but not via a proper concatenation script that
  17701. // understands anonymous AMD modules. A named AMD is safest and most robust
  17702. // way to register. Lowercase jquery is used because AMD module names are
  17703. // derived from file names, and jQuery is normally delivered in a lowercase
  17704. // file name. Do this after creating the global so that if an AMD module wants
  17705. // to call noConflict to hide this version of jQuery, it will work.
  17706. // Note that for maximum portability, libraries that are not jQuery should
  17707. // declare themselves as anonymous modules, and avoid setting a global if an
  17708. // AMD loader is present. jQuery is a special case. For more information, see
  17709. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  17710. if ( true ) {
  17711. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  17712. return jQuery;
  17713. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  17714. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  17715. }
  17716. var
  17717. // Map over jQuery in case of overwrite
  17718. _jQuery = window.jQuery,
  17719. // Map over the $ in case of overwrite
  17720. _$ = window.$;
  17721. jQuery.noConflict = function( deep ) {
  17722. if ( window.$ === jQuery ) {
  17723. window.$ = _$;
  17724. }
  17725. if ( deep && window.jQuery === jQuery ) {
  17726. window.jQuery = _jQuery;
  17727. }
  17728. return jQuery;
  17729. };
  17730. // Expose jQuery and $ identifiers, even in AMD
  17731. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  17732. // and CommonJS for browser emulators (#13566)
  17733. if ( !noGlobal ) {
  17734. window.jQuery = window.$ = jQuery;
  17735. }
  17736. return jQuery;
  17737. } );
  17738. /***/ }),
  17739. /***/ "./node_modules/laravel-echo/dist/echo.js":
  17740. /*!************************************************!*\
  17741. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  17742. \************************************************/
  17743. /*! exports provided: default */
  17744. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  17745. "use strict";
  17746. __webpack_require__.r(__webpack_exports__);
  17747. var classCallCheck = function (instance, Constructor) {
  17748. if (!(instance instanceof Constructor)) {
  17749. throw new TypeError("Cannot call a class as a function");
  17750. }
  17751. };
  17752. var createClass = function () {
  17753. function defineProperties(target, props) {
  17754. for (var i = 0; i < props.length; i++) {
  17755. var descriptor = props[i];
  17756. descriptor.enumerable = descriptor.enumerable || false;
  17757. descriptor.configurable = true;
  17758. if ("value" in descriptor) descriptor.writable = true;
  17759. Object.defineProperty(target, descriptor.key, descriptor);
  17760. }
  17761. }
  17762. return function (Constructor, protoProps, staticProps) {
  17763. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  17764. if (staticProps) defineProperties(Constructor, staticProps);
  17765. return Constructor;
  17766. };
  17767. }();
  17768. var _extends = Object.assign || function (target) {
  17769. for (var i = 1; i < arguments.length; i++) {
  17770. var source = arguments[i];
  17771. for (var key in source) {
  17772. if (Object.prototype.hasOwnProperty.call(source, key)) {
  17773. target[key] = source[key];
  17774. }
  17775. }
  17776. }
  17777. return target;
  17778. };
  17779. var inherits = function (subClass, superClass) {
  17780. if (typeof superClass !== "function" && superClass !== null) {
  17781. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  17782. }
  17783. subClass.prototype = Object.create(superClass && superClass.prototype, {
  17784. constructor: {
  17785. value: subClass,
  17786. enumerable: false,
  17787. writable: true,
  17788. configurable: true
  17789. }
  17790. });
  17791. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  17792. };
  17793. var possibleConstructorReturn = function (self, call) {
  17794. if (!self) {
  17795. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  17796. }
  17797. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  17798. };
  17799. var Connector = function () {
  17800. /**
  17801. * Create a new class instance.
  17802. */
  17803. function Connector(options) {
  17804. classCallCheck(this, Connector);
  17805. /**
  17806. * Default connector options.
  17807. */
  17808. this._defaultOptions = {
  17809. auth: {
  17810. headers: {}
  17811. },
  17812. authEndpoint: '/broadcasting/auth',
  17813. broadcaster: 'pusher',
  17814. csrfToken: null,
  17815. host: null,
  17816. key: null,
  17817. namespace: 'App.Events'
  17818. };
  17819. this.setOptions(options);
  17820. this.connect();
  17821. }
  17822. /**
  17823. * Merge the custom options with the defaults.
  17824. */
  17825. createClass(Connector, [{
  17826. key: 'setOptions',
  17827. value: function setOptions(options) {
  17828. this.options = _extends(this._defaultOptions, options);
  17829. if (this.csrfToken()) {
  17830. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  17831. }
  17832. return options;
  17833. }
  17834. /**
  17835. * Extract the CSRF token from the page.
  17836. */
  17837. }, {
  17838. key: 'csrfToken',
  17839. value: function csrfToken() {
  17840. var selector = void 0;
  17841. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  17842. return window['Laravel'].csrfToken;
  17843. } else if (this.options.csrfToken) {
  17844. return this.options.csrfToken;
  17845. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  17846. return selector.getAttribute('content');
  17847. }
  17848. return null;
  17849. }
  17850. }]);
  17851. return Connector;
  17852. }();
  17853. /**
  17854. * This class represents a basic channel.
  17855. */
  17856. var Channel = function () {
  17857. function Channel() {
  17858. classCallCheck(this, Channel);
  17859. }
  17860. createClass(Channel, [{
  17861. key: 'listenForWhisper',
  17862. /**
  17863. * Listen for a whisper event on the channel instance.
  17864. */
  17865. value: function listenForWhisper(event, callback) {
  17866. return this.listen('.client-' + event, callback);
  17867. }
  17868. /**
  17869. * Listen for an event on the channel instance.
  17870. */
  17871. }, {
  17872. key: 'notification',
  17873. value: function notification(callback) {
  17874. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  17875. }
  17876. /**
  17877. * Stop listening for a whispser event on the channel instance.
  17878. */
  17879. }, {
  17880. key: 'stopListeningForWhisper',
  17881. value: function stopListeningForWhisper(event) {
  17882. return this.stopListening('.client-' + event);
  17883. }
  17884. }]);
  17885. return Channel;
  17886. }();
  17887. /**
  17888. * Event name formatter
  17889. */
  17890. var EventFormatter = function () {
  17891. /**
  17892. * Create a new class instance.
  17893. */
  17894. function EventFormatter(namespace) {
  17895. classCallCheck(this, EventFormatter);
  17896. this.setNamespace(namespace);
  17897. }
  17898. /**
  17899. * Format the given event name.
  17900. */
  17901. createClass(EventFormatter, [{
  17902. key: 'format',
  17903. value: function format(event) {
  17904. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  17905. return event.substr(1);
  17906. } else if (this.namespace) {
  17907. event = this.namespace + '.' + event;
  17908. }
  17909. return event.replace(/\./g, '\\');
  17910. }
  17911. /**
  17912. * Set the event namespace.
  17913. */
  17914. }, {
  17915. key: 'setNamespace',
  17916. value: function setNamespace(value) {
  17917. this.namespace = value;
  17918. }
  17919. }]);
  17920. return EventFormatter;
  17921. }();
  17922. /**
  17923. * This class represents a Pusher channel.
  17924. */
  17925. var PusherChannel = function (_Channel) {
  17926. inherits(PusherChannel, _Channel);
  17927. /**
  17928. * Create a new class instance.
  17929. */
  17930. function PusherChannel(pusher, name, options) {
  17931. classCallCheck(this, PusherChannel);
  17932. var _this = possibleConstructorReturn(this, (PusherChannel.__proto__ || Object.getPrototypeOf(PusherChannel)).call(this));
  17933. _this.name = name;
  17934. _this.pusher = pusher;
  17935. _this.options = options;
  17936. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17937. _this.subscribe();
  17938. return _this;
  17939. }
  17940. /**
  17941. * Subscribe to a Pusher channel.
  17942. */
  17943. createClass(PusherChannel, [{
  17944. key: 'subscribe',
  17945. value: function subscribe() {
  17946. this.subscription = this.pusher.subscribe(this.name);
  17947. }
  17948. /**
  17949. * Unsubscribe from a Pusher channel.
  17950. */
  17951. }, {
  17952. key: 'unsubscribe',
  17953. value: function unsubscribe() {
  17954. this.pusher.unsubscribe(this.name);
  17955. }
  17956. /**
  17957. * Listen for an event on the channel instance.
  17958. */
  17959. }, {
  17960. key: 'listen',
  17961. value: function listen(event, callback) {
  17962. this.on(this.eventFormatter.format(event), callback);
  17963. return this;
  17964. }
  17965. /**
  17966. * Stop listening for an event on the channel instance.
  17967. */
  17968. }, {
  17969. key: 'stopListening',
  17970. value: function stopListening(event) {
  17971. this.subscription.unbind(this.eventFormatter.format(event));
  17972. return this;
  17973. }
  17974. /**
  17975. * Bind a channel to an event.
  17976. */
  17977. }, {
  17978. key: 'on',
  17979. value: function on(event, callback) {
  17980. this.subscription.bind(event, callback);
  17981. return this;
  17982. }
  17983. }]);
  17984. return PusherChannel;
  17985. }(Channel);
  17986. /**
  17987. * This class represents a Pusher private channel.
  17988. */
  17989. var PusherPrivateChannel = function (_PusherChannel) {
  17990. inherits(PusherPrivateChannel, _PusherChannel);
  17991. function PusherPrivateChannel() {
  17992. classCallCheck(this, PusherPrivateChannel);
  17993. return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments));
  17994. }
  17995. createClass(PusherPrivateChannel, [{
  17996. key: 'whisper',
  17997. /**
  17998. * Trigger client event on the channel.
  17999. */
  18000. value: function whisper(eventName, data) {
  18001. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  18002. return this;
  18003. }
  18004. }]);
  18005. return PusherPrivateChannel;
  18006. }(PusherChannel);
  18007. /**
  18008. * This class represents a Pusher presence channel.
  18009. */
  18010. var PusherPresenceChannel = function (_PusherChannel) {
  18011. inherits(PusherPresenceChannel, _PusherChannel);
  18012. function PusherPresenceChannel() {
  18013. classCallCheck(this, PusherPresenceChannel);
  18014. return possibleConstructorReturn(this, (PusherPresenceChannel.__proto__ || Object.getPrototypeOf(PusherPresenceChannel)).apply(this, arguments));
  18015. }
  18016. createClass(PusherPresenceChannel, [{
  18017. key: 'here',
  18018. /**
  18019. * Register a callback to be called anytime the member list changes.
  18020. */
  18021. value: function here(callback) {
  18022. this.on('pusher:subscription_succeeded', function (data) {
  18023. callback(Object.keys(data.members).map(function (k) {
  18024. return data.members[k];
  18025. }));
  18026. });
  18027. return this;
  18028. }
  18029. /**
  18030. * Listen for someone joining the channel.
  18031. */
  18032. }, {
  18033. key: 'joining',
  18034. value: function joining(callback) {
  18035. this.on('pusher:member_added', function (member) {
  18036. callback(member.info);
  18037. });
  18038. return this;
  18039. }
  18040. /**
  18041. * Listen for someone leaving the channel.
  18042. */
  18043. }, {
  18044. key: 'leaving',
  18045. value: function leaving(callback) {
  18046. this.on('pusher:member_removed', function (member) {
  18047. callback(member.info);
  18048. });
  18049. return this;
  18050. }
  18051. /**
  18052. * Trigger client event on the channel.
  18053. */
  18054. }, {
  18055. key: 'whisper',
  18056. value: function whisper(eventName, data) {
  18057. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  18058. return this;
  18059. }
  18060. }]);
  18061. return PusherPresenceChannel;
  18062. }(PusherChannel);
  18063. /**
  18064. * This class represents a Socket.io channel.
  18065. */
  18066. var SocketIoChannel = function (_Channel) {
  18067. inherits(SocketIoChannel, _Channel);
  18068. /**
  18069. * Create a new class instance.
  18070. */
  18071. function SocketIoChannel(socket, name, options) {
  18072. classCallCheck(this, SocketIoChannel);
  18073. /**
  18074. * The event callbacks applied to the channel.
  18075. */
  18076. var _this = possibleConstructorReturn(this, (SocketIoChannel.__proto__ || Object.getPrototypeOf(SocketIoChannel)).call(this));
  18077. _this.events = {};
  18078. _this.name = name;
  18079. _this.socket = socket;
  18080. _this.options = options;
  18081. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  18082. _this.subscribe();
  18083. _this.configureReconnector();
  18084. return _this;
  18085. }
  18086. /**
  18087. * Subscribe to a Socket.io channel.
  18088. */
  18089. createClass(SocketIoChannel, [{
  18090. key: 'subscribe',
  18091. value: function subscribe() {
  18092. this.socket.emit('subscribe', {
  18093. channel: this.name,
  18094. auth: this.options.auth || {}
  18095. });
  18096. }
  18097. /**
  18098. * Unsubscribe from channel and ubind event callbacks.
  18099. */
  18100. }, {
  18101. key: 'unsubscribe',
  18102. value: function unsubscribe() {
  18103. this.unbind();
  18104. this.socket.emit('unsubscribe', {
  18105. channel: this.name,
  18106. auth: this.options.auth || {}
  18107. });
  18108. }
  18109. /**
  18110. * Listen for an event on the channel instance.
  18111. */
  18112. }, {
  18113. key: 'listen',
  18114. value: function listen(event, callback) {
  18115. this.on(this.eventFormatter.format(event), callback);
  18116. return this;
  18117. }
  18118. /**
  18119. * Stop listening for an event on the channel instance.
  18120. */
  18121. }, {
  18122. key: 'stopListening',
  18123. value: function stopListening(event) {
  18124. var name = this.eventFormatter.format(event);
  18125. this.socket.removeListener(name);
  18126. delete this.events[name];
  18127. return this;
  18128. }
  18129. /**
  18130. * Bind the channel's socket to an event and store the callback.
  18131. */
  18132. }, {
  18133. key: 'on',
  18134. value: function on(event, callback) {
  18135. var _this2 = this;
  18136. var listener = function listener(channel, data) {
  18137. if (_this2.name == channel) {
  18138. callback(data);
  18139. }
  18140. };
  18141. this.socket.on(event, listener);
  18142. this.bind(event, listener);
  18143. }
  18144. /**
  18145. * Attach a 'reconnect' listener and bind the event.
  18146. */
  18147. }, {
  18148. key: 'configureReconnector',
  18149. value: function configureReconnector() {
  18150. var _this3 = this;
  18151. var listener = function listener() {
  18152. _this3.subscribe();
  18153. };
  18154. this.socket.on('reconnect', listener);
  18155. this.bind('reconnect', listener);
  18156. }
  18157. /**
  18158. * Bind the channel's socket to an event and store the callback.
  18159. */
  18160. }, {
  18161. key: 'bind',
  18162. value: function bind(event, callback) {
  18163. this.events[event] = this.events[event] || [];
  18164. this.events[event].push(callback);
  18165. }
  18166. /**
  18167. * Unbind the channel's socket from all stored event callbacks.
  18168. */
  18169. }, {
  18170. key: 'unbind',
  18171. value: function unbind() {
  18172. var _this4 = this;
  18173. Object.keys(this.events).forEach(function (event) {
  18174. _this4.events[event].forEach(function (callback) {
  18175. _this4.socket.removeListener(event, callback);
  18176. });
  18177. delete _this4.events[event];
  18178. });
  18179. }
  18180. }]);
  18181. return SocketIoChannel;
  18182. }(Channel);
  18183. /**
  18184. * This class represents a Socket.io presence channel.
  18185. */
  18186. var SocketIoPrivateChannel = function (_SocketIoChannel) {
  18187. inherits(SocketIoPrivateChannel, _SocketIoChannel);
  18188. function SocketIoPrivateChannel() {
  18189. classCallCheck(this, SocketIoPrivateChannel);
  18190. return possibleConstructorReturn(this, (SocketIoPrivateChannel.__proto__ || Object.getPrototypeOf(SocketIoPrivateChannel)).apply(this, arguments));
  18191. }
  18192. createClass(SocketIoPrivateChannel, [{
  18193. key: 'whisper',
  18194. /**
  18195. * Trigger client event on the channel.
  18196. */
  18197. value: function whisper(eventName, data) {
  18198. this.socket.emit('client event', {
  18199. channel: this.name,
  18200. event: 'client-' + eventName,
  18201. data: data
  18202. });
  18203. return this;
  18204. }
  18205. }]);
  18206. return SocketIoPrivateChannel;
  18207. }(SocketIoChannel);
  18208. /**
  18209. * This class represents a Socket.io presence channel.
  18210. */
  18211. var SocketIoPresenceChannel = function (_SocketIoPrivateChann) {
  18212. inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  18213. function SocketIoPresenceChannel() {
  18214. classCallCheck(this, SocketIoPresenceChannel);
  18215. return possibleConstructorReturn(this, (SocketIoPresenceChannel.__proto__ || Object.getPrototypeOf(SocketIoPresenceChannel)).apply(this, arguments));
  18216. }
  18217. createClass(SocketIoPresenceChannel, [{
  18218. key: 'here',
  18219. /**
  18220. * Register a callback to be called anytime the member list changes.
  18221. */
  18222. value: function here(callback) {
  18223. this.on('presence:subscribed', function (members) {
  18224. callback(members.map(function (m) {
  18225. return m.user_info;
  18226. }));
  18227. });
  18228. return this;
  18229. }
  18230. /**
  18231. * Listen for someone joining the channel.
  18232. */
  18233. }, {
  18234. key: 'joining',
  18235. value: function joining(callback) {
  18236. this.on('presence:joining', function (member) {
  18237. return callback(member.user_info);
  18238. });
  18239. return this;
  18240. }
  18241. /**
  18242. * Listen for someone leaving the channel.
  18243. */
  18244. }, {
  18245. key: 'leaving',
  18246. value: function leaving(callback) {
  18247. this.on('presence:leaving', function (member) {
  18248. return callback(member.user_info);
  18249. });
  18250. return this;
  18251. }
  18252. }]);
  18253. return SocketIoPresenceChannel;
  18254. }(SocketIoPrivateChannel);
  18255. /**
  18256. * This class represents a null channel.
  18257. */
  18258. var NullChannel = function (_Channel) {
  18259. inherits(NullChannel, _Channel);
  18260. function NullChannel() {
  18261. classCallCheck(this, NullChannel);
  18262. return possibleConstructorReturn(this, (NullChannel.__proto__ || Object.getPrototypeOf(NullChannel)).apply(this, arguments));
  18263. }
  18264. createClass(NullChannel, [{
  18265. key: 'subscribe',
  18266. /**
  18267. * Subscribe to a channel.
  18268. */
  18269. value: function subscribe() {}
  18270. //
  18271. /**
  18272. * Unsubscribe from a channel.
  18273. */
  18274. }, {
  18275. key: 'unsubscribe',
  18276. value: function unsubscribe() {}
  18277. //
  18278. /**
  18279. * Listen for an event on the channel instance.
  18280. */
  18281. }, {
  18282. key: 'listen',
  18283. value: function listen(event, callback) {
  18284. return this;
  18285. }
  18286. /**
  18287. * Stop listening for an event on the channel instance.
  18288. */
  18289. }, {
  18290. key: 'stopListening',
  18291. value: function stopListening(event) {
  18292. return this;
  18293. }
  18294. /**
  18295. * Bind a channel to an event.
  18296. */
  18297. }, {
  18298. key: 'on',
  18299. value: function on(event, callback) {
  18300. return this;
  18301. }
  18302. }]);
  18303. return NullChannel;
  18304. }(Channel);
  18305. /**
  18306. * This class represents a null private channel.
  18307. */
  18308. var NullPrivateChannel = function (_NullChannel) {
  18309. inherits(NullPrivateChannel, _NullChannel);
  18310. function NullPrivateChannel() {
  18311. classCallCheck(this, NullPrivateChannel);
  18312. return possibleConstructorReturn(this, (NullPrivateChannel.__proto__ || Object.getPrototypeOf(NullPrivateChannel)).apply(this, arguments));
  18313. }
  18314. createClass(NullPrivateChannel, [{
  18315. key: 'whisper',
  18316. /**
  18317. * Trigger client event on the channel.
  18318. */
  18319. value: function whisper(eventName, data) {
  18320. return this;
  18321. }
  18322. }]);
  18323. return NullPrivateChannel;
  18324. }(NullChannel);
  18325. /**
  18326. * This class represents a null presence channel.
  18327. */
  18328. var NullPresenceChannel = function (_NullChannel) {
  18329. inherits(NullPresenceChannel, _NullChannel);
  18330. function NullPresenceChannel() {
  18331. classCallCheck(this, NullPresenceChannel);
  18332. return possibleConstructorReturn(this, (NullPresenceChannel.__proto__ || Object.getPrototypeOf(NullPresenceChannel)).apply(this, arguments));
  18333. }
  18334. createClass(NullPresenceChannel, [{
  18335. key: 'here',
  18336. /**
  18337. * Register a callback to be called anytime the member list changes.
  18338. */
  18339. value: function here(callback) {
  18340. return this;
  18341. }
  18342. /**
  18343. * Listen for someone joining the channel.
  18344. */
  18345. }, {
  18346. key: 'joining',
  18347. value: function joining(callback) {
  18348. return this;
  18349. }
  18350. /**
  18351. * Listen for someone leaving the channel.
  18352. */
  18353. }, {
  18354. key: 'leaving',
  18355. value: function leaving(callback) {
  18356. return this;
  18357. }
  18358. /**
  18359. * Trigger client event on the channel.
  18360. */
  18361. }, {
  18362. key: 'whisper',
  18363. value: function whisper(eventName, data) {
  18364. return this;
  18365. }
  18366. }]);
  18367. return NullPresenceChannel;
  18368. }(NullChannel);
  18369. /**
  18370. * This class creates a connector to Pusher.
  18371. */
  18372. var PusherConnector = function (_Connector) {
  18373. inherits(PusherConnector, _Connector);
  18374. function PusherConnector() {
  18375. classCallCheck(this, PusherConnector);
  18376. /**
  18377. * All of the subscribed channel names.
  18378. */
  18379. var _this = possibleConstructorReturn(this, (PusherConnector.__proto__ || Object.getPrototypeOf(PusherConnector)).apply(this, arguments));
  18380. _this.channels = {};
  18381. return _this;
  18382. }
  18383. /**
  18384. * Create a fresh Pusher connection.
  18385. */
  18386. createClass(PusherConnector, [{
  18387. key: 'connect',
  18388. value: function connect() {
  18389. if (typeof this.options.client !== 'undefined') {
  18390. this.pusher = this.options.client;
  18391. } else {
  18392. this.pusher = new Pusher(this.options.key, this.options);
  18393. }
  18394. }
  18395. /**
  18396. * Listen for an event on a channel instance.
  18397. */
  18398. }, {
  18399. key: 'listen',
  18400. value: function listen(name, event, callback) {
  18401. return this.channel(name).listen(event, callback);
  18402. }
  18403. /**
  18404. * Get a channel instance by name.
  18405. */
  18406. }, {
  18407. key: 'channel',
  18408. value: function channel(name) {
  18409. if (!this.channels[name]) {
  18410. this.channels[name] = new PusherChannel(this.pusher, name, this.options);
  18411. }
  18412. return this.channels[name];
  18413. }
  18414. /**
  18415. * Get a private channel instance by name.
  18416. */
  18417. }, {
  18418. key: 'privateChannel',
  18419. value: function privateChannel(name) {
  18420. if (!this.channels['private-' + name]) {
  18421. this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options);
  18422. }
  18423. return this.channels['private-' + name];
  18424. }
  18425. /**
  18426. * Get a presence channel instance by name.
  18427. */
  18428. }, {
  18429. key: 'presenceChannel',
  18430. value: function presenceChannel(name) {
  18431. if (!this.channels['presence-' + name]) {
  18432. this.channels['presence-' + name] = new PusherPresenceChannel(this.pusher, 'presence-' + name, this.options);
  18433. }
  18434. return this.channels['presence-' + name];
  18435. }
  18436. /**
  18437. * Leave the given channel, as well as its private and presence variants.
  18438. */
  18439. }, {
  18440. key: 'leave',
  18441. value: function leave(name) {
  18442. var _this2 = this;
  18443. var channels = [name, 'private-' + name, 'presence-' + name];
  18444. channels.forEach(function (name, index) {
  18445. _this2.leaveChannel(name);
  18446. });
  18447. }
  18448. /**
  18449. * Leave the given channel.
  18450. */
  18451. }, {
  18452. key: 'leaveChannel',
  18453. value: function leaveChannel(name) {
  18454. if (this.channels[name]) {
  18455. this.channels[name].unsubscribe();
  18456. delete this.channels[name];
  18457. }
  18458. }
  18459. /**
  18460. * Get the socket ID for the connection.
  18461. */
  18462. }, {
  18463. key: 'socketId',
  18464. value: function socketId() {
  18465. return this.pusher.connection.socket_id;
  18466. }
  18467. /**
  18468. * Disconnect Pusher connection.
  18469. */
  18470. }, {
  18471. key: 'disconnect',
  18472. value: function disconnect() {
  18473. this.pusher.disconnect();
  18474. }
  18475. }]);
  18476. return PusherConnector;
  18477. }(Connector);
  18478. /**
  18479. * This class creates a connnector to a Socket.io server.
  18480. */
  18481. var SocketIoConnector = function (_Connector) {
  18482. inherits(SocketIoConnector, _Connector);
  18483. function SocketIoConnector() {
  18484. classCallCheck(this, SocketIoConnector);
  18485. /**
  18486. * All of the subscribed channel names.
  18487. */
  18488. var _this = possibleConstructorReturn(this, (SocketIoConnector.__proto__ || Object.getPrototypeOf(SocketIoConnector)).apply(this, arguments));
  18489. _this.channels = {};
  18490. return _this;
  18491. }
  18492. /**
  18493. * Create a fresh Socket.io connection.
  18494. */
  18495. createClass(SocketIoConnector, [{
  18496. key: 'connect',
  18497. value: function connect() {
  18498. var io = this.getSocketIO();
  18499. this.socket = io(this.options.host, this.options);
  18500. return this.socket;
  18501. }
  18502. /**
  18503. * Get socket.io module from global scope or options.
  18504. */
  18505. }, {
  18506. key: 'getSocketIO',
  18507. value: function getSocketIO() {
  18508. if (typeof this.options.client !== 'undefined') {
  18509. return this.options.client;
  18510. }
  18511. if (typeof io !== 'undefined') {
  18512. return io;
  18513. }
  18514. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  18515. }
  18516. /**
  18517. * Listen for an event on a channel instance.
  18518. */
  18519. }, {
  18520. key: 'listen',
  18521. value: function listen(name, event, callback) {
  18522. return this.channel(name).listen(event, callback);
  18523. }
  18524. /**
  18525. * Get a channel instance by name.
  18526. */
  18527. }, {
  18528. key: 'channel',
  18529. value: function channel(name) {
  18530. if (!this.channels[name]) {
  18531. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  18532. }
  18533. return this.channels[name];
  18534. }
  18535. /**
  18536. * Get a private channel instance by name.
  18537. */
  18538. }, {
  18539. key: 'privateChannel',
  18540. value: function privateChannel(name) {
  18541. if (!this.channels['private-' + name]) {
  18542. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  18543. }
  18544. return this.channels['private-' + name];
  18545. }
  18546. /**
  18547. * Get a presence channel instance by name.
  18548. */
  18549. }, {
  18550. key: 'presenceChannel',
  18551. value: function presenceChannel(name) {
  18552. if (!this.channels['presence-' + name]) {
  18553. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  18554. }
  18555. return this.channels['presence-' + name];
  18556. }
  18557. /**
  18558. * Leave the given channel, as well as its private and presence variants.
  18559. */
  18560. }, {
  18561. key: 'leave',
  18562. value: function leave(name) {
  18563. var _this2 = this;
  18564. var channels = [name, 'private-' + name, 'presence-' + name];
  18565. channels.forEach(function (name) {
  18566. _this2.leaveChannel(name);
  18567. });
  18568. }
  18569. /**
  18570. * Leave the given channel.
  18571. */
  18572. }, {
  18573. key: 'leaveChannel',
  18574. value: function leaveChannel(name) {
  18575. if (this.channels[name]) {
  18576. this.channels[name].unsubscribe();
  18577. delete this.channels[name];
  18578. }
  18579. }
  18580. /**
  18581. * Get the socket ID for the connection.
  18582. */
  18583. }, {
  18584. key: 'socketId',
  18585. value: function socketId() {
  18586. return this.socket.id;
  18587. }
  18588. /**
  18589. * Disconnect Socketio connection.
  18590. */
  18591. }, {
  18592. key: 'disconnect',
  18593. value: function disconnect() {
  18594. this.socket.disconnect();
  18595. }
  18596. }]);
  18597. return SocketIoConnector;
  18598. }(Connector);
  18599. /**
  18600. * This class creates a null connector.
  18601. */
  18602. var NullConnector = function (_Connector) {
  18603. inherits(NullConnector, _Connector);
  18604. function NullConnector() {
  18605. classCallCheck(this, NullConnector);
  18606. /**
  18607. * All of the subscribed channel names.
  18608. */
  18609. var _this = possibleConstructorReturn(this, (NullConnector.__proto__ || Object.getPrototypeOf(NullConnector)).apply(this, arguments));
  18610. _this.channels = {};
  18611. return _this;
  18612. }
  18613. /**
  18614. * Create a fresh connection.
  18615. */
  18616. createClass(NullConnector, [{
  18617. key: 'connect',
  18618. value: function connect() {}
  18619. //
  18620. /**
  18621. * Listen for an event on a channel instance.
  18622. */
  18623. }, {
  18624. key: 'listen',
  18625. value: function listen(name, event, callback) {
  18626. return new NullChannel();
  18627. }
  18628. /**
  18629. * Get a channel instance by name.
  18630. */
  18631. }, {
  18632. key: 'channel',
  18633. value: function channel(name) {
  18634. return new NullChannel();
  18635. }
  18636. /**
  18637. * Get a private channel instance by name.
  18638. */
  18639. }, {
  18640. key: 'privateChannel',
  18641. value: function privateChannel(name) {
  18642. return new NullPrivateChannel();
  18643. }
  18644. /**
  18645. * Get a presence channel instance by name.
  18646. */
  18647. }, {
  18648. key: 'presenceChannel',
  18649. value: function presenceChannel(name) {
  18650. return new NullPresenceChannel();
  18651. }
  18652. /**
  18653. * Leave the given channel, as well as its private and presence variants.
  18654. */
  18655. }, {
  18656. key: 'leave',
  18657. value: function leave(name) {}
  18658. //
  18659. /**
  18660. * Leave the given channel.
  18661. */
  18662. }, {
  18663. key: 'leaveChannel',
  18664. value: function leaveChannel(name) {}
  18665. //
  18666. /**
  18667. * Get the socket ID for the connection.
  18668. */
  18669. }, {
  18670. key: 'socketId',
  18671. value: function socketId() {
  18672. return 'fake-socket-id';
  18673. }
  18674. /**
  18675. * Disconnect the connection.
  18676. */
  18677. }, {
  18678. key: 'disconnect',
  18679. value: function disconnect() {
  18680. //
  18681. }
  18682. }]);
  18683. return NullConnector;
  18684. }(Connector);
  18685. /**
  18686. * This class is the primary API for interacting with broadcasting.
  18687. */
  18688. var Echo = function () {
  18689. /**
  18690. * Create a new class instance.
  18691. */
  18692. function Echo(options) {
  18693. classCallCheck(this, Echo);
  18694. this.options = options;
  18695. this.connect();
  18696. if (!this.options.withoutInterceptors) {
  18697. this.registerInterceptors();
  18698. }
  18699. }
  18700. /**
  18701. * Get a channel instance by name.
  18702. */
  18703. createClass(Echo, [{
  18704. key: 'channel',
  18705. value: function channel(_channel) {
  18706. return this.connector.channel(_channel);
  18707. }
  18708. /**
  18709. * Create a new connection.
  18710. */
  18711. }, {
  18712. key: 'connect',
  18713. value: function connect() {
  18714. if (this.options.broadcaster == 'pusher') {
  18715. this.connector = new PusherConnector(this.options);
  18716. } else if (this.options.broadcaster == 'socket.io') {
  18717. this.connector = new SocketIoConnector(this.options);
  18718. } else if (this.options.broadcaster == 'null') {
  18719. this.connector = new NullConnector(this.options);
  18720. } else if (typeof this.options.broadcaster == 'function') {
  18721. this.connector = new this.options.broadcaster(this.options);
  18722. }
  18723. }
  18724. /**
  18725. * Disconnect from the Echo server.
  18726. */
  18727. }, {
  18728. key: 'disconnect',
  18729. value: function disconnect() {
  18730. this.connector.disconnect();
  18731. }
  18732. /**
  18733. * Get a presence channel instance by name.
  18734. */
  18735. }, {
  18736. key: 'join',
  18737. value: function join(channel) {
  18738. return this.connector.presenceChannel(channel);
  18739. }
  18740. /**
  18741. * Leave the given channel, as well as its private and presence variants.
  18742. */
  18743. }, {
  18744. key: 'leave',
  18745. value: function leave(channel) {
  18746. this.connector.leave(channel);
  18747. }
  18748. /**
  18749. * Leave the given channel.
  18750. */
  18751. }, {
  18752. key: 'leaveChannel',
  18753. value: function leaveChannel(channel) {
  18754. this.connector.leaveChannel(channel);
  18755. }
  18756. /**
  18757. * Listen for an event on a channel instance.
  18758. */
  18759. }, {
  18760. key: 'listen',
  18761. value: function listen(channel, event, callback) {
  18762. return this.connector.listen(channel, event, callback);
  18763. }
  18764. /**
  18765. * Get a private channel instance by name.
  18766. */
  18767. }, {
  18768. key: 'private',
  18769. value: function _private(channel) {
  18770. return this.connector.privateChannel(channel);
  18771. }
  18772. /**
  18773. * Get the Socket ID for the connection.
  18774. */
  18775. }, {
  18776. key: 'socketId',
  18777. value: function socketId() {
  18778. return this.connector.socketId();
  18779. }
  18780. /**
  18781. * Register 3rd party request interceptiors. These are used to automatically
  18782. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  18783. */
  18784. }, {
  18785. key: 'registerInterceptors',
  18786. value: function registerInterceptors() {
  18787. if (typeof Vue === 'function' && Vue.http) {
  18788. this.registerVueRequestInterceptor();
  18789. }
  18790. if (typeof axios === 'function') {
  18791. this.registerAxiosRequestInterceptor();
  18792. }
  18793. if (typeof jQuery === 'function') {
  18794. this.registerjQueryAjaxSetup();
  18795. }
  18796. }
  18797. /**
  18798. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  18799. */
  18800. }, {
  18801. key: 'registerVueRequestInterceptor',
  18802. value: function registerVueRequestInterceptor() {
  18803. var _this = this;
  18804. Vue.http.interceptors.push(function (request, next) {
  18805. if (_this.socketId()) {
  18806. request.headers.set('X-Socket-ID', _this.socketId());
  18807. }
  18808. next();
  18809. });
  18810. }
  18811. /**
  18812. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  18813. */
  18814. }, {
  18815. key: 'registerAxiosRequestInterceptor',
  18816. value: function registerAxiosRequestInterceptor() {
  18817. var _this2 = this;
  18818. axios.interceptors.request.use(function (config) {
  18819. if (_this2.socketId()) {
  18820. config.headers['X-Socket-Id'] = _this2.socketId();
  18821. }
  18822. return config;
  18823. });
  18824. }
  18825. /**
  18826. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  18827. */
  18828. }, {
  18829. key: 'registerjQueryAjaxSetup',
  18830. value: function registerjQueryAjaxSetup() {
  18831. var _this3 = this;
  18832. if (typeof jQuery.ajax != 'undefined') {
  18833. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  18834. if (_this3.socketId()) {
  18835. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  18836. }
  18837. });
  18838. }
  18839. }
  18840. }]);
  18841. return Echo;
  18842. }();
  18843. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  18844. /***/ }),
  18845. /***/ "./node_modules/lodash/lodash.js":
  18846. /*!***************************************!*\
  18847. !*** ./node_modules/lodash/lodash.js ***!
  18848. \***************************************/
  18849. /*! no static exports found */
  18850. /***/ (function(module, exports, __webpack_require__) {
  18851. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  18852. * @license
  18853. * Lodash <https://lodash.com/>
  18854. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  18855. * Released under MIT license <https://lodash.com/license>
  18856. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  18857. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  18858. */
  18859. ;(function() {
  18860. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  18861. var undefined;
  18862. /** Used as the semantic version number. */
  18863. var VERSION = '4.17.15';
  18864. /** Used as the size to enable large array optimizations. */
  18865. var LARGE_ARRAY_SIZE = 200;
  18866. /** Error message constants. */
  18867. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  18868. FUNC_ERROR_TEXT = 'Expected a function';
  18869. /** Used to stand-in for `undefined` hash values. */
  18870. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  18871. /** Used as the maximum memoize cache size. */
  18872. var MAX_MEMOIZE_SIZE = 500;
  18873. /** Used as the internal argument placeholder. */
  18874. var PLACEHOLDER = '__lodash_placeholder__';
  18875. /** Used to compose bitmasks for cloning. */
  18876. var CLONE_DEEP_FLAG = 1,
  18877. CLONE_FLAT_FLAG = 2,
  18878. CLONE_SYMBOLS_FLAG = 4;
  18879. /** Used to compose bitmasks for value comparisons. */
  18880. var COMPARE_PARTIAL_FLAG = 1,
  18881. COMPARE_UNORDERED_FLAG = 2;
  18882. /** Used to compose bitmasks for function metadata. */
  18883. var WRAP_BIND_FLAG = 1,
  18884. WRAP_BIND_KEY_FLAG = 2,
  18885. WRAP_CURRY_BOUND_FLAG = 4,
  18886. WRAP_CURRY_FLAG = 8,
  18887. WRAP_CURRY_RIGHT_FLAG = 16,
  18888. WRAP_PARTIAL_FLAG = 32,
  18889. WRAP_PARTIAL_RIGHT_FLAG = 64,
  18890. WRAP_ARY_FLAG = 128,
  18891. WRAP_REARG_FLAG = 256,
  18892. WRAP_FLIP_FLAG = 512;
  18893. /** Used as default options for `_.truncate`. */
  18894. var DEFAULT_TRUNC_LENGTH = 30,
  18895. DEFAULT_TRUNC_OMISSION = '...';
  18896. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  18897. var HOT_COUNT = 800,
  18898. HOT_SPAN = 16;
  18899. /** Used to indicate the type of lazy iteratees. */
  18900. var LAZY_FILTER_FLAG = 1,
  18901. LAZY_MAP_FLAG = 2,
  18902. LAZY_WHILE_FLAG = 3;
  18903. /** Used as references for various `Number` constants. */
  18904. var INFINITY = 1 / 0,
  18905. MAX_SAFE_INTEGER = 9007199254740991,
  18906. MAX_INTEGER = 1.7976931348623157e+308,
  18907. NAN = 0 / 0;
  18908. /** Used as references for the maximum length and index of an array. */
  18909. var MAX_ARRAY_LENGTH = 4294967295,
  18910. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  18911. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  18912. /** Used to associate wrap methods with their bit flags. */
  18913. var wrapFlags = [
  18914. ['ary', WRAP_ARY_FLAG],
  18915. ['bind', WRAP_BIND_FLAG],
  18916. ['bindKey', WRAP_BIND_KEY_FLAG],
  18917. ['curry', WRAP_CURRY_FLAG],
  18918. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  18919. ['flip', WRAP_FLIP_FLAG],
  18920. ['partial', WRAP_PARTIAL_FLAG],
  18921. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  18922. ['rearg', WRAP_REARG_FLAG]
  18923. ];
  18924. /** `Object#toString` result references. */
  18925. var argsTag = '[object Arguments]',
  18926. arrayTag = '[object Array]',
  18927. asyncTag = '[object AsyncFunction]',
  18928. boolTag = '[object Boolean]',
  18929. dateTag = '[object Date]',
  18930. domExcTag = '[object DOMException]',
  18931. errorTag = '[object Error]',
  18932. funcTag = '[object Function]',
  18933. genTag = '[object GeneratorFunction]',
  18934. mapTag = '[object Map]',
  18935. numberTag = '[object Number]',
  18936. nullTag = '[object Null]',
  18937. objectTag = '[object Object]',
  18938. promiseTag = '[object Promise]',
  18939. proxyTag = '[object Proxy]',
  18940. regexpTag = '[object RegExp]',
  18941. setTag = '[object Set]',
  18942. stringTag = '[object String]',
  18943. symbolTag = '[object Symbol]',
  18944. undefinedTag = '[object Undefined]',
  18945. weakMapTag = '[object WeakMap]',
  18946. weakSetTag = '[object WeakSet]';
  18947. var arrayBufferTag = '[object ArrayBuffer]',
  18948. dataViewTag = '[object DataView]',
  18949. float32Tag = '[object Float32Array]',
  18950. float64Tag = '[object Float64Array]',
  18951. int8Tag = '[object Int8Array]',
  18952. int16Tag = '[object Int16Array]',
  18953. int32Tag = '[object Int32Array]',
  18954. uint8Tag = '[object Uint8Array]',
  18955. uint8ClampedTag = '[object Uint8ClampedArray]',
  18956. uint16Tag = '[object Uint16Array]',
  18957. uint32Tag = '[object Uint32Array]';
  18958. /** Used to match empty string literals in compiled template source. */
  18959. var reEmptyStringLeading = /\b__p \+= '';/g,
  18960. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  18961. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  18962. /** Used to match HTML entities and HTML characters. */
  18963. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  18964. reUnescapedHtml = /[&<>"']/g,
  18965. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  18966. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  18967. /** Used to match template delimiters. */
  18968. var reEscape = /<%-([\s\S]+?)%>/g,
  18969. reEvaluate = /<%([\s\S]+?)%>/g,
  18970. reInterpolate = /<%=([\s\S]+?)%>/g;
  18971. /** Used to match property names within property paths. */
  18972. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  18973. reIsPlainProp = /^\w*$/,
  18974. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  18975. /**
  18976. * Used to match `RegExp`
  18977. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  18978. */
  18979. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  18980. reHasRegExpChar = RegExp(reRegExpChar.source);
  18981. /** Used to match leading and trailing whitespace. */
  18982. var reTrim = /^\s+|\s+$/g,
  18983. reTrimStart = /^\s+/,
  18984. reTrimEnd = /\s+$/;
  18985. /** Used to match wrap detail comments. */
  18986. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  18987. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  18988. reSplitDetails = /,? & /;
  18989. /** Used to match words composed of alphanumeric characters. */
  18990. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  18991. /** Used to match backslashes in property paths. */
  18992. var reEscapeChar = /\\(\\)?/g;
  18993. /**
  18994. * Used to match
  18995. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  18996. */
  18997. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  18998. /** Used to match `RegExp` flags from their coerced string values. */
  18999. var reFlags = /\w*$/;
  19000. /** Used to detect bad signed hexadecimal string values. */
  19001. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  19002. /** Used to detect binary string values. */
  19003. var reIsBinary = /^0b[01]+$/i;
  19004. /** Used to detect host constructors (Safari). */
  19005. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  19006. /** Used to detect octal string values. */
  19007. var reIsOctal = /^0o[0-7]+$/i;
  19008. /** Used to detect unsigned integer values. */
  19009. var reIsUint = /^(?:0|[1-9]\d*)$/;
  19010. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  19011. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  19012. /** Used to ensure capturing order of template delimiters. */
  19013. var reNoMatch = /($^)/;
  19014. /** Used to match unescaped characters in compiled string literals. */
  19015. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  19016. /** Used to compose unicode character classes. */
  19017. var rsAstralRange = '\\ud800-\\udfff',
  19018. rsComboMarksRange = '\\u0300-\\u036f',
  19019. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  19020. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  19021. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  19022. rsDingbatRange = '\\u2700-\\u27bf',
  19023. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  19024. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  19025. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  19026. rsPunctuationRange = '\\u2000-\\u206f',
  19027. 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',
  19028. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  19029. rsVarRange = '\\ufe0e\\ufe0f',
  19030. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  19031. /** Used to compose unicode capture groups. */
  19032. var rsApos = "['\u2019]",
  19033. rsAstral = '[' + rsAstralRange + ']',
  19034. rsBreak = '[' + rsBreakRange + ']',
  19035. rsCombo = '[' + rsComboRange + ']',
  19036. rsDigits = '\\d+',
  19037. rsDingbat = '[' + rsDingbatRange + ']',
  19038. rsLower = '[' + rsLowerRange + ']',
  19039. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  19040. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  19041. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  19042. rsNonAstral = '[^' + rsAstralRange + ']',
  19043. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  19044. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  19045. rsUpper = '[' + rsUpperRange + ']',
  19046. rsZWJ = '\\u200d';
  19047. /** Used to compose unicode regexes. */
  19048. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  19049. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  19050. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  19051. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  19052. reOptMod = rsModifier + '?',
  19053. rsOptVar = '[' + rsVarRange + ']?',
  19054. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  19055. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  19056. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  19057. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  19058. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  19059. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  19060. /** Used to match apostrophes. */
  19061. var reApos = RegExp(rsApos, 'g');
  19062. /**
  19063. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  19064. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  19065. */
  19066. var reComboMark = RegExp(rsCombo, 'g');
  19067. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  19068. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  19069. /** Used to match complex or compound words. */
  19070. var reUnicodeWord = RegExp([
  19071. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  19072. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  19073. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  19074. rsUpper + '+' + rsOptContrUpper,
  19075. rsOrdUpper,
  19076. rsOrdLower,
  19077. rsDigits,
  19078. rsEmoji
  19079. ].join('|'), 'g');
  19080. /** 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/). */
  19081. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  19082. /** Used to detect strings that need a more robust regexp to match words. */
  19083. 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 ]/;
  19084. /** Used to assign default `context` object properties. */
  19085. var contextProps = [
  19086. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  19087. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  19088. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  19089. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  19090. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  19091. ];
  19092. /** Used to make template sourceURLs easier to identify. */
  19093. var templateCounter = -1;
  19094. /** Used to identify `toStringTag` values of typed arrays. */
  19095. var typedArrayTags = {};
  19096. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  19097. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  19098. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  19099. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  19100. typedArrayTags[uint32Tag] = true;
  19101. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  19102. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  19103. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  19104. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  19105. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  19106. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  19107. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  19108. typedArrayTags[weakMapTag] = false;
  19109. /** Used to identify `toStringTag` values supported by `_.clone`. */
  19110. var cloneableTags = {};
  19111. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  19112. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  19113. cloneableTags[boolTag] = cloneableTags[dateTag] =
  19114. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  19115. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  19116. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  19117. cloneableTags[numberTag] = cloneableTags[objectTag] =
  19118. cloneableTags[regexpTag] = cloneableTags[setTag] =
  19119. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  19120. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  19121. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  19122. cloneableTags[errorTag] = cloneableTags[funcTag] =
  19123. cloneableTags[weakMapTag] = false;
  19124. /** Used to map Latin Unicode letters to basic Latin letters. */
  19125. var deburredLetters = {
  19126. // Latin-1 Supplement block.
  19127. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  19128. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  19129. '\xc7': 'C', '\xe7': 'c',
  19130. '\xd0': 'D', '\xf0': 'd',
  19131. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  19132. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  19133. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  19134. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  19135. '\xd1': 'N', '\xf1': 'n',
  19136. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  19137. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  19138. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  19139. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  19140. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  19141. '\xc6': 'Ae', '\xe6': 'ae',
  19142. '\xde': 'Th', '\xfe': 'th',
  19143. '\xdf': 'ss',
  19144. // Latin Extended-A block.
  19145. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  19146. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  19147. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  19148. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  19149. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  19150. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  19151. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  19152. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  19153. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  19154. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  19155. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  19156. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  19157. '\u0134': 'J', '\u0135': 'j',
  19158. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  19159. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  19160. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  19161. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  19162. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  19163. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  19164. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  19165. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  19166. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  19167. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  19168. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  19169. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  19170. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  19171. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  19172. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  19173. '\u0174': 'W', '\u0175': 'w',
  19174. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  19175. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  19176. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  19177. '\u0132': 'IJ', '\u0133': 'ij',
  19178. '\u0152': 'Oe', '\u0153': 'oe',
  19179. '\u0149': "'n", '\u017f': 's'
  19180. };
  19181. /** Used to map characters to HTML entities. */
  19182. var htmlEscapes = {
  19183. '&': '&amp;',
  19184. '<': '&lt;',
  19185. '>': '&gt;',
  19186. '"': '&quot;',
  19187. "'": '&#39;'
  19188. };
  19189. /** Used to map HTML entities to characters. */
  19190. var htmlUnescapes = {
  19191. '&amp;': '&',
  19192. '&lt;': '<',
  19193. '&gt;': '>',
  19194. '&quot;': '"',
  19195. '&#39;': "'"
  19196. };
  19197. /** Used to escape characters for inclusion in compiled string literals. */
  19198. var stringEscapes = {
  19199. '\\': '\\',
  19200. "'": "'",
  19201. '\n': 'n',
  19202. '\r': 'r',
  19203. '\u2028': 'u2028',
  19204. '\u2029': 'u2029'
  19205. };
  19206. /** Built-in method references without a dependency on `root`. */
  19207. var freeParseFloat = parseFloat,
  19208. freeParseInt = parseInt;
  19209. /** Detect free variable `global` from Node.js. */
  19210. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  19211. /** Detect free variable `self`. */
  19212. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  19213. /** Used as a reference to the global object. */
  19214. var root = freeGlobal || freeSelf || Function('return this')();
  19215. /** Detect free variable `exports`. */
  19216. var freeExports = true && exports && !exports.nodeType && exports;
  19217. /** Detect free variable `module`. */
  19218. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  19219. /** Detect the popular CommonJS extension `module.exports`. */
  19220. var moduleExports = freeModule && freeModule.exports === freeExports;
  19221. /** Detect free variable `process` from Node.js. */
  19222. var freeProcess = moduleExports && freeGlobal.process;
  19223. /** Used to access faster Node.js helpers. */
  19224. var nodeUtil = (function() {
  19225. try {
  19226. // Use `util.types` for Node.js 10+.
  19227. var types = freeModule && freeModule.require && freeModule.require('util').types;
  19228. if (types) {
  19229. return types;
  19230. }
  19231. // Legacy `process.binding('util')` for Node.js < 10.
  19232. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  19233. } catch (e) {}
  19234. }());
  19235. /* Node.js helper references. */
  19236. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  19237. nodeIsDate = nodeUtil && nodeUtil.isDate,
  19238. nodeIsMap = nodeUtil && nodeUtil.isMap,
  19239. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  19240. nodeIsSet = nodeUtil && nodeUtil.isSet,
  19241. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  19242. /*--------------------------------------------------------------------------*/
  19243. /**
  19244. * A faster alternative to `Function#apply`, this function invokes `func`
  19245. * with the `this` binding of `thisArg` and the arguments of `args`.
  19246. *
  19247. * @private
  19248. * @param {Function} func The function to invoke.
  19249. * @param {*} thisArg The `this` binding of `func`.
  19250. * @param {Array} args The arguments to invoke `func` with.
  19251. * @returns {*} Returns the result of `func`.
  19252. */
  19253. function apply(func, thisArg, args) {
  19254. switch (args.length) {
  19255. case 0: return func.call(thisArg);
  19256. case 1: return func.call(thisArg, args[0]);
  19257. case 2: return func.call(thisArg, args[0], args[1]);
  19258. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  19259. }
  19260. return func.apply(thisArg, args);
  19261. }
  19262. /**
  19263. * A specialized version of `baseAggregator` for arrays.
  19264. *
  19265. * @private
  19266. * @param {Array} [array] The array to iterate over.
  19267. * @param {Function} setter The function to set `accumulator` values.
  19268. * @param {Function} iteratee The iteratee to transform keys.
  19269. * @param {Object} accumulator The initial aggregated object.
  19270. * @returns {Function} Returns `accumulator`.
  19271. */
  19272. function arrayAggregator(array, setter, iteratee, accumulator) {
  19273. var index = -1,
  19274. length = array == null ? 0 : array.length;
  19275. while (++index < length) {
  19276. var value = array[index];
  19277. setter(accumulator, value, iteratee(value), array);
  19278. }
  19279. return accumulator;
  19280. }
  19281. /**
  19282. * A specialized version of `_.forEach` for arrays without support for
  19283. * iteratee shorthands.
  19284. *
  19285. * @private
  19286. * @param {Array} [array] The array to iterate over.
  19287. * @param {Function} iteratee The function invoked per iteration.
  19288. * @returns {Array} Returns `array`.
  19289. */
  19290. function arrayEach(array, iteratee) {
  19291. var index = -1,
  19292. length = array == null ? 0 : array.length;
  19293. while (++index < length) {
  19294. if (iteratee(array[index], index, array) === false) {
  19295. break;
  19296. }
  19297. }
  19298. return array;
  19299. }
  19300. /**
  19301. * A specialized version of `_.forEachRight` for arrays without support for
  19302. * iteratee shorthands.
  19303. *
  19304. * @private
  19305. * @param {Array} [array] The array to iterate over.
  19306. * @param {Function} iteratee The function invoked per iteration.
  19307. * @returns {Array} Returns `array`.
  19308. */
  19309. function arrayEachRight(array, iteratee) {
  19310. var length = array == null ? 0 : array.length;
  19311. while (length--) {
  19312. if (iteratee(array[length], length, array) === false) {
  19313. break;
  19314. }
  19315. }
  19316. return array;
  19317. }
  19318. /**
  19319. * A specialized version of `_.every` for arrays without support for
  19320. * iteratee shorthands.
  19321. *
  19322. * @private
  19323. * @param {Array} [array] The array to iterate over.
  19324. * @param {Function} predicate The function invoked per iteration.
  19325. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  19326. * else `false`.
  19327. */
  19328. function arrayEvery(array, predicate) {
  19329. var index = -1,
  19330. length = array == null ? 0 : array.length;
  19331. while (++index < length) {
  19332. if (!predicate(array[index], index, array)) {
  19333. return false;
  19334. }
  19335. }
  19336. return true;
  19337. }
  19338. /**
  19339. * A specialized version of `_.filter` for arrays without support for
  19340. * iteratee shorthands.
  19341. *
  19342. * @private
  19343. * @param {Array} [array] The array to iterate over.
  19344. * @param {Function} predicate The function invoked per iteration.
  19345. * @returns {Array} Returns the new filtered array.
  19346. */
  19347. function arrayFilter(array, predicate) {
  19348. var index = -1,
  19349. length = array == null ? 0 : array.length,
  19350. resIndex = 0,
  19351. result = [];
  19352. while (++index < length) {
  19353. var value = array[index];
  19354. if (predicate(value, index, array)) {
  19355. result[resIndex++] = value;
  19356. }
  19357. }
  19358. return result;
  19359. }
  19360. /**
  19361. * A specialized version of `_.includes` for arrays without support for
  19362. * specifying an index to search from.
  19363. *
  19364. * @private
  19365. * @param {Array} [array] The array to inspect.
  19366. * @param {*} target The value to search for.
  19367. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  19368. */
  19369. function arrayIncludes(array, value) {
  19370. var length = array == null ? 0 : array.length;
  19371. return !!length && baseIndexOf(array, value, 0) > -1;
  19372. }
  19373. /**
  19374. * This function is like `arrayIncludes` except that it accepts a comparator.
  19375. *
  19376. * @private
  19377. * @param {Array} [array] The array to inspect.
  19378. * @param {*} target The value to search for.
  19379. * @param {Function} comparator The comparator invoked per element.
  19380. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  19381. */
  19382. function arrayIncludesWith(array, value, comparator) {
  19383. var index = -1,
  19384. length = array == null ? 0 : array.length;
  19385. while (++index < length) {
  19386. if (comparator(value, array[index])) {
  19387. return true;
  19388. }
  19389. }
  19390. return false;
  19391. }
  19392. /**
  19393. * A specialized version of `_.map` for arrays without support for iteratee
  19394. * shorthands.
  19395. *
  19396. * @private
  19397. * @param {Array} [array] The array to iterate over.
  19398. * @param {Function} iteratee The function invoked per iteration.
  19399. * @returns {Array} Returns the new mapped array.
  19400. */
  19401. function arrayMap(array, iteratee) {
  19402. var index = -1,
  19403. length = array == null ? 0 : array.length,
  19404. result = Array(length);
  19405. while (++index < length) {
  19406. result[index] = iteratee(array[index], index, array);
  19407. }
  19408. return result;
  19409. }
  19410. /**
  19411. * Appends the elements of `values` to `array`.
  19412. *
  19413. * @private
  19414. * @param {Array} array The array to modify.
  19415. * @param {Array} values The values to append.
  19416. * @returns {Array} Returns `array`.
  19417. */
  19418. function arrayPush(array, values) {
  19419. var index = -1,
  19420. length = values.length,
  19421. offset = array.length;
  19422. while (++index < length) {
  19423. array[offset + index] = values[index];
  19424. }
  19425. return array;
  19426. }
  19427. /**
  19428. * A specialized version of `_.reduce` for arrays without support for
  19429. * iteratee shorthands.
  19430. *
  19431. * @private
  19432. * @param {Array} [array] The array to iterate over.
  19433. * @param {Function} iteratee The function invoked per iteration.
  19434. * @param {*} [accumulator] The initial value.
  19435. * @param {boolean} [initAccum] Specify using the first element of `array` as
  19436. * the initial value.
  19437. * @returns {*} Returns the accumulated value.
  19438. */
  19439. function arrayReduce(array, iteratee, accumulator, initAccum) {
  19440. var index = -1,
  19441. length = array == null ? 0 : array.length;
  19442. if (initAccum && length) {
  19443. accumulator = array[++index];
  19444. }
  19445. while (++index < length) {
  19446. accumulator = iteratee(accumulator, array[index], index, array);
  19447. }
  19448. return accumulator;
  19449. }
  19450. /**
  19451. * A specialized version of `_.reduceRight` for arrays without support for
  19452. * iteratee shorthands.
  19453. *
  19454. * @private
  19455. * @param {Array} [array] The array to iterate over.
  19456. * @param {Function} iteratee The function invoked per iteration.
  19457. * @param {*} [accumulator] The initial value.
  19458. * @param {boolean} [initAccum] Specify using the last element of `array` as
  19459. * the initial value.
  19460. * @returns {*} Returns the accumulated value.
  19461. */
  19462. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  19463. var length = array == null ? 0 : array.length;
  19464. if (initAccum && length) {
  19465. accumulator = array[--length];
  19466. }
  19467. while (length--) {
  19468. accumulator = iteratee(accumulator, array[length], length, array);
  19469. }
  19470. return accumulator;
  19471. }
  19472. /**
  19473. * A specialized version of `_.some` for arrays without support for iteratee
  19474. * shorthands.
  19475. *
  19476. * @private
  19477. * @param {Array} [array] The array to iterate over.
  19478. * @param {Function} predicate The function invoked per iteration.
  19479. * @returns {boolean} Returns `true` if any element passes the predicate check,
  19480. * else `false`.
  19481. */
  19482. function arraySome(array, predicate) {
  19483. var index = -1,
  19484. length = array == null ? 0 : array.length;
  19485. while (++index < length) {
  19486. if (predicate(array[index], index, array)) {
  19487. return true;
  19488. }
  19489. }
  19490. return false;
  19491. }
  19492. /**
  19493. * Gets the size of an ASCII `string`.
  19494. *
  19495. * @private
  19496. * @param {string} string The string inspect.
  19497. * @returns {number} Returns the string size.
  19498. */
  19499. var asciiSize = baseProperty('length');
  19500. /**
  19501. * Converts an ASCII `string` to an array.
  19502. *
  19503. * @private
  19504. * @param {string} string The string to convert.
  19505. * @returns {Array} Returns the converted array.
  19506. */
  19507. function asciiToArray(string) {
  19508. return string.split('');
  19509. }
  19510. /**
  19511. * Splits an ASCII `string` into an array of its words.
  19512. *
  19513. * @private
  19514. * @param {string} The string to inspect.
  19515. * @returns {Array} Returns the words of `string`.
  19516. */
  19517. function asciiWords(string) {
  19518. return string.match(reAsciiWord) || [];
  19519. }
  19520. /**
  19521. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  19522. * without support for iteratee shorthands, which iterates over `collection`
  19523. * using `eachFunc`.
  19524. *
  19525. * @private
  19526. * @param {Array|Object} collection The collection to inspect.
  19527. * @param {Function} predicate The function invoked per iteration.
  19528. * @param {Function} eachFunc The function to iterate over `collection`.
  19529. * @returns {*} Returns the found element or its key, else `undefined`.
  19530. */
  19531. function baseFindKey(collection, predicate, eachFunc) {
  19532. var result;
  19533. eachFunc(collection, function(value, key, collection) {
  19534. if (predicate(value, key, collection)) {
  19535. result = key;
  19536. return false;
  19537. }
  19538. });
  19539. return result;
  19540. }
  19541. /**
  19542. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  19543. * support for iteratee shorthands.
  19544. *
  19545. * @private
  19546. * @param {Array} array The array to inspect.
  19547. * @param {Function} predicate The function invoked per iteration.
  19548. * @param {number} fromIndex The index to search from.
  19549. * @param {boolean} [fromRight] Specify iterating from right to left.
  19550. * @returns {number} Returns the index of the matched value, else `-1`.
  19551. */
  19552. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  19553. var length = array.length,
  19554. index = fromIndex + (fromRight ? 1 : -1);
  19555. while ((fromRight ? index-- : ++index < length)) {
  19556. if (predicate(array[index], index, array)) {
  19557. return index;
  19558. }
  19559. }
  19560. return -1;
  19561. }
  19562. /**
  19563. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  19564. *
  19565. * @private
  19566. * @param {Array} array The array to inspect.
  19567. * @param {*} value The value to search for.
  19568. * @param {number} fromIndex The index to search from.
  19569. * @returns {number} Returns the index of the matched value, else `-1`.
  19570. */
  19571. function baseIndexOf(array, value, fromIndex) {
  19572. return value === value
  19573. ? strictIndexOf(array, value, fromIndex)
  19574. : baseFindIndex(array, baseIsNaN, fromIndex);
  19575. }
  19576. /**
  19577. * This function is like `baseIndexOf` except that it accepts a comparator.
  19578. *
  19579. * @private
  19580. * @param {Array} array The array to inspect.
  19581. * @param {*} value The value to search for.
  19582. * @param {number} fromIndex The index to search from.
  19583. * @param {Function} comparator The comparator invoked per element.
  19584. * @returns {number} Returns the index of the matched value, else `-1`.
  19585. */
  19586. function baseIndexOfWith(array, value, fromIndex, comparator) {
  19587. var index = fromIndex - 1,
  19588. length = array.length;
  19589. while (++index < length) {
  19590. if (comparator(array[index], value)) {
  19591. return index;
  19592. }
  19593. }
  19594. return -1;
  19595. }
  19596. /**
  19597. * The base implementation of `_.isNaN` without support for number objects.
  19598. *
  19599. * @private
  19600. * @param {*} value The value to check.
  19601. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  19602. */
  19603. function baseIsNaN(value) {
  19604. return value !== value;
  19605. }
  19606. /**
  19607. * The base implementation of `_.mean` and `_.meanBy` without support for
  19608. * iteratee shorthands.
  19609. *
  19610. * @private
  19611. * @param {Array} array The array to iterate over.
  19612. * @param {Function} iteratee The function invoked per iteration.
  19613. * @returns {number} Returns the mean.
  19614. */
  19615. function baseMean(array, iteratee) {
  19616. var length = array == null ? 0 : array.length;
  19617. return length ? (baseSum(array, iteratee) / length) : NAN;
  19618. }
  19619. /**
  19620. * The base implementation of `_.property` without support for deep paths.
  19621. *
  19622. * @private
  19623. * @param {string} key The key of the property to get.
  19624. * @returns {Function} Returns the new accessor function.
  19625. */
  19626. function baseProperty(key) {
  19627. return function(object) {
  19628. return object == null ? undefined : object[key];
  19629. };
  19630. }
  19631. /**
  19632. * The base implementation of `_.propertyOf` without support for deep paths.
  19633. *
  19634. * @private
  19635. * @param {Object} object The object to query.
  19636. * @returns {Function} Returns the new accessor function.
  19637. */
  19638. function basePropertyOf(object) {
  19639. return function(key) {
  19640. return object == null ? undefined : object[key];
  19641. };
  19642. }
  19643. /**
  19644. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  19645. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  19646. *
  19647. * @private
  19648. * @param {Array|Object} collection The collection to iterate over.
  19649. * @param {Function} iteratee The function invoked per iteration.
  19650. * @param {*} accumulator The initial value.
  19651. * @param {boolean} initAccum Specify using the first or last element of
  19652. * `collection` as the initial value.
  19653. * @param {Function} eachFunc The function to iterate over `collection`.
  19654. * @returns {*} Returns the accumulated value.
  19655. */
  19656. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  19657. eachFunc(collection, function(value, index, collection) {
  19658. accumulator = initAccum
  19659. ? (initAccum = false, value)
  19660. : iteratee(accumulator, value, index, collection);
  19661. });
  19662. return accumulator;
  19663. }
  19664. /**
  19665. * The base implementation of `_.sortBy` which uses `comparer` to define the
  19666. * sort order of `array` and replaces criteria objects with their corresponding
  19667. * values.
  19668. *
  19669. * @private
  19670. * @param {Array} array The array to sort.
  19671. * @param {Function} comparer The function to define sort order.
  19672. * @returns {Array} Returns `array`.
  19673. */
  19674. function baseSortBy(array, comparer) {
  19675. var length = array.length;
  19676. array.sort(comparer);
  19677. while (length--) {
  19678. array[length] = array[length].value;
  19679. }
  19680. return array;
  19681. }
  19682. /**
  19683. * The base implementation of `_.sum` and `_.sumBy` without support for
  19684. * iteratee shorthands.
  19685. *
  19686. * @private
  19687. * @param {Array} array The array to iterate over.
  19688. * @param {Function} iteratee The function invoked per iteration.
  19689. * @returns {number} Returns the sum.
  19690. */
  19691. function baseSum(array, iteratee) {
  19692. var result,
  19693. index = -1,
  19694. length = array.length;
  19695. while (++index < length) {
  19696. var current = iteratee(array[index]);
  19697. if (current !== undefined) {
  19698. result = result === undefined ? current : (result + current);
  19699. }
  19700. }
  19701. return result;
  19702. }
  19703. /**
  19704. * The base implementation of `_.times` without support for iteratee shorthands
  19705. * or max array length checks.
  19706. *
  19707. * @private
  19708. * @param {number} n The number of times to invoke `iteratee`.
  19709. * @param {Function} iteratee The function invoked per iteration.
  19710. * @returns {Array} Returns the array of results.
  19711. */
  19712. function baseTimes(n, iteratee) {
  19713. var index = -1,
  19714. result = Array(n);
  19715. while (++index < n) {
  19716. result[index] = iteratee(index);
  19717. }
  19718. return result;
  19719. }
  19720. /**
  19721. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  19722. * of key-value pairs for `object` corresponding to the property names of `props`.
  19723. *
  19724. * @private
  19725. * @param {Object} object The object to query.
  19726. * @param {Array} props The property names to get values for.
  19727. * @returns {Object} Returns the key-value pairs.
  19728. */
  19729. function baseToPairs(object, props) {
  19730. return arrayMap(props, function(key) {
  19731. return [key, object[key]];
  19732. });
  19733. }
  19734. /**
  19735. * The base implementation of `_.unary` without support for storing metadata.
  19736. *
  19737. * @private
  19738. * @param {Function} func The function to cap arguments for.
  19739. * @returns {Function} Returns the new capped function.
  19740. */
  19741. function baseUnary(func) {
  19742. return function(value) {
  19743. return func(value);
  19744. };
  19745. }
  19746. /**
  19747. * The base implementation of `_.values` and `_.valuesIn` which creates an
  19748. * array of `object` property values corresponding to the property names
  19749. * of `props`.
  19750. *
  19751. * @private
  19752. * @param {Object} object The object to query.
  19753. * @param {Array} props The property names to get values for.
  19754. * @returns {Object} Returns the array of property values.
  19755. */
  19756. function baseValues(object, props) {
  19757. return arrayMap(props, function(key) {
  19758. return object[key];
  19759. });
  19760. }
  19761. /**
  19762. * Checks if a `cache` value for `key` exists.
  19763. *
  19764. * @private
  19765. * @param {Object} cache The cache to query.
  19766. * @param {string} key The key of the entry to check.
  19767. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19768. */
  19769. function cacheHas(cache, key) {
  19770. return cache.has(key);
  19771. }
  19772. /**
  19773. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  19774. * that is not found in the character symbols.
  19775. *
  19776. * @private
  19777. * @param {Array} strSymbols The string symbols to inspect.
  19778. * @param {Array} chrSymbols The character symbols to find.
  19779. * @returns {number} Returns the index of the first unmatched string symbol.
  19780. */
  19781. function charsStartIndex(strSymbols, chrSymbols) {
  19782. var index = -1,
  19783. length = strSymbols.length;
  19784. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19785. return index;
  19786. }
  19787. /**
  19788. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  19789. * that is not found in the character symbols.
  19790. *
  19791. * @private
  19792. * @param {Array} strSymbols The string symbols to inspect.
  19793. * @param {Array} chrSymbols The character symbols to find.
  19794. * @returns {number} Returns the index of the last unmatched string symbol.
  19795. */
  19796. function charsEndIndex(strSymbols, chrSymbols) {
  19797. var index = strSymbols.length;
  19798. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19799. return index;
  19800. }
  19801. /**
  19802. * Gets the number of `placeholder` occurrences in `array`.
  19803. *
  19804. * @private
  19805. * @param {Array} array The array to inspect.
  19806. * @param {*} placeholder The placeholder to search for.
  19807. * @returns {number} Returns the placeholder count.
  19808. */
  19809. function countHolders(array, placeholder) {
  19810. var length = array.length,
  19811. result = 0;
  19812. while (length--) {
  19813. if (array[length] === placeholder) {
  19814. ++result;
  19815. }
  19816. }
  19817. return result;
  19818. }
  19819. /**
  19820. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  19821. * letters to basic Latin letters.
  19822. *
  19823. * @private
  19824. * @param {string} letter The matched letter to deburr.
  19825. * @returns {string} Returns the deburred letter.
  19826. */
  19827. var deburrLetter = basePropertyOf(deburredLetters);
  19828. /**
  19829. * Used by `_.escape` to convert characters to HTML entities.
  19830. *
  19831. * @private
  19832. * @param {string} chr The matched character to escape.
  19833. * @returns {string} Returns the escaped character.
  19834. */
  19835. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  19836. /**
  19837. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  19838. *
  19839. * @private
  19840. * @param {string} chr The matched character to escape.
  19841. * @returns {string} Returns the escaped character.
  19842. */
  19843. function escapeStringChar(chr) {
  19844. return '\\' + stringEscapes[chr];
  19845. }
  19846. /**
  19847. * Gets the value at `key` of `object`.
  19848. *
  19849. * @private
  19850. * @param {Object} [object] The object to query.
  19851. * @param {string} key The key of the property to get.
  19852. * @returns {*} Returns the property value.
  19853. */
  19854. function getValue(object, key) {
  19855. return object == null ? undefined : object[key];
  19856. }
  19857. /**
  19858. * Checks if `string` contains Unicode symbols.
  19859. *
  19860. * @private
  19861. * @param {string} string The string to inspect.
  19862. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  19863. */
  19864. function hasUnicode(string) {
  19865. return reHasUnicode.test(string);
  19866. }
  19867. /**
  19868. * Checks if `string` contains a word composed of Unicode symbols.
  19869. *
  19870. * @private
  19871. * @param {string} string The string to inspect.
  19872. * @returns {boolean} Returns `true` if a word is found, else `false`.
  19873. */
  19874. function hasUnicodeWord(string) {
  19875. return reHasUnicodeWord.test(string);
  19876. }
  19877. /**
  19878. * Converts `iterator` to an array.
  19879. *
  19880. * @private
  19881. * @param {Object} iterator The iterator to convert.
  19882. * @returns {Array} Returns the converted array.
  19883. */
  19884. function iteratorToArray(iterator) {
  19885. var data,
  19886. result = [];
  19887. while (!(data = iterator.next()).done) {
  19888. result.push(data.value);
  19889. }
  19890. return result;
  19891. }
  19892. /**
  19893. * Converts `map` to its key-value pairs.
  19894. *
  19895. * @private
  19896. * @param {Object} map The map to convert.
  19897. * @returns {Array} Returns the key-value pairs.
  19898. */
  19899. function mapToArray(map) {
  19900. var index = -1,
  19901. result = Array(map.size);
  19902. map.forEach(function(value, key) {
  19903. result[++index] = [key, value];
  19904. });
  19905. return result;
  19906. }
  19907. /**
  19908. * Creates a unary function that invokes `func` with its argument transformed.
  19909. *
  19910. * @private
  19911. * @param {Function} func The function to wrap.
  19912. * @param {Function} transform The argument transform.
  19913. * @returns {Function} Returns the new function.
  19914. */
  19915. function overArg(func, transform) {
  19916. return function(arg) {
  19917. return func(transform(arg));
  19918. };
  19919. }
  19920. /**
  19921. * Replaces all `placeholder` elements in `array` with an internal placeholder
  19922. * and returns an array of their indexes.
  19923. *
  19924. * @private
  19925. * @param {Array} array The array to modify.
  19926. * @param {*} placeholder The placeholder to replace.
  19927. * @returns {Array} Returns the new array of placeholder indexes.
  19928. */
  19929. function replaceHolders(array, placeholder) {
  19930. var index = -1,
  19931. length = array.length,
  19932. resIndex = 0,
  19933. result = [];
  19934. while (++index < length) {
  19935. var value = array[index];
  19936. if (value === placeholder || value === PLACEHOLDER) {
  19937. array[index] = PLACEHOLDER;
  19938. result[resIndex++] = index;
  19939. }
  19940. }
  19941. return result;
  19942. }
  19943. /**
  19944. * Converts `set` to an array of its values.
  19945. *
  19946. * @private
  19947. * @param {Object} set The set to convert.
  19948. * @returns {Array} Returns the values.
  19949. */
  19950. function setToArray(set) {
  19951. var index = -1,
  19952. result = Array(set.size);
  19953. set.forEach(function(value) {
  19954. result[++index] = value;
  19955. });
  19956. return result;
  19957. }
  19958. /**
  19959. * Converts `set` to its value-value pairs.
  19960. *
  19961. * @private
  19962. * @param {Object} set The set to convert.
  19963. * @returns {Array} Returns the value-value pairs.
  19964. */
  19965. function setToPairs(set) {
  19966. var index = -1,
  19967. result = Array(set.size);
  19968. set.forEach(function(value) {
  19969. result[++index] = [value, value];
  19970. });
  19971. return result;
  19972. }
  19973. /**
  19974. * A specialized version of `_.indexOf` which performs strict equality
  19975. * comparisons of values, i.e. `===`.
  19976. *
  19977. * @private
  19978. * @param {Array} array The array to inspect.
  19979. * @param {*} value The value to search for.
  19980. * @param {number} fromIndex The index to search from.
  19981. * @returns {number} Returns the index of the matched value, else `-1`.
  19982. */
  19983. function strictIndexOf(array, value, fromIndex) {
  19984. var index = fromIndex - 1,
  19985. length = array.length;
  19986. while (++index < length) {
  19987. if (array[index] === value) {
  19988. return index;
  19989. }
  19990. }
  19991. return -1;
  19992. }
  19993. /**
  19994. * A specialized version of `_.lastIndexOf` which performs strict equality
  19995. * comparisons of values, i.e. `===`.
  19996. *
  19997. * @private
  19998. * @param {Array} array The array to inspect.
  19999. * @param {*} value The value to search for.
  20000. * @param {number} fromIndex The index to search from.
  20001. * @returns {number} Returns the index of the matched value, else `-1`.
  20002. */
  20003. function strictLastIndexOf(array, value, fromIndex) {
  20004. var index = fromIndex + 1;
  20005. while (index--) {
  20006. if (array[index] === value) {
  20007. return index;
  20008. }
  20009. }
  20010. return index;
  20011. }
  20012. /**
  20013. * Gets the number of symbols in `string`.
  20014. *
  20015. * @private
  20016. * @param {string} string The string to inspect.
  20017. * @returns {number} Returns the string size.
  20018. */
  20019. function stringSize(string) {
  20020. return hasUnicode(string)
  20021. ? unicodeSize(string)
  20022. : asciiSize(string);
  20023. }
  20024. /**
  20025. * Converts `string` to an array.
  20026. *
  20027. * @private
  20028. * @param {string} string The string to convert.
  20029. * @returns {Array} Returns the converted array.
  20030. */
  20031. function stringToArray(string) {
  20032. return hasUnicode(string)
  20033. ? unicodeToArray(string)
  20034. : asciiToArray(string);
  20035. }
  20036. /**
  20037. * Used by `_.unescape` to convert HTML entities to characters.
  20038. *
  20039. * @private
  20040. * @param {string} chr The matched character to unescape.
  20041. * @returns {string} Returns the unescaped character.
  20042. */
  20043. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  20044. /**
  20045. * Gets the size of a Unicode `string`.
  20046. *
  20047. * @private
  20048. * @param {string} string The string inspect.
  20049. * @returns {number} Returns the string size.
  20050. */
  20051. function unicodeSize(string) {
  20052. var result = reUnicode.lastIndex = 0;
  20053. while (reUnicode.test(string)) {
  20054. ++result;
  20055. }
  20056. return result;
  20057. }
  20058. /**
  20059. * Converts a Unicode `string` to an array.
  20060. *
  20061. * @private
  20062. * @param {string} string The string to convert.
  20063. * @returns {Array} Returns the converted array.
  20064. */
  20065. function unicodeToArray(string) {
  20066. return string.match(reUnicode) || [];
  20067. }
  20068. /**
  20069. * Splits a Unicode `string` into an array of its words.
  20070. *
  20071. * @private
  20072. * @param {string} The string to inspect.
  20073. * @returns {Array} Returns the words of `string`.
  20074. */
  20075. function unicodeWords(string) {
  20076. return string.match(reUnicodeWord) || [];
  20077. }
  20078. /*--------------------------------------------------------------------------*/
  20079. /**
  20080. * Create a new pristine `lodash` function using the `context` object.
  20081. *
  20082. * @static
  20083. * @memberOf _
  20084. * @since 1.1.0
  20085. * @category Util
  20086. * @param {Object} [context=root] The context object.
  20087. * @returns {Function} Returns a new `lodash` function.
  20088. * @example
  20089. *
  20090. * _.mixin({ 'foo': _.constant('foo') });
  20091. *
  20092. * var lodash = _.runInContext();
  20093. * lodash.mixin({ 'bar': lodash.constant('bar') });
  20094. *
  20095. * _.isFunction(_.foo);
  20096. * // => true
  20097. * _.isFunction(_.bar);
  20098. * // => false
  20099. *
  20100. * lodash.isFunction(lodash.foo);
  20101. * // => false
  20102. * lodash.isFunction(lodash.bar);
  20103. * // => true
  20104. *
  20105. * // Create a suped-up `defer` in Node.js.
  20106. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  20107. */
  20108. var runInContext = (function runInContext(context) {
  20109. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  20110. /** Built-in constructor references. */
  20111. var Array = context.Array,
  20112. Date = context.Date,
  20113. Error = context.Error,
  20114. Function = context.Function,
  20115. Math = context.Math,
  20116. Object = context.Object,
  20117. RegExp = context.RegExp,
  20118. String = context.String,
  20119. TypeError = context.TypeError;
  20120. /** Used for built-in method references. */
  20121. var arrayProto = Array.prototype,
  20122. funcProto = Function.prototype,
  20123. objectProto = Object.prototype;
  20124. /** Used to detect overreaching core-js shims. */
  20125. var coreJsData = context['__core-js_shared__'];
  20126. /** Used to resolve the decompiled source of functions. */
  20127. var funcToString = funcProto.toString;
  20128. /** Used to check objects for own properties. */
  20129. var hasOwnProperty = objectProto.hasOwnProperty;
  20130. /** Used to generate unique IDs. */
  20131. var idCounter = 0;
  20132. /** Used to detect methods masquerading as native. */
  20133. var maskSrcKey = (function() {
  20134. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  20135. return uid ? ('Symbol(src)_1.' + uid) : '';
  20136. }());
  20137. /**
  20138. * Used to resolve the
  20139. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  20140. * of values.
  20141. */
  20142. var nativeObjectToString = objectProto.toString;
  20143. /** Used to infer the `Object` constructor. */
  20144. var objectCtorString = funcToString.call(Object);
  20145. /** Used to restore the original `_` reference in `_.noConflict`. */
  20146. var oldDash = root._;
  20147. /** Used to detect if a method is native. */
  20148. var reIsNative = RegExp('^' +
  20149. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  20150. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  20151. );
  20152. /** Built-in value references. */
  20153. var Buffer = moduleExports ? context.Buffer : undefined,
  20154. Symbol = context.Symbol,
  20155. Uint8Array = context.Uint8Array,
  20156. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  20157. getPrototype = overArg(Object.getPrototypeOf, Object),
  20158. objectCreate = Object.create,
  20159. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  20160. splice = arrayProto.splice,
  20161. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  20162. symIterator = Symbol ? Symbol.iterator : undefined,
  20163. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  20164. var defineProperty = (function() {
  20165. try {
  20166. var func = getNative(Object, 'defineProperty');
  20167. func({}, '', {});
  20168. return func;
  20169. } catch (e) {}
  20170. }());
  20171. /** Mocked built-ins. */
  20172. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  20173. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  20174. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  20175. /* Built-in method references for those with the same name as other `lodash` methods. */
  20176. var nativeCeil = Math.ceil,
  20177. nativeFloor = Math.floor,
  20178. nativeGetSymbols = Object.getOwnPropertySymbols,
  20179. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  20180. nativeIsFinite = context.isFinite,
  20181. nativeJoin = arrayProto.join,
  20182. nativeKeys = overArg(Object.keys, Object),
  20183. nativeMax = Math.max,
  20184. nativeMin = Math.min,
  20185. nativeNow = Date.now,
  20186. nativeParseInt = context.parseInt,
  20187. nativeRandom = Math.random,
  20188. nativeReverse = arrayProto.reverse;
  20189. /* Built-in method references that are verified to be native. */
  20190. var DataView = getNative(context, 'DataView'),
  20191. Map = getNative(context, 'Map'),
  20192. Promise = getNative(context, 'Promise'),
  20193. Set = getNative(context, 'Set'),
  20194. WeakMap = getNative(context, 'WeakMap'),
  20195. nativeCreate = getNative(Object, 'create');
  20196. /** Used to store function metadata. */
  20197. var metaMap = WeakMap && new WeakMap;
  20198. /** Used to lookup unminified function names. */
  20199. var realNames = {};
  20200. /** Used to detect maps, sets, and weakmaps. */
  20201. var dataViewCtorString = toSource(DataView),
  20202. mapCtorString = toSource(Map),
  20203. promiseCtorString = toSource(Promise),
  20204. setCtorString = toSource(Set),
  20205. weakMapCtorString = toSource(WeakMap);
  20206. /** Used to convert symbols to primitives and strings. */
  20207. var symbolProto = Symbol ? Symbol.prototype : undefined,
  20208. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  20209. symbolToString = symbolProto ? symbolProto.toString : undefined;
  20210. /*------------------------------------------------------------------------*/
  20211. /**
  20212. * Creates a `lodash` object which wraps `value` to enable implicit method
  20213. * chain sequences. Methods that operate on and return arrays, collections,
  20214. * and functions can be chained together. Methods that retrieve a single value
  20215. * or may return a primitive value will automatically end the chain sequence
  20216. * and return the unwrapped value. Otherwise, the value must be unwrapped
  20217. * with `_#value`.
  20218. *
  20219. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  20220. * enabled using `_.chain`.
  20221. *
  20222. * The execution of chained methods is lazy, that is, it's deferred until
  20223. * `_#value` is implicitly or explicitly called.
  20224. *
  20225. * Lazy evaluation allows several methods to support shortcut fusion.
  20226. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  20227. * the creation of intermediate arrays and can greatly reduce the number of
  20228. * iteratee executions. Sections of a chain sequence qualify for shortcut
  20229. * fusion if the section is applied to an array and iteratees accept only
  20230. * one argument. The heuristic for whether a section qualifies for shortcut
  20231. * fusion is subject to change.
  20232. *
  20233. * Chaining is supported in custom builds as long as the `_#value` method is
  20234. * directly or indirectly included in the build.
  20235. *
  20236. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  20237. *
  20238. * The wrapper `Array` methods are:
  20239. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  20240. *
  20241. * The wrapper `String` methods are:
  20242. * `replace` and `split`
  20243. *
  20244. * The wrapper methods that support shortcut fusion are:
  20245. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  20246. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  20247. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  20248. *
  20249. * The chainable wrapper methods are:
  20250. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  20251. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  20252. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  20253. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  20254. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  20255. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  20256. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  20257. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  20258. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  20259. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  20260. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  20261. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  20262. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  20263. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  20264. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  20265. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  20266. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  20267. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  20268. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  20269. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  20270. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  20271. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  20272. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  20273. * `zipObject`, `zipObjectDeep`, and `zipWith`
  20274. *
  20275. * The wrapper methods that are **not** chainable by default are:
  20276. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  20277. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  20278. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  20279. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  20280. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  20281. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  20282. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  20283. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  20284. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  20285. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  20286. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  20287. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  20288. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  20289. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  20290. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  20291. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  20292. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  20293. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  20294. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  20295. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  20296. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  20297. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  20298. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  20299. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  20300. * `upperFirst`, `value`, and `words`
  20301. *
  20302. * @name _
  20303. * @constructor
  20304. * @category Seq
  20305. * @param {*} value The value to wrap in a `lodash` instance.
  20306. * @returns {Object} Returns the new `lodash` wrapper instance.
  20307. * @example
  20308. *
  20309. * function square(n) {
  20310. * return n * n;
  20311. * }
  20312. *
  20313. * var wrapped = _([1, 2, 3]);
  20314. *
  20315. * // Returns an unwrapped value.
  20316. * wrapped.reduce(_.add);
  20317. * // => 6
  20318. *
  20319. * // Returns a wrapped value.
  20320. * var squares = wrapped.map(square);
  20321. *
  20322. * _.isArray(squares);
  20323. * // => false
  20324. *
  20325. * _.isArray(squares.value());
  20326. * // => true
  20327. */
  20328. function lodash(value) {
  20329. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  20330. if (value instanceof LodashWrapper) {
  20331. return value;
  20332. }
  20333. if (hasOwnProperty.call(value, '__wrapped__')) {
  20334. return wrapperClone(value);
  20335. }
  20336. }
  20337. return new LodashWrapper(value);
  20338. }
  20339. /**
  20340. * The base implementation of `_.create` without support for assigning
  20341. * properties to the created object.
  20342. *
  20343. * @private
  20344. * @param {Object} proto The object to inherit from.
  20345. * @returns {Object} Returns the new object.
  20346. */
  20347. var baseCreate = (function() {
  20348. function object() {}
  20349. return function(proto) {
  20350. if (!isObject(proto)) {
  20351. return {};
  20352. }
  20353. if (objectCreate) {
  20354. return objectCreate(proto);
  20355. }
  20356. object.prototype = proto;
  20357. var result = new object;
  20358. object.prototype = undefined;
  20359. return result;
  20360. };
  20361. }());
  20362. /**
  20363. * The function whose prototype chain sequence wrappers inherit from.
  20364. *
  20365. * @private
  20366. */
  20367. function baseLodash() {
  20368. // No operation performed.
  20369. }
  20370. /**
  20371. * The base constructor for creating `lodash` wrapper objects.
  20372. *
  20373. * @private
  20374. * @param {*} value The value to wrap.
  20375. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  20376. */
  20377. function LodashWrapper(value, chainAll) {
  20378. this.__wrapped__ = value;
  20379. this.__actions__ = [];
  20380. this.__chain__ = !!chainAll;
  20381. this.__index__ = 0;
  20382. this.__values__ = undefined;
  20383. }
  20384. /**
  20385. * By default, the template delimiters used by lodash are like those in
  20386. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  20387. * following template settings to use alternative delimiters.
  20388. *
  20389. * @static
  20390. * @memberOf _
  20391. * @type {Object}
  20392. */
  20393. lodash.templateSettings = {
  20394. /**
  20395. * Used to detect `data` property values to be HTML-escaped.
  20396. *
  20397. * @memberOf _.templateSettings
  20398. * @type {RegExp}
  20399. */
  20400. 'escape': reEscape,
  20401. /**
  20402. * Used to detect code to be evaluated.
  20403. *
  20404. * @memberOf _.templateSettings
  20405. * @type {RegExp}
  20406. */
  20407. 'evaluate': reEvaluate,
  20408. /**
  20409. * Used to detect `data` property values to inject.
  20410. *
  20411. * @memberOf _.templateSettings
  20412. * @type {RegExp}
  20413. */
  20414. 'interpolate': reInterpolate,
  20415. /**
  20416. * Used to reference the data object in the template text.
  20417. *
  20418. * @memberOf _.templateSettings
  20419. * @type {string}
  20420. */
  20421. 'variable': '',
  20422. /**
  20423. * Used to import variables into the compiled template.
  20424. *
  20425. * @memberOf _.templateSettings
  20426. * @type {Object}
  20427. */
  20428. 'imports': {
  20429. /**
  20430. * A reference to the `lodash` function.
  20431. *
  20432. * @memberOf _.templateSettings.imports
  20433. * @type {Function}
  20434. */
  20435. '_': lodash
  20436. }
  20437. };
  20438. // Ensure wrappers are instances of `baseLodash`.
  20439. lodash.prototype = baseLodash.prototype;
  20440. lodash.prototype.constructor = lodash;
  20441. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  20442. LodashWrapper.prototype.constructor = LodashWrapper;
  20443. /*------------------------------------------------------------------------*/
  20444. /**
  20445. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  20446. *
  20447. * @private
  20448. * @constructor
  20449. * @param {*} value The value to wrap.
  20450. */
  20451. function LazyWrapper(value) {
  20452. this.__wrapped__ = value;
  20453. this.__actions__ = [];
  20454. this.__dir__ = 1;
  20455. this.__filtered__ = false;
  20456. this.__iteratees__ = [];
  20457. this.__takeCount__ = MAX_ARRAY_LENGTH;
  20458. this.__views__ = [];
  20459. }
  20460. /**
  20461. * Creates a clone of the lazy wrapper object.
  20462. *
  20463. * @private
  20464. * @name clone
  20465. * @memberOf LazyWrapper
  20466. * @returns {Object} Returns the cloned `LazyWrapper` object.
  20467. */
  20468. function lazyClone() {
  20469. var result = new LazyWrapper(this.__wrapped__);
  20470. result.__actions__ = copyArray(this.__actions__);
  20471. result.__dir__ = this.__dir__;
  20472. result.__filtered__ = this.__filtered__;
  20473. result.__iteratees__ = copyArray(this.__iteratees__);
  20474. result.__takeCount__ = this.__takeCount__;
  20475. result.__views__ = copyArray(this.__views__);
  20476. return result;
  20477. }
  20478. /**
  20479. * Reverses the direction of lazy iteration.
  20480. *
  20481. * @private
  20482. * @name reverse
  20483. * @memberOf LazyWrapper
  20484. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  20485. */
  20486. function lazyReverse() {
  20487. if (this.__filtered__) {
  20488. var result = new LazyWrapper(this);
  20489. result.__dir__ = -1;
  20490. result.__filtered__ = true;
  20491. } else {
  20492. result = this.clone();
  20493. result.__dir__ *= -1;
  20494. }
  20495. return result;
  20496. }
  20497. /**
  20498. * Extracts the unwrapped value from its lazy wrapper.
  20499. *
  20500. * @private
  20501. * @name value
  20502. * @memberOf LazyWrapper
  20503. * @returns {*} Returns the unwrapped value.
  20504. */
  20505. function lazyValue() {
  20506. var array = this.__wrapped__.value(),
  20507. dir = this.__dir__,
  20508. isArr = isArray(array),
  20509. isRight = dir < 0,
  20510. arrLength = isArr ? array.length : 0,
  20511. view = getView(0, arrLength, this.__views__),
  20512. start = view.start,
  20513. end = view.end,
  20514. length = end - start,
  20515. index = isRight ? end : (start - 1),
  20516. iteratees = this.__iteratees__,
  20517. iterLength = iteratees.length,
  20518. resIndex = 0,
  20519. takeCount = nativeMin(length, this.__takeCount__);
  20520. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  20521. return baseWrapperValue(array, this.__actions__);
  20522. }
  20523. var result = [];
  20524. outer:
  20525. while (length-- && resIndex < takeCount) {
  20526. index += dir;
  20527. var iterIndex = -1,
  20528. value = array[index];
  20529. while (++iterIndex < iterLength) {
  20530. var data = iteratees[iterIndex],
  20531. iteratee = data.iteratee,
  20532. type = data.type,
  20533. computed = iteratee(value);
  20534. if (type == LAZY_MAP_FLAG) {
  20535. value = computed;
  20536. } else if (!computed) {
  20537. if (type == LAZY_FILTER_FLAG) {
  20538. continue outer;
  20539. } else {
  20540. break outer;
  20541. }
  20542. }
  20543. }
  20544. result[resIndex++] = value;
  20545. }
  20546. return result;
  20547. }
  20548. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  20549. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  20550. LazyWrapper.prototype.constructor = LazyWrapper;
  20551. /*------------------------------------------------------------------------*/
  20552. /**
  20553. * Creates a hash object.
  20554. *
  20555. * @private
  20556. * @constructor
  20557. * @param {Array} [entries] The key-value pairs to cache.
  20558. */
  20559. function Hash(entries) {
  20560. var index = -1,
  20561. length = entries == null ? 0 : entries.length;
  20562. this.clear();
  20563. while (++index < length) {
  20564. var entry = entries[index];
  20565. this.set(entry[0], entry[1]);
  20566. }
  20567. }
  20568. /**
  20569. * Removes all key-value entries from the hash.
  20570. *
  20571. * @private
  20572. * @name clear
  20573. * @memberOf Hash
  20574. */
  20575. function hashClear() {
  20576. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  20577. this.size = 0;
  20578. }
  20579. /**
  20580. * Removes `key` and its value from the hash.
  20581. *
  20582. * @private
  20583. * @name delete
  20584. * @memberOf Hash
  20585. * @param {Object} hash The hash to modify.
  20586. * @param {string} key The key of the value to remove.
  20587. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20588. */
  20589. function hashDelete(key) {
  20590. var result = this.has(key) && delete this.__data__[key];
  20591. this.size -= result ? 1 : 0;
  20592. return result;
  20593. }
  20594. /**
  20595. * Gets the hash value for `key`.
  20596. *
  20597. * @private
  20598. * @name get
  20599. * @memberOf Hash
  20600. * @param {string} key The key of the value to get.
  20601. * @returns {*} Returns the entry value.
  20602. */
  20603. function hashGet(key) {
  20604. var data = this.__data__;
  20605. if (nativeCreate) {
  20606. var result = data[key];
  20607. return result === HASH_UNDEFINED ? undefined : result;
  20608. }
  20609. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  20610. }
  20611. /**
  20612. * Checks if a hash value for `key` exists.
  20613. *
  20614. * @private
  20615. * @name has
  20616. * @memberOf Hash
  20617. * @param {string} key The key of the entry to check.
  20618. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20619. */
  20620. function hashHas(key) {
  20621. var data = this.__data__;
  20622. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  20623. }
  20624. /**
  20625. * Sets the hash `key` to `value`.
  20626. *
  20627. * @private
  20628. * @name set
  20629. * @memberOf Hash
  20630. * @param {string} key The key of the value to set.
  20631. * @param {*} value The value to set.
  20632. * @returns {Object} Returns the hash instance.
  20633. */
  20634. function hashSet(key, value) {
  20635. var data = this.__data__;
  20636. this.size += this.has(key) ? 0 : 1;
  20637. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  20638. return this;
  20639. }
  20640. // Add methods to `Hash`.
  20641. Hash.prototype.clear = hashClear;
  20642. Hash.prototype['delete'] = hashDelete;
  20643. Hash.prototype.get = hashGet;
  20644. Hash.prototype.has = hashHas;
  20645. Hash.prototype.set = hashSet;
  20646. /*------------------------------------------------------------------------*/
  20647. /**
  20648. * Creates an list cache object.
  20649. *
  20650. * @private
  20651. * @constructor
  20652. * @param {Array} [entries] The key-value pairs to cache.
  20653. */
  20654. function ListCache(entries) {
  20655. var index = -1,
  20656. length = entries == null ? 0 : entries.length;
  20657. this.clear();
  20658. while (++index < length) {
  20659. var entry = entries[index];
  20660. this.set(entry[0], entry[1]);
  20661. }
  20662. }
  20663. /**
  20664. * Removes all key-value entries from the list cache.
  20665. *
  20666. * @private
  20667. * @name clear
  20668. * @memberOf ListCache
  20669. */
  20670. function listCacheClear() {
  20671. this.__data__ = [];
  20672. this.size = 0;
  20673. }
  20674. /**
  20675. * Removes `key` and its value from the list cache.
  20676. *
  20677. * @private
  20678. * @name delete
  20679. * @memberOf ListCache
  20680. * @param {string} key The key of the value to remove.
  20681. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20682. */
  20683. function listCacheDelete(key) {
  20684. var data = this.__data__,
  20685. index = assocIndexOf(data, key);
  20686. if (index < 0) {
  20687. return false;
  20688. }
  20689. var lastIndex = data.length - 1;
  20690. if (index == lastIndex) {
  20691. data.pop();
  20692. } else {
  20693. splice.call(data, index, 1);
  20694. }
  20695. --this.size;
  20696. return true;
  20697. }
  20698. /**
  20699. * Gets the list cache value for `key`.
  20700. *
  20701. * @private
  20702. * @name get
  20703. * @memberOf ListCache
  20704. * @param {string} key The key of the value to get.
  20705. * @returns {*} Returns the entry value.
  20706. */
  20707. function listCacheGet(key) {
  20708. var data = this.__data__,
  20709. index = assocIndexOf(data, key);
  20710. return index < 0 ? undefined : data[index][1];
  20711. }
  20712. /**
  20713. * Checks if a list cache value for `key` exists.
  20714. *
  20715. * @private
  20716. * @name has
  20717. * @memberOf ListCache
  20718. * @param {string} key The key of the entry to check.
  20719. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20720. */
  20721. function listCacheHas(key) {
  20722. return assocIndexOf(this.__data__, key) > -1;
  20723. }
  20724. /**
  20725. * Sets the list cache `key` to `value`.
  20726. *
  20727. * @private
  20728. * @name set
  20729. * @memberOf ListCache
  20730. * @param {string} key The key of the value to set.
  20731. * @param {*} value The value to set.
  20732. * @returns {Object} Returns the list cache instance.
  20733. */
  20734. function listCacheSet(key, value) {
  20735. var data = this.__data__,
  20736. index = assocIndexOf(data, key);
  20737. if (index < 0) {
  20738. ++this.size;
  20739. data.push([key, value]);
  20740. } else {
  20741. data[index][1] = value;
  20742. }
  20743. return this;
  20744. }
  20745. // Add methods to `ListCache`.
  20746. ListCache.prototype.clear = listCacheClear;
  20747. ListCache.prototype['delete'] = listCacheDelete;
  20748. ListCache.prototype.get = listCacheGet;
  20749. ListCache.prototype.has = listCacheHas;
  20750. ListCache.prototype.set = listCacheSet;
  20751. /*------------------------------------------------------------------------*/
  20752. /**
  20753. * Creates a map cache object to store key-value pairs.
  20754. *
  20755. * @private
  20756. * @constructor
  20757. * @param {Array} [entries] The key-value pairs to cache.
  20758. */
  20759. function MapCache(entries) {
  20760. var index = -1,
  20761. length = entries == null ? 0 : entries.length;
  20762. this.clear();
  20763. while (++index < length) {
  20764. var entry = entries[index];
  20765. this.set(entry[0], entry[1]);
  20766. }
  20767. }
  20768. /**
  20769. * Removes all key-value entries from the map.
  20770. *
  20771. * @private
  20772. * @name clear
  20773. * @memberOf MapCache
  20774. */
  20775. function mapCacheClear() {
  20776. this.size = 0;
  20777. this.__data__ = {
  20778. 'hash': new Hash,
  20779. 'map': new (Map || ListCache),
  20780. 'string': new Hash
  20781. };
  20782. }
  20783. /**
  20784. * Removes `key` and its value from the map.
  20785. *
  20786. * @private
  20787. * @name delete
  20788. * @memberOf MapCache
  20789. * @param {string} key The key of the value to remove.
  20790. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20791. */
  20792. function mapCacheDelete(key) {
  20793. var result = getMapData(this, key)['delete'](key);
  20794. this.size -= result ? 1 : 0;
  20795. return result;
  20796. }
  20797. /**
  20798. * Gets the map value for `key`.
  20799. *
  20800. * @private
  20801. * @name get
  20802. * @memberOf MapCache
  20803. * @param {string} key The key of the value to get.
  20804. * @returns {*} Returns the entry value.
  20805. */
  20806. function mapCacheGet(key) {
  20807. return getMapData(this, key).get(key);
  20808. }
  20809. /**
  20810. * Checks if a map value for `key` exists.
  20811. *
  20812. * @private
  20813. * @name has
  20814. * @memberOf MapCache
  20815. * @param {string} key The key of the entry to check.
  20816. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20817. */
  20818. function mapCacheHas(key) {
  20819. return getMapData(this, key).has(key);
  20820. }
  20821. /**
  20822. * Sets the map `key` to `value`.
  20823. *
  20824. * @private
  20825. * @name set
  20826. * @memberOf MapCache
  20827. * @param {string} key The key of the value to set.
  20828. * @param {*} value The value to set.
  20829. * @returns {Object} Returns the map cache instance.
  20830. */
  20831. function mapCacheSet(key, value) {
  20832. var data = getMapData(this, key),
  20833. size = data.size;
  20834. data.set(key, value);
  20835. this.size += data.size == size ? 0 : 1;
  20836. return this;
  20837. }
  20838. // Add methods to `MapCache`.
  20839. MapCache.prototype.clear = mapCacheClear;
  20840. MapCache.prototype['delete'] = mapCacheDelete;
  20841. MapCache.prototype.get = mapCacheGet;
  20842. MapCache.prototype.has = mapCacheHas;
  20843. MapCache.prototype.set = mapCacheSet;
  20844. /*------------------------------------------------------------------------*/
  20845. /**
  20846. *
  20847. * Creates an array cache object to store unique values.
  20848. *
  20849. * @private
  20850. * @constructor
  20851. * @param {Array} [values] The values to cache.
  20852. */
  20853. function SetCache(values) {
  20854. var index = -1,
  20855. length = values == null ? 0 : values.length;
  20856. this.__data__ = new MapCache;
  20857. while (++index < length) {
  20858. this.add(values[index]);
  20859. }
  20860. }
  20861. /**
  20862. * Adds `value` to the array cache.
  20863. *
  20864. * @private
  20865. * @name add
  20866. * @memberOf SetCache
  20867. * @alias push
  20868. * @param {*} value The value to cache.
  20869. * @returns {Object} Returns the cache instance.
  20870. */
  20871. function setCacheAdd(value) {
  20872. this.__data__.set(value, HASH_UNDEFINED);
  20873. return this;
  20874. }
  20875. /**
  20876. * Checks if `value` is in the array cache.
  20877. *
  20878. * @private
  20879. * @name has
  20880. * @memberOf SetCache
  20881. * @param {*} value The value to search for.
  20882. * @returns {number} Returns `true` if `value` is found, else `false`.
  20883. */
  20884. function setCacheHas(value) {
  20885. return this.__data__.has(value);
  20886. }
  20887. // Add methods to `SetCache`.
  20888. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  20889. SetCache.prototype.has = setCacheHas;
  20890. /*------------------------------------------------------------------------*/
  20891. /**
  20892. * Creates a stack cache object to store key-value pairs.
  20893. *
  20894. * @private
  20895. * @constructor
  20896. * @param {Array} [entries] The key-value pairs to cache.
  20897. */
  20898. function Stack(entries) {
  20899. var data = this.__data__ = new ListCache(entries);
  20900. this.size = data.size;
  20901. }
  20902. /**
  20903. * Removes all key-value entries from the stack.
  20904. *
  20905. * @private
  20906. * @name clear
  20907. * @memberOf Stack
  20908. */
  20909. function stackClear() {
  20910. this.__data__ = new ListCache;
  20911. this.size = 0;
  20912. }
  20913. /**
  20914. * Removes `key` and its value from the stack.
  20915. *
  20916. * @private
  20917. * @name delete
  20918. * @memberOf Stack
  20919. * @param {string} key The key of the value to remove.
  20920. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20921. */
  20922. function stackDelete(key) {
  20923. var data = this.__data__,
  20924. result = data['delete'](key);
  20925. this.size = data.size;
  20926. return result;
  20927. }
  20928. /**
  20929. * Gets the stack value for `key`.
  20930. *
  20931. * @private
  20932. * @name get
  20933. * @memberOf Stack
  20934. * @param {string} key The key of the value to get.
  20935. * @returns {*} Returns the entry value.
  20936. */
  20937. function stackGet(key) {
  20938. return this.__data__.get(key);
  20939. }
  20940. /**
  20941. * Checks if a stack value for `key` exists.
  20942. *
  20943. * @private
  20944. * @name has
  20945. * @memberOf Stack
  20946. * @param {string} key The key of the entry to check.
  20947. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20948. */
  20949. function stackHas(key) {
  20950. return this.__data__.has(key);
  20951. }
  20952. /**
  20953. * Sets the stack `key` to `value`.
  20954. *
  20955. * @private
  20956. * @name set
  20957. * @memberOf Stack
  20958. * @param {string} key The key of the value to set.
  20959. * @param {*} value The value to set.
  20960. * @returns {Object} Returns the stack cache instance.
  20961. */
  20962. function stackSet(key, value) {
  20963. var data = this.__data__;
  20964. if (data instanceof ListCache) {
  20965. var pairs = data.__data__;
  20966. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  20967. pairs.push([key, value]);
  20968. this.size = ++data.size;
  20969. return this;
  20970. }
  20971. data = this.__data__ = new MapCache(pairs);
  20972. }
  20973. data.set(key, value);
  20974. this.size = data.size;
  20975. return this;
  20976. }
  20977. // Add methods to `Stack`.
  20978. Stack.prototype.clear = stackClear;
  20979. Stack.prototype['delete'] = stackDelete;
  20980. Stack.prototype.get = stackGet;
  20981. Stack.prototype.has = stackHas;
  20982. Stack.prototype.set = stackSet;
  20983. /*------------------------------------------------------------------------*/
  20984. /**
  20985. * Creates an array of the enumerable property names of the array-like `value`.
  20986. *
  20987. * @private
  20988. * @param {*} value The value to query.
  20989. * @param {boolean} inherited Specify returning inherited property names.
  20990. * @returns {Array} Returns the array of property names.
  20991. */
  20992. function arrayLikeKeys(value, inherited) {
  20993. var isArr = isArray(value),
  20994. isArg = !isArr && isArguments(value),
  20995. isBuff = !isArr && !isArg && isBuffer(value),
  20996. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  20997. skipIndexes = isArr || isArg || isBuff || isType,
  20998. result = skipIndexes ? baseTimes(value.length, String) : [],
  20999. length = result.length;
  21000. for (var key in value) {
  21001. if ((inherited || hasOwnProperty.call(value, key)) &&
  21002. !(skipIndexes && (
  21003. // Safari 9 has enumerable `arguments.length` in strict mode.
  21004. key == 'length' ||
  21005. // Node.js 0.10 has enumerable non-index properties on buffers.
  21006. (isBuff && (key == 'offset' || key == 'parent')) ||
  21007. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  21008. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  21009. // Skip index properties.
  21010. isIndex(key, length)
  21011. ))) {
  21012. result.push(key);
  21013. }
  21014. }
  21015. return result;
  21016. }
  21017. /**
  21018. * A specialized version of `_.sample` for arrays.
  21019. *
  21020. * @private
  21021. * @param {Array} array The array to sample.
  21022. * @returns {*} Returns the random element.
  21023. */
  21024. function arraySample(array) {
  21025. var length = array.length;
  21026. return length ? array[baseRandom(0, length - 1)] : undefined;
  21027. }
  21028. /**
  21029. * A specialized version of `_.sampleSize` for arrays.
  21030. *
  21031. * @private
  21032. * @param {Array} array The array to sample.
  21033. * @param {number} n The number of elements to sample.
  21034. * @returns {Array} Returns the random elements.
  21035. */
  21036. function arraySampleSize(array, n) {
  21037. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  21038. }
  21039. /**
  21040. * A specialized version of `_.shuffle` for arrays.
  21041. *
  21042. * @private
  21043. * @param {Array} array The array to shuffle.
  21044. * @returns {Array} Returns the new shuffled array.
  21045. */
  21046. function arrayShuffle(array) {
  21047. return shuffleSelf(copyArray(array));
  21048. }
  21049. /**
  21050. * This function is like `assignValue` except that it doesn't assign
  21051. * `undefined` values.
  21052. *
  21053. * @private
  21054. * @param {Object} object The object to modify.
  21055. * @param {string} key The key of the property to assign.
  21056. * @param {*} value The value to assign.
  21057. */
  21058. function assignMergeValue(object, key, value) {
  21059. if ((value !== undefined && !eq(object[key], value)) ||
  21060. (value === undefined && !(key in object))) {
  21061. baseAssignValue(object, key, value);
  21062. }
  21063. }
  21064. /**
  21065. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  21066. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  21067. * for equality comparisons.
  21068. *
  21069. * @private
  21070. * @param {Object} object The object to modify.
  21071. * @param {string} key The key of the property to assign.
  21072. * @param {*} value The value to assign.
  21073. */
  21074. function assignValue(object, key, value) {
  21075. var objValue = object[key];
  21076. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  21077. (value === undefined && !(key in object))) {
  21078. baseAssignValue(object, key, value);
  21079. }
  21080. }
  21081. /**
  21082. * Gets the index at which the `key` is found in `array` of key-value pairs.
  21083. *
  21084. * @private
  21085. * @param {Array} array The array to inspect.
  21086. * @param {*} key The key to search for.
  21087. * @returns {number} Returns the index of the matched value, else `-1`.
  21088. */
  21089. function assocIndexOf(array, key) {
  21090. var length = array.length;
  21091. while (length--) {
  21092. if (eq(array[length][0], key)) {
  21093. return length;
  21094. }
  21095. }
  21096. return -1;
  21097. }
  21098. /**
  21099. * Aggregates elements of `collection` on `accumulator` with keys transformed
  21100. * by `iteratee` and values set by `setter`.
  21101. *
  21102. * @private
  21103. * @param {Array|Object} collection The collection to iterate over.
  21104. * @param {Function} setter The function to set `accumulator` values.
  21105. * @param {Function} iteratee The iteratee to transform keys.
  21106. * @param {Object} accumulator The initial aggregated object.
  21107. * @returns {Function} Returns `accumulator`.
  21108. */
  21109. function baseAggregator(collection, setter, iteratee, accumulator) {
  21110. baseEach(collection, function(value, key, collection) {
  21111. setter(accumulator, value, iteratee(value), collection);
  21112. });
  21113. return accumulator;
  21114. }
  21115. /**
  21116. * The base implementation of `_.assign` without support for multiple sources
  21117. * or `customizer` functions.
  21118. *
  21119. * @private
  21120. * @param {Object} object The destination object.
  21121. * @param {Object} source The source object.
  21122. * @returns {Object} Returns `object`.
  21123. */
  21124. function baseAssign(object, source) {
  21125. return object && copyObject(source, keys(source), object);
  21126. }
  21127. /**
  21128. * The base implementation of `_.assignIn` without support for multiple sources
  21129. * or `customizer` functions.
  21130. *
  21131. * @private
  21132. * @param {Object} object The destination object.
  21133. * @param {Object} source The source object.
  21134. * @returns {Object} Returns `object`.
  21135. */
  21136. function baseAssignIn(object, source) {
  21137. return object && copyObject(source, keysIn(source), object);
  21138. }
  21139. /**
  21140. * The base implementation of `assignValue` and `assignMergeValue` without
  21141. * value checks.
  21142. *
  21143. * @private
  21144. * @param {Object} object The object to modify.
  21145. * @param {string} key The key of the property to assign.
  21146. * @param {*} value The value to assign.
  21147. */
  21148. function baseAssignValue(object, key, value) {
  21149. if (key == '__proto__' && defineProperty) {
  21150. defineProperty(object, key, {
  21151. 'configurable': true,
  21152. 'enumerable': true,
  21153. 'value': value,
  21154. 'writable': true
  21155. });
  21156. } else {
  21157. object[key] = value;
  21158. }
  21159. }
  21160. /**
  21161. * The base implementation of `_.at` without support for individual paths.
  21162. *
  21163. * @private
  21164. * @param {Object} object The object to iterate over.
  21165. * @param {string[]} paths The property paths to pick.
  21166. * @returns {Array} Returns the picked elements.
  21167. */
  21168. function baseAt(object, paths) {
  21169. var index = -1,
  21170. length = paths.length,
  21171. result = Array(length),
  21172. skip = object == null;
  21173. while (++index < length) {
  21174. result[index] = skip ? undefined : get(object, paths[index]);
  21175. }
  21176. return result;
  21177. }
  21178. /**
  21179. * The base implementation of `_.clamp` which doesn't coerce arguments.
  21180. *
  21181. * @private
  21182. * @param {number} number The number to clamp.
  21183. * @param {number} [lower] The lower bound.
  21184. * @param {number} upper The upper bound.
  21185. * @returns {number} Returns the clamped number.
  21186. */
  21187. function baseClamp(number, lower, upper) {
  21188. if (number === number) {
  21189. if (upper !== undefined) {
  21190. number = number <= upper ? number : upper;
  21191. }
  21192. if (lower !== undefined) {
  21193. number = number >= lower ? number : lower;
  21194. }
  21195. }
  21196. return number;
  21197. }
  21198. /**
  21199. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  21200. * traversed objects.
  21201. *
  21202. * @private
  21203. * @param {*} value The value to clone.
  21204. * @param {boolean} bitmask The bitmask flags.
  21205. * 1 - Deep clone
  21206. * 2 - Flatten inherited properties
  21207. * 4 - Clone symbols
  21208. * @param {Function} [customizer] The function to customize cloning.
  21209. * @param {string} [key] The key of `value`.
  21210. * @param {Object} [object] The parent object of `value`.
  21211. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  21212. * @returns {*} Returns the cloned value.
  21213. */
  21214. function baseClone(value, bitmask, customizer, key, object, stack) {
  21215. var result,
  21216. isDeep = bitmask & CLONE_DEEP_FLAG,
  21217. isFlat = bitmask & CLONE_FLAT_FLAG,
  21218. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  21219. if (customizer) {
  21220. result = object ? customizer(value, key, object, stack) : customizer(value);
  21221. }
  21222. if (result !== undefined) {
  21223. return result;
  21224. }
  21225. if (!isObject(value)) {
  21226. return value;
  21227. }
  21228. var isArr = isArray(value);
  21229. if (isArr) {
  21230. result = initCloneArray(value);
  21231. if (!isDeep) {
  21232. return copyArray(value, result);
  21233. }
  21234. } else {
  21235. var tag = getTag(value),
  21236. isFunc = tag == funcTag || tag == genTag;
  21237. if (isBuffer(value)) {
  21238. return cloneBuffer(value, isDeep);
  21239. }
  21240. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  21241. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  21242. if (!isDeep) {
  21243. return isFlat
  21244. ? copySymbolsIn(value, baseAssignIn(result, value))
  21245. : copySymbols(value, baseAssign(result, value));
  21246. }
  21247. } else {
  21248. if (!cloneableTags[tag]) {
  21249. return object ? value : {};
  21250. }
  21251. result = initCloneByTag(value, tag, isDeep);
  21252. }
  21253. }
  21254. // Check for circular references and return its corresponding clone.
  21255. stack || (stack = new Stack);
  21256. var stacked = stack.get(value);
  21257. if (stacked) {
  21258. return stacked;
  21259. }
  21260. stack.set(value, result);
  21261. if (isSet(value)) {
  21262. value.forEach(function(subValue) {
  21263. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  21264. });
  21265. } else if (isMap(value)) {
  21266. value.forEach(function(subValue, key) {
  21267. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  21268. });
  21269. }
  21270. var keysFunc = isFull
  21271. ? (isFlat ? getAllKeysIn : getAllKeys)
  21272. : (isFlat ? keysIn : keys);
  21273. var props = isArr ? undefined : keysFunc(value);
  21274. arrayEach(props || value, function(subValue, key) {
  21275. if (props) {
  21276. key = subValue;
  21277. subValue = value[key];
  21278. }
  21279. // Recursively populate clone (susceptible to call stack limits).
  21280. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  21281. });
  21282. return result;
  21283. }
  21284. /**
  21285. * The base implementation of `_.conforms` which doesn't clone `source`.
  21286. *
  21287. * @private
  21288. * @param {Object} source The object of property predicates to conform to.
  21289. * @returns {Function} Returns the new spec function.
  21290. */
  21291. function baseConforms(source) {
  21292. var props = keys(source);
  21293. return function(object) {
  21294. return baseConformsTo(object, source, props);
  21295. };
  21296. }
  21297. /**
  21298. * The base implementation of `_.conformsTo` which accepts `props` to check.
  21299. *
  21300. * @private
  21301. * @param {Object} object The object to inspect.
  21302. * @param {Object} source The object of property predicates to conform to.
  21303. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  21304. */
  21305. function baseConformsTo(object, source, props) {
  21306. var length = props.length;
  21307. if (object == null) {
  21308. return !length;
  21309. }
  21310. object = Object(object);
  21311. while (length--) {
  21312. var key = props[length],
  21313. predicate = source[key],
  21314. value = object[key];
  21315. if ((value === undefined && !(key in object)) || !predicate(value)) {
  21316. return false;
  21317. }
  21318. }
  21319. return true;
  21320. }
  21321. /**
  21322. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  21323. * to provide to `func`.
  21324. *
  21325. * @private
  21326. * @param {Function} func The function to delay.
  21327. * @param {number} wait The number of milliseconds to delay invocation.
  21328. * @param {Array} args The arguments to provide to `func`.
  21329. * @returns {number|Object} Returns the timer id or timeout object.
  21330. */
  21331. function baseDelay(func, wait, args) {
  21332. if (typeof func != 'function') {
  21333. throw new TypeError(FUNC_ERROR_TEXT);
  21334. }
  21335. return setTimeout(function() { func.apply(undefined, args); }, wait);
  21336. }
  21337. /**
  21338. * The base implementation of methods like `_.difference` without support
  21339. * for excluding multiple arrays or iteratee shorthands.
  21340. *
  21341. * @private
  21342. * @param {Array} array The array to inspect.
  21343. * @param {Array} values The values to exclude.
  21344. * @param {Function} [iteratee] The iteratee invoked per element.
  21345. * @param {Function} [comparator] The comparator invoked per element.
  21346. * @returns {Array} Returns the new array of filtered values.
  21347. */
  21348. function baseDifference(array, values, iteratee, comparator) {
  21349. var index = -1,
  21350. includes = arrayIncludes,
  21351. isCommon = true,
  21352. length = array.length,
  21353. result = [],
  21354. valuesLength = values.length;
  21355. if (!length) {
  21356. return result;
  21357. }
  21358. if (iteratee) {
  21359. values = arrayMap(values, baseUnary(iteratee));
  21360. }
  21361. if (comparator) {
  21362. includes = arrayIncludesWith;
  21363. isCommon = false;
  21364. }
  21365. else if (values.length >= LARGE_ARRAY_SIZE) {
  21366. includes = cacheHas;
  21367. isCommon = false;
  21368. values = new SetCache(values);
  21369. }
  21370. outer:
  21371. while (++index < length) {
  21372. var value = array[index],
  21373. computed = iteratee == null ? value : iteratee(value);
  21374. value = (comparator || value !== 0) ? value : 0;
  21375. if (isCommon && computed === computed) {
  21376. var valuesIndex = valuesLength;
  21377. while (valuesIndex--) {
  21378. if (values[valuesIndex] === computed) {
  21379. continue outer;
  21380. }
  21381. }
  21382. result.push(value);
  21383. }
  21384. else if (!includes(values, computed, comparator)) {
  21385. result.push(value);
  21386. }
  21387. }
  21388. return result;
  21389. }
  21390. /**
  21391. * The base implementation of `_.forEach` without support for iteratee shorthands.
  21392. *
  21393. * @private
  21394. * @param {Array|Object} collection The collection to iterate over.
  21395. * @param {Function} iteratee The function invoked per iteration.
  21396. * @returns {Array|Object} Returns `collection`.
  21397. */
  21398. var baseEach = createBaseEach(baseForOwn);
  21399. /**
  21400. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  21401. *
  21402. * @private
  21403. * @param {Array|Object} collection The collection to iterate over.
  21404. * @param {Function} iteratee The function invoked per iteration.
  21405. * @returns {Array|Object} Returns `collection`.
  21406. */
  21407. var baseEachRight = createBaseEach(baseForOwnRight, true);
  21408. /**
  21409. * The base implementation of `_.every` without support for iteratee shorthands.
  21410. *
  21411. * @private
  21412. * @param {Array|Object} collection The collection to iterate over.
  21413. * @param {Function} predicate The function invoked per iteration.
  21414. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  21415. * else `false`
  21416. */
  21417. function baseEvery(collection, predicate) {
  21418. var result = true;
  21419. baseEach(collection, function(value, index, collection) {
  21420. result = !!predicate(value, index, collection);
  21421. return result;
  21422. });
  21423. return result;
  21424. }
  21425. /**
  21426. * The base implementation of methods like `_.max` and `_.min` which accepts a
  21427. * `comparator` to determine the extremum value.
  21428. *
  21429. * @private
  21430. * @param {Array} array The array to iterate over.
  21431. * @param {Function} iteratee The iteratee invoked per iteration.
  21432. * @param {Function} comparator The comparator used to compare values.
  21433. * @returns {*} Returns the extremum value.
  21434. */
  21435. function baseExtremum(array, iteratee, comparator) {
  21436. var index = -1,
  21437. length = array.length;
  21438. while (++index < length) {
  21439. var value = array[index],
  21440. current = iteratee(value);
  21441. if (current != null && (computed === undefined
  21442. ? (current === current && !isSymbol(current))
  21443. : comparator(current, computed)
  21444. )) {
  21445. var computed = current,
  21446. result = value;
  21447. }
  21448. }
  21449. return result;
  21450. }
  21451. /**
  21452. * The base implementation of `_.fill` without an iteratee call guard.
  21453. *
  21454. * @private
  21455. * @param {Array} array The array to fill.
  21456. * @param {*} value The value to fill `array` with.
  21457. * @param {number} [start=0] The start position.
  21458. * @param {number} [end=array.length] The end position.
  21459. * @returns {Array} Returns `array`.
  21460. */
  21461. function baseFill(array, value, start, end) {
  21462. var length = array.length;
  21463. start = toInteger(start);
  21464. if (start < 0) {
  21465. start = -start > length ? 0 : (length + start);
  21466. }
  21467. end = (end === undefined || end > length) ? length : toInteger(end);
  21468. if (end < 0) {
  21469. end += length;
  21470. }
  21471. end = start > end ? 0 : toLength(end);
  21472. while (start < end) {
  21473. array[start++] = value;
  21474. }
  21475. return array;
  21476. }
  21477. /**
  21478. * The base implementation of `_.filter` without support for iteratee shorthands.
  21479. *
  21480. * @private
  21481. * @param {Array|Object} collection The collection to iterate over.
  21482. * @param {Function} predicate The function invoked per iteration.
  21483. * @returns {Array} Returns the new filtered array.
  21484. */
  21485. function baseFilter(collection, predicate) {
  21486. var result = [];
  21487. baseEach(collection, function(value, index, collection) {
  21488. if (predicate(value, index, collection)) {
  21489. result.push(value);
  21490. }
  21491. });
  21492. return result;
  21493. }
  21494. /**
  21495. * The base implementation of `_.flatten` with support for restricting flattening.
  21496. *
  21497. * @private
  21498. * @param {Array} array The array to flatten.
  21499. * @param {number} depth The maximum recursion depth.
  21500. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  21501. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  21502. * @param {Array} [result=[]] The initial result value.
  21503. * @returns {Array} Returns the new flattened array.
  21504. */
  21505. function baseFlatten(array, depth, predicate, isStrict, result) {
  21506. var index = -1,
  21507. length = array.length;
  21508. predicate || (predicate = isFlattenable);
  21509. result || (result = []);
  21510. while (++index < length) {
  21511. var value = array[index];
  21512. if (depth > 0 && predicate(value)) {
  21513. if (depth > 1) {
  21514. // Recursively flatten arrays (susceptible to call stack limits).
  21515. baseFlatten(value, depth - 1, predicate, isStrict, result);
  21516. } else {
  21517. arrayPush(result, value);
  21518. }
  21519. } else if (!isStrict) {
  21520. result[result.length] = value;
  21521. }
  21522. }
  21523. return result;
  21524. }
  21525. /**
  21526. * The base implementation of `baseForOwn` which iterates over `object`
  21527. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  21528. * Iteratee functions may exit iteration early by explicitly returning `false`.
  21529. *
  21530. * @private
  21531. * @param {Object} object The object to iterate over.
  21532. * @param {Function} iteratee The function invoked per iteration.
  21533. * @param {Function} keysFunc The function to get the keys of `object`.
  21534. * @returns {Object} Returns `object`.
  21535. */
  21536. var baseFor = createBaseFor();
  21537. /**
  21538. * This function is like `baseFor` except that it iterates over properties
  21539. * in the opposite order.
  21540. *
  21541. * @private
  21542. * @param {Object} object The object to iterate over.
  21543. * @param {Function} iteratee The function invoked per iteration.
  21544. * @param {Function} keysFunc The function to get the keys of `object`.
  21545. * @returns {Object} Returns `object`.
  21546. */
  21547. var baseForRight = createBaseFor(true);
  21548. /**
  21549. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  21550. *
  21551. * @private
  21552. * @param {Object} object The object to iterate over.
  21553. * @param {Function} iteratee The function invoked per iteration.
  21554. * @returns {Object} Returns `object`.
  21555. */
  21556. function baseForOwn(object, iteratee) {
  21557. return object && baseFor(object, iteratee, keys);
  21558. }
  21559. /**
  21560. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  21561. *
  21562. * @private
  21563. * @param {Object} object The object to iterate over.
  21564. * @param {Function} iteratee The function invoked per iteration.
  21565. * @returns {Object} Returns `object`.
  21566. */
  21567. function baseForOwnRight(object, iteratee) {
  21568. return object && baseForRight(object, iteratee, keys);
  21569. }
  21570. /**
  21571. * The base implementation of `_.functions` which creates an array of
  21572. * `object` function property names filtered from `props`.
  21573. *
  21574. * @private
  21575. * @param {Object} object The object to inspect.
  21576. * @param {Array} props The property names to filter.
  21577. * @returns {Array} Returns the function names.
  21578. */
  21579. function baseFunctions(object, props) {
  21580. return arrayFilter(props, function(key) {
  21581. return isFunction(object[key]);
  21582. });
  21583. }
  21584. /**
  21585. * The base implementation of `_.get` without support for default values.
  21586. *
  21587. * @private
  21588. * @param {Object} object The object to query.
  21589. * @param {Array|string} path The path of the property to get.
  21590. * @returns {*} Returns the resolved value.
  21591. */
  21592. function baseGet(object, path) {
  21593. path = castPath(path, object);
  21594. var index = 0,
  21595. length = path.length;
  21596. while (object != null && index < length) {
  21597. object = object[toKey(path[index++])];
  21598. }
  21599. return (index && index == length) ? object : undefined;
  21600. }
  21601. /**
  21602. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  21603. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  21604. * symbols of `object`.
  21605. *
  21606. * @private
  21607. * @param {Object} object The object to query.
  21608. * @param {Function} keysFunc The function to get the keys of `object`.
  21609. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  21610. * @returns {Array} Returns the array of property names and symbols.
  21611. */
  21612. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  21613. var result = keysFunc(object);
  21614. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  21615. }
  21616. /**
  21617. * The base implementation of `getTag` without fallbacks for buggy environments.
  21618. *
  21619. * @private
  21620. * @param {*} value The value to query.
  21621. * @returns {string} Returns the `toStringTag`.
  21622. */
  21623. function baseGetTag(value) {
  21624. if (value == null) {
  21625. return value === undefined ? undefinedTag : nullTag;
  21626. }
  21627. return (symToStringTag && symToStringTag in Object(value))
  21628. ? getRawTag(value)
  21629. : objectToString(value);
  21630. }
  21631. /**
  21632. * The base implementation of `_.gt` which doesn't coerce arguments.
  21633. *
  21634. * @private
  21635. * @param {*} value The value to compare.
  21636. * @param {*} other The other value to compare.
  21637. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  21638. * else `false`.
  21639. */
  21640. function baseGt(value, other) {
  21641. return value > other;
  21642. }
  21643. /**
  21644. * The base implementation of `_.has` without support for deep paths.
  21645. *
  21646. * @private
  21647. * @param {Object} [object] The object to query.
  21648. * @param {Array|string} key The key to check.
  21649. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21650. */
  21651. function baseHas(object, key) {
  21652. return object != null && hasOwnProperty.call(object, key);
  21653. }
  21654. /**
  21655. * The base implementation of `_.hasIn` without support for deep paths.
  21656. *
  21657. * @private
  21658. * @param {Object} [object] The object to query.
  21659. * @param {Array|string} key The key to check.
  21660. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21661. */
  21662. function baseHasIn(object, key) {
  21663. return object != null && key in Object(object);
  21664. }
  21665. /**
  21666. * The base implementation of `_.inRange` which doesn't coerce arguments.
  21667. *
  21668. * @private
  21669. * @param {number} number The number to check.
  21670. * @param {number} start The start of the range.
  21671. * @param {number} end The end of the range.
  21672. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  21673. */
  21674. function baseInRange(number, start, end) {
  21675. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  21676. }
  21677. /**
  21678. * The base implementation of methods like `_.intersection`, without support
  21679. * for iteratee shorthands, that accepts an array of arrays to inspect.
  21680. *
  21681. * @private
  21682. * @param {Array} arrays The arrays to inspect.
  21683. * @param {Function} [iteratee] The iteratee invoked per element.
  21684. * @param {Function} [comparator] The comparator invoked per element.
  21685. * @returns {Array} Returns the new array of shared values.
  21686. */
  21687. function baseIntersection(arrays, iteratee, comparator) {
  21688. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  21689. length = arrays[0].length,
  21690. othLength = arrays.length,
  21691. othIndex = othLength,
  21692. caches = Array(othLength),
  21693. maxLength = Infinity,
  21694. result = [];
  21695. while (othIndex--) {
  21696. var array = arrays[othIndex];
  21697. if (othIndex && iteratee) {
  21698. array = arrayMap(array, baseUnary(iteratee));
  21699. }
  21700. maxLength = nativeMin(array.length, maxLength);
  21701. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  21702. ? new SetCache(othIndex && array)
  21703. : undefined;
  21704. }
  21705. array = arrays[0];
  21706. var index = -1,
  21707. seen = caches[0];
  21708. outer:
  21709. while (++index < length && result.length < maxLength) {
  21710. var value = array[index],
  21711. computed = iteratee ? iteratee(value) : value;
  21712. value = (comparator || value !== 0) ? value : 0;
  21713. if (!(seen
  21714. ? cacheHas(seen, computed)
  21715. : includes(result, computed, comparator)
  21716. )) {
  21717. othIndex = othLength;
  21718. while (--othIndex) {
  21719. var cache = caches[othIndex];
  21720. if (!(cache
  21721. ? cacheHas(cache, computed)
  21722. : includes(arrays[othIndex], computed, comparator))
  21723. ) {
  21724. continue outer;
  21725. }
  21726. }
  21727. if (seen) {
  21728. seen.push(computed);
  21729. }
  21730. result.push(value);
  21731. }
  21732. }
  21733. return result;
  21734. }
  21735. /**
  21736. * The base implementation of `_.invert` and `_.invertBy` which inverts
  21737. * `object` with values transformed by `iteratee` and set by `setter`.
  21738. *
  21739. * @private
  21740. * @param {Object} object The object to iterate over.
  21741. * @param {Function} setter The function to set `accumulator` values.
  21742. * @param {Function} iteratee The iteratee to transform values.
  21743. * @param {Object} accumulator The initial inverted object.
  21744. * @returns {Function} Returns `accumulator`.
  21745. */
  21746. function baseInverter(object, setter, iteratee, accumulator) {
  21747. baseForOwn(object, function(value, key, object) {
  21748. setter(accumulator, iteratee(value), key, object);
  21749. });
  21750. return accumulator;
  21751. }
  21752. /**
  21753. * The base implementation of `_.invoke` without support for individual
  21754. * method arguments.
  21755. *
  21756. * @private
  21757. * @param {Object} object The object to query.
  21758. * @param {Array|string} path The path of the method to invoke.
  21759. * @param {Array} args The arguments to invoke the method with.
  21760. * @returns {*} Returns the result of the invoked method.
  21761. */
  21762. function baseInvoke(object, path, args) {
  21763. path = castPath(path, object);
  21764. object = parent(object, path);
  21765. var func = object == null ? object : object[toKey(last(path))];
  21766. return func == null ? undefined : apply(func, object, args);
  21767. }
  21768. /**
  21769. * The base implementation of `_.isArguments`.
  21770. *
  21771. * @private
  21772. * @param {*} value The value to check.
  21773. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  21774. */
  21775. function baseIsArguments(value) {
  21776. return isObjectLike(value) && baseGetTag(value) == argsTag;
  21777. }
  21778. /**
  21779. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  21780. *
  21781. * @private
  21782. * @param {*} value The value to check.
  21783. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  21784. */
  21785. function baseIsArrayBuffer(value) {
  21786. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  21787. }
  21788. /**
  21789. * The base implementation of `_.isDate` without Node.js optimizations.
  21790. *
  21791. * @private
  21792. * @param {*} value The value to check.
  21793. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  21794. */
  21795. function baseIsDate(value) {
  21796. return isObjectLike(value) && baseGetTag(value) == dateTag;
  21797. }
  21798. /**
  21799. * The base implementation of `_.isEqual` which supports partial comparisons
  21800. * and tracks traversed objects.
  21801. *
  21802. * @private
  21803. * @param {*} value The value to compare.
  21804. * @param {*} other The other value to compare.
  21805. * @param {boolean} bitmask The bitmask flags.
  21806. * 1 - Unordered comparison
  21807. * 2 - Partial comparison
  21808. * @param {Function} [customizer] The function to customize comparisons.
  21809. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  21810. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  21811. */
  21812. function baseIsEqual(value, other, bitmask, customizer, stack) {
  21813. if (value === other) {
  21814. return true;
  21815. }
  21816. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  21817. return value !== value && other !== other;
  21818. }
  21819. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  21820. }
  21821. /**
  21822. * A specialized version of `baseIsEqual` for arrays and objects which performs
  21823. * deep comparisons and tracks traversed objects enabling objects with circular
  21824. * references to be compared.
  21825. *
  21826. * @private
  21827. * @param {Object} object The object to compare.
  21828. * @param {Object} other The other object to compare.
  21829. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  21830. * @param {Function} customizer The function to customize comparisons.
  21831. * @param {Function} equalFunc The function to determine equivalents of values.
  21832. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  21833. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  21834. */
  21835. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  21836. var objIsArr = isArray(object),
  21837. othIsArr = isArray(other),
  21838. objTag = objIsArr ? arrayTag : getTag(object),
  21839. othTag = othIsArr ? arrayTag : getTag(other);
  21840. objTag = objTag == argsTag ? objectTag : objTag;
  21841. othTag = othTag == argsTag ? objectTag : othTag;
  21842. var objIsObj = objTag == objectTag,
  21843. othIsObj = othTag == objectTag,
  21844. isSameTag = objTag == othTag;
  21845. if (isSameTag && isBuffer(object)) {
  21846. if (!isBuffer(other)) {
  21847. return false;
  21848. }
  21849. objIsArr = true;
  21850. objIsObj = false;
  21851. }
  21852. if (isSameTag && !objIsObj) {
  21853. stack || (stack = new Stack);
  21854. return (objIsArr || isTypedArray(object))
  21855. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  21856. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  21857. }
  21858. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  21859. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  21860. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  21861. if (objIsWrapped || othIsWrapped) {
  21862. var objUnwrapped = objIsWrapped ? object.value() : object,
  21863. othUnwrapped = othIsWrapped ? other.value() : other;
  21864. stack || (stack = new Stack);
  21865. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  21866. }
  21867. }
  21868. if (!isSameTag) {
  21869. return false;
  21870. }
  21871. stack || (stack = new Stack);
  21872. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  21873. }
  21874. /**
  21875. * The base implementation of `_.isMap` without Node.js optimizations.
  21876. *
  21877. * @private
  21878. * @param {*} value The value to check.
  21879. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  21880. */
  21881. function baseIsMap(value) {
  21882. return isObjectLike(value) && getTag(value) == mapTag;
  21883. }
  21884. /**
  21885. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  21886. *
  21887. * @private
  21888. * @param {Object} object The object to inspect.
  21889. * @param {Object} source The object of property values to match.
  21890. * @param {Array} matchData The property names, values, and compare flags to match.
  21891. * @param {Function} [customizer] The function to customize comparisons.
  21892. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  21893. */
  21894. function baseIsMatch(object, source, matchData, customizer) {
  21895. var index = matchData.length,
  21896. length = index,
  21897. noCustomizer = !customizer;
  21898. if (object == null) {
  21899. return !length;
  21900. }
  21901. object = Object(object);
  21902. while (index--) {
  21903. var data = matchData[index];
  21904. if ((noCustomizer && data[2])
  21905. ? data[1] !== object[data[0]]
  21906. : !(data[0] in object)
  21907. ) {
  21908. return false;
  21909. }
  21910. }
  21911. while (++index < length) {
  21912. data = matchData[index];
  21913. var key = data[0],
  21914. objValue = object[key],
  21915. srcValue = data[1];
  21916. if (noCustomizer && data[2]) {
  21917. if (objValue === undefined && !(key in object)) {
  21918. return false;
  21919. }
  21920. } else {
  21921. var stack = new Stack;
  21922. if (customizer) {
  21923. var result = customizer(objValue, srcValue, key, object, source, stack);
  21924. }
  21925. if (!(result === undefined
  21926. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  21927. : result
  21928. )) {
  21929. return false;
  21930. }
  21931. }
  21932. }
  21933. return true;
  21934. }
  21935. /**
  21936. * The base implementation of `_.isNative` without bad shim checks.
  21937. *
  21938. * @private
  21939. * @param {*} value The value to check.
  21940. * @returns {boolean} Returns `true` if `value` is a native function,
  21941. * else `false`.
  21942. */
  21943. function baseIsNative(value) {
  21944. if (!isObject(value) || isMasked(value)) {
  21945. return false;
  21946. }
  21947. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  21948. return pattern.test(toSource(value));
  21949. }
  21950. /**
  21951. * The base implementation of `_.isRegExp` without Node.js optimizations.
  21952. *
  21953. * @private
  21954. * @param {*} value The value to check.
  21955. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  21956. */
  21957. function baseIsRegExp(value) {
  21958. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  21959. }
  21960. /**
  21961. * The base implementation of `_.isSet` without Node.js optimizations.
  21962. *
  21963. * @private
  21964. * @param {*} value The value to check.
  21965. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  21966. */
  21967. function baseIsSet(value) {
  21968. return isObjectLike(value) && getTag(value) == setTag;
  21969. }
  21970. /**
  21971. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  21972. *
  21973. * @private
  21974. * @param {*} value The value to check.
  21975. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  21976. */
  21977. function baseIsTypedArray(value) {
  21978. return isObjectLike(value) &&
  21979. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  21980. }
  21981. /**
  21982. * The base implementation of `_.iteratee`.
  21983. *
  21984. * @private
  21985. * @param {*} [value=_.identity] The value to convert to an iteratee.
  21986. * @returns {Function} Returns the iteratee.
  21987. */
  21988. function baseIteratee(value) {
  21989. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  21990. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  21991. if (typeof value == 'function') {
  21992. return value;
  21993. }
  21994. if (value == null) {
  21995. return identity;
  21996. }
  21997. if (typeof value == 'object') {
  21998. return isArray(value)
  21999. ? baseMatchesProperty(value[0], value[1])
  22000. : baseMatches(value);
  22001. }
  22002. return property(value);
  22003. }
  22004. /**
  22005. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  22006. *
  22007. * @private
  22008. * @param {Object} object The object to query.
  22009. * @returns {Array} Returns the array of property names.
  22010. */
  22011. function baseKeys(object) {
  22012. if (!isPrototype(object)) {
  22013. return nativeKeys(object);
  22014. }
  22015. var result = [];
  22016. for (var key in Object(object)) {
  22017. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  22018. result.push(key);
  22019. }
  22020. }
  22021. return result;
  22022. }
  22023. /**
  22024. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  22025. *
  22026. * @private
  22027. * @param {Object} object The object to query.
  22028. * @returns {Array} Returns the array of property names.
  22029. */
  22030. function baseKeysIn(object) {
  22031. if (!isObject(object)) {
  22032. return nativeKeysIn(object);
  22033. }
  22034. var isProto = isPrototype(object),
  22035. result = [];
  22036. for (var key in object) {
  22037. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  22038. result.push(key);
  22039. }
  22040. }
  22041. return result;
  22042. }
  22043. /**
  22044. * The base implementation of `_.lt` which doesn't coerce arguments.
  22045. *
  22046. * @private
  22047. * @param {*} value The value to compare.
  22048. * @param {*} other The other value to compare.
  22049. * @returns {boolean} Returns `true` if `value` is less than `other`,
  22050. * else `false`.
  22051. */
  22052. function baseLt(value, other) {
  22053. return value < other;
  22054. }
  22055. /**
  22056. * The base implementation of `_.map` without support for iteratee shorthands.
  22057. *
  22058. * @private
  22059. * @param {Array|Object} collection The collection to iterate over.
  22060. * @param {Function} iteratee The function invoked per iteration.
  22061. * @returns {Array} Returns the new mapped array.
  22062. */
  22063. function baseMap(collection, iteratee) {
  22064. var index = -1,
  22065. result = isArrayLike(collection) ? Array(collection.length) : [];
  22066. baseEach(collection, function(value, key, collection) {
  22067. result[++index] = iteratee(value, key, collection);
  22068. });
  22069. return result;
  22070. }
  22071. /**
  22072. * The base implementation of `_.matches` which doesn't clone `source`.
  22073. *
  22074. * @private
  22075. * @param {Object} source The object of property values to match.
  22076. * @returns {Function} Returns the new spec function.
  22077. */
  22078. function baseMatches(source) {
  22079. var matchData = getMatchData(source);
  22080. if (matchData.length == 1 && matchData[0][2]) {
  22081. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  22082. }
  22083. return function(object) {
  22084. return object === source || baseIsMatch(object, source, matchData);
  22085. };
  22086. }
  22087. /**
  22088. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  22089. *
  22090. * @private
  22091. * @param {string} path The path of the property to get.
  22092. * @param {*} srcValue The value to match.
  22093. * @returns {Function} Returns the new spec function.
  22094. */
  22095. function baseMatchesProperty(path, srcValue) {
  22096. if (isKey(path) && isStrictComparable(srcValue)) {
  22097. return matchesStrictComparable(toKey(path), srcValue);
  22098. }
  22099. return function(object) {
  22100. var objValue = get(object, path);
  22101. return (objValue === undefined && objValue === srcValue)
  22102. ? hasIn(object, path)
  22103. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  22104. };
  22105. }
  22106. /**
  22107. * The base implementation of `_.merge` without support for multiple sources.
  22108. *
  22109. * @private
  22110. * @param {Object} object The destination object.
  22111. * @param {Object} source The source object.
  22112. * @param {number} srcIndex The index of `source`.
  22113. * @param {Function} [customizer] The function to customize merged values.
  22114. * @param {Object} [stack] Tracks traversed source values and their merged
  22115. * counterparts.
  22116. */
  22117. function baseMerge(object, source, srcIndex, customizer, stack) {
  22118. if (object === source) {
  22119. return;
  22120. }
  22121. baseFor(source, function(srcValue, key) {
  22122. stack || (stack = new Stack);
  22123. if (isObject(srcValue)) {
  22124. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  22125. }
  22126. else {
  22127. var newValue = customizer
  22128. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  22129. : undefined;
  22130. if (newValue === undefined) {
  22131. newValue = srcValue;
  22132. }
  22133. assignMergeValue(object, key, newValue);
  22134. }
  22135. }, keysIn);
  22136. }
  22137. /**
  22138. * A specialized version of `baseMerge` for arrays and objects which performs
  22139. * deep merges and tracks traversed objects enabling objects with circular
  22140. * references to be merged.
  22141. *
  22142. * @private
  22143. * @param {Object} object The destination object.
  22144. * @param {Object} source The source object.
  22145. * @param {string} key The key of the value to merge.
  22146. * @param {number} srcIndex The index of `source`.
  22147. * @param {Function} mergeFunc The function to merge values.
  22148. * @param {Function} [customizer] The function to customize assigned values.
  22149. * @param {Object} [stack] Tracks traversed source values and their merged
  22150. * counterparts.
  22151. */
  22152. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  22153. var objValue = safeGet(object, key),
  22154. srcValue = safeGet(source, key),
  22155. stacked = stack.get(srcValue);
  22156. if (stacked) {
  22157. assignMergeValue(object, key, stacked);
  22158. return;
  22159. }
  22160. var newValue = customizer
  22161. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  22162. : undefined;
  22163. var isCommon = newValue === undefined;
  22164. if (isCommon) {
  22165. var isArr = isArray(srcValue),
  22166. isBuff = !isArr && isBuffer(srcValue),
  22167. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  22168. newValue = srcValue;
  22169. if (isArr || isBuff || isTyped) {
  22170. if (isArray(objValue)) {
  22171. newValue = objValue;
  22172. }
  22173. else if (isArrayLikeObject(objValue)) {
  22174. newValue = copyArray(objValue);
  22175. }
  22176. else if (isBuff) {
  22177. isCommon = false;
  22178. newValue = cloneBuffer(srcValue, true);
  22179. }
  22180. else if (isTyped) {
  22181. isCommon = false;
  22182. newValue = cloneTypedArray(srcValue, true);
  22183. }
  22184. else {
  22185. newValue = [];
  22186. }
  22187. }
  22188. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  22189. newValue = objValue;
  22190. if (isArguments(objValue)) {
  22191. newValue = toPlainObject(objValue);
  22192. }
  22193. else if (!isObject(objValue) || isFunction(objValue)) {
  22194. newValue = initCloneObject(srcValue);
  22195. }
  22196. }
  22197. else {
  22198. isCommon = false;
  22199. }
  22200. }
  22201. if (isCommon) {
  22202. // Recursively merge objects and arrays (susceptible to call stack limits).
  22203. stack.set(srcValue, newValue);
  22204. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  22205. stack['delete'](srcValue);
  22206. }
  22207. assignMergeValue(object, key, newValue);
  22208. }
  22209. /**
  22210. * The base implementation of `_.nth` which doesn't coerce arguments.
  22211. *
  22212. * @private
  22213. * @param {Array} array The array to query.
  22214. * @param {number} n The index of the element to return.
  22215. * @returns {*} Returns the nth element of `array`.
  22216. */
  22217. function baseNth(array, n) {
  22218. var length = array.length;
  22219. if (!length) {
  22220. return;
  22221. }
  22222. n += n < 0 ? length : 0;
  22223. return isIndex(n, length) ? array[n] : undefined;
  22224. }
  22225. /**
  22226. * The base implementation of `_.orderBy` without param guards.
  22227. *
  22228. * @private
  22229. * @param {Array|Object} collection The collection to iterate over.
  22230. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  22231. * @param {string[]} orders The sort orders of `iteratees`.
  22232. * @returns {Array} Returns the new sorted array.
  22233. */
  22234. function baseOrderBy(collection, iteratees, orders) {
  22235. var index = -1;
  22236. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  22237. var result = baseMap(collection, function(value, key, collection) {
  22238. var criteria = arrayMap(iteratees, function(iteratee) {
  22239. return iteratee(value);
  22240. });
  22241. return { 'criteria': criteria, 'index': ++index, 'value': value };
  22242. });
  22243. return baseSortBy(result, function(object, other) {
  22244. return compareMultiple(object, other, orders);
  22245. });
  22246. }
  22247. /**
  22248. * The base implementation of `_.pick` without support for individual
  22249. * property identifiers.
  22250. *
  22251. * @private
  22252. * @param {Object} object The source object.
  22253. * @param {string[]} paths The property paths to pick.
  22254. * @returns {Object} Returns the new object.
  22255. */
  22256. function basePick(object, paths) {
  22257. return basePickBy(object, paths, function(value, path) {
  22258. return hasIn(object, path);
  22259. });
  22260. }
  22261. /**
  22262. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  22263. *
  22264. * @private
  22265. * @param {Object} object The source object.
  22266. * @param {string[]} paths The property paths to pick.
  22267. * @param {Function} predicate The function invoked per property.
  22268. * @returns {Object} Returns the new object.
  22269. */
  22270. function basePickBy(object, paths, predicate) {
  22271. var index = -1,
  22272. length = paths.length,
  22273. result = {};
  22274. while (++index < length) {
  22275. var path = paths[index],
  22276. value = baseGet(object, path);
  22277. if (predicate(value, path)) {
  22278. baseSet(result, castPath(path, object), value);
  22279. }
  22280. }
  22281. return result;
  22282. }
  22283. /**
  22284. * A specialized version of `baseProperty` which supports deep paths.
  22285. *
  22286. * @private
  22287. * @param {Array|string} path The path of the property to get.
  22288. * @returns {Function} Returns the new accessor function.
  22289. */
  22290. function basePropertyDeep(path) {
  22291. return function(object) {
  22292. return baseGet(object, path);
  22293. };
  22294. }
  22295. /**
  22296. * The base implementation of `_.pullAllBy` without support for iteratee
  22297. * shorthands.
  22298. *
  22299. * @private
  22300. * @param {Array} array The array to modify.
  22301. * @param {Array} values The values to remove.
  22302. * @param {Function} [iteratee] The iteratee invoked per element.
  22303. * @param {Function} [comparator] The comparator invoked per element.
  22304. * @returns {Array} Returns `array`.
  22305. */
  22306. function basePullAll(array, values, iteratee, comparator) {
  22307. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  22308. index = -1,
  22309. length = values.length,
  22310. seen = array;
  22311. if (array === values) {
  22312. values = copyArray(values);
  22313. }
  22314. if (iteratee) {
  22315. seen = arrayMap(array, baseUnary(iteratee));
  22316. }
  22317. while (++index < length) {
  22318. var fromIndex = 0,
  22319. value = values[index],
  22320. computed = iteratee ? iteratee(value) : value;
  22321. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  22322. if (seen !== array) {
  22323. splice.call(seen, fromIndex, 1);
  22324. }
  22325. splice.call(array, fromIndex, 1);
  22326. }
  22327. }
  22328. return array;
  22329. }
  22330. /**
  22331. * The base implementation of `_.pullAt` without support for individual
  22332. * indexes or capturing the removed elements.
  22333. *
  22334. * @private
  22335. * @param {Array} array The array to modify.
  22336. * @param {number[]} indexes The indexes of elements to remove.
  22337. * @returns {Array} Returns `array`.
  22338. */
  22339. function basePullAt(array, indexes) {
  22340. var length = array ? indexes.length : 0,
  22341. lastIndex = length - 1;
  22342. while (length--) {
  22343. var index = indexes[length];
  22344. if (length == lastIndex || index !== previous) {
  22345. var previous = index;
  22346. if (isIndex(index)) {
  22347. splice.call(array, index, 1);
  22348. } else {
  22349. baseUnset(array, index);
  22350. }
  22351. }
  22352. }
  22353. return array;
  22354. }
  22355. /**
  22356. * The base implementation of `_.random` without support for returning
  22357. * floating-point numbers.
  22358. *
  22359. * @private
  22360. * @param {number} lower The lower bound.
  22361. * @param {number} upper The upper bound.
  22362. * @returns {number} Returns the random number.
  22363. */
  22364. function baseRandom(lower, upper) {
  22365. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  22366. }
  22367. /**
  22368. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  22369. * coerce arguments.
  22370. *
  22371. * @private
  22372. * @param {number} start The start of the range.
  22373. * @param {number} end The end of the range.
  22374. * @param {number} step The value to increment or decrement by.
  22375. * @param {boolean} [fromRight] Specify iterating from right to left.
  22376. * @returns {Array} Returns the range of numbers.
  22377. */
  22378. function baseRange(start, end, step, fromRight) {
  22379. var index = -1,
  22380. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  22381. result = Array(length);
  22382. while (length--) {
  22383. result[fromRight ? length : ++index] = start;
  22384. start += step;
  22385. }
  22386. return result;
  22387. }
  22388. /**
  22389. * The base implementation of `_.repeat` which doesn't coerce arguments.
  22390. *
  22391. * @private
  22392. * @param {string} string The string to repeat.
  22393. * @param {number} n The number of times to repeat the string.
  22394. * @returns {string} Returns the repeated string.
  22395. */
  22396. function baseRepeat(string, n) {
  22397. var result = '';
  22398. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  22399. return result;
  22400. }
  22401. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  22402. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  22403. do {
  22404. if (n % 2) {
  22405. result += string;
  22406. }
  22407. n = nativeFloor(n / 2);
  22408. if (n) {
  22409. string += string;
  22410. }
  22411. } while (n);
  22412. return result;
  22413. }
  22414. /**
  22415. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  22416. *
  22417. * @private
  22418. * @param {Function} func The function to apply a rest parameter to.
  22419. * @param {number} [start=func.length-1] The start position of the rest parameter.
  22420. * @returns {Function} Returns the new function.
  22421. */
  22422. function baseRest(func, start) {
  22423. return setToString(overRest(func, start, identity), func + '');
  22424. }
  22425. /**
  22426. * The base implementation of `_.sample`.
  22427. *
  22428. * @private
  22429. * @param {Array|Object} collection The collection to sample.
  22430. * @returns {*} Returns the random element.
  22431. */
  22432. function baseSample(collection) {
  22433. return arraySample(values(collection));
  22434. }
  22435. /**
  22436. * The base implementation of `_.sampleSize` without param guards.
  22437. *
  22438. * @private
  22439. * @param {Array|Object} collection The collection to sample.
  22440. * @param {number} n The number of elements to sample.
  22441. * @returns {Array} Returns the random elements.
  22442. */
  22443. function baseSampleSize(collection, n) {
  22444. var array = values(collection);
  22445. return shuffleSelf(array, baseClamp(n, 0, array.length));
  22446. }
  22447. /**
  22448. * The base implementation of `_.set`.
  22449. *
  22450. * @private
  22451. * @param {Object} object The object to modify.
  22452. * @param {Array|string} path The path of the property to set.
  22453. * @param {*} value The value to set.
  22454. * @param {Function} [customizer] The function to customize path creation.
  22455. * @returns {Object} Returns `object`.
  22456. */
  22457. function baseSet(object, path, value, customizer) {
  22458. if (!isObject(object)) {
  22459. return object;
  22460. }
  22461. path = castPath(path, object);
  22462. var index = -1,
  22463. length = path.length,
  22464. lastIndex = length - 1,
  22465. nested = object;
  22466. while (nested != null && ++index < length) {
  22467. var key = toKey(path[index]),
  22468. newValue = value;
  22469. if (index != lastIndex) {
  22470. var objValue = nested[key];
  22471. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  22472. if (newValue === undefined) {
  22473. newValue = isObject(objValue)
  22474. ? objValue
  22475. : (isIndex(path[index + 1]) ? [] : {});
  22476. }
  22477. }
  22478. assignValue(nested, key, newValue);
  22479. nested = nested[key];
  22480. }
  22481. return object;
  22482. }
  22483. /**
  22484. * The base implementation of `setData` without support for hot loop shorting.
  22485. *
  22486. * @private
  22487. * @param {Function} func The function to associate metadata with.
  22488. * @param {*} data The metadata.
  22489. * @returns {Function} Returns `func`.
  22490. */
  22491. var baseSetData = !metaMap ? identity : function(func, data) {
  22492. metaMap.set(func, data);
  22493. return func;
  22494. };
  22495. /**
  22496. * The base implementation of `setToString` without support for hot loop shorting.
  22497. *
  22498. * @private
  22499. * @param {Function} func The function to modify.
  22500. * @param {Function} string The `toString` result.
  22501. * @returns {Function} Returns `func`.
  22502. */
  22503. var baseSetToString = !defineProperty ? identity : function(func, string) {
  22504. return defineProperty(func, 'toString', {
  22505. 'configurable': true,
  22506. 'enumerable': false,
  22507. 'value': constant(string),
  22508. 'writable': true
  22509. });
  22510. };
  22511. /**
  22512. * The base implementation of `_.shuffle`.
  22513. *
  22514. * @private
  22515. * @param {Array|Object} collection The collection to shuffle.
  22516. * @returns {Array} Returns the new shuffled array.
  22517. */
  22518. function baseShuffle(collection) {
  22519. return shuffleSelf(values(collection));
  22520. }
  22521. /**
  22522. * The base implementation of `_.slice` without an iteratee call guard.
  22523. *
  22524. * @private
  22525. * @param {Array} array The array to slice.
  22526. * @param {number} [start=0] The start position.
  22527. * @param {number} [end=array.length] The end position.
  22528. * @returns {Array} Returns the slice of `array`.
  22529. */
  22530. function baseSlice(array, start, end) {
  22531. var index = -1,
  22532. length = array.length;
  22533. if (start < 0) {
  22534. start = -start > length ? 0 : (length + start);
  22535. }
  22536. end = end > length ? length : end;
  22537. if (end < 0) {
  22538. end += length;
  22539. }
  22540. length = start > end ? 0 : ((end - start) >>> 0);
  22541. start >>>= 0;
  22542. var result = Array(length);
  22543. while (++index < length) {
  22544. result[index] = array[index + start];
  22545. }
  22546. return result;
  22547. }
  22548. /**
  22549. * The base implementation of `_.some` without support for iteratee shorthands.
  22550. *
  22551. * @private
  22552. * @param {Array|Object} collection The collection to iterate over.
  22553. * @param {Function} predicate The function invoked per iteration.
  22554. * @returns {boolean} Returns `true` if any element passes the predicate check,
  22555. * else `false`.
  22556. */
  22557. function baseSome(collection, predicate) {
  22558. var result;
  22559. baseEach(collection, function(value, index, collection) {
  22560. result = predicate(value, index, collection);
  22561. return !result;
  22562. });
  22563. return !!result;
  22564. }
  22565. /**
  22566. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  22567. * performs a binary search of `array` to determine the index at which `value`
  22568. * should be inserted into `array` in order to maintain its sort order.
  22569. *
  22570. * @private
  22571. * @param {Array} array The sorted array to inspect.
  22572. * @param {*} value The value to evaluate.
  22573. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22574. * @returns {number} Returns the index at which `value` should be inserted
  22575. * into `array`.
  22576. */
  22577. function baseSortedIndex(array, value, retHighest) {
  22578. var low = 0,
  22579. high = array == null ? low : array.length;
  22580. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  22581. while (low < high) {
  22582. var mid = (low + high) >>> 1,
  22583. computed = array[mid];
  22584. if (computed !== null && !isSymbol(computed) &&
  22585. (retHighest ? (computed <= value) : (computed < value))) {
  22586. low = mid + 1;
  22587. } else {
  22588. high = mid;
  22589. }
  22590. }
  22591. return high;
  22592. }
  22593. return baseSortedIndexBy(array, value, identity, retHighest);
  22594. }
  22595. /**
  22596. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  22597. * which invokes `iteratee` for `value` and each element of `array` to compute
  22598. * their sort ranking. The iteratee is invoked with one argument; (value).
  22599. *
  22600. * @private
  22601. * @param {Array} array The sorted array to inspect.
  22602. * @param {*} value The value to evaluate.
  22603. * @param {Function} iteratee The iteratee invoked per element.
  22604. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22605. * @returns {number} Returns the index at which `value` should be inserted
  22606. * into `array`.
  22607. */
  22608. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  22609. value = iteratee(value);
  22610. var low = 0,
  22611. high = array == null ? 0 : array.length,
  22612. valIsNaN = value !== value,
  22613. valIsNull = value === null,
  22614. valIsSymbol = isSymbol(value),
  22615. valIsUndefined = value === undefined;
  22616. while (low < high) {
  22617. var mid = nativeFloor((low + high) / 2),
  22618. computed = iteratee(array[mid]),
  22619. othIsDefined = computed !== undefined,
  22620. othIsNull = computed === null,
  22621. othIsReflexive = computed === computed,
  22622. othIsSymbol = isSymbol(computed);
  22623. if (valIsNaN) {
  22624. var setLow = retHighest || othIsReflexive;
  22625. } else if (valIsUndefined) {
  22626. setLow = othIsReflexive && (retHighest || othIsDefined);
  22627. } else if (valIsNull) {
  22628. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  22629. } else if (valIsSymbol) {
  22630. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  22631. } else if (othIsNull || othIsSymbol) {
  22632. setLow = false;
  22633. } else {
  22634. setLow = retHighest ? (computed <= value) : (computed < value);
  22635. }
  22636. if (setLow) {
  22637. low = mid + 1;
  22638. } else {
  22639. high = mid;
  22640. }
  22641. }
  22642. return nativeMin(high, MAX_ARRAY_INDEX);
  22643. }
  22644. /**
  22645. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  22646. * support for iteratee shorthands.
  22647. *
  22648. * @private
  22649. * @param {Array} array The array to inspect.
  22650. * @param {Function} [iteratee] The iteratee invoked per element.
  22651. * @returns {Array} Returns the new duplicate free array.
  22652. */
  22653. function baseSortedUniq(array, iteratee) {
  22654. var index = -1,
  22655. length = array.length,
  22656. resIndex = 0,
  22657. result = [];
  22658. while (++index < length) {
  22659. var value = array[index],
  22660. computed = iteratee ? iteratee(value) : value;
  22661. if (!index || !eq(computed, seen)) {
  22662. var seen = computed;
  22663. result[resIndex++] = value === 0 ? 0 : value;
  22664. }
  22665. }
  22666. return result;
  22667. }
  22668. /**
  22669. * The base implementation of `_.toNumber` which doesn't ensure correct
  22670. * conversions of binary, hexadecimal, or octal string values.
  22671. *
  22672. * @private
  22673. * @param {*} value The value to process.
  22674. * @returns {number} Returns the number.
  22675. */
  22676. function baseToNumber(value) {
  22677. if (typeof value == 'number') {
  22678. return value;
  22679. }
  22680. if (isSymbol(value)) {
  22681. return NAN;
  22682. }
  22683. return +value;
  22684. }
  22685. /**
  22686. * The base implementation of `_.toString` which doesn't convert nullish
  22687. * values to empty strings.
  22688. *
  22689. * @private
  22690. * @param {*} value The value to process.
  22691. * @returns {string} Returns the string.
  22692. */
  22693. function baseToString(value) {
  22694. // Exit early for strings to avoid a performance hit in some environments.
  22695. if (typeof value == 'string') {
  22696. return value;
  22697. }
  22698. if (isArray(value)) {
  22699. // Recursively convert values (susceptible to call stack limits).
  22700. return arrayMap(value, baseToString) + '';
  22701. }
  22702. if (isSymbol(value)) {
  22703. return symbolToString ? symbolToString.call(value) : '';
  22704. }
  22705. var result = (value + '');
  22706. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  22707. }
  22708. /**
  22709. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  22710. *
  22711. * @private
  22712. * @param {Array} array The array to inspect.
  22713. * @param {Function} [iteratee] The iteratee invoked per element.
  22714. * @param {Function} [comparator] The comparator invoked per element.
  22715. * @returns {Array} Returns the new duplicate free array.
  22716. */
  22717. function baseUniq(array, iteratee, comparator) {
  22718. var index = -1,
  22719. includes = arrayIncludes,
  22720. length = array.length,
  22721. isCommon = true,
  22722. result = [],
  22723. seen = result;
  22724. if (comparator) {
  22725. isCommon = false;
  22726. includes = arrayIncludesWith;
  22727. }
  22728. else if (length >= LARGE_ARRAY_SIZE) {
  22729. var set = iteratee ? null : createSet(array);
  22730. if (set) {
  22731. return setToArray(set);
  22732. }
  22733. isCommon = false;
  22734. includes = cacheHas;
  22735. seen = new SetCache;
  22736. }
  22737. else {
  22738. seen = iteratee ? [] : result;
  22739. }
  22740. outer:
  22741. while (++index < length) {
  22742. var value = array[index],
  22743. computed = iteratee ? iteratee(value) : value;
  22744. value = (comparator || value !== 0) ? value : 0;
  22745. if (isCommon && computed === computed) {
  22746. var seenIndex = seen.length;
  22747. while (seenIndex--) {
  22748. if (seen[seenIndex] === computed) {
  22749. continue outer;
  22750. }
  22751. }
  22752. if (iteratee) {
  22753. seen.push(computed);
  22754. }
  22755. result.push(value);
  22756. }
  22757. else if (!includes(seen, computed, comparator)) {
  22758. if (seen !== result) {
  22759. seen.push(computed);
  22760. }
  22761. result.push(value);
  22762. }
  22763. }
  22764. return result;
  22765. }
  22766. /**
  22767. * The base implementation of `_.unset`.
  22768. *
  22769. * @private
  22770. * @param {Object} object The object to modify.
  22771. * @param {Array|string} path The property path to unset.
  22772. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  22773. */
  22774. function baseUnset(object, path) {
  22775. path = castPath(path, object);
  22776. object = parent(object, path);
  22777. return object == null || delete object[toKey(last(path))];
  22778. }
  22779. /**
  22780. * The base implementation of `_.update`.
  22781. *
  22782. * @private
  22783. * @param {Object} object The object to modify.
  22784. * @param {Array|string} path The path of the property to update.
  22785. * @param {Function} updater The function to produce the updated value.
  22786. * @param {Function} [customizer] The function to customize path creation.
  22787. * @returns {Object} Returns `object`.
  22788. */
  22789. function baseUpdate(object, path, updater, customizer) {
  22790. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  22791. }
  22792. /**
  22793. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  22794. * without support for iteratee shorthands.
  22795. *
  22796. * @private
  22797. * @param {Array} array The array to query.
  22798. * @param {Function} predicate The function invoked per iteration.
  22799. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  22800. * @param {boolean} [fromRight] Specify iterating from right to left.
  22801. * @returns {Array} Returns the slice of `array`.
  22802. */
  22803. function baseWhile(array, predicate, isDrop, fromRight) {
  22804. var length = array.length,
  22805. index = fromRight ? length : -1;
  22806. while ((fromRight ? index-- : ++index < length) &&
  22807. predicate(array[index], index, array)) {}
  22808. return isDrop
  22809. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  22810. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  22811. }
  22812. /**
  22813. * The base implementation of `wrapperValue` which returns the result of
  22814. * performing a sequence of actions on the unwrapped `value`, where each
  22815. * successive action is supplied the return value of the previous.
  22816. *
  22817. * @private
  22818. * @param {*} value The unwrapped value.
  22819. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  22820. * @returns {*} Returns the resolved value.
  22821. */
  22822. function baseWrapperValue(value, actions) {
  22823. var result = value;
  22824. if (result instanceof LazyWrapper) {
  22825. result = result.value();
  22826. }
  22827. return arrayReduce(actions, function(result, action) {
  22828. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  22829. }, result);
  22830. }
  22831. /**
  22832. * The base implementation of methods like `_.xor`, without support for
  22833. * iteratee shorthands, that accepts an array of arrays to inspect.
  22834. *
  22835. * @private
  22836. * @param {Array} arrays The arrays to inspect.
  22837. * @param {Function} [iteratee] The iteratee invoked per element.
  22838. * @param {Function} [comparator] The comparator invoked per element.
  22839. * @returns {Array} Returns the new array of values.
  22840. */
  22841. function baseXor(arrays, iteratee, comparator) {
  22842. var length = arrays.length;
  22843. if (length < 2) {
  22844. return length ? baseUniq(arrays[0]) : [];
  22845. }
  22846. var index = -1,
  22847. result = Array(length);
  22848. while (++index < length) {
  22849. var array = arrays[index],
  22850. othIndex = -1;
  22851. while (++othIndex < length) {
  22852. if (othIndex != index) {
  22853. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  22854. }
  22855. }
  22856. }
  22857. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  22858. }
  22859. /**
  22860. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  22861. *
  22862. * @private
  22863. * @param {Array} props The property identifiers.
  22864. * @param {Array} values The property values.
  22865. * @param {Function} assignFunc The function to assign values.
  22866. * @returns {Object} Returns the new object.
  22867. */
  22868. function baseZipObject(props, values, assignFunc) {
  22869. var index = -1,
  22870. length = props.length,
  22871. valsLength = values.length,
  22872. result = {};
  22873. while (++index < length) {
  22874. var value = index < valsLength ? values[index] : undefined;
  22875. assignFunc(result, props[index], value);
  22876. }
  22877. return result;
  22878. }
  22879. /**
  22880. * Casts `value` to an empty array if it's not an array like object.
  22881. *
  22882. * @private
  22883. * @param {*} value The value to inspect.
  22884. * @returns {Array|Object} Returns the cast array-like object.
  22885. */
  22886. function castArrayLikeObject(value) {
  22887. return isArrayLikeObject(value) ? value : [];
  22888. }
  22889. /**
  22890. * Casts `value` to `identity` if it's not a function.
  22891. *
  22892. * @private
  22893. * @param {*} value The value to inspect.
  22894. * @returns {Function} Returns cast function.
  22895. */
  22896. function castFunction(value) {
  22897. return typeof value == 'function' ? value : identity;
  22898. }
  22899. /**
  22900. * Casts `value` to a path array if it's not one.
  22901. *
  22902. * @private
  22903. * @param {*} value The value to inspect.
  22904. * @param {Object} [object] The object to query keys on.
  22905. * @returns {Array} Returns the cast property path array.
  22906. */
  22907. function castPath(value, object) {
  22908. if (isArray(value)) {
  22909. return value;
  22910. }
  22911. return isKey(value, object) ? [value] : stringToPath(toString(value));
  22912. }
  22913. /**
  22914. * A `baseRest` alias which can be replaced with `identity` by module
  22915. * replacement plugins.
  22916. *
  22917. * @private
  22918. * @type {Function}
  22919. * @param {Function} func The function to apply a rest parameter to.
  22920. * @returns {Function} Returns the new function.
  22921. */
  22922. var castRest = baseRest;
  22923. /**
  22924. * Casts `array` to a slice if it's needed.
  22925. *
  22926. * @private
  22927. * @param {Array} array The array to inspect.
  22928. * @param {number} start The start position.
  22929. * @param {number} [end=array.length] The end position.
  22930. * @returns {Array} Returns the cast slice.
  22931. */
  22932. function castSlice(array, start, end) {
  22933. var length = array.length;
  22934. end = end === undefined ? length : end;
  22935. return (!start && end >= length) ? array : baseSlice(array, start, end);
  22936. }
  22937. /**
  22938. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  22939. *
  22940. * @private
  22941. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  22942. */
  22943. var clearTimeout = ctxClearTimeout || function(id) {
  22944. return root.clearTimeout(id);
  22945. };
  22946. /**
  22947. * Creates a clone of `buffer`.
  22948. *
  22949. * @private
  22950. * @param {Buffer} buffer The buffer to clone.
  22951. * @param {boolean} [isDeep] Specify a deep clone.
  22952. * @returns {Buffer} Returns the cloned buffer.
  22953. */
  22954. function cloneBuffer(buffer, isDeep) {
  22955. if (isDeep) {
  22956. return buffer.slice();
  22957. }
  22958. var length = buffer.length,
  22959. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  22960. buffer.copy(result);
  22961. return result;
  22962. }
  22963. /**
  22964. * Creates a clone of `arrayBuffer`.
  22965. *
  22966. * @private
  22967. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  22968. * @returns {ArrayBuffer} Returns the cloned array buffer.
  22969. */
  22970. function cloneArrayBuffer(arrayBuffer) {
  22971. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  22972. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  22973. return result;
  22974. }
  22975. /**
  22976. * Creates a clone of `dataView`.
  22977. *
  22978. * @private
  22979. * @param {Object} dataView The data view to clone.
  22980. * @param {boolean} [isDeep] Specify a deep clone.
  22981. * @returns {Object} Returns the cloned data view.
  22982. */
  22983. function cloneDataView(dataView, isDeep) {
  22984. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  22985. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  22986. }
  22987. /**
  22988. * Creates a clone of `regexp`.
  22989. *
  22990. * @private
  22991. * @param {Object} regexp The regexp to clone.
  22992. * @returns {Object} Returns the cloned regexp.
  22993. */
  22994. function cloneRegExp(regexp) {
  22995. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  22996. result.lastIndex = regexp.lastIndex;
  22997. return result;
  22998. }
  22999. /**
  23000. * Creates a clone of the `symbol` object.
  23001. *
  23002. * @private
  23003. * @param {Object} symbol The symbol object to clone.
  23004. * @returns {Object} Returns the cloned symbol object.
  23005. */
  23006. function cloneSymbol(symbol) {
  23007. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  23008. }
  23009. /**
  23010. * Creates a clone of `typedArray`.
  23011. *
  23012. * @private
  23013. * @param {Object} typedArray The typed array to clone.
  23014. * @param {boolean} [isDeep] Specify a deep clone.
  23015. * @returns {Object} Returns the cloned typed array.
  23016. */
  23017. function cloneTypedArray(typedArray, isDeep) {
  23018. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  23019. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  23020. }
  23021. /**
  23022. * Compares values to sort them in ascending order.
  23023. *
  23024. * @private
  23025. * @param {*} value The value to compare.
  23026. * @param {*} other The other value to compare.
  23027. * @returns {number} Returns the sort order indicator for `value`.
  23028. */
  23029. function compareAscending(value, other) {
  23030. if (value !== other) {
  23031. var valIsDefined = value !== undefined,
  23032. valIsNull = value === null,
  23033. valIsReflexive = value === value,
  23034. valIsSymbol = isSymbol(value);
  23035. var othIsDefined = other !== undefined,
  23036. othIsNull = other === null,
  23037. othIsReflexive = other === other,
  23038. othIsSymbol = isSymbol(other);
  23039. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  23040. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  23041. (valIsNull && othIsDefined && othIsReflexive) ||
  23042. (!valIsDefined && othIsReflexive) ||
  23043. !valIsReflexive) {
  23044. return 1;
  23045. }
  23046. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  23047. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  23048. (othIsNull && valIsDefined && valIsReflexive) ||
  23049. (!othIsDefined && valIsReflexive) ||
  23050. !othIsReflexive) {
  23051. return -1;
  23052. }
  23053. }
  23054. return 0;
  23055. }
  23056. /**
  23057. * Used by `_.orderBy` to compare multiple properties of a value to another
  23058. * and stable sort them.
  23059. *
  23060. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  23061. * specify an order of "desc" for descending or "asc" for ascending sort order
  23062. * of corresponding values.
  23063. *
  23064. * @private
  23065. * @param {Object} object The object to compare.
  23066. * @param {Object} other The other object to compare.
  23067. * @param {boolean[]|string[]} orders The order to sort by for each property.
  23068. * @returns {number} Returns the sort order indicator for `object`.
  23069. */
  23070. function compareMultiple(object, other, orders) {
  23071. var index = -1,
  23072. objCriteria = object.criteria,
  23073. othCriteria = other.criteria,
  23074. length = objCriteria.length,
  23075. ordersLength = orders.length;
  23076. while (++index < length) {
  23077. var result = compareAscending(objCriteria[index], othCriteria[index]);
  23078. if (result) {
  23079. if (index >= ordersLength) {
  23080. return result;
  23081. }
  23082. var order = orders[index];
  23083. return result * (order == 'desc' ? -1 : 1);
  23084. }
  23085. }
  23086. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  23087. // that causes it, under certain circumstances, to provide the same value for
  23088. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  23089. // for more details.
  23090. //
  23091. // This also ensures a stable sort in V8 and other engines.
  23092. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  23093. return object.index - other.index;
  23094. }
  23095. /**
  23096. * Creates an array that is the composition of partially applied arguments,
  23097. * placeholders, and provided arguments into a single array of arguments.
  23098. *
  23099. * @private
  23100. * @param {Array} args The provided arguments.
  23101. * @param {Array} partials The arguments to prepend to those provided.
  23102. * @param {Array} holders The `partials` placeholder indexes.
  23103. * @params {boolean} [isCurried] Specify composing for a curried function.
  23104. * @returns {Array} Returns the new array of composed arguments.
  23105. */
  23106. function composeArgs(args, partials, holders, isCurried) {
  23107. var argsIndex = -1,
  23108. argsLength = args.length,
  23109. holdersLength = holders.length,
  23110. leftIndex = -1,
  23111. leftLength = partials.length,
  23112. rangeLength = nativeMax(argsLength - holdersLength, 0),
  23113. result = Array(leftLength + rangeLength),
  23114. isUncurried = !isCurried;
  23115. while (++leftIndex < leftLength) {
  23116. result[leftIndex] = partials[leftIndex];
  23117. }
  23118. while (++argsIndex < holdersLength) {
  23119. if (isUncurried || argsIndex < argsLength) {
  23120. result[holders[argsIndex]] = args[argsIndex];
  23121. }
  23122. }
  23123. while (rangeLength--) {
  23124. result[leftIndex++] = args[argsIndex++];
  23125. }
  23126. return result;
  23127. }
  23128. /**
  23129. * This function is like `composeArgs` except that the arguments composition
  23130. * is tailored for `_.partialRight`.
  23131. *
  23132. * @private
  23133. * @param {Array} args The provided arguments.
  23134. * @param {Array} partials The arguments to append to those provided.
  23135. * @param {Array} holders The `partials` placeholder indexes.
  23136. * @params {boolean} [isCurried] Specify composing for a curried function.
  23137. * @returns {Array} Returns the new array of composed arguments.
  23138. */
  23139. function composeArgsRight(args, partials, holders, isCurried) {
  23140. var argsIndex = -1,
  23141. argsLength = args.length,
  23142. holdersIndex = -1,
  23143. holdersLength = holders.length,
  23144. rightIndex = -1,
  23145. rightLength = partials.length,
  23146. rangeLength = nativeMax(argsLength - holdersLength, 0),
  23147. result = Array(rangeLength + rightLength),
  23148. isUncurried = !isCurried;
  23149. while (++argsIndex < rangeLength) {
  23150. result[argsIndex] = args[argsIndex];
  23151. }
  23152. var offset = argsIndex;
  23153. while (++rightIndex < rightLength) {
  23154. result[offset + rightIndex] = partials[rightIndex];
  23155. }
  23156. while (++holdersIndex < holdersLength) {
  23157. if (isUncurried || argsIndex < argsLength) {
  23158. result[offset + holders[holdersIndex]] = args[argsIndex++];
  23159. }
  23160. }
  23161. return result;
  23162. }
  23163. /**
  23164. * Copies the values of `source` to `array`.
  23165. *
  23166. * @private
  23167. * @param {Array} source The array to copy values from.
  23168. * @param {Array} [array=[]] The array to copy values to.
  23169. * @returns {Array} Returns `array`.
  23170. */
  23171. function copyArray(source, array) {
  23172. var index = -1,
  23173. length = source.length;
  23174. array || (array = Array(length));
  23175. while (++index < length) {
  23176. array[index] = source[index];
  23177. }
  23178. return array;
  23179. }
  23180. /**
  23181. * Copies properties of `source` to `object`.
  23182. *
  23183. * @private
  23184. * @param {Object} source The object to copy properties from.
  23185. * @param {Array} props The property identifiers to copy.
  23186. * @param {Object} [object={}] The object to copy properties to.
  23187. * @param {Function} [customizer] The function to customize copied values.
  23188. * @returns {Object} Returns `object`.
  23189. */
  23190. function copyObject(source, props, object, customizer) {
  23191. var isNew = !object;
  23192. object || (object = {});
  23193. var index = -1,
  23194. length = props.length;
  23195. while (++index < length) {
  23196. var key = props[index];
  23197. var newValue = customizer
  23198. ? customizer(object[key], source[key], key, object, source)
  23199. : undefined;
  23200. if (newValue === undefined) {
  23201. newValue = source[key];
  23202. }
  23203. if (isNew) {
  23204. baseAssignValue(object, key, newValue);
  23205. } else {
  23206. assignValue(object, key, newValue);
  23207. }
  23208. }
  23209. return object;
  23210. }
  23211. /**
  23212. * Copies own symbols of `source` to `object`.
  23213. *
  23214. * @private
  23215. * @param {Object} source The object to copy symbols from.
  23216. * @param {Object} [object={}] The object to copy symbols to.
  23217. * @returns {Object} Returns `object`.
  23218. */
  23219. function copySymbols(source, object) {
  23220. return copyObject(source, getSymbols(source), object);
  23221. }
  23222. /**
  23223. * Copies own and inherited symbols of `source` to `object`.
  23224. *
  23225. * @private
  23226. * @param {Object} source The object to copy symbols from.
  23227. * @param {Object} [object={}] The object to copy symbols to.
  23228. * @returns {Object} Returns `object`.
  23229. */
  23230. function copySymbolsIn(source, object) {
  23231. return copyObject(source, getSymbolsIn(source), object);
  23232. }
  23233. /**
  23234. * Creates a function like `_.groupBy`.
  23235. *
  23236. * @private
  23237. * @param {Function} setter The function to set accumulator values.
  23238. * @param {Function} [initializer] The accumulator object initializer.
  23239. * @returns {Function} Returns the new aggregator function.
  23240. */
  23241. function createAggregator(setter, initializer) {
  23242. return function(collection, iteratee) {
  23243. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  23244. accumulator = initializer ? initializer() : {};
  23245. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  23246. };
  23247. }
  23248. /**
  23249. * Creates a function like `_.assign`.
  23250. *
  23251. * @private
  23252. * @param {Function} assigner The function to assign values.
  23253. * @returns {Function} Returns the new assigner function.
  23254. */
  23255. function createAssigner(assigner) {
  23256. return baseRest(function(object, sources) {
  23257. var index = -1,
  23258. length = sources.length,
  23259. customizer = length > 1 ? sources[length - 1] : undefined,
  23260. guard = length > 2 ? sources[2] : undefined;
  23261. customizer = (assigner.length > 3 && typeof customizer == 'function')
  23262. ? (length--, customizer)
  23263. : undefined;
  23264. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  23265. customizer = length < 3 ? undefined : customizer;
  23266. length = 1;
  23267. }
  23268. object = Object(object);
  23269. while (++index < length) {
  23270. var source = sources[index];
  23271. if (source) {
  23272. assigner(object, source, index, customizer);
  23273. }
  23274. }
  23275. return object;
  23276. });
  23277. }
  23278. /**
  23279. * Creates a `baseEach` or `baseEachRight` function.
  23280. *
  23281. * @private
  23282. * @param {Function} eachFunc The function to iterate over a collection.
  23283. * @param {boolean} [fromRight] Specify iterating from right to left.
  23284. * @returns {Function} Returns the new base function.
  23285. */
  23286. function createBaseEach(eachFunc, fromRight) {
  23287. return function(collection, iteratee) {
  23288. if (collection == null) {
  23289. return collection;
  23290. }
  23291. if (!isArrayLike(collection)) {
  23292. return eachFunc(collection, iteratee);
  23293. }
  23294. var length = collection.length,
  23295. index = fromRight ? length : -1,
  23296. iterable = Object(collection);
  23297. while ((fromRight ? index-- : ++index < length)) {
  23298. if (iteratee(iterable[index], index, iterable) === false) {
  23299. break;
  23300. }
  23301. }
  23302. return collection;
  23303. };
  23304. }
  23305. /**
  23306. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  23307. *
  23308. * @private
  23309. * @param {boolean} [fromRight] Specify iterating from right to left.
  23310. * @returns {Function} Returns the new base function.
  23311. */
  23312. function createBaseFor(fromRight) {
  23313. return function(object, iteratee, keysFunc) {
  23314. var index = -1,
  23315. iterable = Object(object),
  23316. props = keysFunc(object),
  23317. length = props.length;
  23318. while (length--) {
  23319. var key = props[fromRight ? length : ++index];
  23320. if (iteratee(iterable[key], key, iterable) === false) {
  23321. break;
  23322. }
  23323. }
  23324. return object;
  23325. };
  23326. }
  23327. /**
  23328. * Creates a function that wraps `func` to invoke it with the optional `this`
  23329. * binding of `thisArg`.
  23330. *
  23331. * @private
  23332. * @param {Function} func The function to wrap.
  23333. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23334. * @param {*} [thisArg] The `this` binding of `func`.
  23335. * @returns {Function} Returns the new wrapped function.
  23336. */
  23337. function createBind(func, bitmask, thisArg) {
  23338. var isBind = bitmask & WRAP_BIND_FLAG,
  23339. Ctor = createCtor(func);
  23340. function wrapper() {
  23341. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23342. return fn.apply(isBind ? thisArg : this, arguments);
  23343. }
  23344. return wrapper;
  23345. }
  23346. /**
  23347. * Creates a function like `_.lowerFirst`.
  23348. *
  23349. * @private
  23350. * @param {string} methodName The name of the `String` case method to use.
  23351. * @returns {Function} Returns the new case function.
  23352. */
  23353. function createCaseFirst(methodName) {
  23354. return function(string) {
  23355. string = toString(string);
  23356. var strSymbols = hasUnicode(string)
  23357. ? stringToArray(string)
  23358. : undefined;
  23359. var chr = strSymbols
  23360. ? strSymbols[0]
  23361. : string.charAt(0);
  23362. var trailing = strSymbols
  23363. ? castSlice(strSymbols, 1).join('')
  23364. : string.slice(1);
  23365. return chr[methodName]() + trailing;
  23366. };
  23367. }
  23368. /**
  23369. * Creates a function like `_.camelCase`.
  23370. *
  23371. * @private
  23372. * @param {Function} callback The function to combine each word.
  23373. * @returns {Function} Returns the new compounder function.
  23374. */
  23375. function createCompounder(callback) {
  23376. return function(string) {
  23377. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  23378. };
  23379. }
  23380. /**
  23381. * Creates a function that produces an instance of `Ctor` regardless of
  23382. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  23383. *
  23384. * @private
  23385. * @param {Function} Ctor The constructor to wrap.
  23386. * @returns {Function} Returns the new wrapped function.
  23387. */
  23388. function createCtor(Ctor) {
  23389. return function() {
  23390. // Use a `switch` statement to work with class constructors. See
  23391. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  23392. // for more details.
  23393. var args = arguments;
  23394. switch (args.length) {
  23395. case 0: return new Ctor;
  23396. case 1: return new Ctor(args[0]);
  23397. case 2: return new Ctor(args[0], args[1]);
  23398. case 3: return new Ctor(args[0], args[1], args[2]);
  23399. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  23400. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  23401. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  23402. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  23403. }
  23404. var thisBinding = baseCreate(Ctor.prototype),
  23405. result = Ctor.apply(thisBinding, args);
  23406. // Mimic the constructor's `return` behavior.
  23407. // See https://es5.github.io/#x13.2.2 for more details.
  23408. return isObject(result) ? result : thisBinding;
  23409. };
  23410. }
  23411. /**
  23412. * Creates a function that wraps `func` to enable currying.
  23413. *
  23414. * @private
  23415. * @param {Function} func The function to wrap.
  23416. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23417. * @param {number} arity The arity of `func`.
  23418. * @returns {Function} Returns the new wrapped function.
  23419. */
  23420. function createCurry(func, bitmask, arity) {
  23421. var Ctor = createCtor(func);
  23422. function wrapper() {
  23423. var length = arguments.length,
  23424. args = Array(length),
  23425. index = length,
  23426. placeholder = getHolder(wrapper);
  23427. while (index--) {
  23428. args[index] = arguments[index];
  23429. }
  23430. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  23431. ? []
  23432. : replaceHolders(args, placeholder);
  23433. length -= holders.length;
  23434. if (length < arity) {
  23435. return createRecurry(
  23436. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  23437. args, holders, undefined, undefined, arity - length);
  23438. }
  23439. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23440. return apply(fn, this, args);
  23441. }
  23442. return wrapper;
  23443. }
  23444. /**
  23445. * Creates a `_.find` or `_.findLast` function.
  23446. *
  23447. * @private
  23448. * @param {Function} findIndexFunc The function to find the collection index.
  23449. * @returns {Function} Returns the new find function.
  23450. */
  23451. function createFind(findIndexFunc) {
  23452. return function(collection, predicate, fromIndex) {
  23453. var iterable = Object(collection);
  23454. if (!isArrayLike(collection)) {
  23455. var iteratee = getIteratee(predicate, 3);
  23456. collection = keys(collection);
  23457. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  23458. }
  23459. var index = findIndexFunc(collection, predicate, fromIndex);
  23460. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  23461. };
  23462. }
  23463. /**
  23464. * Creates a `_.flow` or `_.flowRight` function.
  23465. *
  23466. * @private
  23467. * @param {boolean} [fromRight] Specify iterating from right to left.
  23468. * @returns {Function} Returns the new flow function.
  23469. */
  23470. function createFlow(fromRight) {
  23471. return flatRest(function(funcs) {
  23472. var length = funcs.length,
  23473. index = length,
  23474. prereq = LodashWrapper.prototype.thru;
  23475. if (fromRight) {
  23476. funcs.reverse();
  23477. }
  23478. while (index--) {
  23479. var func = funcs[index];
  23480. if (typeof func != 'function') {
  23481. throw new TypeError(FUNC_ERROR_TEXT);
  23482. }
  23483. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  23484. var wrapper = new LodashWrapper([], true);
  23485. }
  23486. }
  23487. index = wrapper ? index : length;
  23488. while (++index < length) {
  23489. func = funcs[index];
  23490. var funcName = getFuncName(func),
  23491. data = funcName == 'wrapper' ? getData(func) : undefined;
  23492. if (data && isLaziable(data[0]) &&
  23493. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  23494. !data[4].length && data[9] == 1
  23495. ) {
  23496. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  23497. } else {
  23498. wrapper = (func.length == 1 && isLaziable(func))
  23499. ? wrapper[funcName]()
  23500. : wrapper.thru(func);
  23501. }
  23502. }
  23503. return function() {
  23504. var args = arguments,
  23505. value = args[0];
  23506. if (wrapper && args.length == 1 && isArray(value)) {
  23507. return wrapper.plant(value).value();
  23508. }
  23509. var index = 0,
  23510. result = length ? funcs[index].apply(this, args) : value;
  23511. while (++index < length) {
  23512. result = funcs[index].call(this, result);
  23513. }
  23514. return result;
  23515. };
  23516. });
  23517. }
  23518. /**
  23519. * Creates a function that wraps `func` to invoke it with optional `this`
  23520. * binding of `thisArg`, partial application, and currying.
  23521. *
  23522. * @private
  23523. * @param {Function|string} func The function or method name to wrap.
  23524. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23525. * @param {*} [thisArg] The `this` binding of `func`.
  23526. * @param {Array} [partials] The arguments to prepend to those provided to
  23527. * the new function.
  23528. * @param {Array} [holders] The `partials` placeholder indexes.
  23529. * @param {Array} [partialsRight] The arguments to append to those provided
  23530. * to the new function.
  23531. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  23532. * @param {Array} [argPos] The argument positions of the new function.
  23533. * @param {number} [ary] The arity cap of `func`.
  23534. * @param {number} [arity] The arity of `func`.
  23535. * @returns {Function} Returns the new wrapped function.
  23536. */
  23537. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  23538. var isAry = bitmask & WRAP_ARY_FLAG,
  23539. isBind = bitmask & WRAP_BIND_FLAG,
  23540. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  23541. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  23542. isFlip = bitmask & WRAP_FLIP_FLAG,
  23543. Ctor = isBindKey ? undefined : createCtor(func);
  23544. function wrapper() {
  23545. var length = arguments.length,
  23546. args = Array(length),
  23547. index = length;
  23548. while (index--) {
  23549. args[index] = arguments[index];
  23550. }
  23551. if (isCurried) {
  23552. var placeholder = getHolder(wrapper),
  23553. holdersCount = countHolders(args, placeholder);
  23554. }
  23555. if (partials) {
  23556. args = composeArgs(args, partials, holders, isCurried);
  23557. }
  23558. if (partialsRight) {
  23559. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  23560. }
  23561. length -= holdersCount;
  23562. if (isCurried && length < arity) {
  23563. var newHolders = replaceHolders(args, placeholder);
  23564. return createRecurry(
  23565. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  23566. args, newHolders, argPos, ary, arity - length
  23567. );
  23568. }
  23569. var thisBinding = isBind ? thisArg : this,
  23570. fn = isBindKey ? thisBinding[func] : func;
  23571. length = args.length;
  23572. if (argPos) {
  23573. args = reorder(args, argPos);
  23574. } else if (isFlip && length > 1) {
  23575. args.reverse();
  23576. }
  23577. if (isAry && ary < length) {
  23578. args.length = ary;
  23579. }
  23580. if (this && this !== root && this instanceof wrapper) {
  23581. fn = Ctor || createCtor(fn);
  23582. }
  23583. return fn.apply(thisBinding, args);
  23584. }
  23585. return wrapper;
  23586. }
  23587. /**
  23588. * Creates a function like `_.invertBy`.
  23589. *
  23590. * @private
  23591. * @param {Function} setter The function to set accumulator values.
  23592. * @param {Function} toIteratee The function to resolve iteratees.
  23593. * @returns {Function} Returns the new inverter function.
  23594. */
  23595. function createInverter(setter, toIteratee) {
  23596. return function(object, iteratee) {
  23597. return baseInverter(object, setter, toIteratee(iteratee), {});
  23598. };
  23599. }
  23600. /**
  23601. * Creates a function that performs a mathematical operation on two values.
  23602. *
  23603. * @private
  23604. * @param {Function} operator The function to perform the operation.
  23605. * @param {number} [defaultValue] The value used for `undefined` arguments.
  23606. * @returns {Function} Returns the new mathematical operation function.
  23607. */
  23608. function createMathOperation(operator, defaultValue) {
  23609. return function(value, other) {
  23610. var result;
  23611. if (value === undefined && other === undefined) {
  23612. return defaultValue;
  23613. }
  23614. if (value !== undefined) {
  23615. result = value;
  23616. }
  23617. if (other !== undefined) {
  23618. if (result === undefined) {
  23619. return other;
  23620. }
  23621. if (typeof value == 'string' || typeof other == 'string') {
  23622. value = baseToString(value);
  23623. other = baseToString(other);
  23624. } else {
  23625. value = baseToNumber(value);
  23626. other = baseToNumber(other);
  23627. }
  23628. result = operator(value, other);
  23629. }
  23630. return result;
  23631. };
  23632. }
  23633. /**
  23634. * Creates a function like `_.over`.
  23635. *
  23636. * @private
  23637. * @param {Function} arrayFunc The function to iterate over iteratees.
  23638. * @returns {Function} Returns the new over function.
  23639. */
  23640. function createOver(arrayFunc) {
  23641. return flatRest(function(iteratees) {
  23642. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  23643. return baseRest(function(args) {
  23644. var thisArg = this;
  23645. return arrayFunc(iteratees, function(iteratee) {
  23646. return apply(iteratee, thisArg, args);
  23647. });
  23648. });
  23649. });
  23650. }
  23651. /**
  23652. * Creates the padding for `string` based on `length`. The `chars` string
  23653. * is truncated if the number of characters exceeds `length`.
  23654. *
  23655. * @private
  23656. * @param {number} length The padding length.
  23657. * @param {string} [chars=' '] The string used as padding.
  23658. * @returns {string} Returns the padding for `string`.
  23659. */
  23660. function createPadding(length, chars) {
  23661. chars = chars === undefined ? ' ' : baseToString(chars);
  23662. var charsLength = chars.length;
  23663. if (charsLength < 2) {
  23664. return charsLength ? baseRepeat(chars, length) : chars;
  23665. }
  23666. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  23667. return hasUnicode(chars)
  23668. ? castSlice(stringToArray(result), 0, length).join('')
  23669. : result.slice(0, length);
  23670. }
  23671. /**
  23672. * Creates a function that wraps `func` to invoke it with the `this` binding
  23673. * of `thisArg` and `partials` prepended to the arguments it receives.
  23674. *
  23675. * @private
  23676. * @param {Function} func The function to wrap.
  23677. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23678. * @param {*} thisArg The `this` binding of `func`.
  23679. * @param {Array} partials The arguments to prepend to those provided to
  23680. * the new function.
  23681. * @returns {Function} Returns the new wrapped function.
  23682. */
  23683. function createPartial(func, bitmask, thisArg, partials) {
  23684. var isBind = bitmask & WRAP_BIND_FLAG,
  23685. Ctor = createCtor(func);
  23686. function wrapper() {
  23687. var argsIndex = -1,
  23688. argsLength = arguments.length,
  23689. leftIndex = -1,
  23690. leftLength = partials.length,
  23691. args = Array(leftLength + argsLength),
  23692. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23693. while (++leftIndex < leftLength) {
  23694. args[leftIndex] = partials[leftIndex];
  23695. }
  23696. while (argsLength--) {
  23697. args[leftIndex++] = arguments[++argsIndex];
  23698. }
  23699. return apply(fn, isBind ? thisArg : this, args);
  23700. }
  23701. return wrapper;
  23702. }
  23703. /**
  23704. * Creates a `_.range` or `_.rangeRight` function.
  23705. *
  23706. * @private
  23707. * @param {boolean} [fromRight] Specify iterating from right to left.
  23708. * @returns {Function} Returns the new range function.
  23709. */
  23710. function createRange(fromRight) {
  23711. return function(start, end, step) {
  23712. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  23713. end = step = undefined;
  23714. }
  23715. // Ensure the sign of `-0` is preserved.
  23716. start = toFinite(start);
  23717. if (end === undefined) {
  23718. end = start;
  23719. start = 0;
  23720. } else {
  23721. end = toFinite(end);
  23722. }
  23723. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  23724. return baseRange(start, end, step, fromRight);
  23725. };
  23726. }
  23727. /**
  23728. * Creates a function that performs a relational operation on two values.
  23729. *
  23730. * @private
  23731. * @param {Function} operator The function to perform the operation.
  23732. * @returns {Function} Returns the new relational operation function.
  23733. */
  23734. function createRelationalOperation(operator) {
  23735. return function(value, other) {
  23736. if (!(typeof value == 'string' && typeof other == 'string')) {
  23737. value = toNumber(value);
  23738. other = toNumber(other);
  23739. }
  23740. return operator(value, other);
  23741. };
  23742. }
  23743. /**
  23744. * Creates a function that wraps `func` to continue currying.
  23745. *
  23746. * @private
  23747. * @param {Function} func The function to wrap.
  23748. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23749. * @param {Function} wrapFunc The function to create the `func` wrapper.
  23750. * @param {*} placeholder The placeholder value.
  23751. * @param {*} [thisArg] The `this` binding of `func`.
  23752. * @param {Array} [partials] The arguments to prepend to those provided to
  23753. * the new function.
  23754. * @param {Array} [holders] The `partials` placeholder indexes.
  23755. * @param {Array} [argPos] The argument positions of the new function.
  23756. * @param {number} [ary] The arity cap of `func`.
  23757. * @param {number} [arity] The arity of `func`.
  23758. * @returns {Function} Returns the new wrapped function.
  23759. */
  23760. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  23761. var isCurry = bitmask & WRAP_CURRY_FLAG,
  23762. newHolders = isCurry ? holders : undefined,
  23763. newHoldersRight = isCurry ? undefined : holders,
  23764. newPartials = isCurry ? partials : undefined,
  23765. newPartialsRight = isCurry ? undefined : partials;
  23766. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  23767. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  23768. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  23769. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  23770. }
  23771. var newData = [
  23772. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  23773. newHoldersRight, argPos, ary, arity
  23774. ];
  23775. var result = wrapFunc.apply(undefined, newData);
  23776. if (isLaziable(func)) {
  23777. setData(result, newData);
  23778. }
  23779. result.placeholder = placeholder;
  23780. return setWrapToString(result, func, bitmask);
  23781. }
  23782. /**
  23783. * Creates a function like `_.round`.
  23784. *
  23785. * @private
  23786. * @param {string} methodName The name of the `Math` method to use when rounding.
  23787. * @returns {Function} Returns the new round function.
  23788. */
  23789. function createRound(methodName) {
  23790. var func = Math[methodName];
  23791. return function(number, precision) {
  23792. number = toNumber(number);
  23793. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  23794. if (precision && nativeIsFinite(number)) {
  23795. // Shift with exponential notation to avoid floating-point issues.
  23796. // See [MDN](https://mdn.io/round#Examples) for more details.
  23797. var pair = (toString(number) + 'e').split('e'),
  23798. value = func(pair[0] + 'e' + (+pair[1] + precision));
  23799. pair = (toString(value) + 'e').split('e');
  23800. return +(pair[0] + 'e' + (+pair[1] - precision));
  23801. }
  23802. return func(number);
  23803. };
  23804. }
  23805. /**
  23806. * Creates a set object of `values`.
  23807. *
  23808. * @private
  23809. * @param {Array} values The values to add to the set.
  23810. * @returns {Object} Returns the new set.
  23811. */
  23812. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  23813. return new Set(values);
  23814. };
  23815. /**
  23816. * Creates a `_.toPairs` or `_.toPairsIn` function.
  23817. *
  23818. * @private
  23819. * @param {Function} keysFunc The function to get the keys of a given object.
  23820. * @returns {Function} Returns the new pairs function.
  23821. */
  23822. function createToPairs(keysFunc) {
  23823. return function(object) {
  23824. var tag = getTag(object);
  23825. if (tag == mapTag) {
  23826. return mapToArray(object);
  23827. }
  23828. if (tag == setTag) {
  23829. return setToPairs(object);
  23830. }
  23831. return baseToPairs(object, keysFunc(object));
  23832. };
  23833. }
  23834. /**
  23835. * Creates a function that either curries or invokes `func` with optional
  23836. * `this` binding and partially applied arguments.
  23837. *
  23838. * @private
  23839. * @param {Function|string} func The function or method name to wrap.
  23840. * @param {number} bitmask The bitmask flags.
  23841. * 1 - `_.bind`
  23842. * 2 - `_.bindKey`
  23843. * 4 - `_.curry` or `_.curryRight` of a bound function
  23844. * 8 - `_.curry`
  23845. * 16 - `_.curryRight`
  23846. * 32 - `_.partial`
  23847. * 64 - `_.partialRight`
  23848. * 128 - `_.rearg`
  23849. * 256 - `_.ary`
  23850. * 512 - `_.flip`
  23851. * @param {*} [thisArg] The `this` binding of `func`.
  23852. * @param {Array} [partials] The arguments to be partially applied.
  23853. * @param {Array} [holders] The `partials` placeholder indexes.
  23854. * @param {Array} [argPos] The argument positions of the new function.
  23855. * @param {number} [ary] The arity cap of `func`.
  23856. * @param {number} [arity] The arity of `func`.
  23857. * @returns {Function} Returns the new wrapped function.
  23858. */
  23859. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  23860. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  23861. if (!isBindKey && typeof func != 'function') {
  23862. throw new TypeError(FUNC_ERROR_TEXT);
  23863. }
  23864. var length = partials ? partials.length : 0;
  23865. if (!length) {
  23866. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  23867. partials = holders = undefined;
  23868. }
  23869. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  23870. arity = arity === undefined ? arity : toInteger(arity);
  23871. length -= holders ? holders.length : 0;
  23872. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  23873. var partialsRight = partials,
  23874. holdersRight = holders;
  23875. partials = holders = undefined;
  23876. }
  23877. var data = isBindKey ? undefined : getData(func);
  23878. var newData = [
  23879. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  23880. argPos, ary, arity
  23881. ];
  23882. if (data) {
  23883. mergeData(newData, data);
  23884. }
  23885. func = newData[0];
  23886. bitmask = newData[1];
  23887. thisArg = newData[2];
  23888. partials = newData[3];
  23889. holders = newData[4];
  23890. arity = newData[9] = newData[9] === undefined
  23891. ? (isBindKey ? 0 : func.length)
  23892. : nativeMax(newData[9] - length, 0);
  23893. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  23894. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  23895. }
  23896. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  23897. var result = createBind(func, bitmask, thisArg);
  23898. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  23899. result = createCurry(func, bitmask, arity);
  23900. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  23901. result = createPartial(func, bitmask, thisArg, partials);
  23902. } else {
  23903. result = createHybrid.apply(undefined, newData);
  23904. }
  23905. var setter = data ? baseSetData : setData;
  23906. return setWrapToString(setter(result, newData), func, bitmask);
  23907. }
  23908. /**
  23909. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  23910. * of source objects to the destination object for all destination properties
  23911. * that resolve to `undefined`.
  23912. *
  23913. * @private
  23914. * @param {*} objValue The destination value.
  23915. * @param {*} srcValue The source value.
  23916. * @param {string} key The key of the property to assign.
  23917. * @param {Object} object The parent object of `objValue`.
  23918. * @returns {*} Returns the value to assign.
  23919. */
  23920. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  23921. if (objValue === undefined ||
  23922. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  23923. return srcValue;
  23924. }
  23925. return objValue;
  23926. }
  23927. /**
  23928. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  23929. * objects into destination objects that are passed thru.
  23930. *
  23931. * @private
  23932. * @param {*} objValue The destination value.
  23933. * @param {*} srcValue The source value.
  23934. * @param {string} key The key of the property to merge.
  23935. * @param {Object} object The parent object of `objValue`.
  23936. * @param {Object} source The parent object of `srcValue`.
  23937. * @param {Object} [stack] Tracks traversed source values and their merged
  23938. * counterparts.
  23939. * @returns {*} Returns the value to assign.
  23940. */
  23941. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  23942. if (isObject(objValue) && isObject(srcValue)) {
  23943. // Recursively merge objects and arrays (susceptible to call stack limits).
  23944. stack.set(srcValue, objValue);
  23945. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  23946. stack['delete'](srcValue);
  23947. }
  23948. return objValue;
  23949. }
  23950. /**
  23951. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  23952. * objects.
  23953. *
  23954. * @private
  23955. * @param {*} value The value to inspect.
  23956. * @param {string} key The key of the property to inspect.
  23957. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  23958. */
  23959. function customOmitClone(value) {
  23960. return isPlainObject(value) ? undefined : value;
  23961. }
  23962. /**
  23963. * A specialized version of `baseIsEqualDeep` for arrays with support for
  23964. * partial deep comparisons.
  23965. *
  23966. * @private
  23967. * @param {Array} array The array to compare.
  23968. * @param {Array} other The other array to compare.
  23969. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23970. * @param {Function} customizer The function to customize comparisons.
  23971. * @param {Function} equalFunc The function to determine equivalents of values.
  23972. * @param {Object} stack Tracks traversed `array` and `other` objects.
  23973. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  23974. */
  23975. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  23976. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23977. arrLength = array.length,
  23978. othLength = other.length;
  23979. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  23980. return false;
  23981. }
  23982. // Assume cyclic values are equal.
  23983. var stacked = stack.get(array);
  23984. if (stacked && stack.get(other)) {
  23985. return stacked == other;
  23986. }
  23987. var index = -1,
  23988. result = true,
  23989. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  23990. stack.set(array, other);
  23991. stack.set(other, array);
  23992. // Ignore non-index properties.
  23993. while (++index < arrLength) {
  23994. var arrValue = array[index],
  23995. othValue = other[index];
  23996. if (customizer) {
  23997. var compared = isPartial
  23998. ? customizer(othValue, arrValue, index, other, array, stack)
  23999. : customizer(arrValue, othValue, index, array, other, stack);
  24000. }
  24001. if (compared !== undefined) {
  24002. if (compared) {
  24003. continue;
  24004. }
  24005. result = false;
  24006. break;
  24007. }
  24008. // Recursively compare arrays (susceptible to call stack limits).
  24009. if (seen) {
  24010. if (!arraySome(other, function(othValue, othIndex) {
  24011. if (!cacheHas(seen, othIndex) &&
  24012. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  24013. return seen.push(othIndex);
  24014. }
  24015. })) {
  24016. result = false;
  24017. break;
  24018. }
  24019. } else if (!(
  24020. arrValue === othValue ||
  24021. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  24022. )) {
  24023. result = false;
  24024. break;
  24025. }
  24026. }
  24027. stack['delete'](array);
  24028. stack['delete'](other);
  24029. return result;
  24030. }
  24031. /**
  24032. * A specialized version of `baseIsEqualDeep` for comparing objects of
  24033. * the same `toStringTag`.
  24034. *
  24035. * **Note:** This function only supports comparing values with tags of
  24036. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  24037. *
  24038. * @private
  24039. * @param {Object} object The object to compare.
  24040. * @param {Object} other The other object to compare.
  24041. * @param {string} tag The `toStringTag` of the objects to compare.
  24042. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  24043. * @param {Function} customizer The function to customize comparisons.
  24044. * @param {Function} equalFunc The function to determine equivalents of values.
  24045. * @param {Object} stack Tracks traversed `object` and `other` objects.
  24046. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  24047. */
  24048. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  24049. switch (tag) {
  24050. case dataViewTag:
  24051. if ((object.byteLength != other.byteLength) ||
  24052. (object.byteOffset != other.byteOffset)) {
  24053. return false;
  24054. }
  24055. object = object.buffer;
  24056. other = other.buffer;
  24057. case arrayBufferTag:
  24058. if ((object.byteLength != other.byteLength) ||
  24059. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  24060. return false;
  24061. }
  24062. return true;
  24063. case boolTag:
  24064. case dateTag:
  24065. case numberTag:
  24066. // Coerce booleans to `1` or `0` and dates to milliseconds.
  24067. // Invalid dates are coerced to `NaN`.
  24068. return eq(+object, +other);
  24069. case errorTag:
  24070. return object.name == other.name && object.message == other.message;
  24071. case regexpTag:
  24072. case stringTag:
  24073. // Coerce regexes to strings and treat strings, primitives and objects,
  24074. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  24075. // for more details.
  24076. return object == (other + '');
  24077. case mapTag:
  24078. var convert = mapToArray;
  24079. case setTag:
  24080. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  24081. convert || (convert = setToArray);
  24082. if (object.size != other.size && !isPartial) {
  24083. return false;
  24084. }
  24085. // Assume cyclic values are equal.
  24086. var stacked = stack.get(object);
  24087. if (stacked) {
  24088. return stacked == other;
  24089. }
  24090. bitmask |= COMPARE_UNORDERED_FLAG;
  24091. // Recursively compare objects (susceptible to call stack limits).
  24092. stack.set(object, other);
  24093. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  24094. stack['delete'](object);
  24095. return result;
  24096. case symbolTag:
  24097. if (symbolValueOf) {
  24098. return symbolValueOf.call(object) == symbolValueOf.call(other);
  24099. }
  24100. }
  24101. return false;
  24102. }
  24103. /**
  24104. * A specialized version of `baseIsEqualDeep` for objects with support for
  24105. * partial deep comparisons.
  24106. *
  24107. * @private
  24108. * @param {Object} object The object to compare.
  24109. * @param {Object} other The other object to compare.
  24110. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  24111. * @param {Function} customizer The function to customize comparisons.
  24112. * @param {Function} equalFunc The function to determine equivalents of values.
  24113. * @param {Object} stack Tracks traversed `object` and `other` objects.
  24114. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  24115. */
  24116. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  24117. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  24118. objProps = getAllKeys(object),
  24119. objLength = objProps.length,
  24120. othProps = getAllKeys(other),
  24121. othLength = othProps.length;
  24122. if (objLength != othLength && !isPartial) {
  24123. return false;
  24124. }
  24125. var index = objLength;
  24126. while (index--) {
  24127. var key = objProps[index];
  24128. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  24129. return false;
  24130. }
  24131. }
  24132. // Assume cyclic values are equal.
  24133. var stacked = stack.get(object);
  24134. if (stacked && stack.get(other)) {
  24135. return stacked == other;
  24136. }
  24137. var result = true;
  24138. stack.set(object, other);
  24139. stack.set(other, object);
  24140. var skipCtor = isPartial;
  24141. while (++index < objLength) {
  24142. key = objProps[index];
  24143. var objValue = object[key],
  24144. othValue = other[key];
  24145. if (customizer) {
  24146. var compared = isPartial
  24147. ? customizer(othValue, objValue, key, other, object, stack)
  24148. : customizer(objValue, othValue, key, object, other, stack);
  24149. }
  24150. // Recursively compare objects (susceptible to call stack limits).
  24151. if (!(compared === undefined
  24152. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  24153. : compared
  24154. )) {
  24155. result = false;
  24156. break;
  24157. }
  24158. skipCtor || (skipCtor = key == 'constructor');
  24159. }
  24160. if (result && !skipCtor) {
  24161. var objCtor = object.constructor,
  24162. othCtor = other.constructor;
  24163. // Non `Object` object instances with different constructors are not equal.
  24164. if (objCtor != othCtor &&
  24165. ('constructor' in object && 'constructor' in other) &&
  24166. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  24167. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  24168. result = false;
  24169. }
  24170. }
  24171. stack['delete'](object);
  24172. stack['delete'](other);
  24173. return result;
  24174. }
  24175. /**
  24176. * A specialized version of `baseRest` which flattens the rest array.
  24177. *
  24178. * @private
  24179. * @param {Function} func The function to apply a rest parameter to.
  24180. * @returns {Function} Returns the new function.
  24181. */
  24182. function flatRest(func) {
  24183. return setToString(overRest(func, undefined, flatten), func + '');
  24184. }
  24185. /**
  24186. * Creates an array of own enumerable property names and symbols of `object`.
  24187. *
  24188. * @private
  24189. * @param {Object} object The object to query.
  24190. * @returns {Array} Returns the array of property names and symbols.
  24191. */
  24192. function getAllKeys(object) {
  24193. return baseGetAllKeys(object, keys, getSymbols);
  24194. }
  24195. /**
  24196. * Creates an array of own and inherited enumerable property names and
  24197. * symbols of `object`.
  24198. *
  24199. * @private
  24200. * @param {Object} object The object to query.
  24201. * @returns {Array} Returns the array of property names and symbols.
  24202. */
  24203. function getAllKeysIn(object) {
  24204. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  24205. }
  24206. /**
  24207. * Gets metadata for `func`.
  24208. *
  24209. * @private
  24210. * @param {Function} func The function to query.
  24211. * @returns {*} Returns the metadata for `func`.
  24212. */
  24213. var getData = !metaMap ? noop : function(func) {
  24214. return metaMap.get(func);
  24215. };
  24216. /**
  24217. * Gets the name of `func`.
  24218. *
  24219. * @private
  24220. * @param {Function} func The function to query.
  24221. * @returns {string} Returns the function name.
  24222. */
  24223. function getFuncName(func) {
  24224. var result = (func.name + ''),
  24225. array = realNames[result],
  24226. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  24227. while (length--) {
  24228. var data = array[length],
  24229. otherFunc = data.func;
  24230. if (otherFunc == null || otherFunc == func) {
  24231. return data.name;
  24232. }
  24233. }
  24234. return result;
  24235. }
  24236. /**
  24237. * Gets the argument placeholder value for `func`.
  24238. *
  24239. * @private
  24240. * @param {Function} func The function to inspect.
  24241. * @returns {*} Returns the placeholder value.
  24242. */
  24243. function getHolder(func) {
  24244. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  24245. return object.placeholder;
  24246. }
  24247. /**
  24248. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  24249. * this function returns the custom method, otherwise it returns `baseIteratee`.
  24250. * If arguments are provided, the chosen function is invoked with them and
  24251. * its result is returned.
  24252. *
  24253. * @private
  24254. * @param {*} [value] The value to convert to an iteratee.
  24255. * @param {number} [arity] The arity of the created iteratee.
  24256. * @returns {Function} Returns the chosen function or its result.
  24257. */
  24258. function getIteratee() {
  24259. var result = lodash.iteratee || iteratee;
  24260. result = result === iteratee ? baseIteratee : result;
  24261. return arguments.length ? result(arguments[0], arguments[1]) : result;
  24262. }
  24263. /**
  24264. * Gets the data for `map`.
  24265. *
  24266. * @private
  24267. * @param {Object} map The map to query.
  24268. * @param {string} key The reference key.
  24269. * @returns {*} Returns the map data.
  24270. */
  24271. function getMapData(map, key) {
  24272. var data = map.__data__;
  24273. return isKeyable(key)
  24274. ? data[typeof key == 'string' ? 'string' : 'hash']
  24275. : data.map;
  24276. }
  24277. /**
  24278. * Gets the property names, values, and compare flags of `object`.
  24279. *
  24280. * @private
  24281. * @param {Object} object The object to query.
  24282. * @returns {Array} Returns the match data of `object`.
  24283. */
  24284. function getMatchData(object) {
  24285. var result = keys(object),
  24286. length = result.length;
  24287. while (length--) {
  24288. var key = result[length],
  24289. value = object[key];
  24290. result[length] = [key, value, isStrictComparable(value)];
  24291. }
  24292. return result;
  24293. }
  24294. /**
  24295. * Gets the native function at `key` of `object`.
  24296. *
  24297. * @private
  24298. * @param {Object} object The object to query.
  24299. * @param {string} key The key of the method to get.
  24300. * @returns {*} Returns the function if it's native, else `undefined`.
  24301. */
  24302. function getNative(object, key) {
  24303. var value = getValue(object, key);
  24304. return baseIsNative(value) ? value : undefined;
  24305. }
  24306. /**
  24307. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  24308. *
  24309. * @private
  24310. * @param {*} value The value to query.
  24311. * @returns {string} Returns the raw `toStringTag`.
  24312. */
  24313. function getRawTag(value) {
  24314. var isOwn = hasOwnProperty.call(value, symToStringTag),
  24315. tag = value[symToStringTag];
  24316. try {
  24317. value[symToStringTag] = undefined;
  24318. var unmasked = true;
  24319. } catch (e) {}
  24320. var result = nativeObjectToString.call(value);
  24321. if (unmasked) {
  24322. if (isOwn) {
  24323. value[symToStringTag] = tag;
  24324. } else {
  24325. delete value[symToStringTag];
  24326. }
  24327. }
  24328. return result;
  24329. }
  24330. /**
  24331. * Creates an array of the own enumerable symbols of `object`.
  24332. *
  24333. * @private
  24334. * @param {Object} object The object to query.
  24335. * @returns {Array} Returns the array of symbols.
  24336. */
  24337. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  24338. if (object == null) {
  24339. return [];
  24340. }
  24341. object = Object(object);
  24342. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  24343. return propertyIsEnumerable.call(object, symbol);
  24344. });
  24345. };
  24346. /**
  24347. * Creates an array of the own and inherited enumerable symbols of `object`.
  24348. *
  24349. * @private
  24350. * @param {Object} object The object to query.
  24351. * @returns {Array} Returns the array of symbols.
  24352. */
  24353. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  24354. var result = [];
  24355. while (object) {
  24356. arrayPush(result, getSymbols(object));
  24357. object = getPrototype(object);
  24358. }
  24359. return result;
  24360. };
  24361. /**
  24362. * Gets the `toStringTag` of `value`.
  24363. *
  24364. * @private
  24365. * @param {*} value The value to query.
  24366. * @returns {string} Returns the `toStringTag`.
  24367. */
  24368. var getTag = baseGetTag;
  24369. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  24370. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  24371. (Map && getTag(new Map) != mapTag) ||
  24372. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  24373. (Set && getTag(new Set) != setTag) ||
  24374. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  24375. getTag = function(value) {
  24376. var result = baseGetTag(value),
  24377. Ctor = result == objectTag ? value.constructor : undefined,
  24378. ctorString = Ctor ? toSource(Ctor) : '';
  24379. if (ctorString) {
  24380. switch (ctorString) {
  24381. case dataViewCtorString: return dataViewTag;
  24382. case mapCtorString: return mapTag;
  24383. case promiseCtorString: return promiseTag;
  24384. case setCtorString: return setTag;
  24385. case weakMapCtorString: return weakMapTag;
  24386. }
  24387. }
  24388. return result;
  24389. };
  24390. }
  24391. /**
  24392. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  24393. *
  24394. * @private
  24395. * @param {number} start The start of the view.
  24396. * @param {number} end The end of the view.
  24397. * @param {Array} transforms The transformations to apply to the view.
  24398. * @returns {Object} Returns an object containing the `start` and `end`
  24399. * positions of the view.
  24400. */
  24401. function getView(start, end, transforms) {
  24402. var index = -1,
  24403. length = transforms.length;
  24404. while (++index < length) {
  24405. var data = transforms[index],
  24406. size = data.size;
  24407. switch (data.type) {
  24408. case 'drop': start += size; break;
  24409. case 'dropRight': end -= size; break;
  24410. case 'take': end = nativeMin(end, start + size); break;
  24411. case 'takeRight': start = nativeMax(start, end - size); break;
  24412. }
  24413. }
  24414. return { 'start': start, 'end': end };
  24415. }
  24416. /**
  24417. * Extracts wrapper details from the `source` body comment.
  24418. *
  24419. * @private
  24420. * @param {string} source The source to inspect.
  24421. * @returns {Array} Returns the wrapper details.
  24422. */
  24423. function getWrapDetails(source) {
  24424. var match = source.match(reWrapDetails);
  24425. return match ? match[1].split(reSplitDetails) : [];
  24426. }
  24427. /**
  24428. * Checks if `path` exists on `object`.
  24429. *
  24430. * @private
  24431. * @param {Object} object The object to query.
  24432. * @param {Array|string} path The path to check.
  24433. * @param {Function} hasFunc The function to check properties.
  24434. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  24435. */
  24436. function hasPath(object, path, hasFunc) {
  24437. path = castPath(path, object);
  24438. var index = -1,
  24439. length = path.length,
  24440. result = false;
  24441. while (++index < length) {
  24442. var key = toKey(path[index]);
  24443. if (!(result = object != null && hasFunc(object, key))) {
  24444. break;
  24445. }
  24446. object = object[key];
  24447. }
  24448. if (result || ++index != length) {
  24449. return result;
  24450. }
  24451. length = object == null ? 0 : object.length;
  24452. return !!length && isLength(length) && isIndex(key, length) &&
  24453. (isArray(object) || isArguments(object));
  24454. }
  24455. /**
  24456. * Initializes an array clone.
  24457. *
  24458. * @private
  24459. * @param {Array} array The array to clone.
  24460. * @returns {Array} Returns the initialized clone.
  24461. */
  24462. function initCloneArray(array) {
  24463. var length = array.length,
  24464. result = new array.constructor(length);
  24465. // Add properties assigned by `RegExp#exec`.
  24466. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  24467. result.index = array.index;
  24468. result.input = array.input;
  24469. }
  24470. return result;
  24471. }
  24472. /**
  24473. * Initializes an object clone.
  24474. *
  24475. * @private
  24476. * @param {Object} object The object to clone.
  24477. * @returns {Object} Returns the initialized clone.
  24478. */
  24479. function initCloneObject(object) {
  24480. return (typeof object.constructor == 'function' && !isPrototype(object))
  24481. ? baseCreate(getPrototype(object))
  24482. : {};
  24483. }
  24484. /**
  24485. * Initializes an object clone based on its `toStringTag`.
  24486. *
  24487. * **Note:** This function only supports cloning values with tags of
  24488. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  24489. *
  24490. * @private
  24491. * @param {Object} object The object to clone.
  24492. * @param {string} tag The `toStringTag` of the object to clone.
  24493. * @param {boolean} [isDeep] Specify a deep clone.
  24494. * @returns {Object} Returns the initialized clone.
  24495. */
  24496. function initCloneByTag(object, tag, isDeep) {
  24497. var Ctor = object.constructor;
  24498. switch (tag) {
  24499. case arrayBufferTag:
  24500. return cloneArrayBuffer(object);
  24501. case boolTag:
  24502. case dateTag:
  24503. return new Ctor(+object);
  24504. case dataViewTag:
  24505. return cloneDataView(object, isDeep);
  24506. case float32Tag: case float64Tag:
  24507. case int8Tag: case int16Tag: case int32Tag:
  24508. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  24509. return cloneTypedArray(object, isDeep);
  24510. case mapTag:
  24511. return new Ctor;
  24512. case numberTag:
  24513. case stringTag:
  24514. return new Ctor(object);
  24515. case regexpTag:
  24516. return cloneRegExp(object);
  24517. case setTag:
  24518. return new Ctor;
  24519. case symbolTag:
  24520. return cloneSymbol(object);
  24521. }
  24522. }
  24523. /**
  24524. * Inserts wrapper `details` in a comment at the top of the `source` body.
  24525. *
  24526. * @private
  24527. * @param {string} source The source to modify.
  24528. * @returns {Array} details The details to insert.
  24529. * @returns {string} Returns the modified source.
  24530. */
  24531. function insertWrapDetails(source, details) {
  24532. var length = details.length;
  24533. if (!length) {
  24534. return source;
  24535. }
  24536. var lastIndex = length - 1;
  24537. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  24538. details = details.join(length > 2 ? ', ' : ' ');
  24539. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  24540. }
  24541. /**
  24542. * Checks if `value` is a flattenable `arguments` object or array.
  24543. *
  24544. * @private
  24545. * @param {*} value The value to check.
  24546. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  24547. */
  24548. function isFlattenable(value) {
  24549. return isArray(value) || isArguments(value) ||
  24550. !!(spreadableSymbol && value && value[spreadableSymbol]);
  24551. }
  24552. /**
  24553. * Checks if `value` is a valid array-like index.
  24554. *
  24555. * @private
  24556. * @param {*} value The value to check.
  24557. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  24558. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  24559. */
  24560. function isIndex(value, length) {
  24561. var type = typeof value;
  24562. length = length == null ? MAX_SAFE_INTEGER : length;
  24563. return !!length &&
  24564. (type == 'number' ||
  24565. (type != 'symbol' && reIsUint.test(value))) &&
  24566. (value > -1 && value % 1 == 0 && value < length);
  24567. }
  24568. /**
  24569. * Checks if the given arguments are from an iteratee call.
  24570. *
  24571. * @private
  24572. * @param {*} value The potential iteratee value argument.
  24573. * @param {*} index The potential iteratee index or key argument.
  24574. * @param {*} object The potential iteratee object argument.
  24575. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  24576. * else `false`.
  24577. */
  24578. function isIterateeCall(value, index, object) {
  24579. if (!isObject(object)) {
  24580. return false;
  24581. }
  24582. var type = typeof index;
  24583. if (type == 'number'
  24584. ? (isArrayLike(object) && isIndex(index, object.length))
  24585. : (type == 'string' && index in object)
  24586. ) {
  24587. return eq(object[index], value);
  24588. }
  24589. return false;
  24590. }
  24591. /**
  24592. * Checks if `value` is a property name and not a property path.
  24593. *
  24594. * @private
  24595. * @param {*} value The value to check.
  24596. * @param {Object} [object] The object to query keys on.
  24597. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  24598. */
  24599. function isKey(value, object) {
  24600. if (isArray(value)) {
  24601. return false;
  24602. }
  24603. var type = typeof value;
  24604. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  24605. value == null || isSymbol(value)) {
  24606. return true;
  24607. }
  24608. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  24609. (object != null && value in Object(object));
  24610. }
  24611. /**
  24612. * Checks if `value` is suitable for use as unique object key.
  24613. *
  24614. * @private
  24615. * @param {*} value The value to check.
  24616. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  24617. */
  24618. function isKeyable(value) {
  24619. var type = typeof value;
  24620. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  24621. ? (value !== '__proto__')
  24622. : (value === null);
  24623. }
  24624. /**
  24625. * Checks if `func` has a lazy counterpart.
  24626. *
  24627. * @private
  24628. * @param {Function} func The function to check.
  24629. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  24630. * else `false`.
  24631. */
  24632. function isLaziable(func) {
  24633. var funcName = getFuncName(func),
  24634. other = lodash[funcName];
  24635. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  24636. return false;
  24637. }
  24638. if (func === other) {
  24639. return true;
  24640. }
  24641. var data = getData(other);
  24642. return !!data && func === data[0];
  24643. }
  24644. /**
  24645. * Checks if `func` has its source masked.
  24646. *
  24647. * @private
  24648. * @param {Function} func The function to check.
  24649. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  24650. */
  24651. function isMasked(func) {
  24652. return !!maskSrcKey && (maskSrcKey in func);
  24653. }
  24654. /**
  24655. * Checks if `func` is capable of being masked.
  24656. *
  24657. * @private
  24658. * @param {*} value The value to check.
  24659. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  24660. */
  24661. var isMaskable = coreJsData ? isFunction : stubFalse;
  24662. /**
  24663. * Checks if `value` is likely a prototype object.
  24664. *
  24665. * @private
  24666. * @param {*} value The value to check.
  24667. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  24668. */
  24669. function isPrototype(value) {
  24670. var Ctor = value && value.constructor,
  24671. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  24672. return value === proto;
  24673. }
  24674. /**
  24675. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  24676. *
  24677. * @private
  24678. * @param {*} value The value to check.
  24679. * @returns {boolean} Returns `true` if `value` if suitable for strict
  24680. * equality comparisons, else `false`.
  24681. */
  24682. function isStrictComparable(value) {
  24683. return value === value && !isObject(value);
  24684. }
  24685. /**
  24686. * A specialized version of `matchesProperty` for source values suitable
  24687. * for strict equality comparisons, i.e. `===`.
  24688. *
  24689. * @private
  24690. * @param {string} key The key of the property to get.
  24691. * @param {*} srcValue The value to match.
  24692. * @returns {Function} Returns the new spec function.
  24693. */
  24694. function matchesStrictComparable(key, srcValue) {
  24695. return function(object) {
  24696. if (object == null) {
  24697. return false;
  24698. }
  24699. return object[key] === srcValue &&
  24700. (srcValue !== undefined || (key in Object(object)));
  24701. };
  24702. }
  24703. /**
  24704. * A specialized version of `_.memoize` which clears the memoized function's
  24705. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  24706. *
  24707. * @private
  24708. * @param {Function} func The function to have its output memoized.
  24709. * @returns {Function} Returns the new memoized function.
  24710. */
  24711. function memoizeCapped(func) {
  24712. var result = memoize(func, function(key) {
  24713. if (cache.size === MAX_MEMOIZE_SIZE) {
  24714. cache.clear();
  24715. }
  24716. return key;
  24717. });
  24718. var cache = result.cache;
  24719. return result;
  24720. }
  24721. /**
  24722. * Merges the function metadata of `source` into `data`.
  24723. *
  24724. * Merging metadata reduces the number of wrappers used to invoke a function.
  24725. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  24726. * may be applied regardless of execution order. Methods like `_.ary` and
  24727. * `_.rearg` modify function arguments, making the order in which they are
  24728. * executed important, preventing the merging of metadata. However, we make
  24729. * an exception for a safe combined case where curried functions have `_.ary`
  24730. * and or `_.rearg` applied.
  24731. *
  24732. * @private
  24733. * @param {Array} data The destination metadata.
  24734. * @param {Array} source The source metadata.
  24735. * @returns {Array} Returns `data`.
  24736. */
  24737. function mergeData(data, source) {
  24738. var bitmask = data[1],
  24739. srcBitmask = source[1],
  24740. newBitmask = bitmask | srcBitmask,
  24741. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  24742. var isCombo =
  24743. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  24744. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  24745. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  24746. // Exit early if metadata can't be merged.
  24747. if (!(isCommon || isCombo)) {
  24748. return data;
  24749. }
  24750. // Use source `thisArg` if available.
  24751. if (srcBitmask & WRAP_BIND_FLAG) {
  24752. data[2] = source[2];
  24753. // Set when currying a bound function.
  24754. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  24755. }
  24756. // Compose partial arguments.
  24757. var value = source[3];
  24758. if (value) {
  24759. var partials = data[3];
  24760. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  24761. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  24762. }
  24763. // Compose partial right arguments.
  24764. value = source[5];
  24765. if (value) {
  24766. partials = data[5];
  24767. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  24768. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  24769. }
  24770. // Use source `argPos` if available.
  24771. value = source[7];
  24772. if (value) {
  24773. data[7] = value;
  24774. }
  24775. // Use source `ary` if it's smaller.
  24776. if (srcBitmask & WRAP_ARY_FLAG) {
  24777. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  24778. }
  24779. // Use source `arity` if one is not provided.
  24780. if (data[9] == null) {
  24781. data[9] = source[9];
  24782. }
  24783. // Use source `func` and merge bitmasks.
  24784. data[0] = source[0];
  24785. data[1] = newBitmask;
  24786. return data;
  24787. }
  24788. /**
  24789. * This function is like
  24790. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  24791. * except that it includes inherited enumerable properties.
  24792. *
  24793. * @private
  24794. * @param {Object} object The object to query.
  24795. * @returns {Array} Returns the array of property names.
  24796. */
  24797. function nativeKeysIn(object) {
  24798. var result = [];
  24799. if (object != null) {
  24800. for (var key in Object(object)) {
  24801. result.push(key);
  24802. }
  24803. }
  24804. return result;
  24805. }
  24806. /**
  24807. * Converts `value` to a string using `Object.prototype.toString`.
  24808. *
  24809. * @private
  24810. * @param {*} value The value to convert.
  24811. * @returns {string} Returns the converted string.
  24812. */
  24813. function objectToString(value) {
  24814. return nativeObjectToString.call(value);
  24815. }
  24816. /**
  24817. * A specialized version of `baseRest` which transforms the rest array.
  24818. *
  24819. * @private
  24820. * @param {Function} func The function to apply a rest parameter to.
  24821. * @param {number} [start=func.length-1] The start position of the rest parameter.
  24822. * @param {Function} transform The rest array transform.
  24823. * @returns {Function} Returns the new function.
  24824. */
  24825. function overRest(func, start, transform) {
  24826. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  24827. return function() {
  24828. var args = arguments,
  24829. index = -1,
  24830. length = nativeMax(args.length - start, 0),
  24831. array = Array(length);
  24832. while (++index < length) {
  24833. array[index] = args[start + index];
  24834. }
  24835. index = -1;
  24836. var otherArgs = Array(start + 1);
  24837. while (++index < start) {
  24838. otherArgs[index] = args[index];
  24839. }
  24840. otherArgs[start] = transform(array);
  24841. return apply(func, this, otherArgs);
  24842. };
  24843. }
  24844. /**
  24845. * Gets the parent value at `path` of `object`.
  24846. *
  24847. * @private
  24848. * @param {Object} object The object to query.
  24849. * @param {Array} path The path to get the parent value of.
  24850. * @returns {*} Returns the parent value.
  24851. */
  24852. function parent(object, path) {
  24853. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  24854. }
  24855. /**
  24856. * Reorder `array` according to the specified indexes where the element at
  24857. * the first index is assigned as the first element, the element at
  24858. * the second index is assigned as the second element, and so on.
  24859. *
  24860. * @private
  24861. * @param {Array} array The array to reorder.
  24862. * @param {Array} indexes The arranged array indexes.
  24863. * @returns {Array} Returns `array`.
  24864. */
  24865. function reorder(array, indexes) {
  24866. var arrLength = array.length,
  24867. length = nativeMin(indexes.length, arrLength),
  24868. oldArray = copyArray(array);
  24869. while (length--) {
  24870. var index = indexes[length];
  24871. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  24872. }
  24873. return array;
  24874. }
  24875. /**
  24876. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  24877. *
  24878. * @private
  24879. * @param {Object} object The object to query.
  24880. * @param {string} key The key of the property to get.
  24881. * @returns {*} Returns the property value.
  24882. */
  24883. function safeGet(object, key) {
  24884. if (key === 'constructor' && typeof object[key] === 'function') {
  24885. return;
  24886. }
  24887. if (key == '__proto__') {
  24888. return;
  24889. }
  24890. return object[key];
  24891. }
  24892. /**
  24893. * Sets metadata for `func`.
  24894. *
  24895. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  24896. * period of time, it will trip its breaker and transition to an identity
  24897. * function to avoid garbage collection pauses in V8. See
  24898. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  24899. * for more details.
  24900. *
  24901. * @private
  24902. * @param {Function} func The function to associate metadata with.
  24903. * @param {*} data The metadata.
  24904. * @returns {Function} Returns `func`.
  24905. */
  24906. var setData = shortOut(baseSetData);
  24907. /**
  24908. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  24909. *
  24910. * @private
  24911. * @param {Function} func The function to delay.
  24912. * @param {number} wait The number of milliseconds to delay invocation.
  24913. * @returns {number|Object} Returns the timer id or timeout object.
  24914. */
  24915. var setTimeout = ctxSetTimeout || function(func, wait) {
  24916. return root.setTimeout(func, wait);
  24917. };
  24918. /**
  24919. * Sets the `toString` method of `func` to return `string`.
  24920. *
  24921. * @private
  24922. * @param {Function} func The function to modify.
  24923. * @param {Function} string The `toString` result.
  24924. * @returns {Function} Returns `func`.
  24925. */
  24926. var setToString = shortOut(baseSetToString);
  24927. /**
  24928. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  24929. * with wrapper details in a comment at the top of the source body.
  24930. *
  24931. * @private
  24932. * @param {Function} wrapper The function to modify.
  24933. * @param {Function} reference The reference function.
  24934. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24935. * @returns {Function} Returns `wrapper`.
  24936. */
  24937. function setWrapToString(wrapper, reference, bitmask) {
  24938. var source = (reference + '');
  24939. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  24940. }
  24941. /**
  24942. * Creates a function that'll short out and invoke `identity` instead
  24943. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  24944. * milliseconds.
  24945. *
  24946. * @private
  24947. * @param {Function} func The function to restrict.
  24948. * @returns {Function} Returns the new shortable function.
  24949. */
  24950. function shortOut(func) {
  24951. var count = 0,
  24952. lastCalled = 0;
  24953. return function() {
  24954. var stamp = nativeNow(),
  24955. remaining = HOT_SPAN - (stamp - lastCalled);
  24956. lastCalled = stamp;
  24957. if (remaining > 0) {
  24958. if (++count >= HOT_COUNT) {
  24959. return arguments[0];
  24960. }
  24961. } else {
  24962. count = 0;
  24963. }
  24964. return func.apply(undefined, arguments);
  24965. };
  24966. }
  24967. /**
  24968. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  24969. *
  24970. * @private
  24971. * @param {Array} array The array to shuffle.
  24972. * @param {number} [size=array.length] The size of `array`.
  24973. * @returns {Array} Returns `array`.
  24974. */
  24975. function shuffleSelf(array, size) {
  24976. var index = -1,
  24977. length = array.length,
  24978. lastIndex = length - 1;
  24979. size = size === undefined ? length : size;
  24980. while (++index < size) {
  24981. var rand = baseRandom(index, lastIndex),
  24982. value = array[rand];
  24983. array[rand] = array[index];
  24984. array[index] = value;
  24985. }
  24986. array.length = size;
  24987. return array;
  24988. }
  24989. /**
  24990. * Converts `string` to a property path array.
  24991. *
  24992. * @private
  24993. * @param {string} string The string to convert.
  24994. * @returns {Array} Returns the property path array.
  24995. */
  24996. var stringToPath = memoizeCapped(function(string) {
  24997. var result = [];
  24998. if (string.charCodeAt(0) === 46 /* . */) {
  24999. result.push('');
  25000. }
  25001. string.replace(rePropName, function(match, number, quote, subString) {
  25002. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  25003. });
  25004. return result;
  25005. });
  25006. /**
  25007. * Converts `value` to a string key if it's not a string or symbol.
  25008. *
  25009. * @private
  25010. * @param {*} value The value to inspect.
  25011. * @returns {string|symbol} Returns the key.
  25012. */
  25013. function toKey(value) {
  25014. if (typeof value == 'string' || isSymbol(value)) {
  25015. return value;
  25016. }
  25017. var result = (value + '');
  25018. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  25019. }
  25020. /**
  25021. * Converts `func` to its source code.
  25022. *
  25023. * @private
  25024. * @param {Function} func The function to convert.
  25025. * @returns {string} Returns the source code.
  25026. */
  25027. function toSource(func) {
  25028. if (func != null) {
  25029. try {
  25030. return funcToString.call(func);
  25031. } catch (e) {}
  25032. try {
  25033. return (func + '');
  25034. } catch (e) {}
  25035. }
  25036. return '';
  25037. }
  25038. /**
  25039. * Updates wrapper `details` based on `bitmask` flags.
  25040. *
  25041. * @private
  25042. * @returns {Array} details The details to modify.
  25043. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  25044. * @returns {Array} Returns `details`.
  25045. */
  25046. function updateWrapDetails(details, bitmask) {
  25047. arrayEach(wrapFlags, function(pair) {
  25048. var value = '_.' + pair[0];
  25049. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  25050. details.push(value);
  25051. }
  25052. });
  25053. return details.sort();
  25054. }
  25055. /**
  25056. * Creates a clone of `wrapper`.
  25057. *
  25058. * @private
  25059. * @param {Object} wrapper The wrapper to clone.
  25060. * @returns {Object} Returns the cloned wrapper.
  25061. */
  25062. function wrapperClone(wrapper) {
  25063. if (wrapper instanceof LazyWrapper) {
  25064. return wrapper.clone();
  25065. }
  25066. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  25067. result.__actions__ = copyArray(wrapper.__actions__);
  25068. result.__index__ = wrapper.__index__;
  25069. result.__values__ = wrapper.__values__;
  25070. return result;
  25071. }
  25072. /*------------------------------------------------------------------------*/
  25073. /**
  25074. * Creates an array of elements split into groups the length of `size`.
  25075. * If `array` can't be split evenly, the final chunk will be the remaining
  25076. * elements.
  25077. *
  25078. * @static
  25079. * @memberOf _
  25080. * @since 3.0.0
  25081. * @category Array
  25082. * @param {Array} array The array to process.
  25083. * @param {number} [size=1] The length of each chunk
  25084. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25085. * @returns {Array} Returns the new array of chunks.
  25086. * @example
  25087. *
  25088. * _.chunk(['a', 'b', 'c', 'd'], 2);
  25089. * // => [['a', 'b'], ['c', 'd']]
  25090. *
  25091. * _.chunk(['a', 'b', 'c', 'd'], 3);
  25092. * // => [['a', 'b', 'c'], ['d']]
  25093. */
  25094. function chunk(array, size, guard) {
  25095. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  25096. size = 1;
  25097. } else {
  25098. size = nativeMax(toInteger(size), 0);
  25099. }
  25100. var length = array == null ? 0 : array.length;
  25101. if (!length || size < 1) {
  25102. return [];
  25103. }
  25104. var index = 0,
  25105. resIndex = 0,
  25106. result = Array(nativeCeil(length / size));
  25107. while (index < length) {
  25108. result[resIndex++] = baseSlice(array, index, (index += size));
  25109. }
  25110. return result;
  25111. }
  25112. /**
  25113. * Creates an array with all falsey values removed. The values `false`, `null`,
  25114. * `0`, `""`, `undefined`, and `NaN` are falsey.
  25115. *
  25116. * @static
  25117. * @memberOf _
  25118. * @since 0.1.0
  25119. * @category Array
  25120. * @param {Array} array The array to compact.
  25121. * @returns {Array} Returns the new array of filtered values.
  25122. * @example
  25123. *
  25124. * _.compact([0, 1, false, 2, '', 3]);
  25125. * // => [1, 2, 3]
  25126. */
  25127. function compact(array) {
  25128. var index = -1,
  25129. length = array == null ? 0 : array.length,
  25130. resIndex = 0,
  25131. result = [];
  25132. while (++index < length) {
  25133. var value = array[index];
  25134. if (value) {
  25135. result[resIndex++] = value;
  25136. }
  25137. }
  25138. return result;
  25139. }
  25140. /**
  25141. * Creates a new array concatenating `array` with any additional arrays
  25142. * and/or values.
  25143. *
  25144. * @static
  25145. * @memberOf _
  25146. * @since 4.0.0
  25147. * @category Array
  25148. * @param {Array} array The array to concatenate.
  25149. * @param {...*} [values] The values to concatenate.
  25150. * @returns {Array} Returns the new concatenated array.
  25151. * @example
  25152. *
  25153. * var array = [1];
  25154. * var other = _.concat(array, 2, [3], [[4]]);
  25155. *
  25156. * console.log(other);
  25157. * // => [1, 2, 3, [4]]
  25158. *
  25159. * console.log(array);
  25160. * // => [1]
  25161. */
  25162. function concat() {
  25163. var length = arguments.length;
  25164. if (!length) {
  25165. return [];
  25166. }
  25167. var args = Array(length - 1),
  25168. array = arguments[0],
  25169. index = length;
  25170. while (index--) {
  25171. args[index - 1] = arguments[index];
  25172. }
  25173. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  25174. }
  25175. /**
  25176. * Creates an array of `array` values not included in the other given arrays
  25177. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25178. * for equality comparisons. The order and references of result values are
  25179. * determined by the first array.
  25180. *
  25181. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  25182. *
  25183. * @static
  25184. * @memberOf _
  25185. * @since 0.1.0
  25186. * @category Array
  25187. * @param {Array} array The array to inspect.
  25188. * @param {...Array} [values] The values to exclude.
  25189. * @returns {Array} Returns the new array of filtered values.
  25190. * @see _.without, _.xor
  25191. * @example
  25192. *
  25193. * _.difference([2, 1], [2, 3]);
  25194. * // => [1]
  25195. */
  25196. var difference = baseRest(function(array, values) {
  25197. return isArrayLikeObject(array)
  25198. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  25199. : [];
  25200. });
  25201. /**
  25202. * This method is like `_.difference` except that it accepts `iteratee` which
  25203. * is invoked for each element of `array` and `values` to generate the criterion
  25204. * by which they're compared. The order and references of result values are
  25205. * determined by the first array. The iteratee is invoked with one argument:
  25206. * (value).
  25207. *
  25208. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  25209. *
  25210. * @static
  25211. * @memberOf _
  25212. * @since 4.0.0
  25213. * @category Array
  25214. * @param {Array} array The array to inspect.
  25215. * @param {...Array} [values] The values to exclude.
  25216. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25217. * @returns {Array} Returns the new array of filtered values.
  25218. * @example
  25219. *
  25220. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25221. * // => [1.2]
  25222. *
  25223. * // The `_.property` iteratee shorthand.
  25224. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  25225. * // => [{ 'x': 2 }]
  25226. */
  25227. var differenceBy = baseRest(function(array, values) {
  25228. var iteratee = last(values);
  25229. if (isArrayLikeObject(iteratee)) {
  25230. iteratee = undefined;
  25231. }
  25232. return isArrayLikeObject(array)
  25233. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  25234. : [];
  25235. });
  25236. /**
  25237. * This method is like `_.difference` except that it accepts `comparator`
  25238. * which is invoked to compare elements of `array` to `values`. The order and
  25239. * references of result values are determined by the first array. The comparator
  25240. * is invoked with two arguments: (arrVal, othVal).
  25241. *
  25242. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  25243. *
  25244. * @static
  25245. * @memberOf _
  25246. * @since 4.0.0
  25247. * @category Array
  25248. * @param {Array} array The array to inspect.
  25249. * @param {...Array} [values] The values to exclude.
  25250. * @param {Function} [comparator] The comparator invoked per element.
  25251. * @returns {Array} Returns the new array of filtered values.
  25252. * @example
  25253. *
  25254. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25255. *
  25256. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  25257. * // => [{ 'x': 2, 'y': 1 }]
  25258. */
  25259. var differenceWith = baseRest(function(array, values) {
  25260. var comparator = last(values);
  25261. if (isArrayLikeObject(comparator)) {
  25262. comparator = undefined;
  25263. }
  25264. return isArrayLikeObject(array)
  25265. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  25266. : [];
  25267. });
  25268. /**
  25269. * Creates a slice of `array` with `n` elements dropped from the beginning.
  25270. *
  25271. * @static
  25272. * @memberOf _
  25273. * @since 0.5.0
  25274. * @category Array
  25275. * @param {Array} array The array to query.
  25276. * @param {number} [n=1] The number of elements to drop.
  25277. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25278. * @returns {Array} Returns the slice of `array`.
  25279. * @example
  25280. *
  25281. * _.drop([1, 2, 3]);
  25282. * // => [2, 3]
  25283. *
  25284. * _.drop([1, 2, 3], 2);
  25285. * // => [3]
  25286. *
  25287. * _.drop([1, 2, 3], 5);
  25288. * // => []
  25289. *
  25290. * _.drop([1, 2, 3], 0);
  25291. * // => [1, 2, 3]
  25292. */
  25293. function drop(array, n, guard) {
  25294. var length = array == null ? 0 : array.length;
  25295. if (!length) {
  25296. return [];
  25297. }
  25298. n = (guard || n === undefined) ? 1 : toInteger(n);
  25299. return baseSlice(array, n < 0 ? 0 : n, length);
  25300. }
  25301. /**
  25302. * Creates a slice of `array` with `n` elements dropped from the end.
  25303. *
  25304. * @static
  25305. * @memberOf _
  25306. * @since 3.0.0
  25307. * @category Array
  25308. * @param {Array} array The array to query.
  25309. * @param {number} [n=1] The number of elements to drop.
  25310. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25311. * @returns {Array} Returns the slice of `array`.
  25312. * @example
  25313. *
  25314. * _.dropRight([1, 2, 3]);
  25315. * // => [1, 2]
  25316. *
  25317. * _.dropRight([1, 2, 3], 2);
  25318. * // => [1]
  25319. *
  25320. * _.dropRight([1, 2, 3], 5);
  25321. * // => []
  25322. *
  25323. * _.dropRight([1, 2, 3], 0);
  25324. * // => [1, 2, 3]
  25325. */
  25326. function dropRight(array, n, guard) {
  25327. var length = array == null ? 0 : array.length;
  25328. if (!length) {
  25329. return [];
  25330. }
  25331. n = (guard || n === undefined) ? 1 : toInteger(n);
  25332. n = length - n;
  25333. return baseSlice(array, 0, n < 0 ? 0 : n);
  25334. }
  25335. /**
  25336. * Creates a slice of `array` excluding elements dropped from the end.
  25337. * Elements are dropped until `predicate` returns falsey. The predicate is
  25338. * invoked with three arguments: (value, index, array).
  25339. *
  25340. * @static
  25341. * @memberOf _
  25342. * @since 3.0.0
  25343. * @category Array
  25344. * @param {Array} array The array to query.
  25345. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25346. * @returns {Array} Returns the slice of `array`.
  25347. * @example
  25348. *
  25349. * var users = [
  25350. * { 'user': 'barney', 'active': true },
  25351. * { 'user': 'fred', 'active': false },
  25352. * { 'user': 'pebbles', 'active': false }
  25353. * ];
  25354. *
  25355. * _.dropRightWhile(users, function(o) { return !o.active; });
  25356. * // => objects for ['barney']
  25357. *
  25358. * // The `_.matches` iteratee shorthand.
  25359. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  25360. * // => objects for ['barney', 'fred']
  25361. *
  25362. * // The `_.matchesProperty` iteratee shorthand.
  25363. * _.dropRightWhile(users, ['active', false]);
  25364. * // => objects for ['barney']
  25365. *
  25366. * // The `_.property` iteratee shorthand.
  25367. * _.dropRightWhile(users, 'active');
  25368. * // => objects for ['barney', 'fred', 'pebbles']
  25369. */
  25370. function dropRightWhile(array, predicate) {
  25371. return (array && array.length)
  25372. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  25373. : [];
  25374. }
  25375. /**
  25376. * Creates a slice of `array` excluding elements dropped from the beginning.
  25377. * Elements are dropped until `predicate` returns falsey. The predicate is
  25378. * invoked with three arguments: (value, index, array).
  25379. *
  25380. * @static
  25381. * @memberOf _
  25382. * @since 3.0.0
  25383. * @category Array
  25384. * @param {Array} array The array to query.
  25385. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25386. * @returns {Array} Returns the slice of `array`.
  25387. * @example
  25388. *
  25389. * var users = [
  25390. * { 'user': 'barney', 'active': false },
  25391. * { 'user': 'fred', 'active': false },
  25392. * { 'user': 'pebbles', 'active': true }
  25393. * ];
  25394. *
  25395. * _.dropWhile(users, function(o) { return !o.active; });
  25396. * // => objects for ['pebbles']
  25397. *
  25398. * // The `_.matches` iteratee shorthand.
  25399. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  25400. * // => objects for ['fred', 'pebbles']
  25401. *
  25402. * // The `_.matchesProperty` iteratee shorthand.
  25403. * _.dropWhile(users, ['active', false]);
  25404. * // => objects for ['pebbles']
  25405. *
  25406. * // The `_.property` iteratee shorthand.
  25407. * _.dropWhile(users, 'active');
  25408. * // => objects for ['barney', 'fred', 'pebbles']
  25409. */
  25410. function dropWhile(array, predicate) {
  25411. return (array && array.length)
  25412. ? baseWhile(array, getIteratee(predicate, 3), true)
  25413. : [];
  25414. }
  25415. /**
  25416. * Fills elements of `array` with `value` from `start` up to, but not
  25417. * including, `end`.
  25418. *
  25419. * **Note:** This method mutates `array`.
  25420. *
  25421. * @static
  25422. * @memberOf _
  25423. * @since 3.2.0
  25424. * @category Array
  25425. * @param {Array} array The array to fill.
  25426. * @param {*} value The value to fill `array` with.
  25427. * @param {number} [start=0] The start position.
  25428. * @param {number} [end=array.length] The end position.
  25429. * @returns {Array} Returns `array`.
  25430. * @example
  25431. *
  25432. * var array = [1, 2, 3];
  25433. *
  25434. * _.fill(array, 'a');
  25435. * console.log(array);
  25436. * // => ['a', 'a', 'a']
  25437. *
  25438. * _.fill(Array(3), 2);
  25439. * // => [2, 2, 2]
  25440. *
  25441. * _.fill([4, 6, 8, 10], '*', 1, 3);
  25442. * // => [4, '*', '*', 10]
  25443. */
  25444. function fill(array, value, start, end) {
  25445. var length = array == null ? 0 : array.length;
  25446. if (!length) {
  25447. return [];
  25448. }
  25449. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  25450. start = 0;
  25451. end = length;
  25452. }
  25453. return baseFill(array, value, start, end);
  25454. }
  25455. /**
  25456. * This method is like `_.find` except that it returns the index of the first
  25457. * element `predicate` returns truthy for instead of the element itself.
  25458. *
  25459. * @static
  25460. * @memberOf _
  25461. * @since 1.1.0
  25462. * @category Array
  25463. * @param {Array} array The array to inspect.
  25464. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25465. * @param {number} [fromIndex=0] The index to search from.
  25466. * @returns {number} Returns the index of the found element, else `-1`.
  25467. * @example
  25468. *
  25469. * var users = [
  25470. * { 'user': 'barney', 'active': false },
  25471. * { 'user': 'fred', 'active': false },
  25472. * { 'user': 'pebbles', 'active': true }
  25473. * ];
  25474. *
  25475. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  25476. * // => 0
  25477. *
  25478. * // The `_.matches` iteratee shorthand.
  25479. * _.findIndex(users, { 'user': 'fred', 'active': false });
  25480. * // => 1
  25481. *
  25482. * // The `_.matchesProperty` iteratee shorthand.
  25483. * _.findIndex(users, ['active', false]);
  25484. * // => 0
  25485. *
  25486. * // The `_.property` iteratee shorthand.
  25487. * _.findIndex(users, 'active');
  25488. * // => 2
  25489. */
  25490. function findIndex(array, predicate, fromIndex) {
  25491. var length = array == null ? 0 : array.length;
  25492. if (!length) {
  25493. return -1;
  25494. }
  25495. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25496. if (index < 0) {
  25497. index = nativeMax(length + index, 0);
  25498. }
  25499. return baseFindIndex(array, getIteratee(predicate, 3), index);
  25500. }
  25501. /**
  25502. * This method is like `_.findIndex` except that it iterates over elements
  25503. * of `collection` from right to left.
  25504. *
  25505. * @static
  25506. * @memberOf _
  25507. * @since 2.0.0
  25508. * @category Array
  25509. * @param {Array} array The array to inspect.
  25510. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25511. * @param {number} [fromIndex=array.length-1] The index to search from.
  25512. * @returns {number} Returns the index of the found element, else `-1`.
  25513. * @example
  25514. *
  25515. * var users = [
  25516. * { 'user': 'barney', 'active': true },
  25517. * { 'user': 'fred', 'active': false },
  25518. * { 'user': 'pebbles', 'active': false }
  25519. * ];
  25520. *
  25521. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  25522. * // => 2
  25523. *
  25524. * // The `_.matches` iteratee shorthand.
  25525. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  25526. * // => 0
  25527. *
  25528. * // The `_.matchesProperty` iteratee shorthand.
  25529. * _.findLastIndex(users, ['active', false]);
  25530. * // => 2
  25531. *
  25532. * // The `_.property` iteratee shorthand.
  25533. * _.findLastIndex(users, 'active');
  25534. * // => 0
  25535. */
  25536. function findLastIndex(array, predicate, fromIndex) {
  25537. var length = array == null ? 0 : array.length;
  25538. if (!length) {
  25539. return -1;
  25540. }
  25541. var index = length - 1;
  25542. if (fromIndex !== undefined) {
  25543. index = toInteger(fromIndex);
  25544. index = fromIndex < 0
  25545. ? nativeMax(length + index, 0)
  25546. : nativeMin(index, length - 1);
  25547. }
  25548. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  25549. }
  25550. /**
  25551. * Flattens `array` a single level deep.
  25552. *
  25553. * @static
  25554. * @memberOf _
  25555. * @since 0.1.0
  25556. * @category Array
  25557. * @param {Array} array The array to flatten.
  25558. * @returns {Array} Returns the new flattened array.
  25559. * @example
  25560. *
  25561. * _.flatten([1, [2, [3, [4]], 5]]);
  25562. * // => [1, 2, [3, [4]], 5]
  25563. */
  25564. function flatten(array) {
  25565. var length = array == null ? 0 : array.length;
  25566. return length ? baseFlatten(array, 1) : [];
  25567. }
  25568. /**
  25569. * Recursively flattens `array`.
  25570. *
  25571. * @static
  25572. * @memberOf _
  25573. * @since 3.0.0
  25574. * @category Array
  25575. * @param {Array} array The array to flatten.
  25576. * @returns {Array} Returns the new flattened array.
  25577. * @example
  25578. *
  25579. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  25580. * // => [1, 2, 3, 4, 5]
  25581. */
  25582. function flattenDeep(array) {
  25583. var length = array == null ? 0 : array.length;
  25584. return length ? baseFlatten(array, INFINITY) : [];
  25585. }
  25586. /**
  25587. * Recursively flatten `array` up to `depth` times.
  25588. *
  25589. * @static
  25590. * @memberOf _
  25591. * @since 4.4.0
  25592. * @category Array
  25593. * @param {Array} array The array to flatten.
  25594. * @param {number} [depth=1] The maximum recursion depth.
  25595. * @returns {Array} Returns the new flattened array.
  25596. * @example
  25597. *
  25598. * var array = [1, [2, [3, [4]], 5]];
  25599. *
  25600. * _.flattenDepth(array, 1);
  25601. * // => [1, 2, [3, [4]], 5]
  25602. *
  25603. * _.flattenDepth(array, 2);
  25604. * // => [1, 2, 3, [4], 5]
  25605. */
  25606. function flattenDepth(array, depth) {
  25607. var length = array == null ? 0 : array.length;
  25608. if (!length) {
  25609. return [];
  25610. }
  25611. depth = depth === undefined ? 1 : toInteger(depth);
  25612. return baseFlatten(array, depth);
  25613. }
  25614. /**
  25615. * The inverse of `_.toPairs`; this method returns an object composed
  25616. * from key-value `pairs`.
  25617. *
  25618. * @static
  25619. * @memberOf _
  25620. * @since 4.0.0
  25621. * @category Array
  25622. * @param {Array} pairs The key-value pairs.
  25623. * @returns {Object} Returns the new object.
  25624. * @example
  25625. *
  25626. * _.fromPairs([['a', 1], ['b', 2]]);
  25627. * // => { 'a': 1, 'b': 2 }
  25628. */
  25629. function fromPairs(pairs) {
  25630. var index = -1,
  25631. length = pairs == null ? 0 : pairs.length,
  25632. result = {};
  25633. while (++index < length) {
  25634. var pair = pairs[index];
  25635. result[pair[0]] = pair[1];
  25636. }
  25637. return result;
  25638. }
  25639. /**
  25640. * Gets the first element of `array`.
  25641. *
  25642. * @static
  25643. * @memberOf _
  25644. * @since 0.1.0
  25645. * @alias first
  25646. * @category Array
  25647. * @param {Array} array The array to query.
  25648. * @returns {*} Returns the first element of `array`.
  25649. * @example
  25650. *
  25651. * _.head([1, 2, 3]);
  25652. * // => 1
  25653. *
  25654. * _.head([]);
  25655. * // => undefined
  25656. */
  25657. function head(array) {
  25658. return (array && array.length) ? array[0] : undefined;
  25659. }
  25660. /**
  25661. * Gets the index at which the first occurrence of `value` is found in `array`
  25662. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25663. * for equality comparisons. If `fromIndex` is negative, it's used as the
  25664. * offset from the end of `array`.
  25665. *
  25666. * @static
  25667. * @memberOf _
  25668. * @since 0.1.0
  25669. * @category Array
  25670. * @param {Array} array The array to inspect.
  25671. * @param {*} value The value to search for.
  25672. * @param {number} [fromIndex=0] The index to search from.
  25673. * @returns {number} Returns the index of the matched value, else `-1`.
  25674. * @example
  25675. *
  25676. * _.indexOf([1, 2, 1, 2], 2);
  25677. * // => 1
  25678. *
  25679. * // Search from the `fromIndex`.
  25680. * _.indexOf([1, 2, 1, 2], 2, 2);
  25681. * // => 3
  25682. */
  25683. function indexOf(array, value, fromIndex) {
  25684. var length = array == null ? 0 : array.length;
  25685. if (!length) {
  25686. return -1;
  25687. }
  25688. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25689. if (index < 0) {
  25690. index = nativeMax(length + index, 0);
  25691. }
  25692. return baseIndexOf(array, value, index);
  25693. }
  25694. /**
  25695. * Gets all but the last element of `array`.
  25696. *
  25697. * @static
  25698. * @memberOf _
  25699. * @since 0.1.0
  25700. * @category Array
  25701. * @param {Array} array The array to query.
  25702. * @returns {Array} Returns the slice of `array`.
  25703. * @example
  25704. *
  25705. * _.initial([1, 2, 3]);
  25706. * // => [1, 2]
  25707. */
  25708. function initial(array) {
  25709. var length = array == null ? 0 : array.length;
  25710. return length ? baseSlice(array, 0, -1) : [];
  25711. }
  25712. /**
  25713. * Creates an array of unique values that are included in all given arrays
  25714. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25715. * for equality comparisons. The order and references of result values are
  25716. * determined by the first array.
  25717. *
  25718. * @static
  25719. * @memberOf _
  25720. * @since 0.1.0
  25721. * @category Array
  25722. * @param {...Array} [arrays] The arrays to inspect.
  25723. * @returns {Array} Returns the new array of intersecting values.
  25724. * @example
  25725. *
  25726. * _.intersection([2, 1], [2, 3]);
  25727. * // => [2]
  25728. */
  25729. var intersection = baseRest(function(arrays) {
  25730. var mapped = arrayMap(arrays, castArrayLikeObject);
  25731. return (mapped.length && mapped[0] === arrays[0])
  25732. ? baseIntersection(mapped)
  25733. : [];
  25734. });
  25735. /**
  25736. * This method is like `_.intersection` except that it accepts `iteratee`
  25737. * which is invoked for each element of each `arrays` to generate the criterion
  25738. * by which they're compared. The order and references of result values are
  25739. * determined by the first array. The iteratee is invoked with one argument:
  25740. * (value).
  25741. *
  25742. * @static
  25743. * @memberOf _
  25744. * @since 4.0.0
  25745. * @category Array
  25746. * @param {...Array} [arrays] The arrays to inspect.
  25747. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25748. * @returns {Array} Returns the new array of intersecting values.
  25749. * @example
  25750. *
  25751. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25752. * // => [2.1]
  25753. *
  25754. * // The `_.property` iteratee shorthand.
  25755. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25756. * // => [{ 'x': 1 }]
  25757. */
  25758. var intersectionBy = baseRest(function(arrays) {
  25759. var iteratee = last(arrays),
  25760. mapped = arrayMap(arrays, castArrayLikeObject);
  25761. if (iteratee === last(mapped)) {
  25762. iteratee = undefined;
  25763. } else {
  25764. mapped.pop();
  25765. }
  25766. return (mapped.length && mapped[0] === arrays[0])
  25767. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  25768. : [];
  25769. });
  25770. /**
  25771. * This method is like `_.intersection` except that it accepts `comparator`
  25772. * which is invoked to compare elements of `arrays`. The order and references
  25773. * of result values are determined by the first array. The comparator is
  25774. * invoked with two arguments: (arrVal, othVal).
  25775. *
  25776. * @static
  25777. * @memberOf _
  25778. * @since 4.0.0
  25779. * @category Array
  25780. * @param {...Array} [arrays] The arrays to inspect.
  25781. * @param {Function} [comparator] The comparator invoked per element.
  25782. * @returns {Array} Returns the new array of intersecting values.
  25783. * @example
  25784. *
  25785. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25786. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25787. *
  25788. * _.intersectionWith(objects, others, _.isEqual);
  25789. * // => [{ 'x': 1, 'y': 2 }]
  25790. */
  25791. var intersectionWith = baseRest(function(arrays) {
  25792. var comparator = last(arrays),
  25793. mapped = arrayMap(arrays, castArrayLikeObject);
  25794. comparator = typeof comparator == 'function' ? comparator : undefined;
  25795. if (comparator) {
  25796. mapped.pop();
  25797. }
  25798. return (mapped.length && mapped[0] === arrays[0])
  25799. ? baseIntersection(mapped, undefined, comparator)
  25800. : [];
  25801. });
  25802. /**
  25803. * Converts all elements in `array` into a string separated by `separator`.
  25804. *
  25805. * @static
  25806. * @memberOf _
  25807. * @since 4.0.0
  25808. * @category Array
  25809. * @param {Array} array The array to convert.
  25810. * @param {string} [separator=','] The element separator.
  25811. * @returns {string} Returns the joined string.
  25812. * @example
  25813. *
  25814. * _.join(['a', 'b', 'c'], '~');
  25815. * // => 'a~b~c'
  25816. */
  25817. function join(array, separator) {
  25818. return array == null ? '' : nativeJoin.call(array, separator);
  25819. }
  25820. /**
  25821. * Gets the last element of `array`.
  25822. *
  25823. * @static
  25824. * @memberOf _
  25825. * @since 0.1.0
  25826. * @category Array
  25827. * @param {Array} array The array to query.
  25828. * @returns {*} Returns the last element of `array`.
  25829. * @example
  25830. *
  25831. * _.last([1, 2, 3]);
  25832. * // => 3
  25833. */
  25834. function last(array) {
  25835. var length = array == null ? 0 : array.length;
  25836. return length ? array[length - 1] : undefined;
  25837. }
  25838. /**
  25839. * This method is like `_.indexOf` except that it iterates over elements of
  25840. * `array` from right to left.
  25841. *
  25842. * @static
  25843. * @memberOf _
  25844. * @since 0.1.0
  25845. * @category Array
  25846. * @param {Array} array The array to inspect.
  25847. * @param {*} value The value to search for.
  25848. * @param {number} [fromIndex=array.length-1] The index to search from.
  25849. * @returns {number} Returns the index of the matched value, else `-1`.
  25850. * @example
  25851. *
  25852. * _.lastIndexOf([1, 2, 1, 2], 2);
  25853. * // => 3
  25854. *
  25855. * // Search from the `fromIndex`.
  25856. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  25857. * // => 1
  25858. */
  25859. function lastIndexOf(array, value, fromIndex) {
  25860. var length = array == null ? 0 : array.length;
  25861. if (!length) {
  25862. return -1;
  25863. }
  25864. var index = length;
  25865. if (fromIndex !== undefined) {
  25866. index = toInteger(fromIndex);
  25867. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  25868. }
  25869. return value === value
  25870. ? strictLastIndexOf(array, value, index)
  25871. : baseFindIndex(array, baseIsNaN, index, true);
  25872. }
  25873. /**
  25874. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  25875. * element from the end is returned.
  25876. *
  25877. * @static
  25878. * @memberOf _
  25879. * @since 4.11.0
  25880. * @category Array
  25881. * @param {Array} array The array to query.
  25882. * @param {number} [n=0] The index of the element to return.
  25883. * @returns {*} Returns the nth element of `array`.
  25884. * @example
  25885. *
  25886. * var array = ['a', 'b', 'c', 'd'];
  25887. *
  25888. * _.nth(array, 1);
  25889. * // => 'b'
  25890. *
  25891. * _.nth(array, -2);
  25892. * // => 'c';
  25893. */
  25894. function nth(array, n) {
  25895. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  25896. }
  25897. /**
  25898. * Removes all given values from `array` using
  25899. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25900. * for equality comparisons.
  25901. *
  25902. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  25903. * to remove elements from an array by predicate.
  25904. *
  25905. * @static
  25906. * @memberOf _
  25907. * @since 2.0.0
  25908. * @category Array
  25909. * @param {Array} array The array to modify.
  25910. * @param {...*} [values] The values to remove.
  25911. * @returns {Array} Returns `array`.
  25912. * @example
  25913. *
  25914. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25915. *
  25916. * _.pull(array, 'a', 'c');
  25917. * console.log(array);
  25918. * // => ['b', 'b']
  25919. */
  25920. var pull = baseRest(pullAll);
  25921. /**
  25922. * This method is like `_.pull` except that it accepts an array of values to remove.
  25923. *
  25924. * **Note:** Unlike `_.difference`, this method mutates `array`.
  25925. *
  25926. * @static
  25927. * @memberOf _
  25928. * @since 4.0.0
  25929. * @category Array
  25930. * @param {Array} array The array to modify.
  25931. * @param {Array} values The values to remove.
  25932. * @returns {Array} Returns `array`.
  25933. * @example
  25934. *
  25935. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25936. *
  25937. * _.pullAll(array, ['a', 'c']);
  25938. * console.log(array);
  25939. * // => ['b', 'b']
  25940. */
  25941. function pullAll(array, values) {
  25942. return (array && array.length && values && values.length)
  25943. ? basePullAll(array, values)
  25944. : array;
  25945. }
  25946. /**
  25947. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  25948. * invoked for each element of `array` and `values` to generate the criterion
  25949. * by which they're compared. The iteratee is invoked with one argument: (value).
  25950. *
  25951. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  25952. *
  25953. * @static
  25954. * @memberOf _
  25955. * @since 4.0.0
  25956. * @category Array
  25957. * @param {Array} array The array to modify.
  25958. * @param {Array} values The values to remove.
  25959. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25960. * @returns {Array} Returns `array`.
  25961. * @example
  25962. *
  25963. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  25964. *
  25965. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  25966. * console.log(array);
  25967. * // => [{ 'x': 2 }]
  25968. */
  25969. function pullAllBy(array, values, iteratee) {
  25970. return (array && array.length && values && values.length)
  25971. ? basePullAll(array, values, getIteratee(iteratee, 2))
  25972. : array;
  25973. }
  25974. /**
  25975. * This method is like `_.pullAll` except that it accepts `comparator` which
  25976. * is invoked to compare elements of `array` to `values`. The comparator is
  25977. * invoked with two arguments: (arrVal, othVal).
  25978. *
  25979. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  25980. *
  25981. * @static
  25982. * @memberOf _
  25983. * @since 4.6.0
  25984. * @category Array
  25985. * @param {Array} array The array to modify.
  25986. * @param {Array} values The values to remove.
  25987. * @param {Function} [comparator] The comparator invoked per element.
  25988. * @returns {Array} Returns `array`.
  25989. * @example
  25990. *
  25991. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  25992. *
  25993. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  25994. * console.log(array);
  25995. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  25996. */
  25997. function pullAllWith(array, values, comparator) {
  25998. return (array && array.length && values && values.length)
  25999. ? basePullAll(array, values, undefined, comparator)
  26000. : array;
  26001. }
  26002. /**
  26003. * Removes elements from `array` corresponding to `indexes` and returns an
  26004. * array of removed elements.
  26005. *
  26006. * **Note:** Unlike `_.at`, this method mutates `array`.
  26007. *
  26008. * @static
  26009. * @memberOf _
  26010. * @since 3.0.0
  26011. * @category Array
  26012. * @param {Array} array The array to modify.
  26013. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  26014. * @returns {Array} Returns the new array of removed elements.
  26015. * @example
  26016. *
  26017. * var array = ['a', 'b', 'c', 'd'];
  26018. * var pulled = _.pullAt(array, [1, 3]);
  26019. *
  26020. * console.log(array);
  26021. * // => ['a', 'c']
  26022. *
  26023. * console.log(pulled);
  26024. * // => ['b', 'd']
  26025. */
  26026. var pullAt = flatRest(function(array, indexes) {
  26027. var length = array == null ? 0 : array.length,
  26028. result = baseAt(array, indexes);
  26029. basePullAt(array, arrayMap(indexes, function(index) {
  26030. return isIndex(index, length) ? +index : index;
  26031. }).sort(compareAscending));
  26032. return result;
  26033. });
  26034. /**
  26035. * Removes all elements from `array` that `predicate` returns truthy for
  26036. * and returns an array of the removed elements. The predicate is invoked
  26037. * with three arguments: (value, index, array).
  26038. *
  26039. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  26040. * to pull elements from an array by value.
  26041. *
  26042. * @static
  26043. * @memberOf _
  26044. * @since 2.0.0
  26045. * @category Array
  26046. * @param {Array} array The array to modify.
  26047. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26048. * @returns {Array} Returns the new array of removed elements.
  26049. * @example
  26050. *
  26051. * var array = [1, 2, 3, 4];
  26052. * var evens = _.remove(array, function(n) {
  26053. * return n % 2 == 0;
  26054. * });
  26055. *
  26056. * console.log(array);
  26057. * // => [1, 3]
  26058. *
  26059. * console.log(evens);
  26060. * // => [2, 4]
  26061. */
  26062. function remove(array, predicate) {
  26063. var result = [];
  26064. if (!(array && array.length)) {
  26065. return result;
  26066. }
  26067. var index = -1,
  26068. indexes = [],
  26069. length = array.length;
  26070. predicate = getIteratee(predicate, 3);
  26071. while (++index < length) {
  26072. var value = array[index];
  26073. if (predicate(value, index, array)) {
  26074. result.push(value);
  26075. indexes.push(index);
  26076. }
  26077. }
  26078. basePullAt(array, indexes);
  26079. return result;
  26080. }
  26081. /**
  26082. * Reverses `array` so that the first element becomes the last, the second
  26083. * element becomes the second to last, and so on.
  26084. *
  26085. * **Note:** This method mutates `array` and is based on
  26086. * [`Array#reverse`](https://mdn.io/Array/reverse).
  26087. *
  26088. * @static
  26089. * @memberOf _
  26090. * @since 4.0.0
  26091. * @category Array
  26092. * @param {Array} array The array to modify.
  26093. * @returns {Array} Returns `array`.
  26094. * @example
  26095. *
  26096. * var array = [1, 2, 3];
  26097. *
  26098. * _.reverse(array);
  26099. * // => [3, 2, 1]
  26100. *
  26101. * console.log(array);
  26102. * // => [3, 2, 1]
  26103. */
  26104. function reverse(array) {
  26105. return array == null ? array : nativeReverse.call(array);
  26106. }
  26107. /**
  26108. * Creates a slice of `array` from `start` up to, but not including, `end`.
  26109. *
  26110. * **Note:** This method is used instead of
  26111. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  26112. * returned.
  26113. *
  26114. * @static
  26115. * @memberOf _
  26116. * @since 3.0.0
  26117. * @category Array
  26118. * @param {Array} array The array to slice.
  26119. * @param {number} [start=0] The start position.
  26120. * @param {number} [end=array.length] The end position.
  26121. * @returns {Array} Returns the slice of `array`.
  26122. */
  26123. function slice(array, start, end) {
  26124. var length = array == null ? 0 : array.length;
  26125. if (!length) {
  26126. return [];
  26127. }
  26128. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  26129. start = 0;
  26130. end = length;
  26131. }
  26132. else {
  26133. start = start == null ? 0 : toInteger(start);
  26134. end = end === undefined ? length : toInteger(end);
  26135. }
  26136. return baseSlice(array, start, end);
  26137. }
  26138. /**
  26139. * Uses a binary search to determine the lowest index at which `value`
  26140. * should be inserted into `array` in order to maintain its sort order.
  26141. *
  26142. * @static
  26143. * @memberOf _
  26144. * @since 0.1.0
  26145. * @category Array
  26146. * @param {Array} array The sorted array to inspect.
  26147. * @param {*} value The value to evaluate.
  26148. * @returns {number} Returns the index at which `value` should be inserted
  26149. * into `array`.
  26150. * @example
  26151. *
  26152. * _.sortedIndex([30, 50], 40);
  26153. * // => 1
  26154. */
  26155. function sortedIndex(array, value) {
  26156. return baseSortedIndex(array, value);
  26157. }
  26158. /**
  26159. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  26160. * which is invoked for `value` and each element of `array` to compute their
  26161. * sort ranking. The iteratee is invoked with one argument: (value).
  26162. *
  26163. * @static
  26164. * @memberOf _
  26165. * @since 4.0.0
  26166. * @category Array
  26167. * @param {Array} array The sorted array to inspect.
  26168. * @param {*} value The value to evaluate.
  26169. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26170. * @returns {number} Returns the index at which `value` should be inserted
  26171. * into `array`.
  26172. * @example
  26173. *
  26174. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  26175. *
  26176. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  26177. * // => 0
  26178. *
  26179. * // The `_.property` iteratee shorthand.
  26180. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  26181. * // => 0
  26182. */
  26183. function sortedIndexBy(array, value, iteratee) {
  26184. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  26185. }
  26186. /**
  26187. * This method is like `_.indexOf` except that it performs a binary
  26188. * search on a sorted `array`.
  26189. *
  26190. * @static
  26191. * @memberOf _
  26192. * @since 4.0.0
  26193. * @category Array
  26194. * @param {Array} array The array to inspect.
  26195. * @param {*} value The value to search for.
  26196. * @returns {number} Returns the index of the matched value, else `-1`.
  26197. * @example
  26198. *
  26199. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  26200. * // => 1
  26201. */
  26202. function sortedIndexOf(array, value) {
  26203. var length = array == null ? 0 : array.length;
  26204. if (length) {
  26205. var index = baseSortedIndex(array, value);
  26206. if (index < length && eq(array[index], value)) {
  26207. return index;
  26208. }
  26209. }
  26210. return -1;
  26211. }
  26212. /**
  26213. * This method is like `_.sortedIndex` except that it returns the highest
  26214. * index at which `value` should be inserted into `array` in order to
  26215. * maintain its sort order.
  26216. *
  26217. * @static
  26218. * @memberOf _
  26219. * @since 3.0.0
  26220. * @category Array
  26221. * @param {Array} array The sorted array to inspect.
  26222. * @param {*} value The value to evaluate.
  26223. * @returns {number} Returns the index at which `value` should be inserted
  26224. * into `array`.
  26225. * @example
  26226. *
  26227. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  26228. * // => 4
  26229. */
  26230. function sortedLastIndex(array, value) {
  26231. return baseSortedIndex(array, value, true);
  26232. }
  26233. /**
  26234. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  26235. * which is invoked for `value` and each element of `array` to compute their
  26236. * sort ranking. The iteratee is invoked with one argument: (value).
  26237. *
  26238. * @static
  26239. * @memberOf _
  26240. * @since 4.0.0
  26241. * @category Array
  26242. * @param {Array} array The sorted array to inspect.
  26243. * @param {*} value The value to evaluate.
  26244. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26245. * @returns {number} Returns the index at which `value` should be inserted
  26246. * into `array`.
  26247. * @example
  26248. *
  26249. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  26250. *
  26251. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  26252. * // => 1
  26253. *
  26254. * // The `_.property` iteratee shorthand.
  26255. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  26256. * // => 1
  26257. */
  26258. function sortedLastIndexBy(array, value, iteratee) {
  26259. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  26260. }
  26261. /**
  26262. * This method is like `_.lastIndexOf` except that it performs a binary
  26263. * search on a sorted `array`.
  26264. *
  26265. * @static
  26266. * @memberOf _
  26267. * @since 4.0.0
  26268. * @category Array
  26269. * @param {Array} array The array to inspect.
  26270. * @param {*} value The value to search for.
  26271. * @returns {number} Returns the index of the matched value, else `-1`.
  26272. * @example
  26273. *
  26274. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  26275. * // => 3
  26276. */
  26277. function sortedLastIndexOf(array, value) {
  26278. var length = array == null ? 0 : array.length;
  26279. if (length) {
  26280. var index = baseSortedIndex(array, value, true) - 1;
  26281. if (eq(array[index], value)) {
  26282. return index;
  26283. }
  26284. }
  26285. return -1;
  26286. }
  26287. /**
  26288. * This method is like `_.uniq` except that it's designed and optimized
  26289. * for sorted arrays.
  26290. *
  26291. * @static
  26292. * @memberOf _
  26293. * @since 4.0.0
  26294. * @category Array
  26295. * @param {Array} array The array to inspect.
  26296. * @returns {Array} Returns the new duplicate free array.
  26297. * @example
  26298. *
  26299. * _.sortedUniq([1, 1, 2]);
  26300. * // => [1, 2]
  26301. */
  26302. function sortedUniq(array) {
  26303. return (array && array.length)
  26304. ? baseSortedUniq(array)
  26305. : [];
  26306. }
  26307. /**
  26308. * This method is like `_.uniqBy` except that it's designed and optimized
  26309. * for sorted arrays.
  26310. *
  26311. * @static
  26312. * @memberOf _
  26313. * @since 4.0.0
  26314. * @category Array
  26315. * @param {Array} array The array to inspect.
  26316. * @param {Function} [iteratee] The iteratee invoked per element.
  26317. * @returns {Array} Returns the new duplicate free array.
  26318. * @example
  26319. *
  26320. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  26321. * // => [1.1, 2.3]
  26322. */
  26323. function sortedUniqBy(array, iteratee) {
  26324. return (array && array.length)
  26325. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  26326. : [];
  26327. }
  26328. /**
  26329. * Gets all but the first element of `array`.
  26330. *
  26331. * @static
  26332. * @memberOf _
  26333. * @since 4.0.0
  26334. * @category Array
  26335. * @param {Array} array The array to query.
  26336. * @returns {Array} Returns the slice of `array`.
  26337. * @example
  26338. *
  26339. * _.tail([1, 2, 3]);
  26340. * // => [2, 3]
  26341. */
  26342. function tail(array) {
  26343. var length = array == null ? 0 : array.length;
  26344. return length ? baseSlice(array, 1, length) : [];
  26345. }
  26346. /**
  26347. * Creates a slice of `array` with `n` elements taken from the beginning.
  26348. *
  26349. * @static
  26350. * @memberOf _
  26351. * @since 0.1.0
  26352. * @category Array
  26353. * @param {Array} array The array to query.
  26354. * @param {number} [n=1] The number of elements to take.
  26355. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26356. * @returns {Array} Returns the slice of `array`.
  26357. * @example
  26358. *
  26359. * _.take([1, 2, 3]);
  26360. * // => [1]
  26361. *
  26362. * _.take([1, 2, 3], 2);
  26363. * // => [1, 2]
  26364. *
  26365. * _.take([1, 2, 3], 5);
  26366. * // => [1, 2, 3]
  26367. *
  26368. * _.take([1, 2, 3], 0);
  26369. * // => []
  26370. */
  26371. function take(array, n, guard) {
  26372. if (!(array && array.length)) {
  26373. return [];
  26374. }
  26375. n = (guard || n === undefined) ? 1 : toInteger(n);
  26376. return baseSlice(array, 0, n < 0 ? 0 : n);
  26377. }
  26378. /**
  26379. * Creates a slice of `array` with `n` elements taken from the end.
  26380. *
  26381. * @static
  26382. * @memberOf _
  26383. * @since 3.0.0
  26384. * @category Array
  26385. * @param {Array} array The array to query.
  26386. * @param {number} [n=1] The number of elements to take.
  26387. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26388. * @returns {Array} Returns the slice of `array`.
  26389. * @example
  26390. *
  26391. * _.takeRight([1, 2, 3]);
  26392. * // => [3]
  26393. *
  26394. * _.takeRight([1, 2, 3], 2);
  26395. * // => [2, 3]
  26396. *
  26397. * _.takeRight([1, 2, 3], 5);
  26398. * // => [1, 2, 3]
  26399. *
  26400. * _.takeRight([1, 2, 3], 0);
  26401. * // => []
  26402. */
  26403. function takeRight(array, n, guard) {
  26404. var length = array == null ? 0 : array.length;
  26405. if (!length) {
  26406. return [];
  26407. }
  26408. n = (guard || n === undefined) ? 1 : toInteger(n);
  26409. n = length - n;
  26410. return baseSlice(array, n < 0 ? 0 : n, length);
  26411. }
  26412. /**
  26413. * Creates a slice of `array` with elements taken from the end. Elements are
  26414. * taken until `predicate` returns falsey. The predicate is invoked with
  26415. * three arguments: (value, index, array).
  26416. *
  26417. * @static
  26418. * @memberOf _
  26419. * @since 3.0.0
  26420. * @category Array
  26421. * @param {Array} array The array to query.
  26422. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26423. * @returns {Array} Returns the slice of `array`.
  26424. * @example
  26425. *
  26426. * var users = [
  26427. * { 'user': 'barney', 'active': true },
  26428. * { 'user': 'fred', 'active': false },
  26429. * { 'user': 'pebbles', 'active': false }
  26430. * ];
  26431. *
  26432. * _.takeRightWhile(users, function(o) { return !o.active; });
  26433. * // => objects for ['fred', 'pebbles']
  26434. *
  26435. * // The `_.matches` iteratee shorthand.
  26436. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  26437. * // => objects for ['pebbles']
  26438. *
  26439. * // The `_.matchesProperty` iteratee shorthand.
  26440. * _.takeRightWhile(users, ['active', false]);
  26441. * // => objects for ['fred', 'pebbles']
  26442. *
  26443. * // The `_.property` iteratee shorthand.
  26444. * _.takeRightWhile(users, 'active');
  26445. * // => []
  26446. */
  26447. function takeRightWhile(array, predicate) {
  26448. return (array && array.length)
  26449. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  26450. : [];
  26451. }
  26452. /**
  26453. * Creates a slice of `array` with elements taken from the beginning. Elements
  26454. * are taken until `predicate` returns falsey. The predicate is invoked with
  26455. * three arguments: (value, index, array).
  26456. *
  26457. * @static
  26458. * @memberOf _
  26459. * @since 3.0.0
  26460. * @category Array
  26461. * @param {Array} array The array to query.
  26462. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26463. * @returns {Array} Returns the slice of `array`.
  26464. * @example
  26465. *
  26466. * var users = [
  26467. * { 'user': 'barney', 'active': false },
  26468. * { 'user': 'fred', 'active': false },
  26469. * { 'user': 'pebbles', 'active': true }
  26470. * ];
  26471. *
  26472. * _.takeWhile(users, function(o) { return !o.active; });
  26473. * // => objects for ['barney', 'fred']
  26474. *
  26475. * // The `_.matches` iteratee shorthand.
  26476. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  26477. * // => objects for ['barney']
  26478. *
  26479. * // The `_.matchesProperty` iteratee shorthand.
  26480. * _.takeWhile(users, ['active', false]);
  26481. * // => objects for ['barney', 'fred']
  26482. *
  26483. * // The `_.property` iteratee shorthand.
  26484. * _.takeWhile(users, 'active');
  26485. * // => []
  26486. */
  26487. function takeWhile(array, predicate) {
  26488. return (array && array.length)
  26489. ? baseWhile(array, getIteratee(predicate, 3))
  26490. : [];
  26491. }
  26492. /**
  26493. * Creates an array of unique values, in order, from all given arrays using
  26494. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26495. * for equality comparisons.
  26496. *
  26497. * @static
  26498. * @memberOf _
  26499. * @since 0.1.0
  26500. * @category Array
  26501. * @param {...Array} [arrays] The arrays to inspect.
  26502. * @returns {Array} Returns the new array of combined values.
  26503. * @example
  26504. *
  26505. * _.union([2], [1, 2]);
  26506. * // => [2, 1]
  26507. */
  26508. var union = baseRest(function(arrays) {
  26509. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  26510. });
  26511. /**
  26512. * This method is like `_.union` except that it accepts `iteratee` which is
  26513. * invoked for each element of each `arrays` to generate the criterion by
  26514. * which uniqueness is computed. Result values are chosen from the first
  26515. * array in which the value occurs. The iteratee is invoked with one argument:
  26516. * (value).
  26517. *
  26518. * @static
  26519. * @memberOf _
  26520. * @since 4.0.0
  26521. * @category Array
  26522. * @param {...Array} [arrays] The arrays to inspect.
  26523. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26524. * @returns {Array} Returns the new array of combined values.
  26525. * @example
  26526. *
  26527. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  26528. * // => [2.1, 1.2]
  26529. *
  26530. * // The `_.property` iteratee shorthand.
  26531. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26532. * // => [{ 'x': 1 }, { 'x': 2 }]
  26533. */
  26534. var unionBy = baseRest(function(arrays) {
  26535. var iteratee = last(arrays);
  26536. if (isArrayLikeObject(iteratee)) {
  26537. iteratee = undefined;
  26538. }
  26539. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  26540. });
  26541. /**
  26542. * This method is like `_.union` except that it accepts `comparator` which
  26543. * is invoked to compare elements of `arrays`. Result values are chosen from
  26544. * the first array in which the value occurs. The comparator is invoked
  26545. * with two arguments: (arrVal, othVal).
  26546. *
  26547. * @static
  26548. * @memberOf _
  26549. * @since 4.0.0
  26550. * @category Array
  26551. * @param {...Array} [arrays] The arrays to inspect.
  26552. * @param {Function} [comparator] The comparator invoked per element.
  26553. * @returns {Array} Returns the new array of combined values.
  26554. * @example
  26555. *
  26556. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26557. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26558. *
  26559. * _.unionWith(objects, others, _.isEqual);
  26560. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26561. */
  26562. var unionWith = baseRest(function(arrays) {
  26563. var comparator = last(arrays);
  26564. comparator = typeof comparator == 'function' ? comparator : undefined;
  26565. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  26566. });
  26567. /**
  26568. * Creates a duplicate-free version of an array, using
  26569. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26570. * for equality comparisons, in which only the first occurrence of each element
  26571. * is kept. The order of result values is determined by the order they occur
  26572. * in the array.
  26573. *
  26574. * @static
  26575. * @memberOf _
  26576. * @since 0.1.0
  26577. * @category Array
  26578. * @param {Array} array The array to inspect.
  26579. * @returns {Array} Returns the new duplicate free array.
  26580. * @example
  26581. *
  26582. * _.uniq([2, 1, 2]);
  26583. * // => [2, 1]
  26584. */
  26585. function uniq(array) {
  26586. return (array && array.length) ? baseUniq(array) : [];
  26587. }
  26588. /**
  26589. * This method is like `_.uniq` except that it accepts `iteratee` which is
  26590. * invoked for each element in `array` to generate the criterion by which
  26591. * uniqueness is computed. The order of result values is determined by the
  26592. * order they occur in the array. The iteratee is invoked with one argument:
  26593. * (value).
  26594. *
  26595. * @static
  26596. * @memberOf _
  26597. * @since 4.0.0
  26598. * @category Array
  26599. * @param {Array} array The array to inspect.
  26600. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26601. * @returns {Array} Returns the new duplicate free array.
  26602. * @example
  26603. *
  26604. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  26605. * // => [2.1, 1.2]
  26606. *
  26607. * // The `_.property` iteratee shorthand.
  26608. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  26609. * // => [{ 'x': 1 }, { 'x': 2 }]
  26610. */
  26611. function uniqBy(array, iteratee) {
  26612. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  26613. }
  26614. /**
  26615. * This method is like `_.uniq` except that it accepts `comparator` which
  26616. * is invoked to compare elements of `array`. The order of result values is
  26617. * determined by the order they occur in the array.The comparator is invoked
  26618. * with two arguments: (arrVal, othVal).
  26619. *
  26620. * @static
  26621. * @memberOf _
  26622. * @since 4.0.0
  26623. * @category Array
  26624. * @param {Array} array The array to inspect.
  26625. * @param {Function} [comparator] The comparator invoked per element.
  26626. * @returns {Array} Returns the new duplicate free array.
  26627. * @example
  26628. *
  26629. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26630. *
  26631. * _.uniqWith(objects, _.isEqual);
  26632. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  26633. */
  26634. function uniqWith(array, comparator) {
  26635. comparator = typeof comparator == 'function' ? comparator : undefined;
  26636. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  26637. }
  26638. /**
  26639. * This method is like `_.zip` except that it accepts an array of grouped
  26640. * elements and creates an array regrouping the elements to their pre-zip
  26641. * configuration.
  26642. *
  26643. * @static
  26644. * @memberOf _
  26645. * @since 1.2.0
  26646. * @category Array
  26647. * @param {Array} array The array of grouped elements to process.
  26648. * @returns {Array} Returns the new array of regrouped elements.
  26649. * @example
  26650. *
  26651. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  26652. * // => [['a', 1, true], ['b', 2, false]]
  26653. *
  26654. * _.unzip(zipped);
  26655. * // => [['a', 'b'], [1, 2], [true, false]]
  26656. */
  26657. function unzip(array) {
  26658. if (!(array && array.length)) {
  26659. return [];
  26660. }
  26661. var length = 0;
  26662. array = arrayFilter(array, function(group) {
  26663. if (isArrayLikeObject(group)) {
  26664. length = nativeMax(group.length, length);
  26665. return true;
  26666. }
  26667. });
  26668. return baseTimes(length, function(index) {
  26669. return arrayMap(array, baseProperty(index));
  26670. });
  26671. }
  26672. /**
  26673. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  26674. * how regrouped values should be combined. The iteratee is invoked with the
  26675. * elements of each group: (...group).
  26676. *
  26677. * @static
  26678. * @memberOf _
  26679. * @since 3.8.0
  26680. * @category Array
  26681. * @param {Array} array The array of grouped elements to process.
  26682. * @param {Function} [iteratee=_.identity] The function to combine
  26683. * regrouped values.
  26684. * @returns {Array} Returns the new array of regrouped elements.
  26685. * @example
  26686. *
  26687. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  26688. * // => [[1, 10, 100], [2, 20, 200]]
  26689. *
  26690. * _.unzipWith(zipped, _.add);
  26691. * // => [3, 30, 300]
  26692. */
  26693. function unzipWith(array, iteratee) {
  26694. if (!(array && array.length)) {
  26695. return [];
  26696. }
  26697. var result = unzip(array);
  26698. if (iteratee == null) {
  26699. return result;
  26700. }
  26701. return arrayMap(result, function(group) {
  26702. return apply(iteratee, undefined, group);
  26703. });
  26704. }
  26705. /**
  26706. * Creates an array excluding all given values using
  26707. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26708. * for equality comparisons.
  26709. *
  26710. * **Note:** Unlike `_.pull`, this method returns a new array.
  26711. *
  26712. * @static
  26713. * @memberOf _
  26714. * @since 0.1.0
  26715. * @category Array
  26716. * @param {Array} array The array to inspect.
  26717. * @param {...*} [values] The values to exclude.
  26718. * @returns {Array} Returns the new array of filtered values.
  26719. * @see _.difference, _.xor
  26720. * @example
  26721. *
  26722. * _.without([2, 1, 2, 3], 1, 2);
  26723. * // => [3]
  26724. */
  26725. var without = baseRest(function(array, values) {
  26726. return isArrayLikeObject(array)
  26727. ? baseDifference(array, values)
  26728. : [];
  26729. });
  26730. /**
  26731. * Creates an array of unique values that is the
  26732. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  26733. * of the given arrays. The order of result values is determined by the order
  26734. * they occur in the arrays.
  26735. *
  26736. * @static
  26737. * @memberOf _
  26738. * @since 2.4.0
  26739. * @category Array
  26740. * @param {...Array} [arrays] The arrays to inspect.
  26741. * @returns {Array} Returns the new array of filtered values.
  26742. * @see _.difference, _.without
  26743. * @example
  26744. *
  26745. * _.xor([2, 1], [2, 3]);
  26746. * // => [1, 3]
  26747. */
  26748. var xor = baseRest(function(arrays) {
  26749. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  26750. });
  26751. /**
  26752. * This method is like `_.xor` except that it accepts `iteratee` which is
  26753. * invoked for each element of each `arrays` to generate the criterion by
  26754. * which by which they're compared. The order of result values is determined
  26755. * by the order they occur in the arrays. The iteratee is invoked with one
  26756. * argument: (value).
  26757. *
  26758. * @static
  26759. * @memberOf _
  26760. * @since 4.0.0
  26761. * @category Array
  26762. * @param {...Array} [arrays] The arrays to inspect.
  26763. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26764. * @returns {Array} Returns the new array of filtered values.
  26765. * @example
  26766. *
  26767. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  26768. * // => [1.2, 3.4]
  26769. *
  26770. * // The `_.property` iteratee shorthand.
  26771. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26772. * // => [{ 'x': 2 }]
  26773. */
  26774. var xorBy = baseRest(function(arrays) {
  26775. var iteratee = last(arrays);
  26776. if (isArrayLikeObject(iteratee)) {
  26777. iteratee = undefined;
  26778. }
  26779. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  26780. });
  26781. /**
  26782. * This method is like `_.xor` except that it accepts `comparator` which is
  26783. * invoked to compare elements of `arrays`. The order of result values is
  26784. * determined by the order they occur in the arrays. The comparator is invoked
  26785. * with two arguments: (arrVal, othVal).
  26786. *
  26787. * @static
  26788. * @memberOf _
  26789. * @since 4.0.0
  26790. * @category Array
  26791. * @param {...Array} [arrays] The arrays to inspect.
  26792. * @param {Function} [comparator] The comparator invoked per element.
  26793. * @returns {Array} Returns the new array of filtered values.
  26794. * @example
  26795. *
  26796. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26797. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26798. *
  26799. * _.xorWith(objects, others, _.isEqual);
  26800. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26801. */
  26802. var xorWith = baseRest(function(arrays) {
  26803. var comparator = last(arrays);
  26804. comparator = typeof comparator == 'function' ? comparator : undefined;
  26805. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  26806. });
  26807. /**
  26808. * Creates an array of grouped elements, the first of which contains the
  26809. * first elements of the given arrays, the second of which contains the
  26810. * second elements of the given arrays, and so on.
  26811. *
  26812. * @static
  26813. * @memberOf _
  26814. * @since 0.1.0
  26815. * @category Array
  26816. * @param {...Array} [arrays] The arrays to process.
  26817. * @returns {Array} Returns the new array of grouped elements.
  26818. * @example
  26819. *
  26820. * _.zip(['a', 'b'], [1, 2], [true, false]);
  26821. * // => [['a', 1, true], ['b', 2, false]]
  26822. */
  26823. var zip = baseRest(unzip);
  26824. /**
  26825. * This method is like `_.fromPairs` except that it accepts two arrays,
  26826. * one of property identifiers and one of corresponding values.
  26827. *
  26828. * @static
  26829. * @memberOf _
  26830. * @since 0.4.0
  26831. * @category Array
  26832. * @param {Array} [props=[]] The property identifiers.
  26833. * @param {Array} [values=[]] The property values.
  26834. * @returns {Object} Returns the new object.
  26835. * @example
  26836. *
  26837. * _.zipObject(['a', 'b'], [1, 2]);
  26838. * // => { 'a': 1, 'b': 2 }
  26839. */
  26840. function zipObject(props, values) {
  26841. return baseZipObject(props || [], values || [], assignValue);
  26842. }
  26843. /**
  26844. * This method is like `_.zipObject` except that it supports property paths.
  26845. *
  26846. * @static
  26847. * @memberOf _
  26848. * @since 4.1.0
  26849. * @category Array
  26850. * @param {Array} [props=[]] The property identifiers.
  26851. * @param {Array} [values=[]] The property values.
  26852. * @returns {Object} Returns the new object.
  26853. * @example
  26854. *
  26855. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  26856. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  26857. */
  26858. function zipObjectDeep(props, values) {
  26859. return baseZipObject(props || [], values || [], baseSet);
  26860. }
  26861. /**
  26862. * This method is like `_.zip` except that it accepts `iteratee` to specify
  26863. * how grouped values should be combined. The iteratee is invoked with the
  26864. * elements of each group: (...group).
  26865. *
  26866. * @static
  26867. * @memberOf _
  26868. * @since 3.8.0
  26869. * @category Array
  26870. * @param {...Array} [arrays] The arrays to process.
  26871. * @param {Function} [iteratee=_.identity] The function to combine
  26872. * grouped values.
  26873. * @returns {Array} Returns the new array of grouped elements.
  26874. * @example
  26875. *
  26876. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  26877. * return a + b + c;
  26878. * });
  26879. * // => [111, 222]
  26880. */
  26881. var zipWith = baseRest(function(arrays) {
  26882. var length = arrays.length,
  26883. iteratee = length > 1 ? arrays[length - 1] : undefined;
  26884. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  26885. return unzipWith(arrays, iteratee);
  26886. });
  26887. /*------------------------------------------------------------------------*/
  26888. /**
  26889. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  26890. * chain sequences enabled. The result of such sequences must be unwrapped
  26891. * with `_#value`.
  26892. *
  26893. * @static
  26894. * @memberOf _
  26895. * @since 1.3.0
  26896. * @category Seq
  26897. * @param {*} value The value to wrap.
  26898. * @returns {Object} Returns the new `lodash` wrapper instance.
  26899. * @example
  26900. *
  26901. * var users = [
  26902. * { 'user': 'barney', 'age': 36 },
  26903. * { 'user': 'fred', 'age': 40 },
  26904. * { 'user': 'pebbles', 'age': 1 }
  26905. * ];
  26906. *
  26907. * var youngest = _
  26908. * .chain(users)
  26909. * .sortBy('age')
  26910. * .map(function(o) {
  26911. * return o.user + ' is ' + o.age;
  26912. * })
  26913. * .head()
  26914. * .value();
  26915. * // => 'pebbles is 1'
  26916. */
  26917. function chain(value) {
  26918. var result = lodash(value);
  26919. result.__chain__ = true;
  26920. return result;
  26921. }
  26922. /**
  26923. * This method invokes `interceptor` and returns `value`. The interceptor
  26924. * is invoked with one argument; (value). The purpose of this method is to
  26925. * "tap into" a method chain sequence in order to modify intermediate results.
  26926. *
  26927. * @static
  26928. * @memberOf _
  26929. * @since 0.1.0
  26930. * @category Seq
  26931. * @param {*} value The value to provide to `interceptor`.
  26932. * @param {Function} interceptor The function to invoke.
  26933. * @returns {*} Returns `value`.
  26934. * @example
  26935. *
  26936. * _([1, 2, 3])
  26937. * .tap(function(array) {
  26938. * // Mutate input array.
  26939. * array.pop();
  26940. * })
  26941. * .reverse()
  26942. * .value();
  26943. * // => [2, 1]
  26944. */
  26945. function tap(value, interceptor) {
  26946. interceptor(value);
  26947. return value;
  26948. }
  26949. /**
  26950. * This method is like `_.tap` except that it returns the result of `interceptor`.
  26951. * The purpose of this method is to "pass thru" values replacing intermediate
  26952. * results in a method chain sequence.
  26953. *
  26954. * @static
  26955. * @memberOf _
  26956. * @since 3.0.0
  26957. * @category Seq
  26958. * @param {*} value The value to provide to `interceptor`.
  26959. * @param {Function} interceptor The function to invoke.
  26960. * @returns {*} Returns the result of `interceptor`.
  26961. * @example
  26962. *
  26963. * _(' abc ')
  26964. * .chain()
  26965. * .trim()
  26966. * .thru(function(value) {
  26967. * return [value];
  26968. * })
  26969. * .value();
  26970. * // => ['abc']
  26971. */
  26972. function thru(value, interceptor) {
  26973. return interceptor(value);
  26974. }
  26975. /**
  26976. * This method is the wrapper version of `_.at`.
  26977. *
  26978. * @name at
  26979. * @memberOf _
  26980. * @since 1.0.0
  26981. * @category Seq
  26982. * @param {...(string|string[])} [paths] The property paths to pick.
  26983. * @returns {Object} Returns the new `lodash` wrapper instance.
  26984. * @example
  26985. *
  26986. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  26987. *
  26988. * _(object).at(['a[0].b.c', 'a[1]']).value();
  26989. * // => [3, 4]
  26990. */
  26991. var wrapperAt = flatRest(function(paths) {
  26992. var length = paths.length,
  26993. start = length ? paths[0] : 0,
  26994. value = this.__wrapped__,
  26995. interceptor = function(object) { return baseAt(object, paths); };
  26996. if (length > 1 || this.__actions__.length ||
  26997. !(value instanceof LazyWrapper) || !isIndex(start)) {
  26998. return this.thru(interceptor);
  26999. }
  27000. value = value.slice(start, +start + (length ? 1 : 0));
  27001. value.__actions__.push({
  27002. 'func': thru,
  27003. 'args': [interceptor],
  27004. 'thisArg': undefined
  27005. });
  27006. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  27007. if (length && !array.length) {
  27008. array.push(undefined);
  27009. }
  27010. return array;
  27011. });
  27012. });
  27013. /**
  27014. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  27015. *
  27016. * @name chain
  27017. * @memberOf _
  27018. * @since 0.1.0
  27019. * @category Seq
  27020. * @returns {Object} Returns the new `lodash` wrapper instance.
  27021. * @example
  27022. *
  27023. * var users = [
  27024. * { 'user': 'barney', 'age': 36 },
  27025. * { 'user': 'fred', 'age': 40 }
  27026. * ];
  27027. *
  27028. * // A sequence without explicit chaining.
  27029. * _(users).head();
  27030. * // => { 'user': 'barney', 'age': 36 }
  27031. *
  27032. * // A sequence with explicit chaining.
  27033. * _(users)
  27034. * .chain()
  27035. * .head()
  27036. * .pick('user')
  27037. * .value();
  27038. * // => { 'user': 'barney' }
  27039. */
  27040. function wrapperChain() {
  27041. return chain(this);
  27042. }
  27043. /**
  27044. * Executes the chain sequence and returns the wrapped result.
  27045. *
  27046. * @name commit
  27047. * @memberOf _
  27048. * @since 3.2.0
  27049. * @category Seq
  27050. * @returns {Object} Returns the new `lodash` wrapper instance.
  27051. * @example
  27052. *
  27053. * var array = [1, 2];
  27054. * var wrapped = _(array).push(3);
  27055. *
  27056. * console.log(array);
  27057. * // => [1, 2]
  27058. *
  27059. * wrapped = wrapped.commit();
  27060. * console.log(array);
  27061. * // => [1, 2, 3]
  27062. *
  27063. * wrapped.last();
  27064. * // => 3
  27065. *
  27066. * console.log(array);
  27067. * // => [1, 2, 3]
  27068. */
  27069. function wrapperCommit() {
  27070. return new LodashWrapper(this.value(), this.__chain__);
  27071. }
  27072. /**
  27073. * Gets the next value on a wrapped object following the
  27074. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  27075. *
  27076. * @name next
  27077. * @memberOf _
  27078. * @since 4.0.0
  27079. * @category Seq
  27080. * @returns {Object} Returns the next iterator value.
  27081. * @example
  27082. *
  27083. * var wrapped = _([1, 2]);
  27084. *
  27085. * wrapped.next();
  27086. * // => { 'done': false, 'value': 1 }
  27087. *
  27088. * wrapped.next();
  27089. * // => { 'done': false, 'value': 2 }
  27090. *
  27091. * wrapped.next();
  27092. * // => { 'done': true, 'value': undefined }
  27093. */
  27094. function wrapperNext() {
  27095. if (this.__values__ === undefined) {
  27096. this.__values__ = toArray(this.value());
  27097. }
  27098. var done = this.__index__ >= this.__values__.length,
  27099. value = done ? undefined : this.__values__[this.__index__++];
  27100. return { 'done': done, 'value': value };
  27101. }
  27102. /**
  27103. * Enables the wrapper to be iterable.
  27104. *
  27105. * @name Symbol.iterator
  27106. * @memberOf _
  27107. * @since 4.0.0
  27108. * @category Seq
  27109. * @returns {Object} Returns the wrapper object.
  27110. * @example
  27111. *
  27112. * var wrapped = _([1, 2]);
  27113. *
  27114. * wrapped[Symbol.iterator]() === wrapped;
  27115. * // => true
  27116. *
  27117. * Array.from(wrapped);
  27118. * // => [1, 2]
  27119. */
  27120. function wrapperToIterator() {
  27121. return this;
  27122. }
  27123. /**
  27124. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  27125. *
  27126. * @name plant
  27127. * @memberOf _
  27128. * @since 3.2.0
  27129. * @category Seq
  27130. * @param {*} value The value to plant.
  27131. * @returns {Object} Returns the new `lodash` wrapper instance.
  27132. * @example
  27133. *
  27134. * function square(n) {
  27135. * return n * n;
  27136. * }
  27137. *
  27138. * var wrapped = _([1, 2]).map(square);
  27139. * var other = wrapped.plant([3, 4]);
  27140. *
  27141. * other.value();
  27142. * // => [9, 16]
  27143. *
  27144. * wrapped.value();
  27145. * // => [1, 4]
  27146. */
  27147. function wrapperPlant(value) {
  27148. var result,
  27149. parent = this;
  27150. while (parent instanceof baseLodash) {
  27151. var clone = wrapperClone(parent);
  27152. clone.__index__ = 0;
  27153. clone.__values__ = undefined;
  27154. if (result) {
  27155. previous.__wrapped__ = clone;
  27156. } else {
  27157. result = clone;
  27158. }
  27159. var previous = clone;
  27160. parent = parent.__wrapped__;
  27161. }
  27162. previous.__wrapped__ = value;
  27163. return result;
  27164. }
  27165. /**
  27166. * This method is the wrapper version of `_.reverse`.
  27167. *
  27168. * **Note:** This method mutates the wrapped array.
  27169. *
  27170. * @name reverse
  27171. * @memberOf _
  27172. * @since 0.1.0
  27173. * @category Seq
  27174. * @returns {Object} Returns the new `lodash` wrapper instance.
  27175. * @example
  27176. *
  27177. * var array = [1, 2, 3];
  27178. *
  27179. * _(array).reverse().value()
  27180. * // => [3, 2, 1]
  27181. *
  27182. * console.log(array);
  27183. * // => [3, 2, 1]
  27184. */
  27185. function wrapperReverse() {
  27186. var value = this.__wrapped__;
  27187. if (value instanceof LazyWrapper) {
  27188. var wrapped = value;
  27189. if (this.__actions__.length) {
  27190. wrapped = new LazyWrapper(this);
  27191. }
  27192. wrapped = wrapped.reverse();
  27193. wrapped.__actions__.push({
  27194. 'func': thru,
  27195. 'args': [reverse],
  27196. 'thisArg': undefined
  27197. });
  27198. return new LodashWrapper(wrapped, this.__chain__);
  27199. }
  27200. return this.thru(reverse);
  27201. }
  27202. /**
  27203. * Executes the chain sequence to resolve the unwrapped value.
  27204. *
  27205. * @name value
  27206. * @memberOf _
  27207. * @since 0.1.0
  27208. * @alias toJSON, valueOf
  27209. * @category Seq
  27210. * @returns {*} Returns the resolved unwrapped value.
  27211. * @example
  27212. *
  27213. * _([1, 2, 3]).value();
  27214. * // => [1, 2, 3]
  27215. */
  27216. function wrapperValue() {
  27217. return baseWrapperValue(this.__wrapped__, this.__actions__);
  27218. }
  27219. /*------------------------------------------------------------------------*/
  27220. /**
  27221. * Creates an object composed of keys generated from the results of running
  27222. * each element of `collection` thru `iteratee`. The corresponding value of
  27223. * each key is the number of times the key was returned by `iteratee`. The
  27224. * iteratee is invoked with one argument: (value).
  27225. *
  27226. * @static
  27227. * @memberOf _
  27228. * @since 0.5.0
  27229. * @category Collection
  27230. * @param {Array|Object} collection The collection to iterate over.
  27231. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27232. * @returns {Object} Returns the composed aggregate object.
  27233. * @example
  27234. *
  27235. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  27236. * // => { '4': 1, '6': 2 }
  27237. *
  27238. * // The `_.property` iteratee shorthand.
  27239. * _.countBy(['one', 'two', 'three'], 'length');
  27240. * // => { '3': 2, '5': 1 }
  27241. */
  27242. var countBy = createAggregator(function(result, value, key) {
  27243. if (hasOwnProperty.call(result, key)) {
  27244. ++result[key];
  27245. } else {
  27246. baseAssignValue(result, key, 1);
  27247. }
  27248. });
  27249. /**
  27250. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  27251. * Iteration is stopped once `predicate` returns falsey. The predicate is
  27252. * invoked with three arguments: (value, index|key, collection).
  27253. *
  27254. * **Note:** This method returns `true` for
  27255. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  27256. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  27257. * elements of empty collections.
  27258. *
  27259. * @static
  27260. * @memberOf _
  27261. * @since 0.1.0
  27262. * @category Collection
  27263. * @param {Array|Object} collection The collection to iterate over.
  27264. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27265. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27266. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  27267. * else `false`.
  27268. * @example
  27269. *
  27270. * _.every([true, 1, null, 'yes'], Boolean);
  27271. * // => false
  27272. *
  27273. * var users = [
  27274. * { 'user': 'barney', 'age': 36, 'active': false },
  27275. * { 'user': 'fred', 'age': 40, 'active': false }
  27276. * ];
  27277. *
  27278. * // The `_.matches` iteratee shorthand.
  27279. * _.every(users, { 'user': 'barney', 'active': false });
  27280. * // => false
  27281. *
  27282. * // The `_.matchesProperty` iteratee shorthand.
  27283. * _.every(users, ['active', false]);
  27284. * // => true
  27285. *
  27286. * // The `_.property` iteratee shorthand.
  27287. * _.every(users, 'active');
  27288. * // => false
  27289. */
  27290. function every(collection, predicate, guard) {
  27291. var func = isArray(collection) ? arrayEvery : baseEvery;
  27292. if (guard && isIterateeCall(collection, predicate, guard)) {
  27293. predicate = undefined;
  27294. }
  27295. return func(collection, getIteratee(predicate, 3));
  27296. }
  27297. /**
  27298. * Iterates over elements of `collection`, returning an array of all elements
  27299. * `predicate` returns truthy for. The predicate is invoked with three
  27300. * arguments: (value, index|key, collection).
  27301. *
  27302. * **Note:** Unlike `_.remove`, this method returns a new array.
  27303. *
  27304. * @static
  27305. * @memberOf _
  27306. * @since 0.1.0
  27307. * @category Collection
  27308. * @param {Array|Object} collection The collection to iterate over.
  27309. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27310. * @returns {Array} Returns the new filtered array.
  27311. * @see _.reject
  27312. * @example
  27313. *
  27314. * var users = [
  27315. * { 'user': 'barney', 'age': 36, 'active': true },
  27316. * { 'user': 'fred', 'age': 40, 'active': false }
  27317. * ];
  27318. *
  27319. * _.filter(users, function(o) { return !o.active; });
  27320. * // => objects for ['fred']
  27321. *
  27322. * // The `_.matches` iteratee shorthand.
  27323. * _.filter(users, { 'age': 36, 'active': true });
  27324. * // => objects for ['barney']
  27325. *
  27326. * // The `_.matchesProperty` iteratee shorthand.
  27327. * _.filter(users, ['active', false]);
  27328. * // => objects for ['fred']
  27329. *
  27330. * // The `_.property` iteratee shorthand.
  27331. * _.filter(users, 'active');
  27332. * // => objects for ['barney']
  27333. */
  27334. function filter(collection, predicate) {
  27335. var func = isArray(collection) ? arrayFilter : baseFilter;
  27336. return func(collection, getIteratee(predicate, 3));
  27337. }
  27338. /**
  27339. * Iterates over elements of `collection`, returning the first element
  27340. * `predicate` returns truthy for. The predicate is invoked with three
  27341. * arguments: (value, index|key, collection).
  27342. *
  27343. * @static
  27344. * @memberOf _
  27345. * @since 0.1.0
  27346. * @category Collection
  27347. * @param {Array|Object} collection The collection to inspect.
  27348. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27349. * @param {number} [fromIndex=0] The index to search from.
  27350. * @returns {*} Returns the matched element, else `undefined`.
  27351. * @example
  27352. *
  27353. * var users = [
  27354. * { 'user': 'barney', 'age': 36, 'active': true },
  27355. * { 'user': 'fred', 'age': 40, 'active': false },
  27356. * { 'user': 'pebbles', 'age': 1, 'active': true }
  27357. * ];
  27358. *
  27359. * _.find(users, function(o) { return o.age < 40; });
  27360. * // => object for 'barney'
  27361. *
  27362. * // The `_.matches` iteratee shorthand.
  27363. * _.find(users, { 'age': 1, 'active': true });
  27364. * // => object for 'pebbles'
  27365. *
  27366. * // The `_.matchesProperty` iteratee shorthand.
  27367. * _.find(users, ['active', false]);
  27368. * // => object for 'fred'
  27369. *
  27370. * // The `_.property` iteratee shorthand.
  27371. * _.find(users, 'active');
  27372. * // => object for 'barney'
  27373. */
  27374. var find = createFind(findIndex);
  27375. /**
  27376. * This method is like `_.find` except that it iterates over elements of
  27377. * `collection` from right to left.
  27378. *
  27379. * @static
  27380. * @memberOf _
  27381. * @since 2.0.0
  27382. * @category Collection
  27383. * @param {Array|Object} collection The collection to inspect.
  27384. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27385. * @param {number} [fromIndex=collection.length-1] The index to search from.
  27386. * @returns {*} Returns the matched element, else `undefined`.
  27387. * @example
  27388. *
  27389. * _.findLast([1, 2, 3, 4], function(n) {
  27390. * return n % 2 == 1;
  27391. * });
  27392. * // => 3
  27393. */
  27394. var findLast = createFind(findLastIndex);
  27395. /**
  27396. * Creates a flattened array of values by running each element in `collection`
  27397. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  27398. * with three arguments: (value, index|key, collection).
  27399. *
  27400. * @static
  27401. * @memberOf _
  27402. * @since 4.0.0
  27403. * @category Collection
  27404. * @param {Array|Object} collection The collection to iterate over.
  27405. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27406. * @returns {Array} Returns the new flattened array.
  27407. * @example
  27408. *
  27409. * function duplicate(n) {
  27410. * return [n, n];
  27411. * }
  27412. *
  27413. * _.flatMap([1, 2], duplicate);
  27414. * // => [1, 1, 2, 2]
  27415. */
  27416. function flatMap(collection, iteratee) {
  27417. return baseFlatten(map(collection, iteratee), 1);
  27418. }
  27419. /**
  27420. * This method is like `_.flatMap` except that it recursively flattens the
  27421. * mapped results.
  27422. *
  27423. * @static
  27424. * @memberOf _
  27425. * @since 4.7.0
  27426. * @category Collection
  27427. * @param {Array|Object} collection The collection to iterate over.
  27428. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27429. * @returns {Array} Returns the new flattened array.
  27430. * @example
  27431. *
  27432. * function duplicate(n) {
  27433. * return [[[n, n]]];
  27434. * }
  27435. *
  27436. * _.flatMapDeep([1, 2], duplicate);
  27437. * // => [1, 1, 2, 2]
  27438. */
  27439. function flatMapDeep(collection, iteratee) {
  27440. return baseFlatten(map(collection, iteratee), INFINITY);
  27441. }
  27442. /**
  27443. * This method is like `_.flatMap` except that it recursively flattens the
  27444. * mapped results up to `depth` times.
  27445. *
  27446. * @static
  27447. * @memberOf _
  27448. * @since 4.7.0
  27449. * @category Collection
  27450. * @param {Array|Object} collection The collection to iterate over.
  27451. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27452. * @param {number} [depth=1] The maximum recursion depth.
  27453. * @returns {Array} Returns the new flattened array.
  27454. * @example
  27455. *
  27456. * function duplicate(n) {
  27457. * return [[[n, n]]];
  27458. * }
  27459. *
  27460. * _.flatMapDepth([1, 2], duplicate, 2);
  27461. * // => [[1, 1], [2, 2]]
  27462. */
  27463. function flatMapDepth(collection, iteratee, depth) {
  27464. depth = depth === undefined ? 1 : toInteger(depth);
  27465. return baseFlatten(map(collection, iteratee), depth);
  27466. }
  27467. /**
  27468. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  27469. * The iteratee is invoked with three arguments: (value, index|key, collection).
  27470. * Iteratee functions may exit iteration early by explicitly returning `false`.
  27471. *
  27472. * **Note:** As with other "Collections" methods, objects with a "length"
  27473. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  27474. * or `_.forOwn` for object iteration.
  27475. *
  27476. * @static
  27477. * @memberOf _
  27478. * @since 0.1.0
  27479. * @alias each
  27480. * @category Collection
  27481. * @param {Array|Object} collection The collection to iterate over.
  27482. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27483. * @returns {Array|Object} Returns `collection`.
  27484. * @see _.forEachRight
  27485. * @example
  27486. *
  27487. * _.forEach([1, 2], function(value) {
  27488. * console.log(value);
  27489. * });
  27490. * // => Logs `1` then `2`.
  27491. *
  27492. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  27493. * console.log(key);
  27494. * });
  27495. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  27496. */
  27497. function forEach(collection, iteratee) {
  27498. var func = isArray(collection) ? arrayEach : baseEach;
  27499. return func(collection, getIteratee(iteratee, 3));
  27500. }
  27501. /**
  27502. * This method is like `_.forEach` except that it iterates over elements of
  27503. * `collection` from right to left.
  27504. *
  27505. * @static
  27506. * @memberOf _
  27507. * @since 2.0.0
  27508. * @alias eachRight
  27509. * @category Collection
  27510. * @param {Array|Object} collection The collection to iterate over.
  27511. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27512. * @returns {Array|Object} Returns `collection`.
  27513. * @see _.forEach
  27514. * @example
  27515. *
  27516. * _.forEachRight([1, 2], function(value) {
  27517. * console.log(value);
  27518. * });
  27519. * // => Logs `2` then `1`.
  27520. */
  27521. function forEachRight(collection, iteratee) {
  27522. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  27523. return func(collection, getIteratee(iteratee, 3));
  27524. }
  27525. /**
  27526. * Creates an object composed of keys generated from the results of running
  27527. * each element of `collection` thru `iteratee`. The order of grouped values
  27528. * is determined by the order they occur in `collection`. The corresponding
  27529. * value of each key is an array of elements responsible for generating the
  27530. * key. The iteratee is invoked with one argument: (value).
  27531. *
  27532. * @static
  27533. * @memberOf _
  27534. * @since 0.1.0
  27535. * @category Collection
  27536. * @param {Array|Object} collection The collection to iterate over.
  27537. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27538. * @returns {Object} Returns the composed aggregate object.
  27539. * @example
  27540. *
  27541. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  27542. * // => { '4': [4.2], '6': [6.1, 6.3] }
  27543. *
  27544. * // The `_.property` iteratee shorthand.
  27545. * _.groupBy(['one', 'two', 'three'], 'length');
  27546. * // => { '3': ['one', 'two'], '5': ['three'] }
  27547. */
  27548. var groupBy = createAggregator(function(result, value, key) {
  27549. if (hasOwnProperty.call(result, key)) {
  27550. result[key].push(value);
  27551. } else {
  27552. baseAssignValue(result, key, [value]);
  27553. }
  27554. });
  27555. /**
  27556. * Checks if `value` is in `collection`. If `collection` is a string, it's
  27557. * checked for a substring of `value`, otherwise
  27558. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  27559. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  27560. * the offset from the end of `collection`.
  27561. *
  27562. * @static
  27563. * @memberOf _
  27564. * @since 0.1.0
  27565. * @category Collection
  27566. * @param {Array|Object|string} collection The collection to inspect.
  27567. * @param {*} value The value to search for.
  27568. * @param {number} [fromIndex=0] The index to search from.
  27569. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27570. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  27571. * @example
  27572. *
  27573. * _.includes([1, 2, 3], 1);
  27574. * // => true
  27575. *
  27576. * _.includes([1, 2, 3], 1, 2);
  27577. * // => false
  27578. *
  27579. * _.includes({ 'a': 1, 'b': 2 }, 1);
  27580. * // => true
  27581. *
  27582. * _.includes('abcd', 'bc');
  27583. * // => true
  27584. */
  27585. function includes(collection, value, fromIndex, guard) {
  27586. collection = isArrayLike(collection) ? collection : values(collection);
  27587. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  27588. var length = collection.length;
  27589. if (fromIndex < 0) {
  27590. fromIndex = nativeMax(length + fromIndex, 0);
  27591. }
  27592. return isString(collection)
  27593. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  27594. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  27595. }
  27596. /**
  27597. * Invokes the method at `path` of each element in `collection`, returning
  27598. * an array of the results of each invoked method. Any additional arguments
  27599. * are provided to each invoked method. If `path` is a function, it's invoked
  27600. * for, and `this` bound to, each element in `collection`.
  27601. *
  27602. * @static
  27603. * @memberOf _
  27604. * @since 4.0.0
  27605. * @category Collection
  27606. * @param {Array|Object} collection The collection to iterate over.
  27607. * @param {Array|Function|string} path The path of the method to invoke or
  27608. * the function invoked per iteration.
  27609. * @param {...*} [args] The arguments to invoke each method with.
  27610. * @returns {Array} Returns the array of results.
  27611. * @example
  27612. *
  27613. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  27614. * // => [[1, 5, 7], [1, 2, 3]]
  27615. *
  27616. * _.invokeMap([123, 456], String.prototype.split, '');
  27617. * // => [['1', '2', '3'], ['4', '5', '6']]
  27618. */
  27619. var invokeMap = baseRest(function(collection, path, args) {
  27620. var index = -1,
  27621. isFunc = typeof path == 'function',
  27622. result = isArrayLike(collection) ? Array(collection.length) : [];
  27623. baseEach(collection, function(value) {
  27624. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  27625. });
  27626. return result;
  27627. });
  27628. /**
  27629. * Creates an object composed of keys generated from the results of running
  27630. * each element of `collection` thru `iteratee`. The corresponding value of
  27631. * each key is the last element responsible for generating the key. The
  27632. * iteratee is invoked with one argument: (value).
  27633. *
  27634. * @static
  27635. * @memberOf _
  27636. * @since 4.0.0
  27637. * @category Collection
  27638. * @param {Array|Object} collection The collection to iterate over.
  27639. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27640. * @returns {Object} Returns the composed aggregate object.
  27641. * @example
  27642. *
  27643. * var array = [
  27644. * { 'dir': 'left', 'code': 97 },
  27645. * { 'dir': 'right', 'code': 100 }
  27646. * ];
  27647. *
  27648. * _.keyBy(array, function(o) {
  27649. * return String.fromCharCode(o.code);
  27650. * });
  27651. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  27652. *
  27653. * _.keyBy(array, 'dir');
  27654. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  27655. */
  27656. var keyBy = createAggregator(function(result, value, key) {
  27657. baseAssignValue(result, key, value);
  27658. });
  27659. /**
  27660. * Creates an array of values by running each element in `collection` thru
  27661. * `iteratee`. The iteratee is invoked with three arguments:
  27662. * (value, index|key, collection).
  27663. *
  27664. * Many lodash methods are guarded to work as iteratees for methods like
  27665. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  27666. *
  27667. * The guarded methods are:
  27668. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  27669. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  27670. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  27671. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  27672. *
  27673. * @static
  27674. * @memberOf _
  27675. * @since 0.1.0
  27676. * @category Collection
  27677. * @param {Array|Object} collection The collection to iterate over.
  27678. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27679. * @returns {Array} Returns the new mapped array.
  27680. * @example
  27681. *
  27682. * function square(n) {
  27683. * return n * n;
  27684. * }
  27685. *
  27686. * _.map([4, 8], square);
  27687. * // => [16, 64]
  27688. *
  27689. * _.map({ 'a': 4, 'b': 8 }, square);
  27690. * // => [16, 64] (iteration order is not guaranteed)
  27691. *
  27692. * var users = [
  27693. * { 'user': 'barney' },
  27694. * { 'user': 'fred' }
  27695. * ];
  27696. *
  27697. * // The `_.property` iteratee shorthand.
  27698. * _.map(users, 'user');
  27699. * // => ['barney', 'fred']
  27700. */
  27701. function map(collection, iteratee) {
  27702. var func = isArray(collection) ? arrayMap : baseMap;
  27703. return func(collection, getIteratee(iteratee, 3));
  27704. }
  27705. /**
  27706. * This method is like `_.sortBy` except that it allows specifying the sort
  27707. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  27708. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  27709. * descending or "asc" for ascending sort order of corresponding values.
  27710. *
  27711. * @static
  27712. * @memberOf _
  27713. * @since 4.0.0
  27714. * @category Collection
  27715. * @param {Array|Object} collection The collection to iterate over.
  27716. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  27717. * The iteratees to sort by.
  27718. * @param {string[]} [orders] The sort orders of `iteratees`.
  27719. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27720. * @returns {Array} Returns the new sorted array.
  27721. * @example
  27722. *
  27723. * var users = [
  27724. * { 'user': 'fred', 'age': 48 },
  27725. * { 'user': 'barney', 'age': 34 },
  27726. * { 'user': 'fred', 'age': 40 },
  27727. * { 'user': 'barney', 'age': 36 }
  27728. * ];
  27729. *
  27730. * // Sort by `user` in ascending order and by `age` in descending order.
  27731. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  27732. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27733. */
  27734. function orderBy(collection, iteratees, orders, guard) {
  27735. if (collection == null) {
  27736. return [];
  27737. }
  27738. if (!isArray(iteratees)) {
  27739. iteratees = iteratees == null ? [] : [iteratees];
  27740. }
  27741. orders = guard ? undefined : orders;
  27742. if (!isArray(orders)) {
  27743. orders = orders == null ? [] : [orders];
  27744. }
  27745. return baseOrderBy(collection, iteratees, orders);
  27746. }
  27747. /**
  27748. * Creates an array of elements split into two groups, the first of which
  27749. * contains elements `predicate` returns truthy for, the second of which
  27750. * contains elements `predicate` returns falsey for. The predicate is
  27751. * invoked with one argument: (value).
  27752. *
  27753. * @static
  27754. * @memberOf _
  27755. * @since 3.0.0
  27756. * @category Collection
  27757. * @param {Array|Object} collection The collection to iterate over.
  27758. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27759. * @returns {Array} Returns the array of grouped elements.
  27760. * @example
  27761. *
  27762. * var users = [
  27763. * { 'user': 'barney', 'age': 36, 'active': false },
  27764. * { 'user': 'fred', 'age': 40, 'active': true },
  27765. * { 'user': 'pebbles', 'age': 1, 'active': false }
  27766. * ];
  27767. *
  27768. * _.partition(users, function(o) { return o.active; });
  27769. * // => objects for [['fred'], ['barney', 'pebbles']]
  27770. *
  27771. * // The `_.matches` iteratee shorthand.
  27772. * _.partition(users, { 'age': 1, 'active': false });
  27773. * // => objects for [['pebbles'], ['barney', 'fred']]
  27774. *
  27775. * // The `_.matchesProperty` iteratee shorthand.
  27776. * _.partition(users, ['active', false]);
  27777. * // => objects for [['barney', 'pebbles'], ['fred']]
  27778. *
  27779. * // The `_.property` iteratee shorthand.
  27780. * _.partition(users, 'active');
  27781. * // => objects for [['fred'], ['barney', 'pebbles']]
  27782. */
  27783. var partition = createAggregator(function(result, value, key) {
  27784. result[key ? 0 : 1].push(value);
  27785. }, function() { return [[], []]; });
  27786. /**
  27787. * Reduces `collection` to a value which is the accumulated result of running
  27788. * each element in `collection` thru `iteratee`, where each successive
  27789. * invocation is supplied the return value of the previous. If `accumulator`
  27790. * is not given, the first element of `collection` is used as the initial
  27791. * value. The iteratee is invoked with four arguments:
  27792. * (accumulator, value, index|key, collection).
  27793. *
  27794. * Many lodash methods are guarded to work as iteratees for methods like
  27795. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  27796. *
  27797. * The guarded methods are:
  27798. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  27799. * and `sortBy`
  27800. *
  27801. * @static
  27802. * @memberOf _
  27803. * @since 0.1.0
  27804. * @category Collection
  27805. * @param {Array|Object} collection The collection to iterate over.
  27806. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27807. * @param {*} [accumulator] The initial value.
  27808. * @returns {*} Returns the accumulated value.
  27809. * @see _.reduceRight
  27810. * @example
  27811. *
  27812. * _.reduce([1, 2], function(sum, n) {
  27813. * return sum + n;
  27814. * }, 0);
  27815. * // => 3
  27816. *
  27817. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  27818. * (result[value] || (result[value] = [])).push(key);
  27819. * return result;
  27820. * }, {});
  27821. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  27822. */
  27823. function reduce(collection, iteratee, accumulator) {
  27824. var func = isArray(collection) ? arrayReduce : baseReduce,
  27825. initAccum = arguments.length < 3;
  27826. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  27827. }
  27828. /**
  27829. * This method is like `_.reduce` except that it iterates over elements of
  27830. * `collection` from right to left.
  27831. *
  27832. * @static
  27833. * @memberOf _
  27834. * @since 0.1.0
  27835. * @category Collection
  27836. * @param {Array|Object} collection The collection to iterate over.
  27837. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27838. * @param {*} [accumulator] The initial value.
  27839. * @returns {*} Returns the accumulated value.
  27840. * @see _.reduce
  27841. * @example
  27842. *
  27843. * var array = [[0, 1], [2, 3], [4, 5]];
  27844. *
  27845. * _.reduceRight(array, function(flattened, other) {
  27846. * return flattened.concat(other);
  27847. * }, []);
  27848. * // => [4, 5, 2, 3, 0, 1]
  27849. */
  27850. function reduceRight(collection, iteratee, accumulator) {
  27851. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  27852. initAccum = arguments.length < 3;
  27853. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  27854. }
  27855. /**
  27856. * The opposite of `_.filter`; this method returns the elements of `collection`
  27857. * that `predicate` does **not** return truthy for.
  27858. *
  27859. * @static
  27860. * @memberOf _
  27861. * @since 0.1.0
  27862. * @category Collection
  27863. * @param {Array|Object} collection The collection to iterate over.
  27864. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27865. * @returns {Array} Returns the new filtered array.
  27866. * @see _.filter
  27867. * @example
  27868. *
  27869. * var users = [
  27870. * { 'user': 'barney', 'age': 36, 'active': false },
  27871. * { 'user': 'fred', 'age': 40, 'active': true }
  27872. * ];
  27873. *
  27874. * _.reject(users, function(o) { return !o.active; });
  27875. * // => objects for ['fred']
  27876. *
  27877. * // The `_.matches` iteratee shorthand.
  27878. * _.reject(users, { 'age': 40, 'active': true });
  27879. * // => objects for ['barney']
  27880. *
  27881. * // The `_.matchesProperty` iteratee shorthand.
  27882. * _.reject(users, ['active', false]);
  27883. * // => objects for ['fred']
  27884. *
  27885. * // The `_.property` iteratee shorthand.
  27886. * _.reject(users, 'active');
  27887. * // => objects for ['barney']
  27888. */
  27889. function reject(collection, predicate) {
  27890. var func = isArray(collection) ? arrayFilter : baseFilter;
  27891. return func(collection, negate(getIteratee(predicate, 3)));
  27892. }
  27893. /**
  27894. * Gets a random element from `collection`.
  27895. *
  27896. * @static
  27897. * @memberOf _
  27898. * @since 2.0.0
  27899. * @category Collection
  27900. * @param {Array|Object} collection The collection to sample.
  27901. * @returns {*} Returns the random element.
  27902. * @example
  27903. *
  27904. * _.sample([1, 2, 3, 4]);
  27905. * // => 2
  27906. */
  27907. function sample(collection) {
  27908. var func = isArray(collection) ? arraySample : baseSample;
  27909. return func(collection);
  27910. }
  27911. /**
  27912. * Gets `n` random elements at unique keys from `collection` up to the
  27913. * size of `collection`.
  27914. *
  27915. * @static
  27916. * @memberOf _
  27917. * @since 4.0.0
  27918. * @category Collection
  27919. * @param {Array|Object} collection The collection to sample.
  27920. * @param {number} [n=1] The number of elements to sample.
  27921. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27922. * @returns {Array} Returns the random elements.
  27923. * @example
  27924. *
  27925. * _.sampleSize([1, 2, 3], 2);
  27926. * // => [3, 1]
  27927. *
  27928. * _.sampleSize([1, 2, 3], 4);
  27929. * // => [2, 3, 1]
  27930. */
  27931. function sampleSize(collection, n, guard) {
  27932. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  27933. n = 1;
  27934. } else {
  27935. n = toInteger(n);
  27936. }
  27937. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  27938. return func(collection, n);
  27939. }
  27940. /**
  27941. * Creates an array of shuffled values, using a version of the
  27942. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  27943. *
  27944. * @static
  27945. * @memberOf _
  27946. * @since 0.1.0
  27947. * @category Collection
  27948. * @param {Array|Object} collection The collection to shuffle.
  27949. * @returns {Array} Returns the new shuffled array.
  27950. * @example
  27951. *
  27952. * _.shuffle([1, 2, 3, 4]);
  27953. * // => [4, 1, 3, 2]
  27954. */
  27955. function shuffle(collection) {
  27956. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  27957. return func(collection);
  27958. }
  27959. /**
  27960. * Gets the size of `collection` by returning its length for array-like
  27961. * values or the number of own enumerable string keyed properties for objects.
  27962. *
  27963. * @static
  27964. * @memberOf _
  27965. * @since 0.1.0
  27966. * @category Collection
  27967. * @param {Array|Object|string} collection The collection to inspect.
  27968. * @returns {number} Returns the collection size.
  27969. * @example
  27970. *
  27971. * _.size([1, 2, 3]);
  27972. * // => 3
  27973. *
  27974. * _.size({ 'a': 1, 'b': 2 });
  27975. * // => 2
  27976. *
  27977. * _.size('pebbles');
  27978. * // => 7
  27979. */
  27980. function size(collection) {
  27981. if (collection == null) {
  27982. return 0;
  27983. }
  27984. if (isArrayLike(collection)) {
  27985. return isString(collection) ? stringSize(collection) : collection.length;
  27986. }
  27987. var tag = getTag(collection);
  27988. if (tag == mapTag || tag == setTag) {
  27989. return collection.size;
  27990. }
  27991. return baseKeys(collection).length;
  27992. }
  27993. /**
  27994. * Checks if `predicate` returns truthy for **any** element of `collection`.
  27995. * Iteration is stopped once `predicate` returns truthy. The predicate is
  27996. * invoked with three arguments: (value, index|key, collection).
  27997. *
  27998. * @static
  27999. * @memberOf _
  28000. * @since 0.1.0
  28001. * @category Collection
  28002. * @param {Array|Object} collection The collection to iterate over.
  28003. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  28004. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28005. * @returns {boolean} Returns `true` if any element passes the predicate check,
  28006. * else `false`.
  28007. * @example
  28008. *
  28009. * _.some([null, 0, 'yes', false], Boolean);
  28010. * // => true
  28011. *
  28012. * var users = [
  28013. * { 'user': 'barney', 'active': true },
  28014. * { 'user': 'fred', 'active': false }
  28015. * ];
  28016. *
  28017. * // The `_.matches` iteratee shorthand.
  28018. * _.some(users, { 'user': 'barney', 'active': false });
  28019. * // => false
  28020. *
  28021. * // The `_.matchesProperty` iteratee shorthand.
  28022. * _.some(users, ['active', false]);
  28023. * // => true
  28024. *
  28025. * // The `_.property` iteratee shorthand.
  28026. * _.some(users, 'active');
  28027. * // => true
  28028. */
  28029. function some(collection, predicate, guard) {
  28030. var func = isArray(collection) ? arraySome : baseSome;
  28031. if (guard && isIterateeCall(collection, predicate, guard)) {
  28032. predicate = undefined;
  28033. }
  28034. return func(collection, getIteratee(predicate, 3));
  28035. }
  28036. /**
  28037. * Creates an array of elements, sorted in ascending order by the results of
  28038. * running each element in a collection thru each iteratee. This method
  28039. * performs a stable sort, that is, it preserves the original sort order of
  28040. * equal elements. The iteratees are invoked with one argument: (value).
  28041. *
  28042. * @static
  28043. * @memberOf _
  28044. * @since 0.1.0
  28045. * @category Collection
  28046. * @param {Array|Object} collection The collection to iterate over.
  28047. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  28048. * The iteratees to sort by.
  28049. * @returns {Array} Returns the new sorted array.
  28050. * @example
  28051. *
  28052. * var users = [
  28053. * { 'user': 'fred', 'age': 48 },
  28054. * { 'user': 'barney', 'age': 36 },
  28055. * { 'user': 'fred', 'age': 40 },
  28056. * { 'user': 'barney', 'age': 34 }
  28057. * ];
  28058. *
  28059. * _.sortBy(users, [function(o) { return o.user; }]);
  28060. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  28061. *
  28062. * _.sortBy(users, ['user', 'age']);
  28063. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  28064. */
  28065. var sortBy = baseRest(function(collection, iteratees) {
  28066. if (collection == null) {
  28067. return [];
  28068. }
  28069. var length = iteratees.length;
  28070. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  28071. iteratees = [];
  28072. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  28073. iteratees = [iteratees[0]];
  28074. }
  28075. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  28076. });
  28077. /*------------------------------------------------------------------------*/
  28078. /**
  28079. * Gets the timestamp of the number of milliseconds that have elapsed since
  28080. * the Unix epoch (1 January 1970 00:00:00 UTC).
  28081. *
  28082. * @static
  28083. * @memberOf _
  28084. * @since 2.4.0
  28085. * @category Date
  28086. * @returns {number} Returns the timestamp.
  28087. * @example
  28088. *
  28089. * _.defer(function(stamp) {
  28090. * console.log(_.now() - stamp);
  28091. * }, _.now());
  28092. * // => Logs the number of milliseconds it took for the deferred invocation.
  28093. */
  28094. var now = ctxNow || function() {
  28095. return root.Date.now();
  28096. };
  28097. /*------------------------------------------------------------------------*/
  28098. /**
  28099. * The opposite of `_.before`; this method creates a function that invokes
  28100. * `func` once it's called `n` or more times.
  28101. *
  28102. * @static
  28103. * @memberOf _
  28104. * @since 0.1.0
  28105. * @category Function
  28106. * @param {number} n The number of calls before `func` is invoked.
  28107. * @param {Function} func The function to restrict.
  28108. * @returns {Function} Returns the new restricted function.
  28109. * @example
  28110. *
  28111. * var saves = ['profile', 'settings'];
  28112. *
  28113. * var done = _.after(saves.length, function() {
  28114. * console.log('done saving!');
  28115. * });
  28116. *
  28117. * _.forEach(saves, function(type) {
  28118. * asyncSave({ 'type': type, 'complete': done });
  28119. * });
  28120. * // => Logs 'done saving!' after the two async saves have completed.
  28121. */
  28122. function after(n, func) {
  28123. if (typeof func != 'function') {
  28124. throw new TypeError(FUNC_ERROR_TEXT);
  28125. }
  28126. n = toInteger(n);
  28127. return function() {
  28128. if (--n < 1) {
  28129. return func.apply(this, arguments);
  28130. }
  28131. };
  28132. }
  28133. /**
  28134. * Creates a function that invokes `func`, with up to `n` arguments,
  28135. * ignoring any additional arguments.
  28136. *
  28137. * @static
  28138. * @memberOf _
  28139. * @since 3.0.0
  28140. * @category Function
  28141. * @param {Function} func The function to cap arguments for.
  28142. * @param {number} [n=func.length] The arity cap.
  28143. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28144. * @returns {Function} Returns the new capped function.
  28145. * @example
  28146. *
  28147. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  28148. * // => [6, 8, 10]
  28149. */
  28150. function ary(func, n, guard) {
  28151. n = guard ? undefined : n;
  28152. n = (func && n == null) ? func.length : n;
  28153. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  28154. }
  28155. /**
  28156. * Creates a function that invokes `func`, with the `this` binding and arguments
  28157. * of the created function, while it's called less than `n` times. Subsequent
  28158. * calls to the created function return the result of the last `func` invocation.
  28159. *
  28160. * @static
  28161. * @memberOf _
  28162. * @since 3.0.0
  28163. * @category Function
  28164. * @param {number} n The number of calls at which `func` is no longer invoked.
  28165. * @param {Function} func The function to restrict.
  28166. * @returns {Function} Returns the new restricted function.
  28167. * @example
  28168. *
  28169. * jQuery(element).on('click', _.before(5, addContactToList));
  28170. * // => Allows adding up to 4 contacts to the list.
  28171. */
  28172. function before(n, func) {
  28173. var result;
  28174. if (typeof func != 'function') {
  28175. throw new TypeError(FUNC_ERROR_TEXT);
  28176. }
  28177. n = toInteger(n);
  28178. return function() {
  28179. if (--n > 0) {
  28180. result = func.apply(this, arguments);
  28181. }
  28182. if (n <= 1) {
  28183. func = undefined;
  28184. }
  28185. return result;
  28186. };
  28187. }
  28188. /**
  28189. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  28190. * and `partials` prepended to the arguments it receives.
  28191. *
  28192. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  28193. * may be used as a placeholder for partially applied arguments.
  28194. *
  28195. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  28196. * property of bound functions.
  28197. *
  28198. * @static
  28199. * @memberOf _
  28200. * @since 0.1.0
  28201. * @category Function
  28202. * @param {Function} func The function to bind.
  28203. * @param {*} thisArg The `this` binding of `func`.
  28204. * @param {...*} [partials] The arguments to be partially applied.
  28205. * @returns {Function} Returns the new bound function.
  28206. * @example
  28207. *
  28208. * function greet(greeting, punctuation) {
  28209. * return greeting + ' ' + this.user + punctuation;
  28210. * }
  28211. *
  28212. * var object = { 'user': 'fred' };
  28213. *
  28214. * var bound = _.bind(greet, object, 'hi');
  28215. * bound('!');
  28216. * // => 'hi fred!'
  28217. *
  28218. * // Bound with placeholders.
  28219. * var bound = _.bind(greet, object, _, '!');
  28220. * bound('hi');
  28221. * // => 'hi fred!'
  28222. */
  28223. var bind = baseRest(function(func, thisArg, partials) {
  28224. var bitmask = WRAP_BIND_FLAG;
  28225. if (partials.length) {
  28226. var holders = replaceHolders(partials, getHolder(bind));
  28227. bitmask |= WRAP_PARTIAL_FLAG;
  28228. }
  28229. return createWrap(func, bitmask, thisArg, partials, holders);
  28230. });
  28231. /**
  28232. * Creates a function that invokes the method at `object[key]` with `partials`
  28233. * prepended to the arguments it receives.
  28234. *
  28235. * This method differs from `_.bind` by allowing bound functions to reference
  28236. * methods that may be redefined or don't yet exist. See
  28237. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  28238. * for more details.
  28239. *
  28240. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  28241. * builds, may be used as a placeholder for partially applied arguments.
  28242. *
  28243. * @static
  28244. * @memberOf _
  28245. * @since 0.10.0
  28246. * @category Function
  28247. * @param {Object} object The object to invoke the method on.
  28248. * @param {string} key The key of the method.
  28249. * @param {...*} [partials] The arguments to be partially applied.
  28250. * @returns {Function} Returns the new bound function.
  28251. * @example
  28252. *
  28253. * var object = {
  28254. * 'user': 'fred',
  28255. * 'greet': function(greeting, punctuation) {
  28256. * return greeting + ' ' + this.user + punctuation;
  28257. * }
  28258. * };
  28259. *
  28260. * var bound = _.bindKey(object, 'greet', 'hi');
  28261. * bound('!');
  28262. * // => 'hi fred!'
  28263. *
  28264. * object.greet = function(greeting, punctuation) {
  28265. * return greeting + 'ya ' + this.user + punctuation;
  28266. * };
  28267. *
  28268. * bound('!');
  28269. * // => 'hiya fred!'
  28270. *
  28271. * // Bound with placeholders.
  28272. * var bound = _.bindKey(object, 'greet', _, '!');
  28273. * bound('hi');
  28274. * // => 'hiya fred!'
  28275. */
  28276. var bindKey = baseRest(function(object, key, partials) {
  28277. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  28278. if (partials.length) {
  28279. var holders = replaceHolders(partials, getHolder(bindKey));
  28280. bitmask |= WRAP_PARTIAL_FLAG;
  28281. }
  28282. return createWrap(key, bitmask, object, partials, holders);
  28283. });
  28284. /**
  28285. * Creates a function that accepts arguments of `func` and either invokes
  28286. * `func` returning its result, if at least `arity` number of arguments have
  28287. * been provided, or returns a function that accepts the remaining `func`
  28288. * arguments, and so on. The arity of `func` may be specified if `func.length`
  28289. * is not sufficient.
  28290. *
  28291. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  28292. * may be used as a placeholder for provided arguments.
  28293. *
  28294. * **Note:** This method doesn't set the "length" property of curried functions.
  28295. *
  28296. * @static
  28297. * @memberOf _
  28298. * @since 2.0.0
  28299. * @category Function
  28300. * @param {Function} func The function to curry.
  28301. * @param {number} [arity=func.length] The arity of `func`.
  28302. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28303. * @returns {Function} Returns the new curried function.
  28304. * @example
  28305. *
  28306. * var abc = function(a, b, c) {
  28307. * return [a, b, c];
  28308. * };
  28309. *
  28310. * var curried = _.curry(abc);
  28311. *
  28312. * curried(1)(2)(3);
  28313. * // => [1, 2, 3]
  28314. *
  28315. * curried(1, 2)(3);
  28316. * // => [1, 2, 3]
  28317. *
  28318. * curried(1, 2, 3);
  28319. * // => [1, 2, 3]
  28320. *
  28321. * // Curried with placeholders.
  28322. * curried(1)(_, 3)(2);
  28323. * // => [1, 2, 3]
  28324. */
  28325. function curry(func, arity, guard) {
  28326. arity = guard ? undefined : arity;
  28327. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  28328. result.placeholder = curry.placeholder;
  28329. return result;
  28330. }
  28331. /**
  28332. * This method is like `_.curry` except that arguments are applied to `func`
  28333. * in the manner of `_.partialRight` instead of `_.partial`.
  28334. *
  28335. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  28336. * builds, may be used as a placeholder for provided arguments.
  28337. *
  28338. * **Note:** This method doesn't set the "length" property of curried functions.
  28339. *
  28340. * @static
  28341. * @memberOf _
  28342. * @since 3.0.0
  28343. * @category Function
  28344. * @param {Function} func The function to curry.
  28345. * @param {number} [arity=func.length] The arity of `func`.
  28346. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28347. * @returns {Function} Returns the new curried function.
  28348. * @example
  28349. *
  28350. * var abc = function(a, b, c) {
  28351. * return [a, b, c];
  28352. * };
  28353. *
  28354. * var curried = _.curryRight(abc);
  28355. *
  28356. * curried(3)(2)(1);
  28357. * // => [1, 2, 3]
  28358. *
  28359. * curried(2, 3)(1);
  28360. * // => [1, 2, 3]
  28361. *
  28362. * curried(1, 2, 3);
  28363. * // => [1, 2, 3]
  28364. *
  28365. * // Curried with placeholders.
  28366. * curried(3)(1, _)(2);
  28367. * // => [1, 2, 3]
  28368. */
  28369. function curryRight(func, arity, guard) {
  28370. arity = guard ? undefined : arity;
  28371. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  28372. result.placeholder = curryRight.placeholder;
  28373. return result;
  28374. }
  28375. /**
  28376. * Creates a debounced function that delays invoking `func` until after `wait`
  28377. * milliseconds have elapsed since the last time the debounced function was
  28378. * invoked. The debounced function comes with a `cancel` method to cancel
  28379. * delayed `func` invocations and a `flush` method to immediately invoke them.
  28380. * Provide `options` to indicate whether `func` should be invoked on the
  28381. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  28382. * with the last arguments provided to the debounced function. Subsequent
  28383. * calls to the debounced function return the result of the last `func`
  28384. * invocation.
  28385. *
  28386. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  28387. * invoked on the trailing edge of the timeout only if the debounced function
  28388. * is invoked more than once during the `wait` timeout.
  28389. *
  28390. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  28391. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  28392. *
  28393. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  28394. * for details over the differences between `_.debounce` and `_.throttle`.
  28395. *
  28396. * @static
  28397. * @memberOf _
  28398. * @since 0.1.0
  28399. * @category Function
  28400. * @param {Function} func The function to debounce.
  28401. * @param {number} [wait=0] The number of milliseconds to delay.
  28402. * @param {Object} [options={}] The options object.
  28403. * @param {boolean} [options.leading=false]
  28404. * Specify invoking on the leading edge of the timeout.
  28405. * @param {number} [options.maxWait]
  28406. * The maximum time `func` is allowed to be delayed before it's invoked.
  28407. * @param {boolean} [options.trailing=true]
  28408. * Specify invoking on the trailing edge of the timeout.
  28409. * @returns {Function} Returns the new debounced function.
  28410. * @example
  28411. *
  28412. * // Avoid costly calculations while the window size is in flux.
  28413. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  28414. *
  28415. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  28416. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  28417. * 'leading': true,
  28418. * 'trailing': false
  28419. * }));
  28420. *
  28421. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  28422. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  28423. * var source = new EventSource('/stream');
  28424. * jQuery(source).on('message', debounced);
  28425. *
  28426. * // Cancel the trailing debounced invocation.
  28427. * jQuery(window).on('popstate', debounced.cancel);
  28428. */
  28429. function debounce(func, wait, options) {
  28430. var lastArgs,
  28431. lastThis,
  28432. maxWait,
  28433. result,
  28434. timerId,
  28435. lastCallTime,
  28436. lastInvokeTime = 0,
  28437. leading = false,
  28438. maxing = false,
  28439. trailing = true;
  28440. if (typeof func != 'function') {
  28441. throw new TypeError(FUNC_ERROR_TEXT);
  28442. }
  28443. wait = toNumber(wait) || 0;
  28444. if (isObject(options)) {
  28445. leading = !!options.leading;
  28446. maxing = 'maxWait' in options;
  28447. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  28448. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28449. }
  28450. function invokeFunc(time) {
  28451. var args = lastArgs,
  28452. thisArg = lastThis;
  28453. lastArgs = lastThis = undefined;
  28454. lastInvokeTime = time;
  28455. result = func.apply(thisArg, args);
  28456. return result;
  28457. }
  28458. function leadingEdge(time) {
  28459. // Reset any `maxWait` timer.
  28460. lastInvokeTime = time;
  28461. // Start the timer for the trailing edge.
  28462. timerId = setTimeout(timerExpired, wait);
  28463. // Invoke the leading edge.
  28464. return leading ? invokeFunc(time) : result;
  28465. }
  28466. function remainingWait(time) {
  28467. var timeSinceLastCall = time - lastCallTime,
  28468. timeSinceLastInvoke = time - lastInvokeTime,
  28469. timeWaiting = wait - timeSinceLastCall;
  28470. return maxing
  28471. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  28472. : timeWaiting;
  28473. }
  28474. function shouldInvoke(time) {
  28475. var timeSinceLastCall = time - lastCallTime,
  28476. timeSinceLastInvoke = time - lastInvokeTime;
  28477. // Either this is the first call, activity has stopped and we're at the
  28478. // trailing edge, the system time has gone backwards and we're treating
  28479. // it as the trailing edge, or we've hit the `maxWait` limit.
  28480. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  28481. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  28482. }
  28483. function timerExpired() {
  28484. var time = now();
  28485. if (shouldInvoke(time)) {
  28486. return trailingEdge(time);
  28487. }
  28488. // Restart the timer.
  28489. timerId = setTimeout(timerExpired, remainingWait(time));
  28490. }
  28491. function trailingEdge(time) {
  28492. timerId = undefined;
  28493. // Only invoke if we have `lastArgs` which means `func` has been
  28494. // debounced at least once.
  28495. if (trailing && lastArgs) {
  28496. return invokeFunc(time);
  28497. }
  28498. lastArgs = lastThis = undefined;
  28499. return result;
  28500. }
  28501. function cancel() {
  28502. if (timerId !== undefined) {
  28503. clearTimeout(timerId);
  28504. }
  28505. lastInvokeTime = 0;
  28506. lastArgs = lastCallTime = lastThis = timerId = undefined;
  28507. }
  28508. function flush() {
  28509. return timerId === undefined ? result : trailingEdge(now());
  28510. }
  28511. function debounced() {
  28512. var time = now(),
  28513. isInvoking = shouldInvoke(time);
  28514. lastArgs = arguments;
  28515. lastThis = this;
  28516. lastCallTime = time;
  28517. if (isInvoking) {
  28518. if (timerId === undefined) {
  28519. return leadingEdge(lastCallTime);
  28520. }
  28521. if (maxing) {
  28522. // Handle invocations in a tight loop.
  28523. clearTimeout(timerId);
  28524. timerId = setTimeout(timerExpired, wait);
  28525. return invokeFunc(lastCallTime);
  28526. }
  28527. }
  28528. if (timerId === undefined) {
  28529. timerId = setTimeout(timerExpired, wait);
  28530. }
  28531. return result;
  28532. }
  28533. debounced.cancel = cancel;
  28534. debounced.flush = flush;
  28535. return debounced;
  28536. }
  28537. /**
  28538. * Defers invoking the `func` until the current call stack has cleared. Any
  28539. * additional arguments are provided to `func` when it's invoked.
  28540. *
  28541. * @static
  28542. * @memberOf _
  28543. * @since 0.1.0
  28544. * @category Function
  28545. * @param {Function} func The function to defer.
  28546. * @param {...*} [args] The arguments to invoke `func` with.
  28547. * @returns {number} Returns the timer id.
  28548. * @example
  28549. *
  28550. * _.defer(function(text) {
  28551. * console.log(text);
  28552. * }, 'deferred');
  28553. * // => Logs 'deferred' after one millisecond.
  28554. */
  28555. var defer = baseRest(function(func, args) {
  28556. return baseDelay(func, 1, args);
  28557. });
  28558. /**
  28559. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  28560. * provided to `func` when it's invoked.
  28561. *
  28562. * @static
  28563. * @memberOf _
  28564. * @since 0.1.0
  28565. * @category Function
  28566. * @param {Function} func The function to delay.
  28567. * @param {number} wait The number of milliseconds to delay invocation.
  28568. * @param {...*} [args] The arguments to invoke `func` with.
  28569. * @returns {number} Returns the timer id.
  28570. * @example
  28571. *
  28572. * _.delay(function(text) {
  28573. * console.log(text);
  28574. * }, 1000, 'later');
  28575. * // => Logs 'later' after one second.
  28576. */
  28577. var delay = baseRest(function(func, wait, args) {
  28578. return baseDelay(func, toNumber(wait) || 0, args);
  28579. });
  28580. /**
  28581. * Creates a function that invokes `func` with arguments reversed.
  28582. *
  28583. * @static
  28584. * @memberOf _
  28585. * @since 4.0.0
  28586. * @category Function
  28587. * @param {Function} func The function to flip arguments for.
  28588. * @returns {Function} Returns the new flipped function.
  28589. * @example
  28590. *
  28591. * var flipped = _.flip(function() {
  28592. * return _.toArray(arguments);
  28593. * });
  28594. *
  28595. * flipped('a', 'b', 'c', 'd');
  28596. * // => ['d', 'c', 'b', 'a']
  28597. */
  28598. function flip(func) {
  28599. return createWrap(func, WRAP_FLIP_FLAG);
  28600. }
  28601. /**
  28602. * Creates a function that memoizes the result of `func`. If `resolver` is
  28603. * provided, it determines the cache key for storing the result based on the
  28604. * arguments provided to the memoized function. By default, the first argument
  28605. * provided to the memoized function is used as the map cache key. The `func`
  28606. * is invoked with the `this` binding of the memoized function.
  28607. *
  28608. * **Note:** The cache is exposed as the `cache` property on the memoized
  28609. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  28610. * constructor with one whose instances implement the
  28611. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  28612. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  28613. *
  28614. * @static
  28615. * @memberOf _
  28616. * @since 0.1.0
  28617. * @category Function
  28618. * @param {Function} func The function to have its output memoized.
  28619. * @param {Function} [resolver] The function to resolve the cache key.
  28620. * @returns {Function} Returns the new memoized function.
  28621. * @example
  28622. *
  28623. * var object = { 'a': 1, 'b': 2 };
  28624. * var other = { 'c': 3, 'd': 4 };
  28625. *
  28626. * var values = _.memoize(_.values);
  28627. * values(object);
  28628. * // => [1, 2]
  28629. *
  28630. * values(other);
  28631. * // => [3, 4]
  28632. *
  28633. * object.a = 2;
  28634. * values(object);
  28635. * // => [1, 2]
  28636. *
  28637. * // Modify the result cache.
  28638. * values.cache.set(object, ['a', 'b']);
  28639. * values(object);
  28640. * // => ['a', 'b']
  28641. *
  28642. * // Replace `_.memoize.Cache`.
  28643. * _.memoize.Cache = WeakMap;
  28644. */
  28645. function memoize(func, resolver) {
  28646. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  28647. throw new TypeError(FUNC_ERROR_TEXT);
  28648. }
  28649. var memoized = function() {
  28650. var args = arguments,
  28651. key = resolver ? resolver.apply(this, args) : args[0],
  28652. cache = memoized.cache;
  28653. if (cache.has(key)) {
  28654. return cache.get(key);
  28655. }
  28656. var result = func.apply(this, args);
  28657. memoized.cache = cache.set(key, result) || cache;
  28658. return result;
  28659. };
  28660. memoized.cache = new (memoize.Cache || MapCache);
  28661. return memoized;
  28662. }
  28663. // Expose `MapCache`.
  28664. memoize.Cache = MapCache;
  28665. /**
  28666. * Creates a function that negates the result of the predicate `func`. The
  28667. * `func` predicate is invoked with the `this` binding and arguments of the
  28668. * created function.
  28669. *
  28670. * @static
  28671. * @memberOf _
  28672. * @since 3.0.0
  28673. * @category Function
  28674. * @param {Function} predicate The predicate to negate.
  28675. * @returns {Function} Returns the new negated function.
  28676. * @example
  28677. *
  28678. * function isEven(n) {
  28679. * return n % 2 == 0;
  28680. * }
  28681. *
  28682. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  28683. * // => [1, 3, 5]
  28684. */
  28685. function negate(predicate) {
  28686. if (typeof predicate != 'function') {
  28687. throw new TypeError(FUNC_ERROR_TEXT);
  28688. }
  28689. return function() {
  28690. var args = arguments;
  28691. switch (args.length) {
  28692. case 0: return !predicate.call(this);
  28693. case 1: return !predicate.call(this, args[0]);
  28694. case 2: return !predicate.call(this, args[0], args[1]);
  28695. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  28696. }
  28697. return !predicate.apply(this, args);
  28698. };
  28699. }
  28700. /**
  28701. * Creates a function that is restricted to invoking `func` once. Repeat calls
  28702. * to the function return the value of the first invocation. The `func` is
  28703. * invoked with the `this` binding and arguments of the created function.
  28704. *
  28705. * @static
  28706. * @memberOf _
  28707. * @since 0.1.0
  28708. * @category Function
  28709. * @param {Function} func The function to restrict.
  28710. * @returns {Function} Returns the new restricted function.
  28711. * @example
  28712. *
  28713. * var initialize = _.once(createApplication);
  28714. * initialize();
  28715. * initialize();
  28716. * // => `createApplication` is invoked once
  28717. */
  28718. function once(func) {
  28719. return before(2, func);
  28720. }
  28721. /**
  28722. * Creates a function that invokes `func` with its arguments transformed.
  28723. *
  28724. * @static
  28725. * @since 4.0.0
  28726. * @memberOf _
  28727. * @category Function
  28728. * @param {Function} func The function to wrap.
  28729. * @param {...(Function|Function[])} [transforms=[_.identity]]
  28730. * The argument transforms.
  28731. * @returns {Function} Returns the new function.
  28732. * @example
  28733. *
  28734. * function doubled(n) {
  28735. * return n * 2;
  28736. * }
  28737. *
  28738. * function square(n) {
  28739. * return n * n;
  28740. * }
  28741. *
  28742. * var func = _.overArgs(function(x, y) {
  28743. * return [x, y];
  28744. * }, [square, doubled]);
  28745. *
  28746. * func(9, 3);
  28747. * // => [81, 6]
  28748. *
  28749. * func(10, 5);
  28750. * // => [100, 10]
  28751. */
  28752. var overArgs = castRest(function(func, transforms) {
  28753. transforms = (transforms.length == 1 && isArray(transforms[0]))
  28754. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  28755. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  28756. var funcsLength = transforms.length;
  28757. return baseRest(function(args) {
  28758. var index = -1,
  28759. length = nativeMin(args.length, funcsLength);
  28760. while (++index < length) {
  28761. args[index] = transforms[index].call(this, args[index]);
  28762. }
  28763. return apply(func, this, args);
  28764. });
  28765. });
  28766. /**
  28767. * Creates a function that invokes `func` with `partials` prepended to the
  28768. * arguments it receives. This method is like `_.bind` except it does **not**
  28769. * alter the `this` binding.
  28770. *
  28771. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  28772. * builds, may be used as a placeholder for partially applied arguments.
  28773. *
  28774. * **Note:** This method doesn't set the "length" property of partially
  28775. * applied functions.
  28776. *
  28777. * @static
  28778. * @memberOf _
  28779. * @since 0.2.0
  28780. * @category Function
  28781. * @param {Function} func The function to partially apply arguments to.
  28782. * @param {...*} [partials] The arguments to be partially applied.
  28783. * @returns {Function} Returns the new partially applied function.
  28784. * @example
  28785. *
  28786. * function greet(greeting, name) {
  28787. * return greeting + ' ' + name;
  28788. * }
  28789. *
  28790. * var sayHelloTo = _.partial(greet, 'hello');
  28791. * sayHelloTo('fred');
  28792. * // => 'hello fred'
  28793. *
  28794. * // Partially applied with placeholders.
  28795. * var greetFred = _.partial(greet, _, 'fred');
  28796. * greetFred('hi');
  28797. * // => 'hi fred'
  28798. */
  28799. var partial = baseRest(function(func, partials) {
  28800. var holders = replaceHolders(partials, getHolder(partial));
  28801. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  28802. });
  28803. /**
  28804. * This method is like `_.partial` except that partially applied arguments
  28805. * are appended to the arguments it receives.
  28806. *
  28807. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  28808. * builds, may be used as a placeholder for partially applied arguments.
  28809. *
  28810. * **Note:** This method doesn't set the "length" property of partially
  28811. * applied functions.
  28812. *
  28813. * @static
  28814. * @memberOf _
  28815. * @since 1.0.0
  28816. * @category Function
  28817. * @param {Function} func The function to partially apply arguments to.
  28818. * @param {...*} [partials] The arguments to be partially applied.
  28819. * @returns {Function} Returns the new partially applied function.
  28820. * @example
  28821. *
  28822. * function greet(greeting, name) {
  28823. * return greeting + ' ' + name;
  28824. * }
  28825. *
  28826. * var greetFred = _.partialRight(greet, 'fred');
  28827. * greetFred('hi');
  28828. * // => 'hi fred'
  28829. *
  28830. * // Partially applied with placeholders.
  28831. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  28832. * sayHelloTo('fred');
  28833. * // => 'hello fred'
  28834. */
  28835. var partialRight = baseRest(function(func, partials) {
  28836. var holders = replaceHolders(partials, getHolder(partialRight));
  28837. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  28838. });
  28839. /**
  28840. * Creates a function that invokes `func` with arguments arranged according
  28841. * to the specified `indexes` where the argument value at the first index is
  28842. * provided as the first argument, the argument value at the second index is
  28843. * provided as the second argument, and so on.
  28844. *
  28845. * @static
  28846. * @memberOf _
  28847. * @since 3.0.0
  28848. * @category Function
  28849. * @param {Function} func The function to rearrange arguments for.
  28850. * @param {...(number|number[])} indexes The arranged argument indexes.
  28851. * @returns {Function} Returns the new function.
  28852. * @example
  28853. *
  28854. * var rearged = _.rearg(function(a, b, c) {
  28855. * return [a, b, c];
  28856. * }, [2, 0, 1]);
  28857. *
  28858. * rearged('b', 'c', 'a')
  28859. * // => ['a', 'b', 'c']
  28860. */
  28861. var rearg = flatRest(function(func, indexes) {
  28862. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  28863. });
  28864. /**
  28865. * Creates a function that invokes `func` with the `this` binding of the
  28866. * created function and arguments from `start` and beyond provided as
  28867. * an array.
  28868. *
  28869. * **Note:** This method is based on the
  28870. * [rest parameter](https://mdn.io/rest_parameters).
  28871. *
  28872. * @static
  28873. * @memberOf _
  28874. * @since 4.0.0
  28875. * @category Function
  28876. * @param {Function} func The function to apply a rest parameter to.
  28877. * @param {number} [start=func.length-1] The start position of the rest parameter.
  28878. * @returns {Function} Returns the new function.
  28879. * @example
  28880. *
  28881. * var say = _.rest(function(what, names) {
  28882. * return what + ' ' + _.initial(names).join(', ') +
  28883. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  28884. * });
  28885. *
  28886. * say('hello', 'fred', 'barney', 'pebbles');
  28887. * // => 'hello fred, barney, & pebbles'
  28888. */
  28889. function rest(func, start) {
  28890. if (typeof func != 'function') {
  28891. throw new TypeError(FUNC_ERROR_TEXT);
  28892. }
  28893. start = start === undefined ? start : toInteger(start);
  28894. return baseRest(func, start);
  28895. }
  28896. /**
  28897. * Creates a function that invokes `func` with the `this` binding of the
  28898. * create function and an array of arguments much like
  28899. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  28900. *
  28901. * **Note:** This method is based on the
  28902. * [spread operator](https://mdn.io/spread_operator).
  28903. *
  28904. * @static
  28905. * @memberOf _
  28906. * @since 3.2.0
  28907. * @category Function
  28908. * @param {Function} func The function to spread arguments over.
  28909. * @param {number} [start=0] The start position of the spread.
  28910. * @returns {Function} Returns the new function.
  28911. * @example
  28912. *
  28913. * var say = _.spread(function(who, what) {
  28914. * return who + ' says ' + what;
  28915. * });
  28916. *
  28917. * say(['fred', 'hello']);
  28918. * // => 'fred says hello'
  28919. *
  28920. * var numbers = Promise.all([
  28921. * Promise.resolve(40),
  28922. * Promise.resolve(36)
  28923. * ]);
  28924. *
  28925. * numbers.then(_.spread(function(x, y) {
  28926. * return x + y;
  28927. * }));
  28928. * // => a Promise of 76
  28929. */
  28930. function spread(func, start) {
  28931. if (typeof func != 'function') {
  28932. throw new TypeError(FUNC_ERROR_TEXT);
  28933. }
  28934. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  28935. return baseRest(function(args) {
  28936. var array = args[start],
  28937. otherArgs = castSlice(args, 0, start);
  28938. if (array) {
  28939. arrayPush(otherArgs, array);
  28940. }
  28941. return apply(func, this, otherArgs);
  28942. });
  28943. }
  28944. /**
  28945. * Creates a throttled function that only invokes `func` at most once per
  28946. * every `wait` milliseconds. The throttled function comes with a `cancel`
  28947. * method to cancel delayed `func` invocations and a `flush` method to
  28948. * immediately invoke them. Provide `options` to indicate whether `func`
  28949. * should be invoked on the leading and/or trailing edge of the `wait`
  28950. * timeout. The `func` is invoked with the last arguments provided to the
  28951. * throttled function. Subsequent calls to the throttled function return the
  28952. * result of the last `func` invocation.
  28953. *
  28954. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  28955. * invoked on the trailing edge of the timeout only if the throttled function
  28956. * is invoked more than once during the `wait` timeout.
  28957. *
  28958. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  28959. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  28960. *
  28961. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  28962. * for details over the differences between `_.throttle` and `_.debounce`.
  28963. *
  28964. * @static
  28965. * @memberOf _
  28966. * @since 0.1.0
  28967. * @category Function
  28968. * @param {Function} func The function to throttle.
  28969. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  28970. * @param {Object} [options={}] The options object.
  28971. * @param {boolean} [options.leading=true]
  28972. * Specify invoking on the leading edge of the timeout.
  28973. * @param {boolean} [options.trailing=true]
  28974. * Specify invoking on the trailing edge of the timeout.
  28975. * @returns {Function} Returns the new throttled function.
  28976. * @example
  28977. *
  28978. * // Avoid excessively updating the position while scrolling.
  28979. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  28980. *
  28981. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  28982. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  28983. * jQuery(element).on('click', throttled);
  28984. *
  28985. * // Cancel the trailing throttled invocation.
  28986. * jQuery(window).on('popstate', throttled.cancel);
  28987. */
  28988. function throttle(func, wait, options) {
  28989. var leading = true,
  28990. trailing = true;
  28991. if (typeof func != 'function') {
  28992. throw new TypeError(FUNC_ERROR_TEXT);
  28993. }
  28994. if (isObject(options)) {
  28995. leading = 'leading' in options ? !!options.leading : leading;
  28996. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28997. }
  28998. return debounce(func, wait, {
  28999. 'leading': leading,
  29000. 'maxWait': wait,
  29001. 'trailing': trailing
  29002. });
  29003. }
  29004. /**
  29005. * Creates a function that accepts up to one argument, ignoring any
  29006. * additional arguments.
  29007. *
  29008. * @static
  29009. * @memberOf _
  29010. * @since 4.0.0
  29011. * @category Function
  29012. * @param {Function} func The function to cap arguments for.
  29013. * @returns {Function} Returns the new capped function.
  29014. * @example
  29015. *
  29016. * _.map(['6', '8', '10'], _.unary(parseInt));
  29017. * // => [6, 8, 10]
  29018. */
  29019. function unary(func) {
  29020. return ary(func, 1);
  29021. }
  29022. /**
  29023. * Creates a function that provides `value` to `wrapper` as its first
  29024. * argument. Any additional arguments provided to the function are appended
  29025. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  29026. * binding of the created function.
  29027. *
  29028. * @static
  29029. * @memberOf _
  29030. * @since 0.1.0
  29031. * @category Function
  29032. * @param {*} value The value to wrap.
  29033. * @param {Function} [wrapper=identity] The wrapper function.
  29034. * @returns {Function} Returns the new function.
  29035. * @example
  29036. *
  29037. * var p = _.wrap(_.escape, function(func, text) {
  29038. * return '<p>' + func(text) + '</p>';
  29039. * });
  29040. *
  29041. * p('fred, barney, & pebbles');
  29042. * // => '<p>fred, barney, &amp; pebbles</p>'
  29043. */
  29044. function wrap(value, wrapper) {
  29045. return partial(castFunction(wrapper), value);
  29046. }
  29047. /*------------------------------------------------------------------------*/
  29048. /**
  29049. * Casts `value` as an array if it's not one.
  29050. *
  29051. * @static
  29052. * @memberOf _
  29053. * @since 4.4.0
  29054. * @category Lang
  29055. * @param {*} value The value to inspect.
  29056. * @returns {Array} Returns the cast array.
  29057. * @example
  29058. *
  29059. * _.castArray(1);
  29060. * // => [1]
  29061. *
  29062. * _.castArray({ 'a': 1 });
  29063. * // => [{ 'a': 1 }]
  29064. *
  29065. * _.castArray('abc');
  29066. * // => ['abc']
  29067. *
  29068. * _.castArray(null);
  29069. * // => [null]
  29070. *
  29071. * _.castArray(undefined);
  29072. * // => [undefined]
  29073. *
  29074. * _.castArray();
  29075. * // => []
  29076. *
  29077. * var array = [1, 2, 3];
  29078. * console.log(_.castArray(array) === array);
  29079. * // => true
  29080. */
  29081. function castArray() {
  29082. if (!arguments.length) {
  29083. return [];
  29084. }
  29085. var value = arguments[0];
  29086. return isArray(value) ? value : [value];
  29087. }
  29088. /**
  29089. * Creates a shallow clone of `value`.
  29090. *
  29091. * **Note:** This method is loosely based on the
  29092. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  29093. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  29094. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  29095. * arrays. The own enumerable properties of `arguments` objects are cloned
  29096. * as plain objects. An empty object is returned for uncloneable values such
  29097. * as error objects, functions, DOM nodes, and WeakMaps.
  29098. *
  29099. * @static
  29100. * @memberOf _
  29101. * @since 0.1.0
  29102. * @category Lang
  29103. * @param {*} value The value to clone.
  29104. * @returns {*} Returns the cloned value.
  29105. * @see _.cloneDeep
  29106. * @example
  29107. *
  29108. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  29109. *
  29110. * var shallow = _.clone(objects);
  29111. * console.log(shallow[0] === objects[0]);
  29112. * // => true
  29113. */
  29114. function clone(value) {
  29115. return baseClone(value, CLONE_SYMBOLS_FLAG);
  29116. }
  29117. /**
  29118. * This method is like `_.clone` except that it accepts `customizer` which
  29119. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  29120. * cloning is handled by the method instead. The `customizer` is invoked with
  29121. * up to four arguments; (value [, index|key, object, stack]).
  29122. *
  29123. * @static
  29124. * @memberOf _
  29125. * @since 4.0.0
  29126. * @category Lang
  29127. * @param {*} value The value to clone.
  29128. * @param {Function} [customizer] The function to customize cloning.
  29129. * @returns {*} Returns the cloned value.
  29130. * @see _.cloneDeepWith
  29131. * @example
  29132. *
  29133. * function customizer(value) {
  29134. * if (_.isElement(value)) {
  29135. * return value.cloneNode(false);
  29136. * }
  29137. * }
  29138. *
  29139. * var el = _.cloneWith(document.body, customizer);
  29140. *
  29141. * console.log(el === document.body);
  29142. * // => false
  29143. * console.log(el.nodeName);
  29144. * // => 'BODY'
  29145. * console.log(el.childNodes.length);
  29146. * // => 0
  29147. */
  29148. function cloneWith(value, customizer) {
  29149. customizer = typeof customizer == 'function' ? customizer : undefined;
  29150. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  29151. }
  29152. /**
  29153. * This method is like `_.clone` except that it recursively clones `value`.
  29154. *
  29155. * @static
  29156. * @memberOf _
  29157. * @since 1.0.0
  29158. * @category Lang
  29159. * @param {*} value The value to recursively clone.
  29160. * @returns {*} Returns the deep cloned value.
  29161. * @see _.clone
  29162. * @example
  29163. *
  29164. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  29165. *
  29166. * var deep = _.cloneDeep(objects);
  29167. * console.log(deep[0] === objects[0]);
  29168. * // => false
  29169. */
  29170. function cloneDeep(value) {
  29171. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  29172. }
  29173. /**
  29174. * This method is like `_.cloneWith` except that it recursively clones `value`.
  29175. *
  29176. * @static
  29177. * @memberOf _
  29178. * @since 4.0.0
  29179. * @category Lang
  29180. * @param {*} value The value to recursively clone.
  29181. * @param {Function} [customizer] The function to customize cloning.
  29182. * @returns {*} Returns the deep cloned value.
  29183. * @see _.cloneWith
  29184. * @example
  29185. *
  29186. * function customizer(value) {
  29187. * if (_.isElement(value)) {
  29188. * return value.cloneNode(true);
  29189. * }
  29190. * }
  29191. *
  29192. * var el = _.cloneDeepWith(document.body, customizer);
  29193. *
  29194. * console.log(el === document.body);
  29195. * // => false
  29196. * console.log(el.nodeName);
  29197. * // => 'BODY'
  29198. * console.log(el.childNodes.length);
  29199. * // => 20
  29200. */
  29201. function cloneDeepWith(value, customizer) {
  29202. customizer = typeof customizer == 'function' ? customizer : undefined;
  29203. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  29204. }
  29205. /**
  29206. * Checks if `object` conforms to `source` by invoking the predicate
  29207. * properties of `source` with the corresponding property values of `object`.
  29208. *
  29209. * **Note:** This method is equivalent to `_.conforms` when `source` is
  29210. * partially applied.
  29211. *
  29212. * @static
  29213. * @memberOf _
  29214. * @since 4.14.0
  29215. * @category Lang
  29216. * @param {Object} object The object to inspect.
  29217. * @param {Object} source The object of property predicates to conform to.
  29218. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  29219. * @example
  29220. *
  29221. * var object = { 'a': 1, 'b': 2 };
  29222. *
  29223. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  29224. * // => true
  29225. *
  29226. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  29227. * // => false
  29228. */
  29229. function conformsTo(object, source) {
  29230. return source == null || baseConformsTo(object, source, keys(source));
  29231. }
  29232. /**
  29233. * Performs a
  29234. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  29235. * comparison between two values to determine if they are equivalent.
  29236. *
  29237. * @static
  29238. * @memberOf _
  29239. * @since 4.0.0
  29240. * @category Lang
  29241. * @param {*} value The value to compare.
  29242. * @param {*} other The other value to compare.
  29243. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29244. * @example
  29245. *
  29246. * var object = { 'a': 1 };
  29247. * var other = { 'a': 1 };
  29248. *
  29249. * _.eq(object, object);
  29250. * // => true
  29251. *
  29252. * _.eq(object, other);
  29253. * // => false
  29254. *
  29255. * _.eq('a', 'a');
  29256. * // => true
  29257. *
  29258. * _.eq('a', Object('a'));
  29259. * // => false
  29260. *
  29261. * _.eq(NaN, NaN);
  29262. * // => true
  29263. */
  29264. function eq(value, other) {
  29265. return value === other || (value !== value && other !== other);
  29266. }
  29267. /**
  29268. * Checks if `value` is greater than `other`.
  29269. *
  29270. * @static
  29271. * @memberOf _
  29272. * @since 3.9.0
  29273. * @category Lang
  29274. * @param {*} value The value to compare.
  29275. * @param {*} other The other value to compare.
  29276. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  29277. * else `false`.
  29278. * @see _.lt
  29279. * @example
  29280. *
  29281. * _.gt(3, 1);
  29282. * // => true
  29283. *
  29284. * _.gt(3, 3);
  29285. * // => false
  29286. *
  29287. * _.gt(1, 3);
  29288. * // => false
  29289. */
  29290. var gt = createRelationalOperation(baseGt);
  29291. /**
  29292. * Checks if `value` is greater than or equal to `other`.
  29293. *
  29294. * @static
  29295. * @memberOf _
  29296. * @since 3.9.0
  29297. * @category Lang
  29298. * @param {*} value The value to compare.
  29299. * @param {*} other The other value to compare.
  29300. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  29301. * `other`, else `false`.
  29302. * @see _.lte
  29303. * @example
  29304. *
  29305. * _.gte(3, 1);
  29306. * // => true
  29307. *
  29308. * _.gte(3, 3);
  29309. * // => true
  29310. *
  29311. * _.gte(1, 3);
  29312. * // => false
  29313. */
  29314. var gte = createRelationalOperation(function(value, other) {
  29315. return value >= other;
  29316. });
  29317. /**
  29318. * Checks if `value` is likely an `arguments` object.
  29319. *
  29320. * @static
  29321. * @memberOf _
  29322. * @since 0.1.0
  29323. * @category Lang
  29324. * @param {*} value The value to check.
  29325. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  29326. * else `false`.
  29327. * @example
  29328. *
  29329. * _.isArguments(function() { return arguments; }());
  29330. * // => true
  29331. *
  29332. * _.isArguments([1, 2, 3]);
  29333. * // => false
  29334. */
  29335. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  29336. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  29337. !propertyIsEnumerable.call(value, 'callee');
  29338. };
  29339. /**
  29340. * Checks if `value` is classified as an `Array` object.
  29341. *
  29342. * @static
  29343. * @memberOf _
  29344. * @since 0.1.0
  29345. * @category Lang
  29346. * @param {*} value The value to check.
  29347. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  29348. * @example
  29349. *
  29350. * _.isArray([1, 2, 3]);
  29351. * // => true
  29352. *
  29353. * _.isArray(document.body.children);
  29354. * // => false
  29355. *
  29356. * _.isArray('abc');
  29357. * // => false
  29358. *
  29359. * _.isArray(_.noop);
  29360. * // => false
  29361. */
  29362. var isArray = Array.isArray;
  29363. /**
  29364. * Checks if `value` is classified as an `ArrayBuffer` object.
  29365. *
  29366. * @static
  29367. * @memberOf _
  29368. * @since 4.3.0
  29369. * @category Lang
  29370. * @param {*} value The value to check.
  29371. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  29372. * @example
  29373. *
  29374. * _.isArrayBuffer(new ArrayBuffer(2));
  29375. * // => true
  29376. *
  29377. * _.isArrayBuffer(new Array(2));
  29378. * // => false
  29379. */
  29380. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  29381. /**
  29382. * Checks if `value` is array-like. A value is considered array-like if it's
  29383. * not a function and has a `value.length` that's an integer greater than or
  29384. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  29385. *
  29386. * @static
  29387. * @memberOf _
  29388. * @since 4.0.0
  29389. * @category Lang
  29390. * @param {*} value The value to check.
  29391. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  29392. * @example
  29393. *
  29394. * _.isArrayLike([1, 2, 3]);
  29395. * // => true
  29396. *
  29397. * _.isArrayLike(document.body.children);
  29398. * // => true
  29399. *
  29400. * _.isArrayLike('abc');
  29401. * // => true
  29402. *
  29403. * _.isArrayLike(_.noop);
  29404. * // => false
  29405. */
  29406. function isArrayLike(value) {
  29407. return value != null && isLength(value.length) && !isFunction(value);
  29408. }
  29409. /**
  29410. * This method is like `_.isArrayLike` except that it also checks if `value`
  29411. * is an object.
  29412. *
  29413. * @static
  29414. * @memberOf _
  29415. * @since 4.0.0
  29416. * @category Lang
  29417. * @param {*} value The value to check.
  29418. * @returns {boolean} Returns `true` if `value` is an array-like object,
  29419. * else `false`.
  29420. * @example
  29421. *
  29422. * _.isArrayLikeObject([1, 2, 3]);
  29423. * // => true
  29424. *
  29425. * _.isArrayLikeObject(document.body.children);
  29426. * // => true
  29427. *
  29428. * _.isArrayLikeObject('abc');
  29429. * // => false
  29430. *
  29431. * _.isArrayLikeObject(_.noop);
  29432. * // => false
  29433. */
  29434. function isArrayLikeObject(value) {
  29435. return isObjectLike(value) && isArrayLike(value);
  29436. }
  29437. /**
  29438. * Checks if `value` is classified as a boolean primitive or object.
  29439. *
  29440. * @static
  29441. * @memberOf _
  29442. * @since 0.1.0
  29443. * @category Lang
  29444. * @param {*} value The value to check.
  29445. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  29446. * @example
  29447. *
  29448. * _.isBoolean(false);
  29449. * // => true
  29450. *
  29451. * _.isBoolean(null);
  29452. * // => false
  29453. */
  29454. function isBoolean(value) {
  29455. return value === true || value === false ||
  29456. (isObjectLike(value) && baseGetTag(value) == boolTag);
  29457. }
  29458. /**
  29459. * Checks if `value` is a buffer.
  29460. *
  29461. * @static
  29462. * @memberOf _
  29463. * @since 4.3.0
  29464. * @category Lang
  29465. * @param {*} value The value to check.
  29466. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  29467. * @example
  29468. *
  29469. * _.isBuffer(new Buffer(2));
  29470. * // => true
  29471. *
  29472. * _.isBuffer(new Uint8Array(2));
  29473. * // => false
  29474. */
  29475. var isBuffer = nativeIsBuffer || stubFalse;
  29476. /**
  29477. * Checks if `value` is classified as a `Date` object.
  29478. *
  29479. * @static
  29480. * @memberOf _
  29481. * @since 0.1.0
  29482. * @category Lang
  29483. * @param {*} value The value to check.
  29484. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  29485. * @example
  29486. *
  29487. * _.isDate(new Date);
  29488. * // => true
  29489. *
  29490. * _.isDate('Mon April 23 2012');
  29491. * // => false
  29492. */
  29493. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  29494. /**
  29495. * Checks if `value` is likely a DOM element.
  29496. *
  29497. * @static
  29498. * @memberOf _
  29499. * @since 0.1.0
  29500. * @category Lang
  29501. * @param {*} value The value to check.
  29502. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  29503. * @example
  29504. *
  29505. * _.isElement(document.body);
  29506. * // => true
  29507. *
  29508. * _.isElement('<body>');
  29509. * // => false
  29510. */
  29511. function isElement(value) {
  29512. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  29513. }
  29514. /**
  29515. * Checks if `value` is an empty object, collection, map, or set.
  29516. *
  29517. * Objects are considered empty if they have no own enumerable string keyed
  29518. * properties.
  29519. *
  29520. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  29521. * jQuery-like collections are considered empty if they have a `length` of `0`.
  29522. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  29523. *
  29524. * @static
  29525. * @memberOf _
  29526. * @since 0.1.0
  29527. * @category Lang
  29528. * @param {*} value The value to check.
  29529. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  29530. * @example
  29531. *
  29532. * _.isEmpty(null);
  29533. * // => true
  29534. *
  29535. * _.isEmpty(true);
  29536. * // => true
  29537. *
  29538. * _.isEmpty(1);
  29539. * // => true
  29540. *
  29541. * _.isEmpty([1, 2, 3]);
  29542. * // => false
  29543. *
  29544. * _.isEmpty({ 'a': 1 });
  29545. * // => false
  29546. */
  29547. function isEmpty(value) {
  29548. if (value == null) {
  29549. return true;
  29550. }
  29551. if (isArrayLike(value) &&
  29552. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  29553. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  29554. return !value.length;
  29555. }
  29556. var tag = getTag(value);
  29557. if (tag == mapTag || tag == setTag) {
  29558. return !value.size;
  29559. }
  29560. if (isPrototype(value)) {
  29561. return !baseKeys(value).length;
  29562. }
  29563. for (var key in value) {
  29564. if (hasOwnProperty.call(value, key)) {
  29565. return false;
  29566. }
  29567. }
  29568. return true;
  29569. }
  29570. /**
  29571. * Performs a deep comparison between two values to determine if they are
  29572. * equivalent.
  29573. *
  29574. * **Note:** This method supports comparing arrays, array buffers, booleans,
  29575. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  29576. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  29577. * by their own, not inherited, enumerable properties. Functions and DOM
  29578. * nodes are compared by strict equality, i.e. `===`.
  29579. *
  29580. * @static
  29581. * @memberOf _
  29582. * @since 0.1.0
  29583. * @category Lang
  29584. * @param {*} value The value to compare.
  29585. * @param {*} other The other value to compare.
  29586. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29587. * @example
  29588. *
  29589. * var object = { 'a': 1 };
  29590. * var other = { 'a': 1 };
  29591. *
  29592. * _.isEqual(object, other);
  29593. * // => true
  29594. *
  29595. * object === other;
  29596. * // => false
  29597. */
  29598. function isEqual(value, other) {
  29599. return baseIsEqual(value, other);
  29600. }
  29601. /**
  29602. * This method is like `_.isEqual` except that it accepts `customizer` which
  29603. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29604. * are handled by the method instead. The `customizer` is invoked with up to
  29605. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  29606. *
  29607. * @static
  29608. * @memberOf _
  29609. * @since 4.0.0
  29610. * @category Lang
  29611. * @param {*} value The value to compare.
  29612. * @param {*} other The other value to compare.
  29613. * @param {Function} [customizer] The function to customize comparisons.
  29614. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29615. * @example
  29616. *
  29617. * function isGreeting(value) {
  29618. * return /^h(?:i|ello)$/.test(value);
  29619. * }
  29620. *
  29621. * function customizer(objValue, othValue) {
  29622. * if (isGreeting(objValue) && isGreeting(othValue)) {
  29623. * return true;
  29624. * }
  29625. * }
  29626. *
  29627. * var array = ['hello', 'goodbye'];
  29628. * var other = ['hi', 'goodbye'];
  29629. *
  29630. * _.isEqualWith(array, other, customizer);
  29631. * // => true
  29632. */
  29633. function isEqualWith(value, other, customizer) {
  29634. customizer = typeof customizer == 'function' ? customizer : undefined;
  29635. var result = customizer ? customizer(value, other) : undefined;
  29636. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  29637. }
  29638. /**
  29639. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  29640. * `SyntaxError`, `TypeError`, or `URIError` object.
  29641. *
  29642. * @static
  29643. * @memberOf _
  29644. * @since 3.0.0
  29645. * @category Lang
  29646. * @param {*} value The value to check.
  29647. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  29648. * @example
  29649. *
  29650. * _.isError(new Error);
  29651. * // => true
  29652. *
  29653. * _.isError(Error);
  29654. * // => false
  29655. */
  29656. function isError(value) {
  29657. if (!isObjectLike(value)) {
  29658. return false;
  29659. }
  29660. var tag = baseGetTag(value);
  29661. return tag == errorTag || tag == domExcTag ||
  29662. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  29663. }
  29664. /**
  29665. * Checks if `value` is a finite primitive number.
  29666. *
  29667. * **Note:** This method is based on
  29668. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  29669. *
  29670. * @static
  29671. * @memberOf _
  29672. * @since 0.1.0
  29673. * @category Lang
  29674. * @param {*} value The value to check.
  29675. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  29676. * @example
  29677. *
  29678. * _.isFinite(3);
  29679. * // => true
  29680. *
  29681. * _.isFinite(Number.MIN_VALUE);
  29682. * // => true
  29683. *
  29684. * _.isFinite(Infinity);
  29685. * // => false
  29686. *
  29687. * _.isFinite('3');
  29688. * // => false
  29689. */
  29690. function isFinite(value) {
  29691. return typeof value == 'number' && nativeIsFinite(value);
  29692. }
  29693. /**
  29694. * Checks if `value` is classified as a `Function` object.
  29695. *
  29696. * @static
  29697. * @memberOf _
  29698. * @since 0.1.0
  29699. * @category Lang
  29700. * @param {*} value The value to check.
  29701. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  29702. * @example
  29703. *
  29704. * _.isFunction(_);
  29705. * // => true
  29706. *
  29707. * _.isFunction(/abc/);
  29708. * // => false
  29709. */
  29710. function isFunction(value) {
  29711. if (!isObject(value)) {
  29712. return false;
  29713. }
  29714. // The use of `Object#toString` avoids issues with the `typeof` operator
  29715. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  29716. var tag = baseGetTag(value);
  29717. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  29718. }
  29719. /**
  29720. * Checks if `value` is an integer.
  29721. *
  29722. * **Note:** This method is based on
  29723. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  29724. *
  29725. * @static
  29726. * @memberOf _
  29727. * @since 4.0.0
  29728. * @category Lang
  29729. * @param {*} value The value to check.
  29730. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  29731. * @example
  29732. *
  29733. * _.isInteger(3);
  29734. * // => true
  29735. *
  29736. * _.isInteger(Number.MIN_VALUE);
  29737. * // => false
  29738. *
  29739. * _.isInteger(Infinity);
  29740. * // => false
  29741. *
  29742. * _.isInteger('3');
  29743. * // => false
  29744. */
  29745. function isInteger(value) {
  29746. return typeof value == 'number' && value == toInteger(value);
  29747. }
  29748. /**
  29749. * Checks if `value` is a valid array-like length.
  29750. *
  29751. * **Note:** This method is loosely based on
  29752. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29753. *
  29754. * @static
  29755. * @memberOf _
  29756. * @since 4.0.0
  29757. * @category Lang
  29758. * @param {*} value The value to check.
  29759. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  29760. * @example
  29761. *
  29762. * _.isLength(3);
  29763. * // => true
  29764. *
  29765. * _.isLength(Number.MIN_VALUE);
  29766. * // => false
  29767. *
  29768. * _.isLength(Infinity);
  29769. * // => false
  29770. *
  29771. * _.isLength('3');
  29772. * // => false
  29773. */
  29774. function isLength(value) {
  29775. return typeof value == 'number' &&
  29776. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  29777. }
  29778. /**
  29779. * Checks if `value` is the
  29780. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  29781. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  29782. *
  29783. * @static
  29784. * @memberOf _
  29785. * @since 0.1.0
  29786. * @category Lang
  29787. * @param {*} value The value to check.
  29788. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  29789. * @example
  29790. *
  29791. * _.isObject({});
  29792. * // => true
  29793. *
  29794. * _.isObject([1, 2, 3]);
  29795. * // => true
  29796. *
  29797. * _.isObject(_.noop);
  29798. * // => true
  29799. *
  29800. * _.isObject(null);
  29801. * // => false
  29802. */
  29803. function isObject(value) {
  29804. var type = typeof value;
  29805. return value != null && (type == 'object' || type == 'function');
  29806. }
  29807. /**
  29808. * Checks if `value` is object-like. A value is object-like if it's not `null`
  29809. * and has a `typeof` result of "object".
  29810. *
  29811. * @static
  29812. * @memberOf _
  29813. * @since 4.0.0
  29814. * @category Lang
  29815. * @param {*} value The value to check.
  29816. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  29817. * @example
  29818. *
  29819. * _.isObjectLike({});
  29820. * // => true
  29821. *
  29822. * _.isObjectLike([1, 2, 3]);
  29823. * // => true
  29824. *
  29825. * _.isObjectLike(_.noop);
  29826. * // => false
  29827. *
  29828. * _.isObjectLike(null);
  29829. * // => false
  29830. */
  29831. function isObjectLike(value) {
  29832. return value != null && typeof value == 'object';
  29833. }
  29834. /**
  29835. * Checks if `value` is classified as a `Map` object.
  29836. *
  29837. * @static
  29838. * @memberOf _
  29839. * @since 4.3.0
  29840. * @category Lang
  29841. * @param {*} value The value to check.
  29842. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  29843. * @example
  29844. *
  29845. * _.isMap(new Map);
  29846. * // => true
  29847. *
  29848. * _.isMap(new WeakMap);
  29849. * // => false
  29850. */
  29851. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  29852. /**
  29853. * Performs a partial deep comparison between `object` and `source` to
  29854. * determine if `object` contains equivalent property values.
  29855. *
  29856. * **Note:** This method is equivalent to `_.matches` when `source` is
  29857. * partially applied.
  29858. *
  29859. * Partial comparisons will match empty array and empty object `source`
  29860. * values against any array or object value, respectively. See `_.isEqual`
  29861. * for a list of supported value comparisons.
  29862. *
  29863. * @static
  29864. * @memberOf _
  29865. * @since 3.0.0
  29866. * @category Lang
  29867. * @param {Object} object The object to inspect.
  29868. * @param {Object} source The object of property values to match.
  29869. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29870. * @example
  29871. *
  29872. * var object = { 'a': 1, 'b': 2 };
  29873. *
  29874. * _.isMatch(object, { 'b': 2 });
  29875. * // => true
  29876. *
  29877. * _.isMatch(object, { 'b': 1 });
  29878. * // => false
  29879. */
  29880. function isMatch(object, source) {
  29881. return object === source || baseIsMatch(object, source, getMatchData(source));
  29882. }
  29883. /**
  29884. * This method is like `_.isMatch` except that it accepts `customizer` which
  29885. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29886. * are handled by the method instead. The `customizer` is invoked with five
  29887. * arguments: (objValue, srcValue, index|key, object, source).
  29888. *
  29889. * @static
  29890. * @memberOf _
  29891. * @since 4.0.0
  29892. * @category Lang
  29893. * @param {Object} object The object to inspect.
  29894. * @param {Object} source The object of property values to match.
  29895. * @param {Function} [customizer] The function to customize comparisons.
  29896. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29897. * @example
  29898. *
  29899. * function isGreeting(value) {
  29900. * return /^h(?:i|ello)$/.test(value);
  29901. * }
  29902. *
  29903. * function customizer(objValue, srcValue) {
  29904. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  29905. * return true;
  29906. * }
  29907. * }
  29908. *
  29909. * var object = { 'greeting': 'hello' };
  29910. * var source = { 'greeting': 'hi' };
  29911. *
  29912. * _.isMatchWith(object, source, customizer);
  29913. * // => true
  29914. */
  29915. function isMatchWith(object, source, customizer) {
  29916. customizer = typeof customizer == 'function' ? customizer : undefined;
  29917. return baseIsMatch(object, source, getMatchData(source), customizer);
  29918. }
  29919. /**
  29920. * Checks if `value` is `NaN`.
  29921. *
  29922. * **Note:** This method is based on
  29923. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  29924. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  29925. * `undefined` and other non-number values.
  29926. *
  29927. * @static
  29928. * @memberOf _
  29929. * @since 0.1.0
  29930. * @category Lang
  29931. * @param {*} value The value to check.
  29932. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  29933. * @example
  29934. *
  29935. * _.isNaN(NaN);
  29936. * // => true
  29937. *
  29938. * _.isNaN(new Number(NaN));
  29939. * // => true
  29940. *
  29941. * isNaN(undefined);
  29942. * // => true
  29943. *
  29944. * _.isNaN(undefined);
  29945. * // => false
  29946. */
  29947. function isNaN(value) {
  29948. // An `NaN` primitive is the only value that is not equal to itself.
  29949. // Perform the `toStringTag` check first to avoid errors with some
  29950. // ActiveX objects in IE.
  29951. return isNumber(value) && value != +value;
  29952. }
  29953. /**
  29954. * Checks if `value` is a pristine native function.
  29955. *
  29956. * **Note:** This method can't reliably detect native functions in the presence
  29957. * of the core-js package because core-js circumvents this kind of detection.
  29958. * Despite multiple requests, the core-js maintainer has made it clear: any
  29959. * attempt to fix the detection will be obstructed. As a result, we're left
  29960. * with little choice but to throw an error. Unfortunately, this also affects
  29961. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  29962. * which rely on core-js.
  29963. *
  29964. * @static
  29965. * @memberOf _
  29966. * @since 3.0.0
  29967. * @category Lang
  29968. * @param {*} value The value to check.
  29969. * @returns {boolean} Returns `true` if `value` is a native function,
  29970. * else `false`.
  29971. * @example
  29972. *
  29973. * _.isNative(Array.prototype.push);
  29974. * // => true
  29975. *
  29976. * _.isNative(_);
  29977. * // => false
  29978. */
  29979. function isNative(value) {
  29980. if (isMaskable(value)) {
  29981. throw new Error(CORE_ERROR_TEXT);
  29982. }
  29983. return baseIsNative(value);
  29984. }
  29985. /**
  29986. * Checks if `value` is `null`.
  29987. *
  29988. * @static
  29989. * @memberOf _
  29990. * @since 0.1.0
  29991. * @category Lang
  29992. * @param {*} value The value to check.
  29993. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  29994. * @example
  29995. *
  29996. * _.isNull(null);
  29997. * // => true
  29998. *
  29999. * _.isNull(void 0);
  30000. * // => false
  30001. */
  30002. function isNull(value) {
  30003. return value === null;
  30004. }
  30005. /**
  30006. * Checks if `value` is `null` or `undefined`.
  30007. *
  30008. * @static
  30009. * @memberOf _
  30010. * @since 4.0.0
  30011. * @category Lang
  30012. * @param {*} value The value to check.
  30013. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  30014. * @example
  30015. *
  30016. * _.isNil(null);
  30017. * // => true
  30018. *
  30019. * _.isNil(void 0);
  30020. * // => true
  30021. *
  30022. * _.isNil(NaN);
  30023. * // => false
  30024. */
  30025. function isNil(value) {
  30026. return value == null;
  30027. }
  30028. /**
  30029. * Checks if `value` is classified as a `Number` primitive or object.
  30030. *
  30031. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  30032. * classified as numbers, use the `_.isFinite` method.
  30033. *
  30034. * @static
  30035. * @memberOf _
  30036. * @since 0.1.0
  30037. * @category Lang
  30038. * @param {*} value The value to check.
  30039. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  30040. * @example
  30041. *
  30042. * _.isNumber(3);
  30043. * // => true
  30044. *
  30045. * _.isNumber(Number.MIN_VALUE);
  30046. * // => true
  30047. *
  30048. * _.isNumber(Infinity);
  30049. * // => true
  30050. *
  30051. * _.isNumber('3');
  30052. * // => false
  30053. */
  30054. function isNumber(value) {
  30055. return typeof value == 'number' ||
  30056. (isObjectLike(value) && baseGetTag(value) == numberTag);
  30057. }
  30058. /**
  30059. * Checks if `value` is a plain object, that is, an object created by the
  30060. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  30061. *
  30062. * @static
  30063. * @memberOf _
  30064. * @since 0.8.0
  30065. * @category Lang
  30066. * @param {*} value The value to check.
  30067. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  30068. * @example
  30069. *
  30070. * function Foo() {
  30071. * this.a = 1;
  30072. * }
  30073. *
  30074. * _.isPlainObject(new Foo);
  30075. * // => false
  30076. *
  30077. * _.isPlainObject([1, 2, 3]);
  30078. * // => false
  30079. *
  30080. * _.isPlainObject({ 'x': 0, 'y': 0 });
  30081. * // => true
  30082. *
  30083. * _.isPlainObject(Object.create(null));
  30084. * // => true
  30085. */
  30086. function isPlainObject(value) {
  30087. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  30088. return false;
  30089. }
  30090. var proto = getPrototype(value);
  30091. if (proto === null) {
  30092. return true;
  30093. }
  30094. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  30095. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  30096. funcToString.call(Ctor) == objectCtorString;
  30097. }
  30098. /**
  30099. * Checks if `value` is classified as a `RegExp` object.
  30100. *
  30101. * @static
  30102. * @memberOf _
  30103. * @since 0.1.0
  30104. * @category Lang
  30105. * @param {*} value The value to check.
  30106. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  30107. * @example
  30108. *
  30109. * _.isRegExp(/abc/);
  30110. * // => true
  30111. *
  30112. * _.isRegExp('/abc/');
  30113. * // => false
  30114. */
  30115. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  30116. /**
  30117. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  30118. * double precision number which isn't the result of a rounded unsafe integer.
  30119. *
  30120. * **Note:** This method is based on
  30121. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  30122. *
  30123. * @static
  30124. * @memberOf _
  30125. * @since 4.0.0
  30126. * @category Lang
  30127. * @param {*} value The value to check.
  30128. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  30129. * @example
  30130. *
  30131. * _.isSafeInteger(3);
  30132. * // => true
  30133. *
  30134. * _.isSafeInteger(Number.MIN_VALUE);
  30135. * // => false
  30136. *
  30137. * _.isSafeInteger(Infinity);
  30138. * // => false
  30139. *
  30140. * _.isSafeInteger('3');
  30141. * // => false
  30142. */
  30143. function isSafeInteger(value) {
  30144. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  30145. }
  30146. /**
  30147. * Checks if `value` is classified as a `Set` object.
  30148. *
  30149. * @static
  30150. * @memberOf _
  30151. * @since 4.3.0
  30152. * @category Lang
  30153. * @param {*} value The value to check.
  30154. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  30155. * @example
  30156. *
  30157. * _.isSet(new Set);
  30158. * // => true
  30159. *
  30160. * _.isSet(new WeakSet);
  30161. * // => false
  30162. */
  30163. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  30164. /**
  30165. * Checks if `value` is classified as a `String` primitive or object.
  30166. *
  30167. * @static
  30168. * @since 0.1.0
  30169. * @memberOf _
  30170. * @category Lang
  30171. * @param {*} value The value to check.
  30172. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  30173. * @example
  30174. *
  30175. * _.isString('abc');
  30176. * // => true
  30177. *
  30178. * _.isString(1);
  30179. * // => false
  30180. */
  30181. function isString(value) {
  30182. return typeof value == 'string' ||
  30183. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  30184. }
  30185. /**
  30186. * Checks if `value` is classified as a `Symbol` primitive or object.
  30187. *
  30188. * @static
  30189. * @memberOf _
  30190. * @since 4.0.0
  30191. * @category Lang
  30192. * @param {*} value The value to check.
  30193. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  30194. * @example
  30195. *
  30196. * _.isSymbol(Symbol.iterator);
  30197. * // => true
  30198. *
  30199. * _.isSymbol('abc');
  30200. * // => false
  30201. */
  30202. function isSymbol(value) {
  30203. return typeof value == 'symbol' ||
  30204. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  30205. }
  30206. /**
  30207. * Checks if `value` is classified as a typed array.
  30208. *
  30209. * @static
  30210. * @memberOf _
  30211. * @since 3.0.0
  30212. * @category Lang
  30213. * @param {*} value The value to check.
  30214. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  30215. * @example
  30216. *
  30217. * _.isTypedArray(new Uint8Array);
  30218. * // => true
  30219. *
  30220. * _.isTypedArray([]);
  30221. * // => false
  30222. */
  30223. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  30224. /**
  30225. * Checks if `value` is `undefined`.
  30226. *
  30227. * @static
  30228. * @since 0.1.0
  30229. * @memberOf _
  30230. * @category Lang
  30231. * @param {*} value The value to check.
  30232. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  30233. * @example
  30234. *
  30235. * _.isUndefined(void 0);
  30236. * // => true
  30237. *
  30238. * _.isUndefined(null);
  30239. * // => false
  30240. */
  30241. function isUndefined(value) {
  30242. return value === undefined;
  30243. }
  30244. /**
  30245. * Checks if `value` is classified as a `WeakMap` object.
  30246. *
  30247. * @static
  30248. * @memberOf _
  30249. * @since 4.3.0
  30250. * @category Lang
  30251. * @param {*} value The value to check.
  30252. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  30253. * @example
  30254. *
  30255. * _.isWeakMap(new WeakMap);
  30256. * // => true
  30257. *
  30258. * _.isWeakMap(new Map);
  30259. * // => false
  30260. */
  30261. function isWeakMap(value) {
  30262. return isObjectLike(value) && getTag(value) == weakMapTag;
  30263. }
  30264. /**
  30265. * Checks if `value` is classified as a `WeakSet` object.
  30266. *
  30267. * @static
  30268. * @memberOf _
  30269. * @since 4.3.0
  30270. * @category Lang
  30271. * @param {*} value The value to check.
  30272. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  30273. * @example
  30274. *
  30275. * _.isWeakSet(new WeakSet);
  30276. * // => true
  30277. *
  30278. * _.isWeakSet(new Set);
  30279. * // => false
  30280. */
  30281. function isWeakSet(value) {
  30282. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  30283. }
  30284. /**
  30285. * Checks if `value` is less than `other`.
  30286. *
  30287. * @static
  30288. * @memberOf _
  30289. * @since 3.9.0
  30290. * @category Lang
  30291. * @param {*} value The value to compare.
  30292. * @param {*} other The other value to compare.
  30293. * @returns {boolean} Returns `true` if `value` is less than `other`,
  30294. * else `false`.
  30295. * @see _.gt
  30296. * @example
  30297. *
  30298. * _.lt(1, 3);
  30299. * // => true
  30300. *
  30301. * _.lt(3, 3);
  30302. * // => false
  30303. *
  30304. * _.lt(3, 1);
  30305. * // => false
  30306. */
  30307. var lt = createRelationalOperation(baseLt);
  30308. /**
  30309. * Checks if `value` is less than or equal to `other`.
  30310. *
  30311. * @static
  30312. * @memberOf _
  30313. * @since 3.9.0
  30314. * @category Lang
  30315. * @param {*} value The value to compare.
  30316. * @param {*} other The other value to compare.
  30317. * @returns {boolean} Returns `true` if `value` is less than or equal to
  30318. * `other`, else `false`.
  30319. * @see _.gte
  30320. * @example
  30321. *
  30322. * _.lte(1, 3);
  30323. * // => true
  30324. *
  30325. * _.lte(3, 3);
  30326. * // => true
  30327. *
  30328. * _.lte(3, 1);
  30329. * // => false
  30330. */
  30331. var lte = createRelationalOperation(function(value, other) {
  30332. return value <= other;
  30333. });
  30334. /**
  30335. * Converts `value` to an array.
  30336. *
  30337. * @static
  30338. * @since 0.1.0
  30339. * @memberOf _
  30340. * @category Lang
  30341. * @param {*} value The value to convert.
  30342. * @returns {Array} Returns the converted array.
  30343. * @example
  30344. *
  30345. * _.toArray({ 'a': 1, 'b': 2 });
  30346. * // => [1, 2]
  30347. *
  30348. * _.toArray('abc');
  30349. * // => ['a', 'b', 'c']
  30350. *
  30351. * _.toArray(1);
  30352. * // => []
  30353. *
  30354. * _.toArray(null);
  30355. * // => []
  30356. */
  30357. function toArray(value) {
  30358. if (!value) {
  30359. return [];
  30360. }
  30361. if (isArrayLike(value)) {
  30362. return isString(value) ? stringToArray(value) : copyArray(value);
  30363. }
  30364. if (symIterator && value[symIterator]) {
  30365. return iteratorToArray(value[symIterator]());
  30366. }
  30367. var tag = getTag(value),
  30368. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  30369. return func(value);
  30370. }
  30371. /**
  30372. * Converts `value` to a finite number.
  30373. *
  30374. * @static
  30375. * @memberOf _
  30376. * @since 4.12.0
  30377. * @category Lang
  30378. * @param {*} value The value to convert.
  30379. * @returns {number} Returns the converted number.
  30380. * @example
  30381. *
  30382. * _.toFinite(3.2);
  30383. * // => 3.2
  30384. *
  30385. * _.toFinite(Number.MIN_VALUE);
  30386. * // => 5e-324
  30387. *
  30388. * _.toFinite(Infinity);
  30389. * // => 1.7976931348623157e+308
  30390. *
  30391. * _.toFinite('3.2');
  30392. * // => 3.2
  30393. */
  30394. function toFinite(value) {
  30395. if (!value) {
  30396. return value === 0 ? value : 0;
  30397. }
  30398. value = toNumber(value);
  30399. if (value === INFINITY || value === -INFINITY) {
  30400. var sign = (value < 0 ? -1 : 1);
  30401. return sign * MAX_INTEGER;
  30402. }
  30403. return value === value ? value : 0;
  30404. }
  30405. /**
  30406. * Converts `value` to an integer.
  30407. *
  30408. * **Note:** This method is loosely based on
  30409. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  30410. *
  30411. * @static
  30412. * @memberOf _
  30413. * @since 4.0.0
  30414. * @category Lang
  30415. * @param {*} value The value to convert.
  30416. * @returns {number} Returns the converted integer.
  30417. * @example
  30418. *
  30419. * _.toInteger(3.2);
  30420. * // => 3
  30421. *
  30422. * _.toInteger(Number.MIN_VALUE);
  30423. * // => 0
  30424. *
  30425. * _.toInteger(Infinity);
  30426. * // => 1.7976931348623157e+308
  30427. *
  30428. * _.toInteger('3.2');
  30429. * // => 3
  30430. */
  30431. function toInteger(value) {
  30432. var result = toFinite(value),
  30433. remainder = result % 1;
  30434. return result === result ? (remainder ? result - remainder : result) : 0;
  30435. }
  30436. /**
  30437. * Converts `value` to an integer suitable for use as the length of an
  30438. * array-like object.
  30439. *
  30440. * **Note:** This method is based on
  30441. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  30442. *
  30443. * @static
  30444. * @memberOf _
  30445. * @since 4.0.0
  30446. * @category Lang
  30447. * @param {*} value The value to convert.
  30448. * @returns {number} Returns the converted integer.
  30449. * @example
  30450. *
  30451. * _.toLength(3.2);
  30452. * // => 3
  30453. *
  30454. * _.toLength(Number.MIN_VALUE);
  30455. * // => 0
  30456. *
  30457. * _.toLength(Infinity);
  30458. * // => 4294967295
  30459. *
  30460. * _.toLength('3.2');
  30461. * // => 3
  30462. */
  30463. function toLength(value) {
  30464. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  30465. }
  30466. /**
  30467. * Converts `value` to a number.
  30468. *
  30469. * @static
  30470. * @memberOf _
  30471. * @since 4.0.0
  30472. * @category Lang
  30473. * @param {*} value The value to process.
  30474. * @returns {number} Returns the number.
  30475. * @example
  30476. *
  30477. * _.toNumber(3.2);
  30478. * // => 3.2
  30479. *
  30480. * _.toNumber(Number.MIN_VALUE);
  30481. * // => 5e-324
  30482. *
  30483. * _.toNumber(Infinity);
  30484. * // => Infinity
  30485. *
  30486. * _.toNumber('3.2');
  30487. * // => 3.2
  30488. */
  30489. function toNumber(value) {
  30490. if (typeof value == 'number') {
  30491. return value;
  30492. }
  30493. if (isSymbol(value)) {
  30494. return NAN;
  30495. }
  30496. if (isObject(value)) {
  30497. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  30498. value = isObject(other) ? (other + '') : other;
  30499. }
  30500. if (typeof value != 'string') {
  30501. return value === 0 ? value : +value;
  30502. }
  30503. value = value.replace(reTrim, '');
  30504. var isBinary = reIsBinary.test(value);
  30505. return (isBinary || reIsOctal.test(value))
  30506. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  30507. : (reIsBadHex.test(value) ? NAN : +value);
  30508. }
  30509. /**
  30510. * Converts `value` to a plain object flattening inherited enumerable string
  30511. * keyed properties of `value` to own properties of the plain object.
  30512. *
  30513. * @static
  30514. * @memberOf _
  30515. * @since 3.0.0
  30516. * @category Lang
  30517. * @param {*} value The value to convert.
  30518. * @returns {Object} Returns the converted plain object.
  30519. * @example
  30520. *
  30521. * function Foo() {
  30522. * this.b = 2;
  30523. * }
  30524. *
  30525. * Foo.prototype.c = 3;
  30526. *
  30527. * _.assign({ 'a': 1 }, new Foo);
  30528. * // => { 'a': 1, 'b': 2 }
  30529. *
  30530. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  30531. * // => { 'a': 1, 'b': 2, 'c': 3 }
  30532. */
  30533. function toPlainObject(value) {
  30534. return copyObject(value, keysIn(value));
  30535. }
  30536. /**
  30537. * Converts `value` to a safe integer. A safe integer can be compared and
  30538. * represented correctly.
  30539. *
  30540. * @static
  30541. * @memberOf _
  30542. * @since 4.0.0
  30543. * @category Lang
  30544. * @param {*} value The value to convert.
  30545. * @returns {number} Returns the converted integer.
  30546. * @example
  30547. *
  30548. * _.toSafeInteger(3.2);
  30549. * // => 3
  30550. *
  30551. * _.toSafeInteger(Number.MIN_VALUE);
  30552. * // => 0
  30553. *
  30554. * _.toSafeInteger(Infinity);
  30555. * // => 9007199254740991
  30556. *
  30557. * _.toSafeInteger('3.2');
  30558. * // => 3
  30559. */
  30560. function toSafeInteger(value) {
  30561. return value
  30562. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  30563. : (value === 0 ? value : 0);
  30564. }
  30565. /**
  30566. * Converts `value` to a string. An empty string is returned for `null`
  30567. * and `undefined` values. The sign of `-0` is preserved.
  30568. *
  30569. * @static
  30570. * @memberOf _
  30571. * @since 4.0.0
  30572. * @category Lang
  30573. * @param {*} value The value to convert.
  30574. * @returns {string} Returns the converted string.
  30575. * @example
  30576. *
  30577. * _.toString(null);
  30578. * // => ''
  30579. *
  30580. * _.toString(-0);
  30581. * // => '-0'
  30582. *
  30583. * _.toString([1, 2, 3]);
  30584. * // => '1,2,3'
  30585. */
  30586. function toString(value) {
  30587. return value == null ? '' : baseToString(value);
  30588. }
  30589. /*------------------------------------------------------------------------*/
  30590. /**
  30591. * Assigns own enumerable string keyed properties of source objects to the
  30592. * destination object. Source objects are applied from left to right.
  30593. * Subsequent sources overwrite property assignments of previous sources.
  30594. *
  30595. * **Note:** This method mutates `object` and is loosely based on
  30596. * [`Object.assign`](https://mdn.io/Object/assign).
  30597. *
  30598. * @static
  30599. * @memberOf _
  30600. * @since 0.10.0
  30601. * @category Object
  30602. * @param {Object} object The destination object.
  30603. * @param {...Object} [sources] The source objects.
  30604. * @returns {Object} Returns `object`.
  30605. * @see _.assignIn
  30606. * @example
  30607. *
  30608. * function Foo() {
  30609. * this.a = 1;
  30610. * }
  30611. *
  30612. * function Bar() {
  30613. * this.c = 3;
  30614. * }
  30615. *
  30616. * Foo.prototype.b = 2;
  30617. * Bar.prototype.d = 4;
  30618. *
  30619. * _.assign({ 'a': 0 }, new Foo, new Bar);
  30620. * // => { 'a': 1, 'c': 3 }
  30621. */
  30622. var assign = createAssigner(function(object, source) {
  30623. if (isPrototype(source) || isArrayLike(source)) {
  30624. copyObject(source, keys(source), object);
  30625. return;
  30626. }
  30627. for (var key in source) {
  30628. if (hasOwnProperty.call(source, key)) {
  30629. assignValue(object, key, source[key]);
  30630. }
  30631. }
  30632. });
  30633. /**
  30634. * This method is like `_.assign` except that it iterates over own and
  30635. * inherited source properties.
  30636. *
  30637. * **Note:** This method mutates `object`.
  30638. *
  30639. * @static
  30640. * @memberOf _
  30641. * @since 4.0.0
  30642. * @alias extend
  30643. * @category Object
  30644. * @param {Object} object The destination object.
  30645. * @param {...Object} [sources] The source objects.
  30646. * @returns {Object} Returns `object`.
  30647. * @see _.assign
  30648. * @example
  30649. *
  30650. * function Foo() {
  30651. * this.a = 1;
  30652. * }
  30653. *
  30654. * function Bar() {
  30655. * this.c = 3;
  30656. * }
  30657. *
  30658. * Foo.prototype.b = 2;
  30659. * Bar.prototype.d = 4;
  30660. *
  30661. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  30662. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  30663. */
  30664. var assignIn = createAssigner(function(object, source) {
  30665. copyObject(source, keysIn(source), object);
  30666. });
  30667. /**
  30668. * This method is like `_.assignIn` except that it accepts `customizer`
  30669. * which is invoked to produce the assigned values. If `customizer` returns
  30670. * `undefined`, assignment is handled by the method instead. The `customizer`
  30671. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30672. *
  30673. * **Note:** This method mutates `object`.
  30674. *
  30675. * @static
  30676. * @memberOf _
  30677. * @since 4.0.0
  30678. * @alias extendWith
  30679. * @category Object
  30680. * @param {Object} object The destination object.
  30681. * @param {...Object} sources The source objects.
  30682. * @param {Function} [customizer] The function to customize assigned values.
  30683. * @returns {Object} Returns `object`.
  30684. * @see _.assignWith
  30685. * @example
  30686. *
  30687. * function customizer(objValue, srcValue) {
  30688. * return _.isUndefined(objValue) ? srcValue : objValue;
  30689. * }
  30690. *
  30691. * var defaults = _.partialRight(_.assignInWith, customizer);
  30692. *
  30693. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30694. * // => { 'a': 1, 'b': 2 }
  30695. */
  30696. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  30697. copyObject(source, keysIn(source), object, customizer);
  30698. });
  30699. /**
  30700. * This method is like `_.assign` except that it accepts `customizer`
  30701. * which is invoked to produce the assigned values. If `customizer` returns
  30702. * `undefined`, assignment is handled by the method instead. The `customizer`
  30703. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30704. *
  30705. * **Note:** This method mutates `object`.
  30706. *
  30707. * @static
  30708. * @memberOf _
  30709. * @since 4.0.0
  30710. * @category Object
  30711. * @param {Object} object The destination object.
  30712. * @param {...Object} sources The source objects.
  30713. * @param {Function} [customizer] The function to customize assigned values.
  30714. * @returns {Object} Returns `object`.
  30715. * @see _.assignInWith
  30716. * @example
  30717. *
  30718. * function customizer(objValue, srcValue) {
  30719. * return _.isUndefined(objValue) ? srcValue : objValue;
  30720. * }
  30721. *
  30722. * var defaults = _.partialRight(_.assignWith, customizer);
  30723. *
  30724. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30725. * // => { 'a': 1, 'b': 2 }
  30726. */
  30727. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  30728. copyObject(source, keys(source), object, customizer);
  30729. });
  30730. /**
  30731. * Creates an array of values corresponding to `paths` of `object`.
  30732. *
  30733. * @static
  30734. * @memberOf _
  30735. * @since 1.0.0
  30736. * @category Object
  30737. * @param {Object} object The object to iterate over.
  30738. * @param {...(string|string[])} [paths] The property paths to pick.
  30739. * @returns {Array} Returns the picked values.
  30740. * @example
  30741. *
  30742. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  30743. *
  30744. * _.at(object, ['a[0].b.c', 'a[1]']);
  30745. * // => [3, 4]
  30746. */
  30747. var at = flatRest(baseAt);
  30748. /**
  30749. * Creates an object that inherits from the `prototype` object. If a
  30750. * `properties` object is given, its own enumerable string keyed properties
  30751. * are assigned to the created object.
  30752. *
  30753. * @static
  30754. * @memberOf _
  30755. * @since 2.3.0
  30756. * @category Object
  30757. * @param {Object} prototype The object to inherit from.
  30758. * @param {Object} [properties] The properties to assign to the object.
  30759. * @returns {Object} Returns the new object.
  30760. * @example
  30761. *
  30762. * function Shape() {
  30763. * this.x = 0;
  30764. * this.y = 0;
  30765. * }
  30766. *
  30767. * function Circle() {
  30768. * Shape.call(this);
  30769. * }
  30770. *
  30771. * Circle.prototype = _.create(Shape.prototype, {
  30772. * 'constructor': Circle
  30773. * });
  30774. *
  30775. * var circle = new Circle;
  30776. * circle instanceof Circle;
  30777. * // => true
  30778. *
  30779. * circle instanceof Shape;
  30780. * // => true
  30781. */
  30782. function create(prototype, properties) {
  30783. var result = baseCreate(prototype);
  30784. return properties == null ? result : baseAssign(result, properties);
  30785. }
  30786. /**
  30787. * Assigns own and inherited enumerable string keyed properties of source
  30788. * objects to the destination object for all destination properties that
  30789. * resolve to `undefined`. Source objects are applied from left to right.
  30790. * Once a property is set, additional values of the same property are ignored.
  30791. *
  30792. * **Note:** This method mutates `object`.
  30793. *
  30794. * @static
  30795. * @since 0.1.0
  30796. * @memberOf _
  30797. * @category Object
  30798. * @param {Object} object The destination object.
  30799. * @param {...Object} [sources] The source objects.
  30800. * @returns {Object} Returns `object`.
  30801. * @see _.defaultsDeep
  30802. * @example
  30803. *
  30804. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30805. * // => { 'a': 1, 'b': 2 }
  30806. */
  30807. var defaults = baseRest(function(object, sources) {
  30808. object = Object(object);
  30809. var index = -1;
  30810. var length = sources.length;
  30811. var guard = length > 2 ? sources[2] : undefined;
  30812. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  30813. length = 1;
  30814. }
  30815. while (++index < length) {
  30816. var source = sources[index];
  30817. var props = keysIn(source);
  30818. var propsIndex = -1;
  30819. var propsLength = props.length;
  30820. while (++propsIndex < propsLength) {
  30821. var key = props[propsIndex];
  30822. var value = object[key];
  30823. if (value === undefined ||
  30824. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  30825. object[key] = source[key];
  30826. }
  30827. }
  30828. }
  30829. return object;
  30830. });
  30831. /**
  30832. * This method is like `_.defaults` except that it recursively assigns
  30833. * default properties.
  30834. *
  30835. * **Note:** This method mutates `object`.
  30836. *
  30837. * @static
  30838. * @memberOf _
  30839. * @since 3.10.0
  30840. * @category Object
  30841. * @param {Object} object The destination object.
  30842. * @param {...Object} [sources] The source objects.
  30843. * @returns {Object} Returns `object`.
  30844. * @see _.defaults
  30845. * @example
  30846. *
  30847. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  30848. * // => { 'a': { 'b': 2, 'c': 3 } }
  30849. */
  30850. var defaultsDeep = baseRest(function(args) {
  30851. args.push(undefined, customDefaultsMerge);
  30852. return apply(mergeWith, undefined, args);
  30853. });
  30854. /**
  30855. * This method is like `_.find` except that it returns the key of the first
  30856. * element `predicate` returns truthy for instead of the element itself.
  30857. *
  30858. * @static
  30859. * @memberOf _
  30860. * @since 1.1.0
  30861. * @category Object
  30862. * @param {Object} object The object to inspect.
  30863. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30864. * @returns {string|undefined} Returns the key of the matched element,
  30865. * else `undefined`.
  30866. * @example
  30867. *
  30868. * var users = {
  30869. * 'barney': { 'age': 36, 'active': true },
  30870. * 'fred': { 'age': 40, 'active': false },
  30871. * 'pebbles': { 'age': 1, 'active': true }
  30872. * };
  30873. *
  30874. * _.findKey(users, function(o) { return o.age < 40; });
  30875. * // => 'barney' (iteration order is not guaranteed)
  30876. *
  30877. * // The `_.matches` iteratee shorthand.
  30878. * _.findKey(users, { 'age': 1, 'active': true });
  30879. * // => 'pebbles'
  30880. *
  30881. * // The `_.matchesProperty` iteratee shorthand.
  30882. * _.findKey(users, ['active', false]);
  30883. * // => 'fred'
  30884. *
  30885. * // The `_.property` iteratee shorthand.
  30886. * _.findKey(users, 'active');
  30887. * // => 'barney'
  30888. */
  30889. function findKey(object, predicate) {
  30890. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  30891. }
  30892. /**
  30893. * This method is like `_.findKey` except that it iterates over elements of
  30894. * a collection in the opposite order.
  30895. *
  30896. * @static
  30897. * @memberOf _
  30898. * @since 2.0.0
  30899. * @category Object
  30900. * @param {Object} object The object to inspect.
  30901. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30902. * @returns {string|undefined} Returns the key of the matched element,
  30903. * else `undefined`.
  30904. * @example
  30905. *
  30906. * var users = {
  30907. * 'barney': { 'age': 36, 'active': true },
  30908. * 'fred': { 'age': 40, 'active': false },
  30909. * 'pebbles': { 'age': 1, 'active': true }
  30910. * };
  30911. *
  30912. * _.findLastKey(users, function(o) { return o.age < 40; });
  30913. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  30914. *
  30915. * // The `_.matches` iteratee shorthand.
  30916. * _.findLastKey(users, { 'age': 36, 'active': true });
  30917. * // => 'barney'
  30918. *
  30919. * // The `_.matchesProperty` iteratee shorthand.
  30920. * _.findLastKey(users, ['active', false]);
  30921. * // => 'fred'
  30922. *
  30923. * // The `_.property` iteratee shorthand.
  30924. * _.findLastKey(users, 'active');
  30925. * // => 'pebbles'
  30926. */
  30927. function findLastKey(object, predicate) {
  30928. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  30929. }
  30930. /**
  30931. * Iterates over own and inherited enumerable string keyed properties of an
  30932. * object and invokes `iteratee` for each property. The iteratee is invoked
  30933. * with three arguments: (value, key, object). Iteratee functions may exit
  30934. * iteration early by explicitly returning `false`.
  30935. *
  30936. * @static
  30937. * @memberOf _
  30938. * @since 0.3.0
  30939. * @category Object
  30940. * @param {Object} object The object to iterate over.
  30941. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30942. * @returns {Object} Returns `object`.
  30943. * @see _.forInRight
  30944. * @example
  30945. *
  30946. * function Foo() {
  30947. * this.a = 1;
  30948. * this.b = 2;
  30949. * }
  30950. *
  30951. * Foo.prototype.c = 3;
  30952. *
  30953. * _.forIn(new Foo, function(value, key) {
  30954. * console.log(key);
  30955. * });
  30956. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  30957. */
  30958. function forIn(object, iteratee) {
  30959. return object == null
  30960. ? object
  30961. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  30962. }
  30963. /**
  30964. * This method is like `_.forIn` except that it iterates over properties of
  30965. * `object` in the opposite order.
  30966. *
  30967. * @static
  30968. * @memberOf _
  30969. * @since 2.0.0
  30970. * @category Object
  30971. * @param {Object} object The object to iterate over.
  30972. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30973. * @returns {Object} Returns `object`.
  30974. * @see _.forIn
  30975. * @example
  30976. *
  30977. * function Foo() {
  30978. * this.a = 1;
  30979. * this.b = 2;
  30980. * }
  30981. *
  30982. * Foo.prototype.c = 3;
  30983. *
  30984. * _.forInRight(new Foo, function(value, key) {
  30985. * console.log(key);
  30986. * });
  30987. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  30988. */
  30989. function forInRight(object, iteratee) {
  30990. return object == null
  30991. ? object
  30992. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  30993. }
  30994. /**
  30995. * Iterates over own enumerable string keyed properties of an object and
  30996. * invokes `iteratee` for each property. The iteratee is invoked with three
  30997. * arguments: (value, key, object). Iteratee functions may exit iteration
  30998. * early by explicitly returning `false`.
  30999. *
  31000. * @static
  31001. * @memberOf _
  31002. * @since 0.3.0
  31003. * @category Object
  31004. * @param {Object} object The object to iterate over.
  31005. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31006. * @returns {Object} Returns `object`.
  31007. * @see _.forOwnRight
  31008. * @example
  31009. *
  31010. * function Foo() {
  31011. * this.a = 1;
  31012. * this.b = 2;
  31013. * }
  31014. *
  31015. * Foo.prototype.c = 3;
  31016. *
  31017. * _.forOwn(new Foo, function(value, key) {
  31018. * console.log(key);
  31019. * });
  31020. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  31021. */
  31022. function forOwn(object, iteratee) {
  31023. return object && baseForOwn(object, getIteratee(iteratee, 3));
  31024. }
  31025. /**
  31026. * This method is like `_.forOwn` except that it iterates over properties of
  31027. * `object` in the opposite order.
  31028. *
  31029. * @static
  31030. * @memberOf _
  31031. * @since 2.0.0
  31032. * @category Object
  31033. * @param {Object} object The object to iterate over.
  31034. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31035. * @returns {Object} Returns `object`.
  31036. * @see _.forOwn
  31037. * @example
  31038. *
  31039. * function Foo() {
  31040. * this.a = 1;
  31041. * this.b = 2;
  31042. * }
  31043. *
  31044. * Foo.prototype.c = 3;
  31045. *
  31046. * _.forOwnRight(new Foo, function(value, key) {
  31047. * console.log(key);
  31048. * });
  31049. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  31050. */
  31051. function forOwnRight(object, iteratee) {
  31052. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  31053. }
  31054. /**
  31055. * Creates an array of function property names from own enumerable properties
  31056. * of `object`.
  31057. *
  31058. * @static
  31059. * @since 0.1.0
  31060. * @memberOf _
  31061. * @category Object
  31062. * @param {Object} object The object to inspect.
  31063. * @returns {Array} Returns the function names.
  31064. * @see _.functionsIn
  31065. * @example
  31066. *
  31067. * function Foo() {
  31068. * this.a = _.constant('a');
  31069. * this.b = _.constant('b');
  31070. * }
  31071. *
  31072. * Foo.prototype.c = _.constant('c');
  31073. *
  31074. * _.functions(new Foo);
  31075. * // => ['a', 'b']
  31076. */
  31077. function functions(object) {
  31078. return object == null ? [] : baseFunctions(object, keys(object));
  31079. }
  31080. /**
  31081. * Creates an array of function property names from own and inherited
  31082. * enumerable properties of `object`.
  31083. *
  31084. * @static
  31085. * @memberOf _
  31086. * @since 4.0.0
  31087. * @category Object
  31088. * @param {Object} object The object to inspect.
  31089. * @returns {Array} Returns the function names.
  31090. * @see _.functions
  31091. * @example
  31092. *
  31093. * function Foo() {
  31094. * this.a = _.constant('a');
  31095. * this.b = _.constant('b');
  31096. * }
  31097. *
  31098. * Foo.prototype.c = _.constant('c');
  31099. *
  31100. * _.functionsIn(new Foo);
  31101. * // => ['a', 'b', 'c']
  31102. */
  31103. function functionsIn(object) {
  31104. return object == null ? [] : baseFunctions(object, keysIn(object));
  31105. }
  31106. /**
  31107. * Gets the value at `path` of `object`. If the resolved value is
  31108. * `undefined`, the `defaultValue` is returned in its place.
  31109. *
  31110. * @static
  31111. * @memberOf _
  31112. * @since 3.7.0
  31113. * @category Object
  31114. * @param {Object} object The object to query.
  31115. * @param {Array|string} path The path of the property to get.
  31116. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  31117. * @returns {*} Returns the resolved value.
  31118. * @example
  31119. *
  31120. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31121. *
  31122. * _.get(object, 'a[0].b.c');
  31123. * // => 3
  31124. *
  31125. * _.get(object, ['a', '0', 'b', 'c']);
  31126. * // => 3
  31127. *
  31128. * _.get(object, 'a.b.c', 'default');
  31129. * // => 'default'
  31130. */
  31131. function get(object, path, defaultValue) {
  31132. var result = object == null ? undefined : baseGet(object, path);
  31133. return result === undefined ? defaultValue : result;
  31134. }
  31135. /**
  31136. * Checks if `path` is a direct property of `object`.
  31137. *
  31138. * @static
  31139. * @since 0.1.0
  31140. * @memberOf _
  31141. * @category Object
  31142. * @param {Object} object The object to query.
  31143. * @param {Array|string} path The path to check.
  31144. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  31145. * @example
  31146. *
  31147. * var object = { 'a': { 'b': 2 } };
  31148. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  31149. *
  31150. * _.has(object, 'a');
  31151. * // => true
  31152. *
  31153. * _.has(object, 'a.b');
  31154. * // => true
  31155. *
  31156. * _.has(object, ['a', 'b']);
  31157. * // => true
  31158. *
  31159. * _.has(other, 'a');
  31160. * // => false
  31161. */
  31162. function has(object, path) {
  31163. return object != null && hasPath(object, path, baseHas);
  31164. }
  31165. /**
  31166. * Checks if `path` is a direct or inherited property of `object`.
  31167. *
  31168. * @static
  31169. * @memberOf _
  31170. * @since 4.0.0
  31171. * @category Object
  31172. * @param {Object} object The object to query.
  31173. * @param {Array|string} path The path to check.
  31174. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  31175. * @example
  31176. *
  31177. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  31178. *
  31179. * _.hasIn(object, 'a');
  31180. * // => true
  31181. *
  31182. * _.hasIn(object, 'a.b');
  31183. * // => true
  31184. *
  31185. * _.hasIn(object, ['a', 'b']);
  31186. * // => true
  31187. *
  31188. * _.hasIn(object, 'b');
  31189. * // => false
  31190. */
  31191. function hasIn(object, path) {
  31192. return object != null && hasPath(object, path, baseHasIn);
  31193. }
  31194. /**
  31195. * Creates an object composed of the inverted keys and values of `object`.
  31196. * If `object` contains duplicate values, subsequent values overwrite
  31197. * property assignments of previous values.
  31198. *
  31199. * @static
  31200. * @memberOf _
  31201. * @since 0.7.0
  31202. * @category Object
  31203. * @param {Object} object The object to invert.
  31204. * @returns {Object} Returns the new inverted object.
  31205. * @example
  31206. *
  31207. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  31208. *
  31209. * _.invert(object);
  31210. * // => { '1': 'c', '2': 'b' }
  31211. */
  31212. var invert = createInverter(function(result, value, key) {
  31213. if (value != null &&
  31214. typeof value.toString != 'function') {
  31215. value = nativeObjectToString.call(value);
  31216. }
  31217. result[value] = key;
  31218. }, constant(identity));
  31219. /**
  31220. * This method is like `_.invert` except that the inverted object is generated
  31221. * from the results of running each element of `object` thru `iteratee`. The
  31222. * corresponding inverted value of each inverted key is an array of keys
  31223. * responsible for generating the inverted value. The iteratee is invoked
  31224. * with one argument: (value).
  31225. *
  31226. * @static
  31227. * @memberOf _
  31228. * @since 4.1.0
  31229. * @category Object
  31230. * @param {Object} object The object to invert.
  31231. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  31232. * @returns {Object} Returns the new inverted object.
  31233. * @example
  31234. *
  31235. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  31236. *
  31237. * _.invertBy(object);
  31238. * // => { '1': ['a', 'c'], '2': ['b'] }
  31239. *
  31240. * _.invertBy(object, function(value) {
  31241. * return 'group' + value;
  31242. * });
  31243. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  31244. */
  31245. var invertBy = createInverter(function(result, value, key) {
  31246. if (value != null &&
  31247. typeof value.toString != 'function') {
  31248. value = nativeObjectToString.call(value);
  31249. }
  31250. if (hasOwnProperty.call(result, value)) {
  31251. result[value].push(key);
  31252. } else {
  31253. result[value] = [key];
  31254. }
  31255. }, getIteratee);
  31256. /**
  31257. * Invokes the method at `path` of `object`.
  31258. *
  31259. * @static
  31260. * @memberOf _
  31261. * @since 4.0.0
  31262. * @category Object
  31263. * @param {Object} object The object to query.
  31264. * @param {Array|string} path The path of the method to invoke.
  31265. * @param {...*} [args] The arguments to invoke the method with.
  31266. * @returns {*} Returns the result of the invoked method.
  31267. * @example
  31268. *
  31269. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  31270. *
  31271. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  31272. * // => [2, 3]
  31273. */
  31274. var invoke = baseRest(baseInvoke);
  31275. /**
  31276. * Creates an array of the own enumerable property names of `object`.
  31277. *
  31278. * **Note:** Non-object values are coerced to objects. See the
  31279. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  31280. * for more details.
  31281. *
  31282. * @static
  31283. * @since 0.1.0
  31284. * @memberOf _
  31285. * @category Object
  31286. * @param {Object} object The object to query.
  31287. * @returns {Array} Returns the array of property names.
  31288. * @example
  31289. *
  31290. * function Foo() {
  31291. * this.a = 1;
  31292. * this.b = 2;
  31293. * }
  31294. *
  31295. * Foo.prototype.c = 3;
  31296. *
  31297. * _.keys(new Foo);
  31298. * // => ['a', 'b'] (iteration order is not guaranteed)
  31299. *
  31300. * _.keys('hi');
  31301. * // => ['0', '1']
  31302. */
  31303. function keys(object) {
  31304. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  31305. }
  31306. /**
  31307. * Creates an array of the own and inherited enumerable property names of `object`.
  31308. *
  31309. * **Note:** Non-object values are coerced to objects.
  31310. *
  31311. * @static
  31312. * @memberOf _
  31313. * @since 3.0.0
  31314. * @category Object
  31315. * @param {Object} object The object to query.
  31316. * @returns {Array} Returns the array of property names.
  31317. * @example
  31318. *
  31319. * function Foo() {
  31320. * this.a = 1;
  31321. * this.b = 2;
  31322. * }
  31323. *
  31324. * Foo.prototype.c = 3;
  31325. *
  31326. * _.keysIn(new Foo);
  31327. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  31328. */
  31329. function keysIn(object) {
  31330. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  31331. }
  31332. /**
  31333. * The opposite of `_.mapValues`; this method creates an object with the
  31334. * same values as `object` and keys generated by running each own enumerable
  31335. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  31336. * with three arguments: (value, key, object).
  31337. *
  31338. * @static
  31339. * @memberOf _
  31340. * @since 3.8.0
  31341. * @category Object
  31342. * @param {Object} object The object to iterate over.
  31343. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31344. * @returns {Object} Returns the new mapped object.
  31345. * @see _.mapValues
  31346. * @example
  31347. *
  31348. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  31349. * return key + value;
  31350. * });
  31351. * // => { 'a1': 1, 'b2': 2 }
  31352. */
  31353. function mapKeys(object, iteratee) {
  31354. var result = {};
  31355. iteratee = getIteratee(iteratee, 3);
  31356. baseForOwn(object, function(value, key, object) {
  31357. baseAssignValue(result, iteratee(value, key, object), value);
  31358. });
  31359. return result;
  31360. }
  31361. /**
  31362. * Creates an object with the same keys as `object` and values generated
  31363. * by running each own enumerable string keyed property of `object` thru
  31364. * `iteratee`. The iteratee is invoked with three arguments:
  31365. * (value, key, object).
  31366. *
  31367. * @static
  31368. * @memberOf _
  31369. * @since 2.4.0
  31370. * @category Object
  31371. * @param {Object} object The object to iterate over.
  31372. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31373. * @returns {Object} Returns the new mapped object.
  31374. * @see _.mapKeys
  31375. * @example
  31376. *
  31377. * var users = {
  31378. * 'fred': { 'user': 'fred', 'age': 40 },
  31379. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  31380. * };
  31381. *
  31382. * _.mapValues(users, function(o) { return o.age; });
  31383. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  31384. *
  31385. * // The `_.property` iteratee shorthand.
  31386. * _.mapValues(users, 'age');
  31387. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  31388. */
  31389. function mapValues(object, iteratee) {
  31390. var result = {};
  31391. iteratee = getIteratee(iteratee, 3);
  31392. baseForOwn(object, function(value, key, object) {
  31393. baseAssignValue(result, key, iteratee(value, key, object));
  31394. });
  31395. return result;
  31396. }
  31397. /**
  31398. * This method is like `_.assign` except that it recursively merges own and
  31399. * inherited enumerable string keyed properties of source objects into the
  31400. * destination object. Source properties that resolve to `undefined` are
  31401. * skipped if a destination value exists. Array and plain object properties
  31402. * are merged recursively. Other objects and value types are overridden by
  31403. * assignment. Source objects are applied from left to right. Subsequent
  31404. * sources overwrite property assignments of previous sources.
  31405. *
  31406. * **Note:** This method mutates `object`.
  31407. *
  31408. * @static
  31409. * @memberOf _
  31410. * @since 0.5.0
  31411. * @category Object
  31412. * @param {Object} object The destination object.
  31413. * @param {...Object} [sources] The source objects.
  31414. * @returns {Object} Returns `object`.
  31415. * @example
  31416. *
  31417. * var object = {
  31418. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  31419. * };
  31420. *
  31421. * var other = {
  31422. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  31423. * };
  31424. *
  31425. * _.merge(object, other);
  31426. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  31427. */
  31428. var merge = createAssigner(function(object, source, srcIndex) {
  31429. baseMerge(object, source, srcIndex);
  31430. });
  31431. /**
  31432. * This method is like `_.merge` except that it accepts `customizer` which
  31433. * is invoked to produce the merged values of the destination and source
  31434. * properties. If `customizer` returns `undefined`, merging is handled by the
  31435. * method instead. The `customizer` is invoked with six arguments:
  31436. * (objValue, srcValue, key, object, source, stack).
  31437. *
  31438. * **Note:** This method mutates `object`.
  31439. *
  31440. * @static
  31441. * @memberOf _
  31442. * @since 4.0.0
  31443. * @category Object
  31444. * @param {Object} object The destination object.
  31445. * @param {...Object} sources The source objects.
  31446. * @param {Function} customizer The function to customize assigned values.
  31447. * @returns {Object} Returns `object`.
  31448. * @example
  31449. *
  31450. * function customizer(objValue, srcValue) {
  31451. * if (_.isArray(objValue)) {
  31452. * return objValue.concat(srcValue);
  31453. * }
  31454. * }
  31455. *
  31456. * var object = { 'a': [1], 'b': [2] };
  31457. * var other = { 'a': [3], 'b': [4] };
  31458. *
  31459. * _.mergeWith(object, other, customizer);
  31460. * // => { 'a': [1, 3], 'b': [2, 4] }
  31461. */
  31462. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  31463. baseMerge(object, source, srcIndex, customizer);
  31464. });
  31465. /**
  31466. * The opposite of `_.pick`; this method creates an object composed of the
  31467. * own and inherited enumerable property paths of `object` that are not omitted.
  31468. *
  31469. * **Note:** This method is considerably slower than `_.pick`.
  31470. *
  31471. * @static
  31472. * @since 0.1.0
  31473. * @memberOf _
  31474. * @category Object
  31475. * @param {Object} object The source object.
  31476. * @param {...(string|string[])} [paths] The property paths to omit.
  31477. * @returns {Object} Returns the new object.
  31478. * @example
  31479. *
  31480. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31481. *
  31482. * _.omit(object, ['a', 'c']);
  31483. * // => { 'b': '2' }
  31484. */
  31485. var omit = flatRest(function(object, paths) {
  31486. var result = {};
  31487. if (object == null) {
  31488. return result;
  31489. }
  31490. var isDeep = false;
  31491. paths = arrayMap(paths, function(path) {
  31492. path = castPath(path, object);
  31493. isDeep || (isDeep = path.length > 1);
  31494. return path;
  31495. });
  31496. copyObject(object, getAllKeysIn(object), result);
  31497. if (isDeep) {
  31498. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  31499. }
  31500. var length = paths.length;
  31501. while (length--) {
  31502. baseUnset(result, paths[length]);
  31503. }
  31504. return result;
  31505. });
  31506. /**
  31507. * The opposite of `_.pickBy`; this method creates an object composed of
  31508. * the own and inherited enumerable string keyed properties of `object` that
  31509. * `predicate` doesn't return truthy for. The predicate is invoked with two
  31510. * arguments: (value, key).
  31511. *
  31512. * @static
  31513. * @memberOf _
  31514. * @since 4.0.0
  31515. * @category Object
  31516. * @param {Object} object The source object.
  31517. * @param {Function} [predicate=_.identity] The function invoked per property.
  31518. * @returns {Object} Returns the new object.
  31519. * @example
  31520. *
  31521. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31522. *
  31523. * _.omitBy(object, _.isNumber);
  31524. * // => { 'b': '2' }
  31525. */
  31526. function omitBy(object, predicate) {
  31527. return pickBy(object, negate(getIteratee(predicate)));
  31528. }
  31529. /**
  31530. * Creates an object composed of the picked `object` properties.
  31531. *
  31532. * @static
  31533. * @since 0.1.0
  31534. * @memberOf _
  31535. * @category Object
  31536. * @param {Object} object The source object.
  31537. * @param {...(string|string[])} [paths] The property paths to pick.
  31538. * @returns {Object} Returns the new object.
  31539. * @example
  31540. *
  31541. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31542. *
  31543. * _.pick(object, ['a', 'c']);
  31544. * // => { 'a': 1, 'c': 3 }
  31545. */
  31546. var pick = flatRest(function(object, paths) {
  31547. return object == null ? {} : basePick(object, paths);
  31548. });
  31549. /**
  31550. * Creates an object composed of the `object` properties `predicate` returns
  31551. * truthy for. The predicate is invoked with two arguments: (value, key).
  31552. *
  31553. * @static
  31554. * @memberOf _
  31555. * @since 4.0.0
  31556. * @category Object
  31557. * @param {Object} object The source object.
  31558. * @param {Function} [predicate=_.identity] The function invoked per property.
  31559. * @returns {Object} Returns the new object.
  31560. * @example
  31561. *
  31562. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31563. *
  31564. * _.pickBy(object, _.isNumber);
  31565. * // => { 'a': 1, 'c': 3 }
  31566. */
  31567. function pickBy(object, predicate) {
  31568. if (object == null) {
  31569. return {};
  31570. }
  31571. var props = arrayMap(getAllKeysIn(object), function(prop) {
  31572. return [prop];
  31573. });
  31574. predicate = getIteratee(predicate);
  31575. return basePickBy(object, props, function(value, path) {
  31576. return predicate(value, path[0]);
  31577. });
  31578. }
  31579. /**
  31580. * This method is like `_.get` except that if the resolved value is a
  31581. * function it's invoked with the `this` binding of its parent object and
  31582. * its result is returned.
  31583. *
  31584. * @static
  31585. * @since 0.1.0
  31586. * @memberOf _
  31587. * @category Object
  31588. * @param {Object} object The object to query.
  31589. * @param {Array|string} path The path of the property to resolve.
  31590. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  31591. * @returns {*} Returns the resolved value.
  31592. * @example
  31593. *
  31594. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  31595. *
  31596. * _.result(object, 'a[0].b.c1');
  31597. * // => 3
  31598. *
  31599. * _.result(object, 'a[0].b.c2');
  31600. * // => 4
  31601. *
  31602. * _.result(object, 'a[0].b.c3', 'default');
  31603. * // => 'default'
  31604. *
  31605. * _.result(object, 'a[0].b.c3', _.constant('default'));
  31606. * // => 'default'
  31607. */
  31608. function result(object, path, defaultValue) {
  31609. path = castPath(path, object);
  31610. var index = -1,
  31611. length = path.length;
  31612. // Ensure the loop is entered when path is empty.
  31613. if (!length) {
  31614. length = 1;
  31615. object = undefined;
  31616. }
  31617. while (++index < length) {
  31618. var value = object == null ? undefined : object[toKey(path[index])];
  31619. if (value === undefined) {
  31620. index = length;
  31621. value = defaultValue;
  31622. }
  31623. object = isFunction(value) ? value.call(object) : value;
  31624. }
  31625. return object;
  31626. }
  31627. /**
  31628. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  31629. * it's created. Arrays are created for missing index properties while objects
  31630. * are created for all other missing properties. Use `_.setWith` to customize
  31631. * `path` creation.
  31632. *
  31633. * **Note:** This method mutates `object`.
  31634. *
  31635. * @static
  31636. * @memberOf _
  31637. * @since 3.7.0
  31638. * @category Object
  31639. * @param {Object} object The object to modify.
  31640. * @param {Array|string} path The path of the property to set.
  31641. * @param {*} value The value to set.
  31642. * @returns {Object} Returns `object`.
  31643. * @example
  31644. *
  31645. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31646. *
  31647. * _.set(object, 'a[0].b.c', 4);
  31648. * console.log(object.a[0].b.c);
  31649. * // => 4
  31650. *
  31651. * _.set(object, ['x', '0', 'y', 'z'], 5);
  31652. * console.log(object.x[0].y.z);
  31653. * // => 5
  31654. */
  31655. function set(object, path, value) {
  31656. return object == null ? object : baseSet(object, path, value);
  31657. }
  31658. /**
  31659. * This method is like `_.set` except that it accepts `customizer` which is
  31660. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31661. * path creation is handled by the method instead. The `customizer` is invoked
  31662. * with three arguments: (nsValue, key, nsObject).
  31663. *
  31664. * **Note:** This method mutates `object`.
  31665. *
  31666. * @static
  31667. * @memberOf _
  31668. * @since 4.0.0
  31669. * @category Object
  31670. * @param {Object} object The object to modify.
  31671. * @param {Array|string} path The path of the property to set.
  31672. * @param {*} value The value to set.
  31673. * @param {Function} [customizer] The function to customize assigned values.
  31674. * @returns {Object} Returns `object`.
  31675. * @example
  31676. *
  31677. * var object = {};
  31678. *
  31679. * _.setWith(object, '[0][1]', 'a', Object);
  31680. * // => { '0': { '1': 'a' } }
  31681. */
  31682. function setWith(object, path, value, customizer) {
  31683. customizer = typeof customizer == 'function' ? customizer : undefined;
  31684. return object == null ? object : baseSet(object, path, value, customizer);
  31685. }
  31686. /**
  31687. * Creates an array of own enumerable string keyed-value pairs for `object`
  31688. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  31689. * entries are returned.
  31690. *
  31691. * @static
  31692. * @memberOf _
  31693. * @since 4.0.0
  31694. * @alias entries
  31695. * @category Object
  31696. * @param {Object} object The object to query.
  31697. * @returns {Array} Returns the key-value pairs.
  31698. * @example
  31699. *
  31700. * function Foo() {
  31701. * this.a = 1;
  31702. * this.b = 2;
  31703. * }
  31704. *
  31705. * Foo.prototype.c = 3;
  31706. *
  31707. * _.toPairs(new Foo);
  31708. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  31709. */
  31710. var toPairs = createToPairs(keys);
  31711. /**
  31712. * Creates an array of own and inherited enumerable string keyed-value pairs
  31713. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  31714. * or set, its entries are returned.
  31715. *
  31716. * @static
  31717. * @memberOf _
  31718. * @since 4.0.0
  31719. * @alias entriesIn
  31720. * @category Object
  31721. * @param {Object} object The object to query.
  31722. * @returns {Array} Returns the key-value pairs.
  31723. * @example
  31724. *
  31725. * function Foo() {
  31726. * this.a = 1;
  31727. * this.b = 2;
  31728. * }
  31729. *
  31730. * Foo.prototype.c = 3;
  31731. *
  31732. * _.toPairsIn(new Foo);
  31733. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  31734. */
  31735. var toPairsIn = createToPairs(keysIn);
  31736. /**
  31737. * An alternative to `_.reduce`; this method transforms `object` to a new
  31738. * `accumulator` object which is the result of running each of its own
  31739. * enumerable string keyed properties thru `iteratee`, with each invocation
  31740. * potentially mutating the `accumulator` object. If `accumulator` is not
  31741. * provided, a new object with the same `[[Prototype]]` will be used. The
  31742. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  31743. * Iteratee functions may exit iteration early by explicitly returning `false`.
  31744. *
  31745. * @static
  31746. * @memberOf _
  31747. * @since 1.3.0
  31748. * @category Object
  31749. * @param {Object} object The object to iterate over.
  31750. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31751. * @param {*} [accumulator] The custom accumulator value.
  31752. * @returns {*} Returns the accumulated value.
  31753. * @example
  31754. *
  31755. * _.transform([2, 3, 4], function(result, n) {
  31756. * result.push(n *= n);
  31757. * return n % 2 == 0;
  31758. * }, []);
  31759. * // => [4, 9]
  31760. *
  31761. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  31762. * (result[value] || (result[value] = [])).push(key);
  31763. * }, {});
  31764. * // => { '1': ['a', 'c'], '2': ['b'] }
  31765. */
  31766. function transform(object, iteratee, accumulator) {
  31767. var isArr = isArray(object),
  31768. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  31769. iteratee = getIteratee(iteratee, 4);
  31770. if (accumulator == null) {
  31771. var Ctor = object && object.constructor;
  31772. if (isArrLike) {
  31773. accumulator = isArr ? new Ctor : [];
  31774. }
  31775. else if (isObject(object)) {
  31776. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  31777. }
  31778. else {
  31779. accumulator = {};
  31780. }
  31781. }
  31782. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  31783. return iteratee(accumulator, value, index, object);
  31784. });
  31785. return accumulator;
  31786. }
  31787. /**
  31788. * Removes the property at `path` of `object`.
  31789. *
  31790. * **Note:** This method mutates `object`.
  31791. *
  31792. * @static
  31793. * @memberOf _
  31794. * @since 4.0.0
  31795. * @category Object
  31796. * @param {Object} object The object to modify.
  31797. * @param {Array|string} path The path of the property to unset.
  31798. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  31799. * @example
  31800. *
  31801. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  31802. * _.unset(object, 'a[0].b.c');
  31803. * // => true
  31804. *
  31805. * console.log(object);
  31806. * // => { 'a': [{ 'b': {} }] };
  31807. *
  31808. * _.unset(object, ['a', '0', 'b', 'c']);
  31809. * // => true
  31810. *
  31811. * console.log(object);
  31812. * // => { 'a': [{ 'b': {} }] };
  31813. */
  31814. function unset(object, path) {
  31815. return object == null ? true : baseUnset(object, path);
  31816. }
  31817. /**
  31818. * This method is like `_.set` except that accepts `updater` to produce the
  31819. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  31820. * is invoked with one argument: (value).
  31821. *
  31822. * **Note:** This method mutates `object`.
  31823. *
  31824. * @static
  31825. * @memberOf _
  31826. * @since 4.6.0
  31827. * @category Object
  31828. * @param {Object} object The object to modify.
  31829. * @param {Array|string} path The path of the property to set.
  31830. * @param {Function} updater The function to produce the updated value.
  31831. * @returns {Object} Returns `object`.
  31832. * @example
  31833. *
  31834. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31835. *
  31836. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  31837. * console.log(object.a[0].b.c);
  31838. * // => 9
  31839. *
  31840. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  31841. * console.log(object.x[0].y.z);
  31842. * // => 0
  31843. */
  31844. function update(object, path, updater) {
  31845. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  31846. }
  31847. /**
  31848. * This method is like `_.update` except that it accepts `customizer` which is
  31849. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31850. * path creation is handled by the method instead. The `customizer` is invoked
  31851. * with three arguments: (nsValue, key, nsObject).
  31852. *
  31853. * **Note:** This method mutates `object`.
  31854. *
  31855. * @static
  31856. * @memberOf _
  31857. * @since 4.6.0
  31858. * @category Object
  31859. * @param {Object} object The object to modify.
  31860. * @param {Array|string} path The path of the property to set.
  31861. * @param {Function} updater The function to produce the updated value.
  31862. * @param {Function} [customizer] The function to customize assigned values.
  31863. * @returns {Object} Returns `object`.
  31864. * @example
  31865. *
  31866. * var object = {};
  31867. *
  31868. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  31869. * // => { '0': { '1': 'a' } }
  31870. */
  31871. function updateWith(object, path, updater, customizer) {
  31872. customizer = typeof customizer == 'function' ? customizer : undefined;
  31873. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  31874. }
  31875. /**
  31876. * Creates an array of the own enumerable string keyed property values of `object`.
  31877. *
  31878. * **Note:** Non-object values are coerced to objects.
  31879. *
  31880. * @static
  31881. * @since 0.1.0
  31882. * @memberOf _
  31883. * @category Object
  31884. * @param {Object} object The object to query.
  31885. * @returns {Array} Returns the array of property values.
  31886. * @example
  31887. *
  31888. * function Foo() {
  31889. * this.a = 1;
  31890. * this.b = 2;
  31891. * }
  31892. *
  31893. * Foo.prototype.c = 3;
  31894. *
  31895. * _.values(new Foo);
  31896. * // => [1, 2] (iteration order is not guaranteed)
  31897. *
  31898. * _.values('hi');
  31899. * // => ['h', 'i']
  31900. */
  31901. function values(object) {
  31902. return object == null ? [] : baseValues(object, keys(object));
  31903. }
  31904. /**
  31905. * Creates an array of the own and inherited enumerable string keyed property
  31906. * values of `object`.
  31907. *
  31908. * **Note:** Non-object values are coerced to objects.
  31909. *
  31910. * @static
  31911. * @memberOf _
  31912. * @since 3.0.0
  31913. * @category Object
  31914. * @param {Object} object The object to query.
  31915. * @returns {Array} Returns the array of property values.
  31916. * @example
  31917. *
  31918. * function Foo() {
  31919. * this.a = 1;
  31920. * this.b = 2;
  31921. * }
  31922. *
  31923. * Foo.prototype.c = 3;
  31924. *
  31925. * _.valuesIn(new Foo);
  31926. * // => [1, 2, 3] (iteration order is not guaranteed)
  31927. */
  31928. function valuesIn(object) {
  31929. return object == null ? [] : baseValues(object, keysIn(object));
  31930. }
  31931. /*------------------------------------------------------------------------*/
  31932. /**
  31933. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  31934. *
  31935. * @static
  31936. * @memberOf _
  31937. * @since 4.0.0
  31938. * @category Number
  31939. * @param {number} number The number to clamp.
  31940. * @param {number} [lower] The lower bound.
  31941. * @param {number} upper The upper bound.
  31942. * @returns {number} Returns the clamped number.
  31943. * @example
  31944. *
  31945. * _.clamp(-10, -5, 5);
  31946. * // => -5
  31947. *
  31948. * _.clamp(10, -5, 5);
  31949. * // => 5
  31950. */
  31951. function clamp(number, lower, upper) {
  31952. if (upper === undefined) {
  31953. upper = lower;
  31954. lower = undefined;
  31955. }
  31956. if (upper !== undefined) {
  31957. upper = toNumber(upper);
  31958. upper = upper === upper ? upper : 0;
  31959. }
  31960. if (lower !== undefined) {
  31961. lower = toNumber(lower);
  31962. lower = lower === lower ? lower : 0;
  31963. }
  31964. return baseClamp(toNumber(number), lower, upper);
  31965. }
  31966. /**
  31967. * Checks if `n` is between `start` and up to, but not including, `end`. If
  31968. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  31969. * If `start` is greater than `end` the params are swapped to support
  31970. * negative ranges.
  31971. *
  31972. * @static
  31973. * @memberOf _
  31974. * @since 3.3.0
  31975. * @category Number
  31976. * @param {number} number The number to check.
  31977. * @param {number} [start=0] The start of the range.
  31978. * @param {number} end The end of the range.
  31979. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  31980. * @see _.range, _.rangeRight
  31981. * @example
  31982. *
  31983. * _.inRange(3, 2, 4);
  31984. * // => true
  31985. *
  31986. * _.inRange(4, 8);
  31987. * // => true
  31988. *
  31989. * _.inRange(4, 2);
  31990. * // => false
  31991. *
  31992. * _.inRange(2, 2);
  31993. * // => false
  31994. *
  31995. * _.inRange(1.2, 2);
  31996. * // => true
  31997. *
  31998. * _.inRange(5.2, 4);
  31999. * // => false
  32000. *
  32001. * _.inRange(-3, -2, -6);
  32002. * // => true
  32003. */
  32004. function inRange(number, start, end) {
  32005. start = toFinite(start);
  32006. if (end === undefined) {
  32007. end = start;
  32008. start = 0;
  32009. } else {
  32010. end = toFinite(end);
  32011. }
  32012. number = toNumber(number);
  32013. return baseInRange(number, start, end);
  32014. }
  32015. /**
  32016. * Produces a random number between the inclusive `lower` and `upper` bounds.
  32017. * If only one argument is provided a number between `0` and the given number
  32018. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  32019. * floats, a floating-point number is returned instead of an integer.
  32020. *
  32021. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  32022. * floating-point values which can produce unexpected results.
  32023. *
  32024. * @static
  32025. * @memberOf _
  32026. * @since 0.7.0
  32027. * @category Number
  32028. * @param {number} [lower=0] The lower bound.
  32029. * @param {number} [upper=1] The upper bound.
  32030. * @param {boolean} [floating] Specify returning a floating-point number.
  32031. * @returns {number} Returns the random number.
  32032. * @example
  32033. *
  32034. * _.random(0, 5);
  32035. * // => an integer between 0 and 5
  32036. *
  32037. * _.random(5);
  32038. * // => also an integer between 0 and 5
  32039. *
  32040. * _.random(5, true);
  32041. * // => a floating-point number between 0 and 5
  32042. *
  32043. * _.random(1.2, 5.2);
  32044. * // => a floating-point number between 1.2 and 5.2
  32045. */
  32046. function random(lower, upper, floating) {
  32047. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  32048. upper = floating = undefined;
  32049. }
  32050. if (floating === undefined) {
  32051. if (typeof upper == 'boolean') {
  32052. floating = upper;
  32053. upper = undefined;
  32054. }
  32055. else if (typeof lower == 'boolean') {
  32056. floating = lower;
  32057. lower = undefined;
  32058. }
  32059. }
  32060. if (lower === undefined && upper === undefined) {
  32061. lower = 0;
  32062. upper = 1;
  32063. }
  32064. else {
  32065. lower = toFinite(lower);
  32066. if (upper === undefined) {
  32067. upper = lower;
  32068. lower = 0;
  32069. } else {
  32070. upper = toFinite(upper);
  32071. }
  32072. }
  32073. if (lower > upper) {
  32074. var temp = lower;
  32075. lower = upper;
  32076. upper = temp;
  32077. }
  32078. if (floating || lower % 1 || upper % 1) {
  32079. var rand = nativeRandom();
  32080. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  32081. }
  32082. return baseRandom(lower, upper);
  32083. }
  32084. /*------------------------------------------------------------------------*/
  32085. /**
  32086. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  32087. *
  32088. * @static
  32089. * @memberOf _
  32090. * @since 3.0.0
  32091. * @category String
  32092. * @param {string} [string=''] The string to convert.
  32093. * @returns {string} Returns the camel cased string.
  32094. * @example
  32095. *
  32096. * _.camelCase('Foo Bar');
  32097. * // => 'fooBar'
  32098. *
  32099. * _.camelCase('--foo-bar--');
  32100. * // => 'fooBar'
  32101. *
  32102. * _.camelCase('__FOO_BAR__');
  32103. * // => 'fooBar'
  32104. */
  32105. var camelCase = createCompounder(function(result, word, index) {
  32106. word = word.toLowerCase();
  32107. return result + (index ? capitalize(word) : word);
  32108. });
  32109. /**
  32110. * Converts the first character of `string` to upper case and the remaining
  32111. * to lower case.
  32112. *
  32113. * @static
  32114. * @memberOf _
  32115. * @since 3.0.0
  32116. * @category String
  32117. * @param {string} [string=''] The string to capitalize.
  32118. * @returns {string} Returns the capitalized string.
  32119. * @example
  32120. *
  32121. * _.capitalize('FRED');
  32122. * // => 'Fred'
  32123. */
  32124. function capitalize(string) {
  32125. return upperFirst(toString(string).toLowerCase());
  32126. }
  32127. /**
  32128. * Deburrs `string` by converting
  32129. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  32130. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  32131. * letters to basic Latin letters and removing
  32132. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  32133. *
  32134. * @static
  32135. * @memberOf _
  32136. * @since 3.0.0
  32137. * @category String
  32138. * @param {string} [string=''] The string to deburr.
  32139. * @returns {string} Returns the deburred string.
  32140. * @example
  32141. *
  32142. * _.deburr('déjà vu');
  32143. * // => 'deja vu'
  32144. */
  32145. function deburr(string) {
  32146. string = toString(string);
  32147. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  32148. }
  32149. /**
  32150. * Checks if `string` ends with the given target string.
  32151. *
  32152. * @static
  32153. * @memberOf _
  32154. * @since 3.0.0
  32155. * @category String
  32156. * @param {string} [string=''] The string to inspect.
  32157. * @param {string} [target] The string to search for.
  32158. * @param {number} [position=string.length] The position to search up to.
  32159. * @returns {boolean} Returns `true` if `string` ends with `target`,
  32160. * else `false`.
  32161. * @example
  32162. *
  32163. * _.endsWith('abc', 'c');
  32164. * // => true
  32165. *
  32166. * _.endsWith('abc', 'b');
  32167. * // => false
  32168. *
  32169. * _.endsWith('abc', 'b', 2);
  32170. * // => true
  32171. */
  32172. function endsWith(string, target, position) {
  32173. string = toString(string);
  32174. target = baseToString(target);
  32175. var length = string.length;
  32176. position = position === undefined
  32177. ? length
  32178. : baseClamp(toInteger(position), 0, length);
  32179. var end = position;
  32180. position -= target.length;
  32181. return position >= 0 && string.slice(position, end) == target;
  32182. }
  32183. /**
  32184. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  32185. * corresponding HTML entities.
  32186. *
  32187. * **Note:** No other characters are escaped. To escape additional
  32188. * characters use a third-party library like [_he_](https://mths.be/he).
  32189. *
  32190. * Though the ">" character is escaped for symmetry, characters like
  32191. * ">" and "/" don't need escaping in HTML and have no special meaning
  32192. * unless they're part of a tag or unquoted attribute value. See
  32193. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  32194. * (under "semi-related fun fact") for more details.
  32195. *
  32196. * When working with HTML you should always
  32197. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  32198. * XSS vectors.
  32199. *
  32200. * @static
  32201. * @since 0.1.0
  32202. * @memberOf _
  32203. * @category String
  32204. * @param {string} [string=''] The string to escape.
  32205. * @returns {string} Returns the escaped string.
  32206. * @example
  32207. *
  32208. * _.escape('fred, barney, & pebbles');
  32209. * // => 'fred, barney, &amp; pebbles'
  32210. */
  32211. function escape(string) {
  32212. string = toString(string);
  32213. return (string && reHasUnescapedHtml.test(string))
  32214. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  32215. : string;
  32216. }
  32217. /**
  32218. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  32219. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  32220. *
  32221. * @static
  32222. * @memberOf _
  32223. * @since 3.0.0
  32224. * @category String
  32225. * @param {string} [string=''] The string to escape.
  32226. * @returns {string} Returns the escaped string.
  32227. * @example
  32228. *
  32229. * _.escapeRegExp('[lodash](https://lodash.com/)');
  32230. * // => '\[lodash\]\(https://lodash\.com/\)'
  32231. */
  32232. function escapeRegExp(string) {
  32233. string = toString(string);
  32234. return (string && reHasRegExpChar.test(string))
  32235. ? string.replace(reRegExpChar, '\\$&')
  32236. : string;
  32237. }
  32238. /**
  32239. * Converts `string` to
  32240. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  32241. *
  32242. * @static
  32243. * @memberOf _
  32244. * @since 3.0.0
  32245. * @category String
  32246. * @param {string} [string=''] The string to convert.
  32247. * @returns {string} Returns the kebab cased string.
  32248. * @example
  32249. *
  32250. * _.kebabCase('Foo Bar');
  32251. * // => 'foo-bar'
  32252. *
  32253. * _.kebabCase('fooBar');
  32254. * // => 'foo-bar'
  32255. *
  32256. * _.kebabCase('__FOO_BAR__');
  32257. * // => 'foo-bar'
  32258. */
  32259. var kebabCase = createCompounder(function(result, word, index) {
  32260. return result + (index ? '-' : '') + word.toLowerCase();
  32261. });
  32262. /**
  32263. * Converts `string`, as space separated words, to lower case.
  32264. *
  32265. * @static
  32266. * @memberOf _
  32267. * @since 4.0.0
  32268. * @category String
  32269. * @param {string} [string=''] The string to convert.
  32270. * @returns {string} Returns the lower cased string.
  32271. * @example
  32272. *
  32273. * _.lowerCase('--Foo-Bar--');
  32274. * // => 'foo bar'
  32275. *
  32276. * _.lowerCase('fooBar');
  32277. * // => 'foo bar'
  32278. *
  32279. * _.lowerCase('__FOO_BAR__');
  32280. * // => 'foo bar'
  32281. */
  32282. var lowerCase = createCompounder(function(result, word, index) {
  32283. return result + (index ? ' ' : '') + word.toLowerCase();
  32284. });
  32285. /**
  32286. * Converts the first character of `string` to lower case.
  32287. *
  32288. * @static
  32289. * @memberOf _
  32290. * @since 4.0.0
  32291. * @category String
  32292. * @param {string} [string=''] The string to convert.
  32293. * @returns {string} Returns the converted string.
  32294. * @example
  32295. *
  32296. * _.lowerFirst('Fred');
  32297. * // => 'fred'
  32298. *
  32299. * _.lowerFirst('FRED');
  32300. * // => 'fRED'
  32301. */
  32302. var lowerFirst = createCaseFirst('toLowerCase');
  32303. /**
  32304. * Pads `string` on the left and right sides if it's shorter than `length`.
  32305. * Padding characters are truncated if they can't be evenly divided by `length`.
  32306. *
  32307. * @static
  32308. * @memberOf _
  32309. * @since 3.0.0
  32310. * @category String
  32311. * @param {string} [string=''] The string to pad.
  32312. * @param {number} [length=0] The padding length.
  32313. * @param {string} [chars=' '] The string used as padding.
  32314. * @returns {string} Returns the padded string.
  32315. * @example
  32316. *
  32317. * _.pad('abc', 8);
  32318. * // => ' abc '
  32319. *
  32320. * _.pad('abc', 8, '_-');
  32321. * // => '_-abc_-_'
  32322. *
  32323. * _.pad('abc', 3);
  32324. * // => 'abc'
  32325. */
  32326. function pad(string, length, chars) {
  32327. string = toString(string);
  32328. length = toInteger(length);
  32329. var strLength = length ? stringSize(string) : 0;
  32330. if (!length || strLength >= length) {
  32331. return string;
  32332. }
  32333. var mid = (length - strLength) / 2;
  32334. return (
  32335. createPadding(nativeFloor(mid), chars) +
  32336. string +
  32337. createPadding(nativeCeil(mid), chars)
  32338. );
  32339. }
  32340. /**
  32341. * Pads `string` on the right side if it's shorter than `length`. Padding
  32342. * characters are truncated if they exceed `length`.
  32343. *
  32344. * @static
  32345. * @memberOf _
  32346. * @since 4.0.0
  32347. * @category String
  32348. * @param {string} [string=''] The string to pad.
  32349. * @param {number} [length=0] The padding length.
  32350. * @param {string} [chars=' '] The string used as padding.
  32351. * @returns {string} Returns the padded string.
  32352. * @example
  32353. *
  32354. * _.padEnd('abc', 6);
  32355. * // => 'abc '
  32356. *
  32357. * _.padEnd('abc', 6, '_-');
  32358. * // => 'abc_-_'
  32359. *
  32360. * _.padEnd('abc', 3);
  32361. * // => 'abc'
  32362. */
  32363. function padEnd(string, length, chars) {
  32364. string = toString(string);
  32365. length = toInteger(length);
  32366. var strLength = length ? stringSize(string) : 0;
  32367. return (length && strLength < length)
  32368. ? (string + createPadding(length - strLength, chars))
  32369. : string;
  32370. }
  32371. /**
  32372. * Pads `string` on the left side if it's shorter than `length`. Padding
  32373. * characters are truncated if they exceed `length`.
  32374. *
  32375. * @static
  32376. * @memberOf _
  32377. * @since 4.0.0
  32378. * @category String
  32379. * @param {string} [string=''] The string to pad.
  32380. * @param {number} [length=0] The padding length.
  32381. * @param {string} [chars=' '] The string used as padding.
  32382. * @returns {string} Returns the padded string.
  32383. * @example
  32384. *
  32385. * _.padStart('abc', 6);
  32386. * // => ' abc'
  32387. *
  32388. * _.padStart('abc', 6, '_-');
  32389. * // => '_-_abc'
  32390. *
  32391. * _.padStart('abc', 3);
  32392. * // => 'abc'
  32393. */
  32394. function padStart(string, length, chars) {
  32395. string = toString(string);
  32396. length = toInteger(length);
  32397. var strLength = length ? stringSize(string) : 0;
  32398. return (length && strLength < length)
  32399. ? (createPadding(length - strLength, chars) + string)
  32400. : string;
  32401. }
  32402. /**
  32403. * Converts `string` to an integer of the specified radix. If `radix` is
  32404. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  32405. * hexadecimal, in which case a `radix` of `16` is used.
  32406. *
  32407. * **Note:** This method aligns with the
  32408. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  32409. *
  32410. * @static
  32411. * @memberOf _
  32412. * @since 1.1.0
  32413. * @category String
  32414. * @param {string} string The string to convert.
  32415. * @param {number} [radix=10] The radix to interpret `value` by.
  32416. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32417. * @returns {number} Returns the converted integer.
  32418. * @example
  32419. *
  32420. * _.parseInt('08');
  32421. * // => 8
  32422. *
  32423. * _.map(['6', '08', '10'], _.parseInt);
  32424. * // => [6, 8, 10]
  32425. */
  32426. function parseInt(string, radix, guard) {
  32427. if (guard || radix == null) {
  32428. radix = 0;
  32429. } else if (radix) {
  32430. radix = +radix;
  32431. }
  32432. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  32433. }
  32434. /**
  32435. * Repeats the given string `n` times.
  32436. *
  32437. * @static
  32438. * @memberOf _
  32439. * @since 3.0.0
  32440. * @category String
  32441. * @param {string} [string=''] The string to repeat.
  32442. * @param {number} [n=1] The number of times to repeat the string.
  32443. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32444. * @returns {string} Returns the repeated string.
  32445. * @example
  32446. *
  32447. * _.repeat('*', 3);
  32448. * // => '***'
  32449. *
  32450. * _.repeat('abc', 2);
  32451. * // => 'abcabc'
  32452. *
  32453. * _.repeat('abc', 0);
  32454. * // => ''
  32455. */
  32456. function repeat(string, n, guard) {
  32457. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  32458. n = 1;
  32459. } else {
  32460. n = toInteger(n);
  32461. }
  32462. return baseRepeat(toString(string), n);
  32463. }
  32464. /**
  32465. * Replaces matches for `pattern` in `string` with `replacement`.
  32466. *
  32467. * **Note:** This method is based on
  32468. * [`String#replace`](https://mdn.io/String/replace).
  32469. *
  32470. * @static
  32471. * @memberOf _
  32472. * @since 4.0.0
  32473. * @category String
  32474. * @param {string} [string=''] The string to modify.
  32475. * @param {RegExp|string} pattern The pattern to replace.
  32476. * @param {Function|string} replacement The match replacement.
  32477. * @returns {string} Returns the modified string.
  32478. * @example
  32479. *
  32480. * _.replace('Hi Fred', 'Fred', 'Barney');
  32481. * // => 'Hi Barney'
  32482. */
  32483. function replace() {
  32484. var args = arguments,
  32485. string = toString(args[0]);
  32486. return args.length < 3 ? string : string.replace(args[1], args[2]);
  32487. }
  32488. /**
  32489. * Converts `string` to
  32490. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  32491. *
  32492. * @static
  32493. * @memberOf _
  32494. * @since 3.0.0
  32495. * @category String
  32496. * @param {string} [string=''] The string to convert.
  32497. * @returns {string} Returns the snake cased string.
  32498. * @example
  32499. *
  32500. * _.snakeCase('Foo Bar');
  32501. * // => 'foo_bar'
  32502. *
  32503. * _.snakeCase('fooBar');
  32504. * // => 'foo_bar'
  32505. *
  32506. * _.snakeCase('--FOO-BAR--');
  32507. * // => 'foo_bar'
  32508. */
  32509. var snakeCase = createCompounder(function(result, word, index) {
  32510. return result + (index ? '_' : '') + word.toLowerCase();
  32511. });
  32512. /**
  32513. * Splits `string` by `separator`.
  32514. *
  32515. * **Note:** This method is based on
  32516. * [`String#split`](https://mdn.io/String/split).
  32517. *
  32518. * @static
  32519. * @memberOf _
  32520. * @since 4.0.0
  32521. * @category String
  32522. * @param {string} [string=''] The string to split.
  32523. * @param {RegExp|string} separator The separator pattern to split by.
  32524. * @param {number} [limit] The length to truncate results to.
  32525. * @returns {Array} Returns the string segments.
  32526. * @example
  32527. *
  32528. * _.split('a-b-c', '-', 2);
  32529. * // => ['a', 'b']
  32530. */
  32531. function split(string, separator, limit) {
  32532. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  32533. separator = limit = undefined;
  32534. }
  32535. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  32536. if (!limit) {
  32537. return [];
  32538. }
  32539. string = toString(string);
  32540. if (string && (
  32541. typeof separator == 'string' ||
  32542. (separator != null && !isRegExp(separator))
  32543. )) {
  32544. separator = baseToString(separator);
  32545. if (!separator && hasUnicode(string)) {
  32546. return castSlice(stringToArray(string), 0, limit);
  32547. }
  32548. }
  32549. return string.split(separator, limit);
  32550. }
  32551. /**
  32552. * Converts `string` to
  32553. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  32554. *
  32555. * @static
  32556. * @memberOf _
  32557. * @since 3.1.0
  32558. * @category String
  32559. * @param {string} [string=''] The string to convert.
  32560. * @returns {string} Returns the start cased string.
  32561. * @example
  32562. *
  32563. * _.startCase('--foo-bar--');
  32564. * // => 'Foo Bar'
  32565. *
  32566. * _.startCase('fooBar');
  32567. * // => 'Foo Bar'
  32568. *
  32569. * _.startCase('__FOO_BAR__');
  32570. * // => 'FOO BAR'
  32571. */
  32572. var startCase = createCompounder(function(result, word, index) {
  32573. return result + (index ? ' ' : '') + upperFirst(word);
  32574. });
  32575. /**
  32576. * Checks if `string` starts with the given target string.
  32577. *
  32578. * @static
  32579. * @memberOf _
  32580. * @since 3.0.0
  32581. * @category String
  32582. * @param {string} [string=''] The string to inspect.
  32583. * @param {string} [target] The string to search for.
  32584. * @param {number} [position=0] The position to search from.
  32585. * @returns {boolean} Returns `true` if `string` starts with `target`,
  32586. * else `false`.
  32587. * @example
  32588. *
  32589. * _.startsWith('abc', 'a');
  32590. * // => true
  32591. *
  32592. * _.startsWith('abc', 'b');
  32593. * // => false
  32594. *
  32595. * _.startsWith('abc', 'b', 1);
  32596. * // => true
  32597. */
  32598. function startsWith(string, target, position) {
  32599. string = toString(string);
  32600. position = position == null
  32601. ? 0
  32602. : baseClamp(toInteger(position), 0, string.length);
  32603. target = baseToString(target);
  32604. return string.slice(position, position + target.length) == target;
  32605. }
  32606. /**
  32607. * Creates a compiled template function that can interpolate data properties
  32608. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  32609. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  32610. * properties may be accessed as free variables in the template. If a setting
  32611. * object is given, it takes precedence over `_.templateSettings` values.
  32612. *
  32613. * **Note:** In the development build `_.template` utilizes
  32614. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  32615. * for easier debugging.
  32616. *
  32617. * For more information on precompiling templates see
  32618. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  32619. *
  32620. * For more information on Chrome extension sandboxes see
  32621. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  32622. *
  32623. * @static
  32624. * @since 0.1.0
  32625. * @memberOf _
  32626. * @category String
  32627. * @param {string} [string=''] The template string.
  32628. * @param {Object} [options={}] The options object.
  32629. * @param {RegExp} [options.escape=_.templateSettings.escape]
  32630. * The HTML "escape" delimiter.
  32631. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  32632. * The "evaluate" delimiter.
  32633. * @param {Object} [options.imports=_.templateSettings.imports]
  32634. * An object to import into the template as free variables.
  32635. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  32636. * The "interpolate" delimiter.
  32637. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  32638. * The sourceURL of the compiled template.
  32639. * @param {string} [options.variable='obj']
  32640. * The data object variable name.
  32641. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32642. * @returns {Function} Returns the compiled template function.
  32643. * @example
  32644. *
  32645. * // Use the "interpolate" delimiter to create a compiled template.
  32646. * var compiled = _.template('hello <%= user %>!');
  32647. * compiled({ 'user': 'fred' });
  32648. * // => 'hello fred!'
  32649. *
  32650. * // Use the HTML "escape" delimiter to escape data property values.
  32651. * var compiled = _.template('<b><%- value %></b>');
  32652. * compiled({ 'value': '<script>' });
  32653. * // => '<b>&lt;script&gt;</b>'
  32654. *
  32655. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  32656. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  32657. * compiled({ 'users': ['fred', 'barney'] });
  32658. * // => '<li>fred</li><li>barney</li>'
  32659. *
  32660. * // Use the internal `print` function in "evaluate" delimiters.
  32661. * var compiled = _.template('<% print("hello " + user); %>!');
  32662. * compiled({ 'user': 'barney' });
  32663. * // => 'hello barney!'
  32664. *
  32665. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  32666. * // Disable support by replacing the "interpolate" delimiter.
  32667. * var compiled = _.template('hello ${ user }!');
  32668. * compiled({ 'user': 'pebbles' });
  32669. * // => 'hello pebbles!'
  32670. *
  32671. * // Use backslashes to treat delimiters as plain text.
  32672. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  32673. * compiled({ 'value': 'ignored' });
  32674. * // => '<%- value %>'
  32675. *
  32676. * // Use the `imports` option to import `jQuery` as `jq`.
  32677. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  32678. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  32679. * compiled({ 'users': ['fred', 'barney'] });
  32680. * // => '<li>fred</li><li>barney</li>'
  32681. *
  32682. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  32683. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  32684. * compiled(data);
  32685. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  32686. *
  32687. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  32688. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  32689. * compiled.source;
  32690. * // => function(data) {
  32691. * // var __t, __p = '';
  32692. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  32693. * // return __p;
  32694. * // }
  32695. *
  32696. * // Use custom template delimiters.
  32697. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  32698. * var compiled = _.template('hello {{ user }}!');
  32699. * compiled({ 'user': 'mustache' });
  32700. * // => 'hello mustache!'
  32701. *
  32702. * // Use the `source` property to inline compiled templates for meaningful
  32703. * // line numbers in error messages and stack traces.
  32704. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  32705. * var JST = {\
  32706. * "main": ' + _.template(mainText).source + '\
  32707. * };\
  32708. * ');
  32709. */
  32710. function template(string, options, guard) {
  32711. // Based on John Resig's `tmpl` implementation
  32712. // (http://ejohn.org/blog/javascript-micro-templating/)
  32713. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  32714. var settings = lodash.templateSettings;
  32715. if (guard && isIterateeCall(string, options, guard)) {
  32716. options = undefined;
  32717. }
  32718. string = toString(string);
  32719. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  32720. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  32721. importsKeys = keys(imports),
  32722. importsValues = baseValues(imports, importsKeys);
  32723. var isEscaping,
  32724. isEvaluating,
  32725. index = 0,
  32726. interpolate = options.interpolate || reNoMatch,
  32727. source = "__p += '";
  32728. // Compile the regexp to match each delimiter.
  32729. var reDelimiters = RegExp(
  32730. (options.escape || reNoMatch).source + '|' +
  32731. interpolate.source + '|' +
  32732. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  32733. (options.evaluate || reNoMatch).source + '|$'
  32734. , 'g');
  32735. // Use a sourceURL for easier debugging.
  32736. // The sourceURL gets injected into the source that's eval-ed, so be careful
  32737. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  32738. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  32739. var sourceURL = '//# sourceURL=' +
  32740. (hasOwnProperty.call(options, 'sourceURL')
  32741. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  32742. : ('lodash.templateSources[' + (++templateCounter) + ']')
  32743. ) + '\n';
  32744. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  32745. interpolateValue || (interpolateValue = esTemplateValue);
  32746. // Escape characters that can't be included in string literals.
  32747. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  32748. // Replace delimiters with snippets.
  32749. if (escapeValue) {
  32750. isEscaping = true;
  32751. source += "' +\n__e(" + escapeValue + ") +\n'";
  32752. }
  32753. if (evaluateValue) {
  32754. isEvaluating = true;
  32755. source += "';\n" + evaluateValue + ";\n__p += '";
  32756. }
  32757. if (interpolateValue) {
  32758. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  32759. }
  32760. index = offset + match.length;
  32761. // The JS engine embedded in Adobe products needs `match` returned in
  32762. // order to produce the correct `offset` value.
  32763. return match;
  32764. });
  32765. source += "';\n";
  32766. // If `variable` is not specified wrap a with-statement around the generated
  32767. // code to add the data object to the top of the scope chain.
  32768. // Like with sourceURL, we take care to not check the option's prototype,
  32769. // as this configuration is a code injection vector.
  32770. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  32771. if (!variable) {
  32772. source = 'with (obj) {\n' + source + '\n}\n';
  32773. }
  32774. // Cleanup code by stripping empty strings.
  32775. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  32776. .replace(reEmptyStringMiddle, '$1')
  32777. .replace(reEmptyStringTrailing, '$1;');
  32778. // Frame code as the function body.
  32779. source = 'function(' + (variable || 'obj') + ') {\n' +
  32780. (variable
  32781. ? ''
  32782. : 'obj || (obj = {});\n'
  32783. ) +
  32784. "var __t, __p = ''" +
  32785. (isEscaping
  32786. ? ', __e = _.escape'
  32787. : ''
  32788. ) +
  32789. (isEvaluating
  32790. ? ', __j = Array.prototype.join;\n' +
  32791. "function print() { __p += __j.call(arguments, '') }\n"
  32792. : ';\n'
  32793. ) +
  32794. source +
  32795. 'return __p\n}';
  32796. var result = attempt(function() {
  32797. return Function(importsKeys, sourceURL + 'return ' + source)
  32798. .apply(undefined, importsValues);
  32799. });
  32800. // Provide the compiled function's source by its `toString` method or
  32801. // the `source` property as a convenience for inlining compiled templates.
  32802. result.source = source;
  32803. if (isError(result)) {
  32804. throw result;
  32805. }
  32806. return result;
  32807. }
  32808. /**
  32809. * Converts `string`, as a whole, to lower case just like
  32810. * [String#toLowerCase](https://mdn.io/toLowerCase).
  32811. *
  32812. * @static
  32813. * @memberOf _
  32814. * @since 4.0.0
  32815. * @category String
  32816. * @param {string} [string=''] The string to convert.
  32817. * @returns {string} Returns the lower cased string.
  32818. * @example
  32819. *
  32820. * _.toLower('--Foo-Bar--');
  32821. * // => '--foo-bar--'
  32822. *
  32823. * _.toLower('fooBar');
  32824. * // => 'foobar'
  32825. *
  32826. * _.toLower('__FOO_BAR__');
  32827. * // => '__foo_bar__'
  32828. */
  32829. function toLower(value) {
  32830. return toString(value).toLowerCase();
  32831. }
  32832. /**
  32833. * Converts `string`, as a whole, to upper case just like
  32834. * [String#toUpperCase](https://mdn.io/toUpperCase).
  32835. *
  32836. * @static
  32837. * @memberOf _
  32838. * @since 4.0.0
  32839. * @category String
  32840. * @param {string} [string=''] The string to convert.
  32841. * @returns {string} Returns the upper cased string.
  32842. * @example
  32843. *
  32844. * _.toUpper('--foo-bar--');
  32845. * // => '--FOO-BAR--'
  32846. *
  32847. * _.toUpper('fooBar');
  32848. * // => 'FOOBAR'
  32849. *
  32850. * _.toUpper('__foo_bar__');
  32851. * // => '__FOO_BAR__'
  32852. */
  32853. function toUpper(value) {
  32854. return toString(value).toUpperCase();
  32855. }
  32856. /**
  32857. * Removes leading and trailing whitespace or specified characters from `string`.
  32858. *
  32859. * @static
  32860. * @memberOf _
  32861. * @since 3.0.0
  32862. * @category String
  32863. * @param {string} [string=''] The string to trim.
  32864. * @param {string} [chars=whitespace] The characters to trim.
  32865. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32866. * @returns {string} Returns the trimmed string.
  32867. * @example
  32868. *
  32869. * _.trim(' abc ');
  32870. * // => 'abc'
  32871. *
  32872. * _.trim('-_-abc-_-', '_-');
  32873. * // => 'abc'
  32874. *
  32875. * _.map([' foo ', ' bar '], _.trim);
  32876. * // => ['foo', 'bar']
  32877. */
  32878. function trim(string, chars, guard) {
  32879. string = toString(string);
  32880. if (string && (guard || chars === undefined)) {
  32881. return string.replace(reTrim, '');
  32882. }
  32883. if (!string || !(chars = baseToString(chars))) {
  32884. return string;
  32885. }
  32886. var strSymbols = stringToArray(string),
  32887. chrSymbols = stringToArray(chars),
  32888. start = charsStartIndex(strSymbols, chrSymbols),
  32889. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  32890. return castSlice(strSymbols, start, end).join('');
  32891. }
  32892. /**
  32893. * Removes trailing whitespace or specified characters from `string`.
  32894. *
  32895. * @static
  32896. * @memberOf _
  32897. * @since 4.0.0
  32898. * @category String
  32899. * @param {string} [string=''] The string to trim.
  32900. * @param {string} [chars=whitespace] The characters to trim.
  32901. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32902. * @returns {string} Returns the trimmed string.
  32903. * @example
  32904. *
  32905. * _.trimEnd(' abc ');
  32906. * // => ' abc'
  32907. *
  32908. * _.trimEnd('-_-abc-_-', '_-');
  32909. * // => '-_-abc'
  32910. */
  32911. function trimEnd(string, chars, guard) {
  32912. string = toString(string);
  32913. if (string && (guard || chars === undefined)) {
  32914. return string.replace(reTrimEnd, '');
  32915. }
  32916. if (!string || !(chars = baseToString(chars))) {
  32917. return string;
  32918. }
  32919. var strSymbols = stringToArray(string),
  32920. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  32921. return castSlice(strSymbols, 0, end).join('');
  32922. }
  32923. /**
  32924. * Removes leading whitespace or specified characters from `string`.
  32925. *
  32926. * @static
  32927. * @memberOf _
  32928. * @since 4.0.0
  32929. * @category String
  32930. * @param {string} [string=''] The string to trim.
  32931. * @param {string} [chars=whitespace] The characters to trim.
  32932. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32933. * @returns {string} Returns the trimmed string.
  32934. * @example
  32935. *
  32936. * _.trimStart(' abc ');
  32937. * // => 'abc '
  32938. *
  32939. * _.trimStart('-_-abc-_-', '_-');
  32940. * // => 'abc-_-'
  32941. */
  32942. function trimStart(string, chars, guard) {
  32943. string = toString(string);
  32944. if (string && (guard || chars === undefined)) {
  32945. return string.replace(reTrimStart, '');
  32946. }
  32947. if (!string || !(chars = baseToString(chars))) {
  32948. return string;
  32949. }
  32950. var strSymbols = stringToArray(string),
  32951. start = charsStartIndex(strSymbols, stringToArray(chars));
  32952. return castSlice(strSymbols, start).join('');
  32953. }
  32954. /**
  32955. * Truncates `string` if it's longer than the given maximum string length.
  32956. * The last characters of the truncated string are replaced with the omission
  32957. * string which defaults to "...".
  32958. *
  32959. * @static
  32960. * @memberOf _
  32961. * @since 4.0.0
  32962. * @category String
  32963. * @param {string} [string=''] The string to truncate.
  32964. * @param {Object} [options={}] The options object.
  32965. * @param {number} [options.length=30] The maximum string length.
  32966. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  32967. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  32968. * @returns {string} Returns the truncated string.
  32969. * @example
  32970. *
  32971. * _.truncate('hi-diddly-ho there, neighborino');
  32972. * // => 'hi-diddly-ho there, neighbo...'
  32973. *
  32974. * _.truncate('hi-diddly-ho there, neighborino', {
  32975. * 'length': 24,
  32976. * 'separator': ' '
  32977. * });
  32978. * // => 'hi-diddly-ho there,...'
  32979. *
  32980. * _.truncate('hi-diddly-ho there, neighborino', {
  32981. * 'length': 24,
  32982. * 'separator': /,? +/
  32983. * });
  32984. * // => 'hi-diddly-ho there...'
  32985. *
  32986. * _.truncate('hi-diddly-ho there, neighborino', {
  32987. * 'omission': ' [...]'
  32988. * });
  32989. * // => 'hi-diddly-ho there, neig [...]'
  32990. */
  32991. function truncate(string, options) {
  32992. var length = DEFAULT_TRUNC_LENGTH,
  32993. omission = DEFAULT_TRUNC_OMISSION;
  32994. if (isObject(options)) {
  32995. var separator = 'separator' in options ? options.separator : separator;
  32996. length = 'length' in options ? toInteger(options.length) : length;
  32997. omission = 'omission' in options ? baseToString(options.omission) : omission;
  32998. }
  32999. string = toString(string);
  33000. var strLength = string.length;
  33001. if (hasUnicode(string)) {
  33002. var strSymbols = stringToArray(string);
  33003. strLength = strSymbols.length;
  33004. }
  33005. if (length >= strLength) {
  33006. return string;
  33007. }
  33008. var end = length - stringSize(omission);
  33009. if (end < 1) {
  33010. return omission;
  33011. }
  33012. var result = strSymbols
  33013. ? castSlice(strSymbols, 0, end).join('')
  33014. : string.slice(0, end);
  33015. if (separator === undefined) {
  33016. return result + omission;
  33017. }
  33018. if (strSymbols) {
  33019. end += (result.length - end);
  33020. }
  33021. if (isRegExp(separator)) {
  33022. if (string.slice(end).search(separator)) {
  33023. var match,
  33024. substring = result;
  33025. if (!separator.global) {
  33026. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  33027. }
  33028. separator.lastIndex = 0;
  33029. while ((match = separator.exec(substring))) {
  33030. var newEnd = match.index;
  33031. }
  33032. result = result.slice(0, newEnd === undefined ? end : newEnd);
  33033. }
  33034. } else if (string.indexOf(baseToString(separator), end) != end) {
  33035. var index = result.lastIndexOf(separator);
  33036. if (index > -1) {
  33037. result = result.slice(0, index);
  33038. }
  33039. }
  33040. return result + omission;
  33041. }
  33042. /**
  33043. * The inverse of `_.escape`; this method converts the HTML entities
  33044. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  33045. * their corresponding characters.
  33046. *
  33047. * **Note:** No other HTML entities are unescaped. To unescape additional
  33048. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  33049. *
  33050. * @static
  33051. * @memberOf _
  33052. * @since 0.6.0
  33053. * @category String
  33054. * @param {string} [string=''] The string to unescape.
  33055. * @returns {string} Returns the unescaped string.
  33056. * @example
  33057. *
  33058. * _.unescape('fred, barney, &amp; pebbles');
  33059. * // => 'fred, barney, & pebbles'
  33060. */
  33061. function unescape(string) {
  33062. string = toString(string);
  33063. return (string && reHasEscapedHtml.test(string))
  33064. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  33065. : string;
  33066. }
  33067. /**
  33068. * Converts `string`, as space separated words, to upper case.
  33069. *
  33070. * @static
  33071. * @memberOf _
  33072. * @since 4.0.0
  33073. * @category String
  33074. * @param {string} [string=''] The string to convert.
  33075. * @returns {string} Returns the upper cased string.
  33076. * @example
  33077. *
  33078. * _.upperCase('--foo-bar');
  33079. * // => 'FOO BAR'
  33080. *
  33081. * _.upperCase('fooBar');
  33082. * // => 'FOO BAR'
  33083. *
  33084. * _.upperCase('__foo_bar__');
  33085. * // => 'FOO BAR'
  33086. */
  33087. var upperCase = createCompounder(function(result, word, index) {
  33088. return result + (index ? ' ' : '') + word.toUpperCase();
  33089. });
  33090. /**
  33091. * Converts the first character of `string` to upper case.
  33092. *
  33093. * @static
  33094. * @memberOf _
  33095. * @since 4.0.0
  33096. * @category String
  33097. * @param {string} [string=''] The string to convert.
  33098. * @returns {string} Returns the converted string.
  33099. * @example
  33100. *
  33101. * _.upperFirst('fred');
  33102. * // => 'Fred'
  33103. *
  33104. * _.upperFirst('FRED');
  33105. * // => 'FRED'
  33106. */
  33107. var upperFirst = createCaseFirst('toUpperCase');
  33108. /**
  33109. * Splits `string` into an array of its words.
  33110. *
  33111. * @static
  33112. * @memberOf _
  33113. * @since 3.0.0
  33114. * @category String
  33115. * @param {string} [string=''] The string to inspect.
  33116. * @param {RegExp|string} [pattern] The pattern to match words.
  33117. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  33118. * @returns {Array} Returns the words of `string`.
  33119. * @example
  33120. *
  33121. * _.words('fred, barney, & pebbles');
  33122. * // => ['fred', 'barney', 'pebbles']
  33123. *
  33124. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  33125. * // => ['fred', 'barney', '&', 'pebbles']
  33126. */
  33127. function words(string, pattern, guard) {
  33128. string = toString(string);
  33129. pattern = guard ? undefined : pattern;
  33130. if (pattern === undefined) {
  33131. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  33132. }
  33133. return string.match(pattern) || [];
  33134. }
  33135. /*------------------------------------------------------------------------*/
  33136. /**
  33137. * Attempts to invoke `func`, returning either the result or the caught error
  33138. * object. Any additional arguments are provided to `func` when it's invoked.
  33139. *
  33140. * @static
  33141. * @memberOf _
  33142. * @since 3.0.0
  33143. * @category Util
  33144. * @param {Function} func The function to attempt.
  33145. * @param {...*} [args] The arguments to invoke `func` with.
  33146. * @returns {*} Returns the `func` result or error object.
  33147. * @example
  33148. *
  33149. * // Avoid throwing errors for invalid selectors.
  33150. * var elements = _.attempt(function(selector) {
  33151. * return document.querySelectorAll(selector);
  33152. * }, '>_>');
  33153. *
  33154. * if (_.isError(elements)) {
  33155. * elements = [];
  33156. * }
  33157. */
  33158. var attempt = baseRest(function(func, args) {
  33159. try {
  33160. return apply(func, undefined, args);
  33161. } catch (e) {
  33162. return isError(e) ? e : new Error(e);
  33163. }
  33164. });
  33165. /**
  33166. * Binds methods of an object to the object itself, overwriting the existing
  33167. * method.
  33168. *
  33169. * **Note:** This method doesn't set the "length" property of bound functions.
  33170. *
  33171. * @static
  33172. * @since 0.1.0
  33173. * @memberOf _
  33174. * @category Util
  33175. * @param {Object} object The object to bind and assign the bound methods to.
  33176. * @param {...(string|string[])} methodNames The object method names to bind.
  33177. * @returns {Object} Returns `object`.
  33178. * @example
  33179. *
  33180. * var view = {
  33181. * 'label': 'docs',
  33182. * 'click': function() {
  33183. * console.log('clicked ' + this.label);
  33184. * }
  33185. * };
  33186. *
  33187. * _.bindAll(view, ['click']);
  33188. * jQuery(element).on('click', view.click);
  33189. * // => Logs 'clicked docs' when clicked.
  33190. */
  33191. var bindAll = flatRest(function(object, methodNames) {
  33192. arrayEach(methodNames, function(key) {
  33193. key = toKey(key);
  33194. baseAssignValue(object, key, bind(object[key], object));
  33195. });
  33196. return object;
  33197. });
  33198. /**
  33199. * Creates a function that iterates over `pairs` and invokes the corresponding
  33200. * function of the first predicate to return truthy. The predicate-function
  33201. * pairs are invoked with the `this` binding and arguments of the created
  33202. * function.
  33203. *
  33204. * @static
  33205. * @memberOf _
  33206. * @since 4.0.0
  33207. * @category Util
  33208. * @param {Array} pairs The predicate-function pairs.
  33209. * @returns {Function} Returns the new composite function.
  33210. * @example
  33211. *
  33212. * var func = _.cond([
  33213. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  33214. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  33215. * [_.stubTrue, _.constant('no match')]
  33216. * ]);
  33217. *
  33218. * func({ 'a': 1, 'b': 2 });
  33219. * // => 'matches A'
  33220. *
  33221. * func({ 'a': 0, 'b': 1 });
  33222. * // => 'matches B'
  33223. *
  33224. * func({ 'a': '1', 'b': '2' });
  33225. * // => 'no match'
  33226. */
  33227. function cond(pairs) {
  33228. var length = pairs == null ? 0 : pairs.length,
  33229. toIteratee = getIteratee();
  33230. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  33231. if (typeof pair[1] != 'function') {
  33232. throw new TypeError(FUNC_ERROR_TEXT);
  33233. }
  33234. return [toIteratee(pair[0]), pair[1]];
  33235. });
  33236. return baseRest(function(args) {
  33237. var index = -1;
  33238. while (++index < length) {
  33239. var pair = pairs[index];
  33240. if (apply(pair[0], this, args)) {
  33241. return apply(pair[1], this, args);
  33242. }
  33243. }
  33244. });
  33245. }
  33246. /**
  33247. * Creates a function that invokes the predicate properties of `source` with
  33248. * the corresponding property values of a given object, returning `true` if
  33249. * all predicates return truthy, else `false`.
  33250. *
  33251. * **Note:** The created function is equivalent to `_.conformsTo` with
  33252. * `source` partially applied.
  33253. *
  33254. * @static
  33255. * @memberOf _
  33256. * @since 4.0.0
  33257. * @category Util
  33258. * @param {Object} source The object of property predicates to conform to.
  33259. * @returns {Function} Returns the new spec function.
  33260. * @example
  33261. *
  33262. * var objects = [
  33263. * { 'a': 2, 'b': 1 },
  33264. * { 'a': 1, 'b': 2 }
  33265. * ];
  33266. *
  33267. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  33268. * // => [{ 'a': 1, 'b': 2 }]
  33269. */
  33270. function conforms(source) {
  33271. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  33272. }
  33273. /**
  33274. * Creates a function that returns `value`.
  33275. *
  33276. * @static
  33277. * @memberOf _
  33278. * @since 2.4.0
  33279. * @category Util
  33280. * @param {*} value The value to return from the new function.
  33281. * @returns {Function} Returns the new constant function.
  33282. * @example
  33283. *
  33284. * var objects = _.times(2, _.constant({ 'a': 1 }));
  33285. *
  33286. * console.log(objects);
  33287. * // => [{ 'a': 1 }, { 'a': 1 }]
  33288. *
  33289. * console.log(objects[0] === objects[1]);
  33290. * // => true
  33291. */
  33292. function constant(value) {
  33293. return function() {
  33294. return value;
  33295. };
  33296. }
  33297. /**
  33298. * Checks `value` to determine whether a default value should be returned in
  33299. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  33300. * or `undefined`.
  33301. *
  33302. * @static
  33303. * @memberOf _
  33304. * @since 4.14.0
  33305. * @category Util
  33306. * @param {*} value The value to check.
  33307. * @param {*} defaultValue The default value.
  33308. * @returns {*} Returns the resolved value.
  33309. * @example
  33310. *
  33311. * _.defaultTo(1, 10);
  33312. * // => 1
  33313. *
  33314. * _.defaultTo(undefined, 10);
  33315. * // => 10
  33316. */
  33317. function defaultTo(value, defaultValue) {
  33318. return (value == null || value !== value) ? defaultValue : value;
  33319. }
  33320. /**
  33321. * Creates a function that returns the result of invoking the given functions
  33322. * with the `this` binding of the created function, where each successive
  33323. * invocation is supplied the return value of the previous.
  33324. *
  33325. * @static
  33326. * @memberOf _
  33327. * @since 3.0.0
  33328. * @category Util
  33329. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  33330. * @returns {Function} Returns the new composite function.
  33331. * @see _.flowRight
  33332. * @example
  33333. *
  33334. * function square(n) {
  33335. * return n * n;
  33336. * }
  33337. *
  33338. * var addSquare = _.flow([_.add, square]);
  33339. * addSquare(1, 2);
  33340. * // => 9
  33341. */
  33342. var flow = createFlow();
  33343. /**
  33344. * This method is like `_.flow` except that it creates a function that
  33345. * invokes the given functions from right to left.
  33346. *
  33347. * @static
  33348. * @since 3.0.0
  33349. * @memberOf _
  33350. * @category Util
  33351. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  33352. * @returns {Function} Returns the new composite function.
  33353. * @see _.flow
  33354. * @example
  33355. *
  33356. * function square(n) {
  33357. * return n * n;
  33358. * }
  33359. *
  33360. * var addSquare = _.flowRight([square, _.add]);
  33361. * addSquare(1, 2);
  33362. * // => 9
  33363. */
  33364. var flowRight = createFlow(true);
  33365. /**
  33366. * This method returns the first argument it receives.
  33367. *
  33368. * @static
  33369. * @since 0.1.0
  33370. * @memberOf _
  33371. * @category Util
  33372. * @param {*} value Any value.
  33373. * @returns {*} Returns `value`.
  33374. * @example
  33375. *
  33376. * var object = { 'a': 1 };
  33377. *
  33378. * console.log(_.identity(object) === object);
  33379. * // => true
  33380. */
  33381. function identity(value) {
  33382. return value;
  33383. }
  33384. /**
  33385. * Creates a function that invokes `func` with the arguments of the created
  33386. * function. If `func` is a property name, the created function returns the
  33387. * property value for a given element. If `func` is an array or object, the
  33388. * created function returns `true` for elements that contain the equivalent
  33389. * source properties, otherwise it returns `false`.
  33390. *
  33391. * @static
  33392. * @since 4.0.0
  33393. * @memberOf _
  33394. * @category Util
  33395. * @param {*} [func=_.identity] The value to convert to a callback.
  33396. * @returns {Function} Returns the callback.
  33397. * @example
  33398. *
  33399. * var users = [
  33400. * { 'user': 'barney', 'age': 36, 'active': true },
  33401. * { 'user': 'fred', 'age': 40, 'active': false }
  33402. * ];
  33403. *
  33404. * // The `_.matches` iteratee shorthand.
  33405. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  33406. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  33407. *
  33408. * // The `_.matchesProperty` iteratee shorthand.
  33409. * _.filter(users, _.iteratee(['user', 'fred']));
  33410. * // => [{ 'user': 'fred', 'age': 40 }]
  33411. *
  33412. * // The `_.property` iteratee shorthand.
  33413. * _.map(users, _.iteratee('user'));
  33414. * // => ['barney', 'fred']
  33415. *
  33416. * // Create custom iteratee shorthands.
  33417. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  33418. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  33419. * return func.test(string);
  33420. * };
  33421. * });
  33422. *
  33423. * _.filter(['abc', 'def'], /ef/);
  33424. * // => ['def']
  33425. */
  33426. function iteratee(func) {
  33427. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  33428. }
  33429. /**
  33430. * Creates a function that performs a partial deep comparison between a given
  33431. * object and `source`, returning `true` if the given object has equivalent
  33432. * property values, else `false`.
  33433. *
  33434. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  33435. * partially applied.
  33436. *
  33437. * Partial comparisons will match empty array and empty object `source`
  33438. * values against any array or object value, respectively. See `_.isEqual`
  33439. * for a list of supported value comparisons.
  33440. *
  33441. * @static
  33442. * @memberOf _
  33443. * @since 3.0.0
  33444. * @category Util
  33445. * @param {Object} source The object of property values to match.
  33446. * @returns {Function} Returns the new spec function.
  33447. * @example
  33448. *
  33449. * var objects = [
  33450. * { 'a': 1, 'b': 2, 'c': 3 },
  33451. * { 'a': 4, 'b': 5, 'c': 6 }
  33452. * ];
  33453. *
  33454. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  33455. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  33456. */
  33457. function matches(source) {
  33458. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  33459. }
  33460. /**
  33461. * Creates a function that performs a partial deep comparison between the
  33462. * value at `path` of a given object to `srcValue`, returning `true` if the
  33463. * object value is equivalent, else `false`.
  33464. *
  33465. * **Note:** Partial comparisons will match empty array and empty object
  33466. * `srcValue` values against any array or object value, respectively. See
  33467. * `_.isEqual` for a list of supported value comparisons.
  33468. *
  33469. * @static
  33470. * @memberOf _
  33471. * @since 3.2.0
  33472. * @category Util
  33473. * @param {Array|string} path The path of the property to get.
  33474. * @param {*} srcValue The value to match.
  33475. * @returns {Function} Returns the new spec function.
  33476. * @example
  33477. *
  33478. * var objects = [
  33479. * { 'a': 1, 'b': 2, 'c': 3 },
  33480. * { 'a': 4, 'b': 5, 'c': 6 }
  33481. * ];
  33482. *
  33483. * _.find(objects, _.matchesProperty('a', 4));
  33484. * // => { 'a': 4, 'b': 5, 'c': 6 }
  33485. */
  33486. function matchesProperty(path, srcValue) {
  33487. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  33488. }
  33489. /**
  33490. * Creates a function that invokes the method at `path` of a given object.
  33491. * Any additional arguments are provided to the invoked method.
  33492. *
  33493. * @static
  33494. * @memberOf _
  33495. * @since 3.7.0
  33496. * @category Util
  33497. * @param {Array|string} path The path of the method to invoke.
  33498. * @param {...*} [args] The arguments to invoke the method with.
  33499. * @returns {Function} Returns the new invoker function.
  33500. * @example
  33501. *
  33502. * var objects = [
  33503. * { 'a': { 'b': _.constant(2) } },
  33504. * { 'a': { 'b': _.constant(1) } }
  33505. * ];
  33506. *
  33507. * _.map(objects, _.method('a.b'));
  33508. * // => [2, 1]
  33509. *
  33510. * _.map(objects, _.method(['a', 'b']));
  33511. * // => [2, 1]
  33512. */
  33513. var method = baseRest(function(path, args) {
  33514. return function(object) {
  33515. return baseInvoke(object, path, args);
  33516. };
  33517. });
  33518. /**
  33519. * The opposite of `_.method`; this method creates a function that invokes
  33520. * the method at a given path of `object`. Any additional arguments are
  33521. * provided to the invoked method.
  33522. *
  33523. * @static
  33524. * @memberOf _
  33525. * @since 3.7.0
  33526. * @category Util
  33527. * @param {Object} object The object to query.
  33528. * @param {...*} [args] The arguments to invoke the method with.
  33529. * @returns {Function} Returns the new invoker function.
  33530. * @example
  33531. *
  33532. * var array = _.times(3, _.constant),
  33533. * object = { 'a': array, 'b': array, 'c': array };
  33534. *
  33535. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  33536. * // => [2, 0]
  33537. *
  33538. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  33539. * // => [2, 0]
  33540. */
  33541. var methodOf = baseRest(function(object, args) {
  33542. return function(path) {
  33543. return baseInvoke(object, path, args);
  33544. };
  33545. });
  33546. /**
  33547. * Adds all own enumerable string keyed function properties of a source
  33548. * object to the destination object. If `object` is a function, then methods
  33549. * are added to its prototype as well.
  33550. *
  33551. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  33552. * avoid conflicts caused by modifying the original.
  33553. *
  33554. * @static
  33555. * @since 0.1.0
  33556. * @memberOf _
  33557. * @category Util
  33558. * @param {Function|Object} [object=lodash] The destination object.
  33559. * @param {Object} source The object of functions to add.
  33560. * @param {Object} [options={}] The options object.
  33561. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  33562. * @returns {Function|Object} Returns `object`.
  33563. * @example
  33564. *
  33565. * function vowels(string) {
  33566. * return _.filter(string, function(v) {
  33567. * return /[aeiou]/i.test(v);
  33568. * });
  33569. * }
  33570. *
  33571. * _.mixin({ 'vowels': vowels });
  33572. * _.vowels('fred');
  33573. * // => ['e']
  33574. *
  33575. * _('fred').vowels().value();
  33576. * // => ['e']
  33577. *
  33578. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  33579. * _('fred').vowels();
  33580. * // => ['e']
  33581. */
  33582. function mixin(object, source, options) {
  33583. var props = keys(source),
  33584. methodNames = baseFunctions(source, props);
  33585. if (options == null &&
  33586. !(isObject(source) && (methodNames.length || !props.length))) {
  33587. options = source;
  33588. source = object;
  33589. object = this;
  33590. methodNames = baseFunctions(source, keys(source));
  33591. }
  33592. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  33593. isFunc = isFunction(object);
  33594. arrayEach(methodNames, function(methodName) {
  33595. var func = source[methodName];
  33596. object[methodName] = func;
  33597. if (isFunc) {
  33598. object.prototype[methodName] = function() {
  33599. var chainAll = this.__chain__;
  33600. if (chain || chainAll) {
  33601. var result = object(this.__wrapped__),
  33602. actions = result.__actions__ = copyArray(this.__actions__);
  33603. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  33604. result.__chain__ = chainAll;
  33605. return result;
  33606. }
  33607. return func.apply(object, arrayPush([this.value()], arguments));
  33608. };
  33609. }
  33610. });
  33611. return object;
  33612. }
  33613. /**
  33614. * Reverts the `_` variable to its previous value and returns a reference to
  33615. * the `lodash` function.
  33616. *
  33617. * @static
  33618. * @since 0.1.0
  33619. * @memberOf _
  33620. * @category Util
  33621. * @returns {Function} Returns the `lodash` function.
  33622. * @example
  33623. *
  33624. * var lodash = _.noConflict();
  33625. */
  33626. function noConflict() {
  33627. if (root._ === this) {
  33628. root._ = oldDash;
  33629. }
  33630. return this;
  33631. }
  33632. /**
  33633. * This method returns `undefined`.
  33634. *
  33635. * @static
  33636. * @memberOf _
  33637. * @since 2.3.0
  33638. * @category Util
  33639. * @example
  33640. *
  33641. * _.times(2, _.noop);
  33642. * // => [undefined, undefined]
  33643. */
  33644. function noop() {
  33645. // No operation performed.
  33646. }
  33647. /**
  33648. * Creates a function that gets the argument at index `n`. If `n` is negative,
  33649. * the nth argument from the end is returned.
  33650. *
  33651. * @static
  33652. * @memberOf _
  33653. * @since 4.0.0
  33654. * @category Util
  33655. * @param {number} [n=0] The index of the argument to return.
  33656. * @returns {Function} Returns the new pass-thru function.
  33657. * @example
  33658. *
  33659. * var func = _.nthArg(1);
  33660. * func('a', 'b', 'c', 'd');
  33661. * // => 'b'
  33662. *
  33663. * var func = _.nthArg(-2);
  33664. * func('a', 'b', 'c', 'd');
  33665. * // => 'c'
  33666. */
  33667. function nthArg(n) {
  33668. n = toInteger(n);
  33669. return baseRest(function(args) {
  33670. return baseNth(args, n);
  33671. });
  33672. }
  33673. /**
  33674. * Creates a function that invokes `iteratees` with the arguments it receives
  33675. * and returns their results.
  33676. *
  33677. * @static
  33678. * @memberOf _
  33679. * @since 4.0.0
  33680. * @category Util
  33681. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  33682. * The iteratees to invoke.
  33683. * @returns {Function} Returns the new function.
  33684. * @example
  33685. *
  33686. * var func = _.over([Math.max, Math.min]);
  33687. *
  33688. * func(1, 2, 3, 4);
  33689. * // => [4, 1]
  33690. */
  33691. var over = createOver(arrayMap);
  33692. /**
  33693. * Creates a function that checks if **all** of the `predicates` return
  33694. * truthy when invoked with the arguments it receives.
  33695. *
  33696. * @static
  33697. * @memberOf _
  33698. * @since 4.0.0
  33699. * @category Util
  33700. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33701. * The predicates to check.
  33702. * @returns {Function} Returns the new function.
  33703. * @example
  33704. *
  33705. * var func = _.overEvery([Boolean, isFinite]);
  33706. *
  33707. * func('1');
  33708. * // => true
  33709. *
  33710. * func(null);
  33711. * // => false
  33712. *
  33713. * func(NaN);
  33714. * // => false
  33715. */
  33716. var overEvery = createOver(arrayEvery);
  33717. /**
  33718. * Creates a function that checks if **any** of the `predicates` return
  33719. * truthy when invoked with the arguments it receives.
  33720. *
  33721. * @static
  33722. * @memberOf _
  33723. * @since 4.0.0
  33724. * @category Util
  33725. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33726. * The predicates to check.
  33727. * @returns {Function} Returns the new function.
  33728. * @example
  33729. *
  33730. * var func = _.overSome([Boolean, isFinite]);
  33731. *
  33732. * func('1');
  33733. * // => true
  33734. *
  33735. * func(null);
  33736. * // => true
  33737. *
  33738. * func(NaN);
  33739. * // => false
  33740. */
  33741. var overSome = createOver(arraySome);
  33742. /**
  33743. * Creates a function that returns the value at `path` of a given object.
  33744. *
  33745. * @static
  33746. * @memberOf _
  33747. * @since 2.4.0
  33748. * @category Util
  33749. * @param {Array|string} path The path of the property to get.
  33750. * @returns {Function} Returns the new accessor function.
  33751. * @example
  33752. *
  33753. * var objects = [
  33754. * { 'a': { 'b': 2 } },
  33755. * { 'a': { 'b': 1 } }
  33756. * ];
  33757. *
  33758. * _.map(objects, _.property('a.b'));
  33759. * // => [2, 1]
  33760. *
  33761. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  33762. * // => [1, 2]
  33763. */
  33764. function property(path) {
  33765. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  33766. }
  33767. /**
  33768. * The opposite of `_.property`; this method creates a function that returns
  33769. * the value at a given path of `object`.
  33770. *
  33771. * @static
  33772. * @memberOf _
  33773. * @since 3.0.0
  33774. * @category Util
  33775. * @param {Object} object The object to query.
  33776. * @returns {Function} Returns the new accessor function.
  33777. * @example
  33778. *
  33779. * var array = [0, 1, 2],
  33780. * object = { 'a': array, 'b': array, 'c': array };
  33781. *
  33782. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  33783. * // => [2, 0]
  33784. *
  33785. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  33786. * // => [2, 0]
  33787. */
  33788. function propertyOf(object) {
  33789. return function(path) {
  33790. return object == null ? undefined : baseGet(object, path);
  33791. };
  33792. }
  33793. /**
  33794. * Creates an array of numbers (positive and/or negative) progressing from
  33795. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  33796. * `start` is specified without an `end` or `step`. If `end` is not specified,
  33797. * it's set to `start` with `start` then set to `0`.
  33798. *
  33799. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  33800. * floating-point values which can produce unexpected results.
  33801. *
  33802. * @static
  33803. * @since 0.1.0
  33804. * @memberOf _
  33805. * @category Util
  33806. * @param {number} [start=0] The start of the range.
  33807. * @param {number} end The end of the range.
  33808. * @param {number} [step=1] The value to increment or decrement by.
  33809. * @returns {Array} Returns the range of numbers.
  33810. * @see _.inRange, _.rangeRight
  33811. * @example
  33812. *
  33813. * _.range(4);
  33814. * // => [0, 1, 2, 3]
  33815. *
  33816. * _.range(-4);
  33817. * // => [0, -1, -2, -3]
  33818. *
  33819. * _.range(1, 5);
  33820. * // => [1, 2, 3, 4]
  33821. *
  33822. * _.range(0, 20, 5);
  33823. * // => [0, 5, 10, 15]
  33824. *
  33825. * _.range(0, -4, -1);
  33826. * // => [0, -1, -2, -3]
  33827. *
  33828. * _.range(1, 4, 0);
  33829. * // => [1, 1, 1]
  33830. *
  33831. * _.range(0);
  33832. * // => []
  33833. */
  33834. var range = createRange();
  33835. /**
  33836. * This method is like `_.range` except that it populates values in
  33837. * descending order.
  33838. *
  33839. * @static
  33840. * @memberOf _
  33841. * @since 4.0.0
  33842. * @category Util
  33843. * @param {number} [start=0] The start of the range.
  33844. * @param {number} end The end of the range.
  33845. * @param {number} [step=1] The value to increment or decrement by.
  33846. * @returns {Array} Returns the range of numbers.
  33847. * @see _.inRange, _.range
  33848. * @example
  33849. *
  33850. * _.rangeRight(4);
  33851. * // => [3, 2, 1, 0]
  33852. *
  33853. * _.rangeRight(-4);
  33854. * // => [-3, -2, -1, 0]
  33855. *
  33856. * _.rangeRight(1, 5);
  33857. * // => [4, 3, 2, 1]
  33858. *
  33859. * _.rangeRight(0, 20, 5);
  33860. * // => [15, 10, 5, 0]
  33861. *
  33862. * _.rangeRight(0, -4, -1);
  33863. * // => [-3, -2, -1, 0]
  33864. *
  33865. * _.rangeRight(1, 4, 0);
  33866. * // => [1, 1, 1]
  33867. *
  33868. * _.rangeRight(0);
  33869. * // => []
  33870. */
  33871. var rangeRight = createRange(true);
  33872. /**
  33873. * This method returns a new empty array.
  33874. *
  33875. * @static
  33876. * @memberOf _
  33877. * @since 4.13.0
  33878. * @category Util
  33879. * @returns {Array} Returns the new empty array.
  33880. * @example
  33881. *
  33882. * var arrays = _.times(2, _.stubArray);
  33883. *
  33884. * console.log(arrays);
  33885. * // => [[], []]
  33886. *
  33887. * console.log(arrays[0] === arrays[1]);
  33888. * // => false
  33889. */
  33890. function stubArray() {
  33891. return [];
  33892. }
  33893. /**
  33894. * This method returns `false`.
  33895. *
  33896. * @static
  33897. * @memberOf _
  33898. * @since 4.13.0
  33899. * @category Util
  33900. * @returns {boolean} Returns `false`.
  33901. * @example
  33902. *
  33903. * _.times(2, _.stubFalse);
  33904. * // => [false, false]
  33905. */
  33906. function stubFalse() {
  33907. return false;
  33908. }
  33909. /**
  33910. * This method returns a new empty object.
  33911. *
  33912. * @static
  33913. * @memberOf _
  33914. * @since 4.13.0
  33915. * @category Util
  33916. * @returns {Object} Returns the new empty object.
  33917. * @example
  33918. *
  33919. * var objects = _.times(2, _.stubObject);
  33920. *
  33921. * console.log(objects);
  33922. * // => [{}, {}]
  33923. *
  33924. * console.log(objects[0] === objects[1]);
  33925. * // => false
  33926. */
  33927. function stubObject() {
  33928. return {};
  33929. }
  33930. /**
  33931. * This method returns an empty string.
  33932. *
  33933. * @static
  33934. * @memberOf _
  33935. * @since 4.13.0
  33936. * @category Util
  33937. * @returns {string} Returns the empty string.
  33938. * @example
  33939. *
  33940. * _.times(2, _.stubString);
  33941. * // => ['', '']
  33942. */
  33943. function stubString() {
  33944. return '';
  33945. }
  33946. /**
  33947. * This method returns `true`.
  33948. *
  33949. * @static
  33950. * @memberOf _
  33951. * @since 4.13.0
  33952. * @category Util
  33953. * @returns {boolean} Returns `true`.
  33954. * @example
  33955. *
  33956. * _.times(2, _.stubTrue);
  33957. * // => [true, true]
  33958. */
  33959. function stubTrue() {
  33960. return true;
  33961. }
  33962. /**
  33963. * Invokes the iteratee `n` times, returning an array of the results of
  33964. * each invocation. The iteratee is invoked with one argument; (index).
  33965. *
  33966. * @static
  33967. * @since 0.1.0
  33968. * @memberOf _
  33969. * @category Util
  33970. * @param {number} n The number of times to invoke `iteratee`.
  33971. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  33972. * @returns {Array} Returns the array of results.
  33973. * @example
  33974. *
  33975. * _.times(3, String);
  33976. * // => ['0', '1', '2']
  33977. *
  33978. * _.times(4, _.constant(0));
  33979. * // => [0, 0, 0, 0]
  33980. */
  33981. function times(n, iteratee) {
  33982. n = toInteger(n);
  33983. if (n < 1 || n > MAX_SAFE_INTEGER) {
  33984. return [];
  33985. }
  33986. var index = MAX_ARRAY_LENGTH,
  33987. length = nativeMin(n, MAX_ARRAY_LENGTH);
  33988. iteratee = getIteratee(iteratee);
  33989. n -= MAX_ARRAY_LENGTH;
  33990. var result = baseTimes(length, iteratee);
  33991. while (++index < n) {
  33992. iteratee(index);
  33993. }
  33994. return result;
  33995. }
  33996. /**
  33997. * Converts `value` to a property path array.
  33998. *
  33999. * @static
  34000. * @memberOf _
  34001. * @since 4.0.0
  34002. * @category Util
  34003. * @param {*} value The value to convert.
  34004. * @returns {Array} Returns the new property path array.
  34005. * @example
  34006. *
  34007. * _.toPath('a.b.c');
  34008. * // => ['a', 'b', 'c']
  34009. *
  34010. * _.toPath('a[0].b.c');
  34011. * // => ['a', '0', 'b', 'c']
  34012. */
  34013. function toPath(value) {
  34014. if (isArray(value)) {
  34015. return arrayMap(value, toKey);
  34016. }
  34017. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  34018. }
  34019. /**
  34020. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  34021. *
  34022. * @static
  34023. * @since 0.1.0
  34024. * @memberOf _
  34025. * @category Util
  34026. * @param {string} [prefix=''] The value to prefix the ID with.
  34027. * @returns {string} Returns the unique ID.
  34028. * @example
  34029. *
  34030. * _.uniqueId('contact_');
  34031. * // => 'contact_104'
  34032. *
  34033. * _.uniqueId();
  34034. * // => '105'
  34035. */
  34036. function uniqueId(prefix) {
  34037. var id = ++idCounter;
  34038. return toString(prefix) + id;
  34039. }
  34040. /*------------------------------------------------------------------------*/
  34041. /**
  34042. * Adds two numbers.
  34043. *
  34044. * @static
  34045. * @memberOf _
  34046. * @since 3.4.0
  34047. * @category Math
  34048. * @param {number} augend The first number in an addition.
  34049. * @param {number} addend The second number in an addition.
  34050. * @returns {number} Returns the total.
  34051. * @example
  34052. *
  34053. * _.add(6, 4);
  34054. * // => 10
  34055. */
  34056. var add = createMathOperation(function(augend, addend) {
  34057. return augend + addend;
  34058. }, 0);
  34059. /**
  34060. * Computes `number` rounded up to `precision`.
  34061. *
  34062. * @static
  34063. * @memberOf _
  34064. * @since 3.10.0
  34065. * @category Math
  34066. * @param {number} number The number to round up.
  34067. * @param {number} [precision=0] The precision to round up to.
  34068. * @returns {number} Returns the rounded up number.
  34069. * @example
  34070. *
  34071. * _.ceil(4.006);
  34072. * // => 5
  34073. *
  34074. * _.ceil(6.004, 2);
  34075. * // => 6.01
  34076. *
  34077. * _.ceil(6040, -2);
  34078. * // => 6100
  34079. */
  34080. var ceil = createRound('ceil');
  34081. /**
  34082. * Divide two numbers.
  34083. *
  34084. * @static
  34085. * @memberOf _
  34086. * @since 4.7.0
  34087. * @category Math
  34088. * @param {number} dividend The first number in a division.
  34089. * @param {number} divisor The second number in a division.
  34090. * @returns {number} Returns the quotient.
  34091. * @example
  34092. *
  34093. * _.divide(6, 4);
  34094. * // => 1.5
  34095. */
  34096. var divide = createMathOperation(function(dividend, divisor) {
  34097. return dividend / divisor;
  34098. }, 1);
  34099. /**
  34100. * Computes `number` rounded down to `precision`.
  34101. *
  34102. * @static
  34103. * @memberOf _
  34104. * @since 3.10.0
  34105. * @category Math
  34106. * @param {number} number The number to round down.
  34107. * @param {number} [precision=0] The precision to round down to.
  34108. * @returns {number} Returns the rounded down number.
  34109. * @example
  34110. *
  34111. * _.floor(4.006);
  34112. * // => 4
  34113. *
  34114. * _.floor(0.046, 2);
  34115. * // => 0.04
  34116. *
  34117. * _.floor(4060, -2);
  34118. * // => 4000
  34119. */
  34120. var floor = createRound('floor');
  34121. /**
  34122. * Computes the maximum value of `array`. If `array` is empty or falsey,
  34123. * `undefined` is returned.
  34124. *
  34125. * @static
  34126. * @since 0.1.0
  34127. * @memberOf _
  34128. * @category Math
  34129. * @param {Array} array The array to iterate over.
  34130. * @returns {*} Returns the maximum value.
  34131. * @example
  34132. *
  34133. * _.max([4, 2, 8, 6]);
  34134. * // => 8
  34135. *
  34136. * _.max([]);
  34137. * // => undefined
  34138. */
  34139. function max(array) {
  34140. return (array && array.length)
  34141. ? baseExtremum(array, identity, baseGt)
  34142. : undefined;
  34143. }
  34144. /**
  34145. * This method is like `_.max` except that it accepts `iteratee` which is
  34146. * invoked for each element in `array` to generate the criterion by which
  34147. * the value is ranked. The iteratee is invoked with one argument: (value).
  34148. *
  34149. * @static
  34150. * @memberOf _
  34151. * @since 4.0.0
  34152. * @category Math
  34153. * @param {Array} array The array to iterate over.
  34154. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  34155. * @returns {*} Returns the maximum value.
  34156. * @example
  34157. *
  34158. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  34159. *
  34160. * _.maxBy(objects, function(o) { return o.n; });
  34161. * // => { 'n': 2 }
  34162. *
  34163. * // The `_.property` iteratee shorthand.
  34164. * _.maxBy(objects, 'n');
  34165. * // => { 'n': 2 }
  34166. */
  34167. function maxBy(array, iteratee) {
  34168. return (array && array.length)
  34169. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  34170. : undefined;
  34171. }
  34172. /**
  34173. * Computes the mean of the values in `array`.
  34174. *
  34175. * @static
  34176. * @memberOf _
  34177. * @since 4.0.0
  34178. * @category Math
  34179. * @param {Array} array The array to iterate over.
  34180. * @returns {number} Returns the mean.
  34181. * @example
  34182. *
  34183. * _.mean([4, 2, 8, 6]);
  34184. * // => 5
  34185. */
  34186. function mean(array) {
  34187. return baseMean(array, identity);
  34188. }
  34189. /**
  34190. * This method is like `_.mean` except that it accepts `iteratee` which is
  34191. * invoked for each element in `array` to generate the value to be averaged.
  34192. * The iteratee is invoked with one argument: (value).
  34193. *
  34194. * @static
  34195. * @memberOf _
  34196. * @since 4.7.0
  34197. * @category Math
  34198. * @param {Array} array The array to iterate over.
  34199. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  34200. * @returns {number} Returns the mean.
  34201. * @example
  34202. *
  34203. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  34204. *
  34205. * _.meanBy(objects, function(o) { return o.n; });
  34206. * // => 5
  34207. *
  34208. * // The `_.property` iteratee shorthand.
  34209. * _.meanBy(objects, 'n');
  34210. * // => 5
  34211. */
  34212. function meanBy(array, iteratee) {
  34213. return baseMean(array, getIteratee(iteratee, 2));
  34214. }
  34215. /**
  34216. * Computes the minimum value of `array`. If `array` is empty or falsey,
  34217. * `undefined` is returned.
  34218. *
  34219. * @static
  34220. * @since 0.1.0
  34221. * @memberOf _
  34222. * @category Math
  34223. * @param {Array} array The array to iterate over.
  34224. * @returns {*} Returns the minimum value.
  34225. * @example
  34226. *
  34227. * _.min([4, 2, 8, 6]);
  34228. * // => 2
  34229. *
  34230. * _.min([]);
  34231. * // => undefined
  34232. */
  34233. function min(array) {
  34234. return (array && array.length)
  34235. ? baseExtremum(array, identity, baseLt)
  34236. : undefined;
  34237. }
  34238. /**
  34239. * This method is like `_.min` except that it accepts `iteratee` which is
  34240. * invoked for each element in `array` to generate the criterion by which
  34241. * the value is ranked. The iteratee is invoked with one argument: (value).
  34242. *
  34243. * @static
  34244. * @memberOf _
  34245. * @since 4.0.0
  34246. * @category Math
  34247. * @param {Array} array The array to iterate over.
  34248. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  34249. * @returns {*} Returns the minimum value.
  34250. * @example
  34251. *
  34252. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  34253. *
  34254. * _.minBy(objects, function(o) { return o.n; });
  34255. * // => { 'n': 1 }
  34256. *
  34257. * // The `_.property` iteratee shorthand.
  34258. * _.minBy(objects, 'n');
  34259. * // => { 'n': 1 }
  34260. */
  34261. function minBy(array, iteratee) {
  34262. return (array && array.length)
  34263. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  34264. : undefined;
  34265. }
  34266. /**
  34267. * Multiply two numbers.
  34268. *
  34269. * @static
  34270. * @memberOf _
  34271. * @since 4.7.0
  34272. * @category Math
  34273. * @param {number} multiplier The first number in a multiplication.
  34274. * @param {number} multiplicand The second number in a multiplication.
  34275. * @returns {number} Returns the product.
  34276. * @example
  34277. *
  34278. * _.multiply(6, 4);
  34279. * // => 24
  34280. */
  34281. var multiply = createMathOperation(function(multiplier, multiplicand) {
  34282. return multiplier * multiplicand;
  34283. }, 1);
  34284. /**
  34285. * Computes `number` rounded to `precision`.
  34286. *
  34287. * @static
  34288. * @memberOf _
  34289. * @since 3.10.0
  34290. * @category Math
  34291. * @param {number} number The number to round.
  34292. * @param {number} [precision=0] The precision to round to.
  34293. * @returns {number} Returns the rounded number.
  34294. * @example
  34295. *
  34296. * _.round(4.006);
  34297. * // => 4
  34298. *
  34299. * _.round(4.006, 2);
  34300. * // => 4.01
  34301. *
  34302. * _.round(4060, -2);
  34303. * // => 4100
  34304. */
  34305. var round = createRound('round');
  34306. /**
  34307. * Subtract two numbers.
  34308. *
  34309. * @static
  34310. * @memberOf _
  34311. * @since 4.0.0
  34312. * @category Math
  34313. * @param {number} minuend The first number in a subtraction.
  34314. * @param {number} subtrahend The second number in a subtraction.
  34315. * @returns {number} Returns the difference.
  34316. * @example
  34317. *
  34318. * _.subtract(6, 4);
  34319. * // => 2
  34320. */
  34321. var subtract = createMathOperation(function(minuend, subtrahend) {
  34322. return minuend - subtrahend;
  34323. }, 0);
  34324. /**
  34325. * Computes the sum of the values in `array`.
  34326. *
  34327. * @static
  34328. * @memberOf _
  34329. * @since 3.4.0
  34330. * @category Math
  34331. * @param {Array} array The array to iterate over.
  34332. * @returns {number} Returns the sum.
  34333. * @example
  34334. *
  34335. * _.sum([4, 2, 8, 6]);
  34336. * // => 20
  34337. */
  34338. function sum(array) {
  34339. return (array && array.length)
  34340. ? baseSum(array, identity)
  34341. : 0;
  34342. }
  34343. /**
  34344. * This method is like `_.sum` except that it accepts `iteratee` which is
  34345. * invoked for each element in `array` to generate the value to be summed.
  34346. * The iteratee is invoked with one argument: (value).
  34347. *
  34348. * @static
  34349. * @memberOf _
  34350. * @since 4.0.0
  34351. * @category Math
  34352. * @param {Array} array The array to iterate over.
  34353. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  34354. * @returns {number} Returns the sum.
  34355. * @example
  34356. *
  34357. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  34358. *
  34359. * _.sumBy(objects, function(o) { return o.n; });
  34360. * // => 20
  34361. *
  34362. * // The `_.property` iteratee shorthand.
  34363. * _.sumBy(objects, 'n');
  34364. * // => 20
  34365. */
  34366. function sumBy(array, iteratee) {
  34367. return (array && array.length)
  34368. ? baseSum(array, getIteratee(iteratee, 2))
  34369. : 0;
  34370. }
  34371. /*------------------------------------------------------------------------*/
  34372. // Add methods that return wrapped values in chain sequences.
  34373. lodash.after = after;
  34374. lodash.ary = ary;
  34375. lodash.assign = assign;
  34376. lodash.assignIn = assignIn;
  34377. lodash.assignInWith = assignInWith;
  34378. lodash.assignWith = assignWith;
  34379. lodash.at = at;
  34380. lodash.before = before;
  34381. lodash.bind = bind;
  34382. lodash.bindAll = bindAll;
  34383. lodash.bindKey = bindKey;
  34384. lodash.castArray = castArray;
  34385. lodash.chain = chain;
  34386. lodash.chunk = chunk;
  34387. lodash.compact = compact;
  34388. lodash.concat = concat;
  34389. lodash.cond = cond;
  34390. lodash.conforms = conforms;
  34391. lodash.constant = constant;
  34392. lodash.countBy = countBy;
  34393. lodash.create = create;
  34394. lodash.curry = curry;
  34395. lodash.curryRight = curryRight;
  34396. lodash.debounce = debounce;
  34397. lodash.defaults = defaults;
  34398. lodash.defaultsDeep = defaultsDeep;
  34399. lodash.defer = defer;
  34400. lodash.delay = delay;
  34401. lodash.difference = difference;
  34402. lodash.differenceBy = differenceBy;
  34403. lodash.differenceWith = differenceWith;
  34404. lodash.drop = drop;
  34405. lodash.dropRight = dropRight;
  34406. lodash.dropRightWhile = dropRightWhile;
  34407. lodash.dropWhile = dropWhile;
  34408. lodash.fill = fill;
  34409. lodash.filter = filter;
  34410. lodash.flatMap = flatMap;
  34411. lodash.flatMapDeep = flatMapDeep;
  34412. lodash.flatMapDepth = flatMapDepth;
  34413. lodash.flatten = flatten;
  34414. lodash.flattenDeep = flattenDeep;
  34415. lodash.flattenDepth = flattenDepth;
  34416. lodash.flip = flip;
  34417. lodash.flow = flow;
  34418. lodash.flowRight = flowRight;
  34419. lodash.fromPairs = fromPairs;
  34420. lodash.functions = functions;
  34421. lodash.functionsIn = functionsIn;
  34422. lodash.groupBy = groupBy;
  34423. lodash.initial = initial;
  34424. lodash.intersection = intersection;
  34425. lodash.intersectionBy = intersectionBy;
  34426. lodash.intersectionWith = intersectionWith;
  34427. lodash.invert = invert;
  34428. lodash.invertBy = invertBy;
  34429. lodash.invokeMap = invokeMap;
  34430. lodash.iteratee = iteratee;
  34431. lodash.keyBy = keyBy;
  34432. lodash.keys = keys;
  34433. lodash.keysIn = keysIn;
  34434. lodash.map = map;
  34435. lodash.mapKeys = mapKeys;
  34436. lodash.mapValues = mapValues;
  34437. lodash.matches = matches;
  34438. lodash.matchesProperty = matchesProperty;
  34439. lodash.memoize = memoize;
  34440. lodash.merge = merge;
  34441. lodash.mergeWith = mergeWith;
  34442. lodash.method = method;
  34443. lodash.methodOf = methodOf;
  34444. lodash.mixin = mixin;
  34445. lodash.negate = negate;
  34446. lodash.nthArg = nthArg;
  34447. lodash.omit = omit;
  34448. lodash.omitBy = omitBy;
  34449. lodash.once = once;
  34450. lodash.orderBy = orderBy;
  34451. lodash.over = over;
  34452. lodash.overArgs = overArgs;
  34453. lodash.overEvery = overEvery;
  34454. lodash.overSome = overSome;
  34455. lodash.partial = partial;
  34456. lodash.partialRight = partialRight;
  34457. lodash.partition = partition;
  34458. lodash.pick = pick;
  34459. lodash.pickBy = pickBy;
  34460. lodash.property = property;
  34461. lodash.propertyOf = propertyOf;
  34462. lodash.pull = pull;
  34463. lodash.pullAll = pullAll;
  34464. lodash.pullAllBy = pullAllBy;
  34465. lodash.pullAllWith = pullAllWith;
  34466. lodash.pullAt = pullAt;
  34467. lodash.range = range;
  34468. lodash.rangeRight = rangeRight;
  34469. lodash.rearg = rearg;
  34470. lodash.reject = reject;
  34471. lodash.remove = remove;
  34472. lodash.rest = rest;
  34473. lodash.reverse = reverse;
  34474. lodash.sampleSize = sampleSize;
  34475. lodash.set = set;
  34476. lodash.setWith = setWith;
  34477. lodash.shuffle = shuffle;
  34478. lodash.slice = slice;
  34479. lodash.sortBy = sortBy;
  34480. lodash.sortedUniq = sortedUniq;
  34481. lodash.sortedUniqBy = sortedUniqBy;
  34482. lodash.split = split;
  34483. lodash.spread = spread;
  34484. lodash.tail = tail;
  34485. lodash.take = take;
  34486. lodash.takeRight = takeRight;
  34487. lodash.takeRightWhile = takeRightWhile;
  34488. lodash.takeWhile = takeWhile;
  34489. lodash.tap = tap;
  34490. lodash.throttle = throttle;
  34491. lodash.thru = thru;
  34492. lodash.toArray = toArray;
  34493. lodash.toPairs = toPairs;
  34494. lodash.toPairsIn = toPairsIn;
  34495. lodash.toPath = toPath;
  34496. lodash.toPlainObject = toPlainObject;
  34497. lodash.transform = transform;
  34498. lodash.unary = unary;
  34499. lodash.union = union;
  34500. lodash.unionBy = unionBy;
  34501. lodash.unionWith = unionWith;
  34502. lodash.uniq = uniq;
  34503. lodash.uniqBy = uniqBy;
  34504. lodash.uniqWith = uniqWith;
  34505. lodash.unset = unset;
  34506. lodash.unzip = unzip;
  34507. lodash.unzipWith = unzipWith;
  34508. lodash.update = update;
  34509. lodash.updateWith = updateWith;
  34510. lodash.values = values;
  34511. lodash.valuesIn = valuesIn;
  34512. lodash.without = without;
  34513. lodash.words = words;
  34514. lodash.wrap = wrap;
  34515. lodash.xor = xor;
  34516. lodash.xorBy = xorBy;
  34517. lodash.xorWith = xorWith;
  34518. lodash.zip = zip;
  34519. lodash.zipObject = zipObject;
  34520. lodash.zipObjectDeep = zipObjectDeep;
  34521. lodash.zipWith = zipWith;
  34522. // Add aliases.
  34523. lodash.entries = toPairs;
  34524. lodash.entriesIn = toPairsIn;
  34525. lodash.extend = assignIn;
  34526. lodash.extendWith = assignInWith;
  34527. // Add methods to `lodash.prototype`.
  34528. mixin(lodash, lodash);
  34529. /*------------------------------------------------------------------------*/
  34530. // Add methods that return unwrapped values in chain sequences.
  34531. lodash.add = add;
  34532. lodash.attempt = attempt;
  34533. lodash.camelCase = camelCase;
  34534. lodash.capitalize = capitalize;
  34535. lodash.ceil = ceil;
  34536. lodash.clamp = clamp;
  34537. lodash.clone = clone;
  34538. lodash.cloneDeep = cloneDeep;
  34539. lodash.cloneDeepWith = cloneDeepWith;
  34540. lodash.cloneWith = cloneWith;
  34541. lodash.conformsTo = conformsTo;
  34542. lodash.deburr = deburr;
  34543. lodash.defaultTo = defaultTo;
  34544. lodash.divide = divide;
  34545. lodash.endsWith = endsWith;
  34546. lodash.eq = eq;
  34547. lodash.escape = escape;
  34548. lodash.escapeRegExp = escapeRegExp;
  34549. lodash.every = every;
  34550. lodash.find = find;
  34551. lodash.findIndex = findIndex;
  34552. lodash.findKey = findKey;
  34553. lodash.findLast = findLast;
  34554. lodash.findLastIndex = findLastIndex;
  34555. lodash.findLastKey = findLastKey;
  34556. lodash.floor = floor;
  34557. lodash.forEach = forEach;
  34558. lodash.forEachRight = forEachRight;
  34559. lodash.forIn = forIn;
  34560. lodash.forInRight = forInRight;
  34561. lodash.forOwn = forOwn;
  34562. lodash.forOwnRight = forOwnRight;
  34563. lodash.get = get;
  34564. lodash.gt = gt;
  34565. lodash.gte = gte;
  34566. lodash.has = has;
  34567. lodash.hasIn = hasIn;
  34568. lodash.head = head;
  34569. lodash.identity = identity;
  34570. lodash.includes = includes;
  34571. lodash.indexOf = indexOf;
  34572. lodash.inRange = inRange;
  34573. lodash.invoke = invoke;
  34574. lodash.isArguments = isArguments;
  34575. lodash.isArray = isArray;
  34576. lodash.isArrayBuffer = isArrayBuffer;
  34577. lodash.isArrayLike = isArrayLike;
  34578. lodash.isArrayLikeObject = isArrayLikeObject;
  34579. lodash.isBoolean = isBoolean;
  34580. lodash.isBuffer = isBuffer;
  34581. lodash.isDate = isDate;
  34582. lodash.isElement = isElement;
  34583. lodash.isEmpty = isEmpty;
  34584. lodash.isEqual = isEqual;
  34585. lodash.isEqualWith = isEqualWith;
  34586. lodash.isError = isError;
  34587. lodash.isFinite = isFinite;
  34588. lodash.isFunction = isFunction;
  34589. lodash.isInteger = isInteger;
  34590. lodash.isLength = isLength;
  34591. lodash.isMap = isMap;
  34592. lodash.isMatch = isMatch;
  34593. lodash.isMatchWith = isMatchWith;
  34594. lodash.isNaN = isNaN;
  34595. lodash.isNative = isNative;
  34596. lodash.isNil = isNil;
  34597. lodash.isNull = isNull;
  34598. lodash.isNumber = isNumber;
  34599. lodash.isObject = isObject;
  34600. lodash.isObjectLike = isObjectLike;
  34601. lodash.isPlainObject = isPlainObject;
  34602. lodash.isRegExp = isRegExp;
  34603. lodash.isSafeInteger = isSafeInteger;
  34604. lodash.isSet = isSet;
  34605. lodash.isString = isString;
  34606. lodash.isSymbol = isSymbol;
  34607. lodash.isTypedArray = isTypedArray;
  34608. lodash.isUndefined = isUndefined;
  34609. lodash.isWeakMap = isWeakMap;
  34610. lodash.isWeakSet = isWeakSet;
  34611. lodash.join = join;
  34612. lodash.kebabCase = kebabCase;
  34613. lodash.last = last;
  34614. lodash.lastIndexOf = lastIndexOf;
  34615. lodash.lowerCase = lowerCase;
  34616. lodash.lowerFirst = lowerFirst;
  34617. lodash.lt = lt;
  34618. lodash.lte = lte;
  34619. lodash.max = max;
  34620. lodash.maxBy = maxBy;
  34621. lodash.mean = mean;
  34622. lodash.meanBy = meanBy;
  34623. lodash.min = min;
  34624. lodash.minBy = minBy;
  34625. lodash.stubArray = stubArray;
  34626. lodash.stubFalse = stubFalse;
  34627. lodash.stubObject = stubObject;
  34628. lodash.stubString = stubString;
  34629. lodash.stubTrue = stubTrue;
  34630. lodash.multiply = multiply;
  34631. lodash.nth = nth;
  34632. lodash.noConflict = noConflict;
  34633. lodash.noop = noop;
  34634. lodash.now = now;
  34635. lodash.pad = pad;
  34636. lodash.padEnd = padEnd;
  34637. lodash.padStart = padStart;
  34638. lodash.parseInt = parseInt;
  34639. lodash.random = random;
  34640. lodash.reduce = reduce;
  34641. lodash.reduceRight = reduceRight;
  34642. lodash.repeat = repeat;
  34643. lodash.replace = replace;
  34644. lodash.result = result;
  34645. lodash.round = round;
  34646. lodash.runInContext = runInContext;
  34647. lodash.sample = sample;
  34648. lodash.size = size;
  34649. lodash.snakeCase = snakeCase;
  34650. lodash.some = some;
  34651. lodash.sortedIndex = sortedIndex;
  34652. lodash.sortedIndexBy = sortedIndexBy;
  34653. lodash.sortedIndexOf = sortedIndexOf;
  34654. lodash.sortedLastIndex = sortedLastIndex;
  34655. lodash.sortedLastIndexBy = sortedLastIndexBy;
  34656. lodash.sortedLastIndexOf = sortedLastIndexOf;
  34657. lodash.startCase = startCase;
  34658. lodash.startsWith = startsWith;
  34659. lodash.subtract = subtract;
  34660. lodash.sum = sum;
  34661. lodash.sumBy = sumBy;
  34662. lodash.template = template;
  34663. lodash.times = times;
  34664. lodash.toFinite = toFinite;
  34665. lodash.toInteger = toInteger;
  34666. lodash.toLength = toLength;
  34667. lodash.toLower = toLower;
  34668. lodash.toNumber = toNumber;
  34669. lodash.toSafeInteger = toSafeInteger;
  34670. lodash.toString = toString;
  34671. lodash.toUpper = toUpper;
  34672. lodash.trim = trim;
  34673. lodash.trimEnd = trimEnd;
  34674. lodash.trimStart = trimStart;
  34675. lodash.truncate = truncate;
  34676. lodash.unescape = unescape;
  34677. lodash.uniqueId = uniqueId;
  34678. lodash.upperCase = upperCase;
  34679. lodash.upperFirst = upperFirst;
  34680. // Add aliases.
  34681. lodash.each = forEach;
  34682. lodash.eachRight = forEachRight;
  34683. lodash.first = head;
  34684. mixin(lodash, (function() {
  34685. var source = {};
  34686. baseForOwn(lodash, function(func, methodName) {
  34687. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  34688. source[methodName] = func;
  34689. }
  34690. });
  34691. return source;
  34692. }()), { 'chain': false });
  34693. /*------------------------------------------------------------------------*/
  34694. /**
  34695. * The semantic version number.
  34696. *
  34697. * @static
  34698. * @memberOf _
  34699. * @type {string}
  34700. */
  34701. lodash.VERSION = VERSION;
  34702. // Assign default placeholders.
  34703. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  34704. lodash[methodName].placeholder = lodash;
  34705. });
  34706. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  34707. arrayEach(['drop', 'take'], function(methodName, index) {
  34708. LazyWrapper.prototype[methodName] = function(n) {
  34709. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  34710. var result = (this.__filtered__ && !index)
  34711. ? new LazyWrapper(this)
  34712. : this.clone();
  34713. if (result.__filtered__) {
  34714. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  34715. } else {
  34716. result.__views__.push({
  34717. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  34718. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  34719. });
  34720. }
  34721. return result;
  34722. };
  34723. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  34724. return this.reverse()[methodName](n).reverse();
  34725. };
  34726. });
  34727. // Add `LazyWrapper` methods that accept an `iteratee` value.
  34728. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  34729. var type = index + 1,
  34730. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  34731. LazyWrapper.prototype[methodName] = function(iteratee) {
  34732. var result = this.clone();
  34733. result.__iteratees__.push({
  34734. 'iteratee': getIteratee(iteratee, 3),
  34735. 'type': type
  34736. });
  34737. result.__filtered__ = result.__filtered__ || isFilter;
  34738. return result;
  34739. };
  34740. });
  34741. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  34742. arrayEach(['head', 'last'], function(methodName, index) {
  34743. var takeName = 'take' + (index ? 'Right' : '');
  34744. LazyWrapper.prototype[methodName] = function() {
  34745. return this[takeName](1).value()[0];
  34746. };
  34747. });
  34748. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  34749. arrayEach(['initial', 'tail'], function(methodName, index) {
  34750. var dropName = 'drop' + (index ? '' : 'Right');
  34751. LazyWrapper.prototype[methodName] = function() {
  34752. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  34753. };
  34754. });
  34755. LazyWrapper.prototype.compact = function() {
  34756. return this.filter(identity);
  34757. };
  34758. LazyWrapper.prototype.find = function(predicate) {
  34759. return this.filter(predicate).head();
  34760. };
  34761. LazyWrapper.prototype.findLast = function(predicate) {
  34762. return this.reverse().find(predicate);
  34763. };
  34764. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  34765. if (typeof path == 'function') {
  34766. return new LazyWrapper(this);
  34767. }
  34768. return this.map(function(value) {
  34769. return baseInvoke(value, path, args);
  34770. });
  34771. });
  34772. LazyWrapper.prototype.reject = function(predicate) {
  34773. return this.filter(negate(getIteratee(predicate)));
  34774. };
  34775. LazyWrapper.prototype.slice = function(start, end) {
  34776. start = toInteger(start);
  34777. var result = this;
  34778. if (result.__filtered__ && (start > 0 || end < 0)) {
  34779. return new LazyWrapper(result);
  34780. }
  34781. if (start < 0) {
  34782. result = result.takeRight(-start);
  34783. } else if (start) {
  34784. result = result.drop(start);
  34785. }
  34786. if (end !== undefined) {
  34787. end = toInteger(end);
  34788. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  34789. }
  34790. return result;
  34791. };
  34792. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  34793. return this.reverse().takeWhile(predicate).reverse();
  34794. };
  34795. LazyWrapper.prototype.toArray = function() {
  34796. return this.take(MAX_ARRAY_LENGTH);
  34797. };
  34798. // Add `LazyWrapper` methods to `lodash.prototype`.
  34799. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34800. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  34801. isTaker = /^(?:head|last)$/.test(methodName),
  34802. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  34803. retUnwrapped = isTaker || /^find/.test(methodName);
  34804. if (!lodashFunc) {
  34805. return;
  34806. }
  34807. lodash.prototype[methodName] = function() {
  34808. var value = this.__wrapped__,
  34809. args = isTaker ? [1] : arguments,
  34810. isLazy = value instanceof LazyWrapper,
  34811. iteratee = args[0],
  34812. useLazy = isLazy || isArray(value);
  34813. var interceptor = function(value) {
  34814. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  34815. return (isTaker && chainAll) ? result[0] : result;
  34816. };
  34817. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  34818. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  34819. isLazy = useLazy = false;
  34820. }
  34821. var chainAll = this.__chain__,
  34822. isHybrid = !!this.__actions__.length,
  34823. isUnwrapped = retUnwrapped && !chainAll,
  34824. onlyLazy = isLazy && !isHybrid;
  34825. if (!retUnwrapped && useLazy) {
  34826. value = onlyLazy ? value : new LazyWrapper(this);
  34827. var result = func.apply(value, args);
  34828. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  34829. return new LodashWrapper(result, chainAll);
  34830. }
  34831. if (isUnwrapped && onlyLazy) {
  34832. return func.apply(this, args);
  34833. }
  34834. result = this.thru(interceptor);
  34835. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  34836. };
  34837. });
  34838. // Add `Array` methods to `lodash.prototype`.
  34839. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  34840. var func = arrayProto[methodName],
  34841. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  34842. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  34843. lodash.prototype[methodName] = function() {
  34844. var args = arguments;
  34845. if (retUnwrapped && !this.__chain__) {
  34846. var value = this.value();
  34847. return func.apply(isArray(value) ? value : [], args);
  34848. }
  34849. return this[chainName](function(value) {
  34850. return func.apply(isArray(value) ? value : [], args);
  34851. });
  34852. };
  34853. });
  34854. // Map minified method names to their real names.
  34855. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34856. var lodashFunc = lodash[methodName];
  34857. if (lodashFunc) {
  34858. var key = lodashFunc.name + '';
  34859. if (!hasOwnProperty.call(realNames, key)) {
  34860. realNames[key] = [];
  34861. }
  34862. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  34863. }
  34864. });
  34865. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  34866. 'name': 'wrapper',
  34867. 'func': undefined
  34868. }];
  34869. // Add methods to `LazyWrapper`.
  34870. LazyWrapper.prototype.clone = lazyClone;
  34871. LazyWrapper.prototype.reverse = lazyReverse;
  34872. LazyWrapper.prototype.value = lazyValue;
  34873. // Add chain sequence methods to the `lodash` wrapper.
  34874. lodash.prototype.at = wrapperAt;
  34875. lodash.prototype.chain = wrapperChain;
  34876. lodash.prototype.commit = wrapperCommit;
  34877. lodash.prototype.next = wrapperNext;
  34878. lodash.prototype.plant = wrapperPlant;
  34879. lodash.prototype.reverse = wrapperReverse;
  34880. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  34881. // Add lazy aliases.
  34882. lodash.prototype.first = lodash.prototype.head;
  34883. if (symIterator) {
  34884. lodash.prototype[symIterator] = wrapperToIterator;
  34885. }
  34886. return lodash;
  34887. });
  34888. /*--------------------------------------------------------------------------*/
  34889. // Export lodash.
  34890. var _ = runInContext();
  34891. // Some AMD build optimizers, like r.js, check for condition patterns like:
  34892. if (true) {
  34893. // Expose Lodash on the global object to prevent errors when Lodash is
  34894. // loaded by a script tag in the presence of an AMD loader.
  34895. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  34896. // Use `_.noConflict` to remove Lodash from the global object.
  34897. root._ = _;
  34898. // Define as an anonymous module so, through path mapping, it can be
  34899. // referenced as the "underscore" module.
  34900. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  34901. return _;
  34902. }).call(exports, __webpack_require__, exports, module),
  34903. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  34904. }
  34905. // Check for `exports` after `define` in case a build optimizer adds it.
  34906. else {}
  34907. }.call(this));
  34908. /* 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)))
  34909. /***/ }),
  34910. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  34911. /*!***************************************************!*\
  34912. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  34913. \***************************************************/
  34914. /*! exports provided: default */
  34915. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  34916. "use strict";
  34917. __webpack_require__.r(__webpack_exports__);
  34918. /* WEBPACK VAR INJECTION */(function(global) {/**!
  34919. * @fileOverview Kickass library to create and place poppers near their reference elements.
  34920. * @version 1.16.1
  34921. * @license
  34922. * Copyright (c) 2016 Federico Zivolo and contributors
  34923. *
  34924. * Permission is hereby granted, free of charge, to any person obtaining a copy
  34925. * of this software and associated documentation files (the "Software"), to deal
  34926. * in the Software without restriction, including without limitation the rights
  34927. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  34928. * copies of the Software, and to permit persons to whom the Software is
  34929. * furnished to do so, subject to the following conditions:
  34930. *
  34931. * The above copyright notice and this permission notice shall be included in all
  34932. * copies or substantial portions of the Software.
  34933. *
  34934. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  34935. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  34936. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  34937. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  34938. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  34939. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  34940. * SOFTWARE.
  34941. */
  34942. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  34943. var timeoutDuration = function () {
  34944. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  34945. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  34946. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  34947. return 1;
  34948. }
  34949. }
  34950. return 0;
  34951. }();
  34952. function microtaskDebounce(fn) {
  34953. var called = false;
  34954. return function () {
  34955. if (called) {
  34956. return;
  34957. }
  34958. called = true;
  34959. window.Promise.resolve().then(function () {
  34960. called = false;
  34961. fn();
  34962. });
  34963. };
  34964. }
  34965. function taskDebounce(fn) {
  34966. var scheduled = false;
  34967. return function () {
  34968. if (!scheduled) {
  34969. scheduled = true;
  34970. setTimeout(function () {
  34971. scheduled = false;
  34972. fn();
  34973. }, timeoutDuration);
  34974. }
  34975. };
  34976. }
  34977. var supportsMicroTasks = isBrowser && window.Promise;
  34978. /**
  34979. * Create a debounced version of a method, that's asynchronously deferred
  34980. * but called in the minimum time possible.
  34981. *
  34982. * @method
  34983. * @memberof Popper.Utils
  34984. * @argument {Function} fn
  34985. * @returns {Function}
  34986. */
  34987. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  34988. /**
  34989. * Check if the given variable is a function
  34990. * @method
  34991. * @memberof Popper.Utils
  34992. * @argument {Any} functionToCheck - variable to check
  34993. * @returns {Boolean} answer to: is a function?
  34994. */
  34995. function isFunction(functionToCheck) {
  34996. var getType = {};
  34997. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  34998. }
  34999. /**
  35000. * Get CSS computed property of the given element
  35001. * @method
  35002. * @memberof Popper.Utils
  35003. * @argument {Eement} element
  35004. * @argument {String} property
  35005. */
  35006. function getStyleComputedProperty(element, property) {
  35007. if (element.nodeType !== 1) {
  35008. return [];
  35009. }
  35010. // NOTE: 1 DOM access here
  35011. var window = element.ownerDocument.defaultView;
  35012. var css = window.getComputedStyle(element, null);
  35013. return property ? css[property] : css;
  35014. }
  35015. /**
  35016. * Returns the parentNode or the host of the element
  35017. * @method
  35018. * @memberof Popper.Utils
  35019. * @argument {Element} element
  35020. * @returns {Element} parent
  35021. */
  35022. function getParentNode(element) {
  35023. if (element.nodeName === 'HTML') {
  35024. return element;
  35025. }
  35026. return element.parentNode || element.host;
  35027. }
  35028. /**
  35029. * Returns the scrolling parent of the given element
  35030. * @method
  35031. * @memberof Popper.Utils
  35032. * @argument {Element} element
  35033. * @returns {Element} scroll parent
  35034. */
  35035. function getScrollParent(element) {
  35036. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  35037. if (!element) {
  35038. return document.body;
  35039. }
  35040. switch (element.nodeName) {
  35041. case 'HTML':
  35042. case 'BODY':
  35043. return element.ownerDocument.body;
  35044. case '#document':
  35045. return element.body;
  35046. }
  35047. // Firefox want us to check `-x` and `-y` variations as well
  35048. var _getStyleComputedProp = getStyleComputedProperty(element),
  35049. overflow = _getStyleComputedProp.overflow,
  35050. overflowX = _getStyleComputedProp.overflowX,
  35051. overflowY = _getStyleComputedProp.overflowY;
  35052. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  35053. return element;
  35054. }
  35055. return getScrollParent(getParentNode(element));
  35056. }
  35057. /**
  35058. * Returns the reference node of the reference object, or the reference object itself.
  35059. * @method
  35060. * @memberof Popper.Utils
  35061. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  35062. * @returns {Element} parent
  35063. */
  35064. function getReferenceNode(reference) {
  35065. return reference && reference.referenceNode ? reference.referenceNode : reference;
  35066. }
  35067. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  35068. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  35069. /**
  35070. * Determines if the browser is Internet Explorer
  35071. * @method
  35072. * @memberof Popper.Utils
  35073. * @param {Number} version to check
  35074. * @returns {Boolean} isIE
  35075. */
  35076. function isIE(version) {
  35077. if (version === 11) {
  35078. return isIE11;
  35079. }
  35080. if (version === 10) {
  35081. return isIE10;
  35082. }
  35083. return isIE11 || isIE10;
  35084. }
  35085. /**
  35086. * Returns the offset parent of the given element
  35087. * @method
  35088. * @memberof Popper.Utils
  35089. * @argument {Element} element
  35090. * @returns {Element} offset parent
  35091. */
  35092. function getOffsetParent(element) {
  35093. if (!element) {
  35094. return document.documentElement;
  35095. }
  35096. var noOffsetParent = isIE(10) ? document.body : null;
  35097. // NOTE: 1 DOM access here
  35098. var offsetParent = element.offsetParent || null;
  35099. // Skip hidden elements which don't have an offsetParent
  35100. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  35101. offsetParent = (element = element.nextElementSibling).offsetParent;
  35102. }
  35103. var nodeName = offsetParent && offsetParent.nodeName;
  35104. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  35105. return element ? element.ownerDocument.documentElement : document.documentElement;
  35106. }
  35107. // .offsetParent will return the closest TH, TD or TABLE in case
  35108. // no offsetParent is present, I hate this job...
  35109. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  35110. return getOffsetParent(offsetParent);
  35111. }
  35112. return offsetParent;
  35113. }
  35114. function isOffsetContainer(element) {
  35115. var nodeName = element.nodeName;
  35116. if (nodeName === 'BODY') {
  35117. return false;
  35118. }
  35119. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  35120. }
  35121. /**
  35122. * Finds the root node (document, shadowDOM root) of the given element
  35123. * @method
  35124. * @memberof Popper.Utils
  35125. * @argument {Element} node
  35126. * @returns {Element} root node
  35127. */
  35128. function getRoot(node) {
  35129. if (node.parentNode !== null) {
  35130. return getRoot(node.parentNode);
  35131. }
  35132. return node;
  35133. }
  35134. /**
  35135. * Finds the offset parent common to the two provided nodes
  35136. * @method
  35137. * @memberof Popper.Utils
  35138. * @argument {Element} element1
  35139. * @argument {Element} element2
  35140. * @returns {Element} common offset parent
  35141. */
  35142. function findCommonOffsetParent(element1, element2) {
  35143. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  35144. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  35145. return document.documentElement;
  35146. }
  35147. // Here we make sure to give as "start" the element that comes first in the DOM
  35148. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  35149. var start = order ? element1 : element2;
  35150. var end = order ? element2 : element1;
  35151. // Get common ancestor container
  35152. var range = document.createRange();
  35153. range.setStart(start, 0);
  35154. range.setEnd(end, 0);
  35155. var commonAncestorContainer = range.commonAncestorContainer;
  35156. // Both nodes are inside #document
  35157. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  35158. if (isOffsetContainer(commonAncestorContainer)) {
  35159. return commonAncestorContainer;
  35160. }
  35161. return getOffsetParent(commonAncestorContainer);
  35162. }
  35163. // one of the nodes is inside shadowDOM, find which one
  35164. var element1root = getRoot(element1);
  35165. if (element1root.host) {
  35166. return findCommonOffsetParent(element1root.host, element2);
  35167. } else {
  35168. return findCommonOffsetParent(element1, getRoot(element2).host);
  35169. }
  35170. }
  35171. /**
  35172. * Gets the scroll value of the given element in the given side (top and left)
  35173. * @method
  35174. * @memberof Popper.Utils
  35175. * @argument {Element} element
  35176. * @argument {String} side `top` or `left`
  35177. * @returns {number} amount of scrolled pixels
  35178. */
  35179. function getScroll(element) {
  35180. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  35181. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  35182. var nodeName = element.nodeName;
  35183. if (nodeName === 'BODY' || nodeName === 'HTML') {
  35184. var html = element.ownerDocument.documentElement;
  35185. var scrollingElement = element.ownerDocument.scrollingElement || html;
  35186. return scrollingElement[upperSide];
  35187. }
  35188. return element[upperSide];
  35189. }
  35190. /*
  35191. * Sum or subtract the element scroll values (left and top) from a given rect object
  35192. * @method
  35193. * @memberof Popper.Utils
  35194. * @param {Object} rect - Rect object you want to change
  35195. * @param {HTMLElement} element - The element from the function reads the scroll values
  35196. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  35197. * @return {Object} rect - The modifier rect object
  35198. */
  35199. function includeScroll(rect, element) {
  35200. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  35201. var scrollTop = getScroll(element, 'top');
  35202. var scrollLeft = getScroll(element, 'left');
  35203. var modifier = subtract ? -1 : 1;
  35204. rect.top += scrollTop * modifier;
  35205. rect.bottom += scrollTop * modifier;
  35206. rect.left += scrollLeft * modifier;
  35207. rect.right += scrollLeft * modifier;
  35208. return rect;
  35209. }
  35210. /*
  35211. * Helper to detect borders of a given element
  35212. * @method
  35213. * @memberof Popper.Utils
  35214. * @param {CSSStyleDeclaration} styles
  35215. * Result of `getStyleComputedProperty` on the given element
  35216. * @param {String} axis - `x` or `y`
  35217. * @return {number} borders - The borders size of the given axis
  35218. */
  35219. function getBordersSize(styles, axis) {
  35220. var sideA = axis === 'x' ? 'Left' : 'Top';
  35221. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  35222. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  35223. }
  35224. function getSize(axis, body, html, computedStyle) {
  35225. 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);
  35226. }
  35227. function getWindowSizes(document) {
  35228. var body = document.body;
  35229. var html = document.documentElement;
  35230. var computedStyle = isIE(10) && getComputedStyle(html);
  35231. return {
  35232. height: getSize('Height', body, html, computedStyle),
  35233. width: getSize('Width', body, html, computedStyle)
  35234. };
  35235. }
  35236. var classCallCheck = function (instance, Constructor) {
  35237. if (!(instance instanceof Constructor)) {
  35238. throw new TypeError("Cannot call a class as a function");
  35239. }
  35240. };
  35241. var createClass = function () {
  35242. function defineProperties(target, props) {
  35243. for (var i = 0; i < props.length; i++) {
  35244. var descriptor = props[i];
  35245. descriptor.enumerable = descriptor.enumerable || false;
  35246. descriptor.configurable = true;
  35247. if ("value" in descriptor) descriptor.writable = true;
  35248. Object.defineProperty(target, descriptor.key, descriptor);
  35249. }
  35250. }
  35251. return function (Constructor, protoProps, staticProps) {
  35252. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  35253. if (staticProps) defineProperties(Constructor, staticProps);
  35254. return Constructor;
  35255. };
  35256. }();
  35257. var defineProperty = function (obj, key, value) {
  35258. if (key in obj) {
  35259. Object.defineProperty(obj, key, {
  35260. value: value,
  35261. enumerable: true,
  35262. configurable: true,
  35263. writable: true
  35264. });
  35265. } else {
  35266. obj[key] = value;
  35267. }
  35268. return obj;
  35269. };
  35270. var _extends = Object.assign || function (target) {
  35271. for (var i = 1; i < arguments.length; i++) {
  35272. var source = arguments[i];
  35273. for (var key in source) {
  35274. if (Object.prototype.hasOwnProperty.call(source, key)) {
  35275. target[key] = source[key];
  35276. }
  35277. }
  35278. }
  35279. return target;
  35280. };
  35281. /**
  35282. * Given element offsets, generate an output similar to getBoundingClientRect
  35283. * @method
  35284. * @memberof Popper.Utils
  35285. * @argument {Object} offsets
  35286. * @returns {Object} ClientRect like output
  35287. */
  35288. function getClientRect(offsets) {
  35289. return _extends({}, offsets, {
  35290. right: offsets.left + offsets.width,
  35291. bottom: offsets.top + offsets.height
  35292. });
  35293. }
  35294. /**
  35295. * Get bounding client rect of given element
  35296. * @method
  35297. * @memberof Popper.Utils
  35298. * @param {HTMLElement} element
  35299. * @return {Object} client rect
  35300. */
  35301. function getBoundingClientRect(element) {
  35302. var rect = {};
  35303. // IE10 10 FIX: Please, don't ask, the element isn't
  35304. // considered in DOM in some circumstances...
  35305. // This isn't reproducible in IE10 compatibility mode of IE11
  35306. try {
  35307. if (isIE(10)) {
  35308. rect = element.getBoundingClientRect();
  35309. var scrollTop = getScroll(element, 'top');
  35310. var scrollLeft = getScroll(element, 'left');
  35311. rect.top += scrollTop;
  35312. rect.left += scrollLeft;
  35313. rect.bottom += scrollTop;
  35314. rect.right += scrollLeft;
  35315. } else {
  35316. rect = element.getBoundingClientRect();
  35317. }
  35318. } catch (e) {}
  35319. var result = {
  35320. left: rect.left,
  35321. top: rect.top,
  35322. width: rect.right - rect.left,
  35323. height: rect.bottom - rect.top
  35324. };
  35325. // subtract scrollbar size from sizes
  35326. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  35327. var width = sizes.width || element.clientWidth || result.width;
  35328. var height = sizes.height || element.clientHeight || result.height;
  35329. var horizScrollbar = element.offsetWidth - width;
  35330. var vertScrollbar = element.offsetHeight - height;
  35331. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  35332. // we make this check conditional for performance reasons
  35333. if (horizScrollbar || vertScrollbar) {
  35334. var styles = getStyleComputedProperty(element);
  35335. horizScrollbar -= getBordersSize(styles, 'x');
  35336. vertScrollbar -= getBordersSize(styles, 'y');
  35337. result.width -= horizScrollbar;
  35338. result.height -= vertScrollbar;
  35339. }
  35340. return getClientRect(result);
  35341. }
  35342. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  35343. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  35344. var isIE10 = isIE(10);
  35345. var isHTML = parent.nodeName === 'HTML';
  35346. var childrenRect = getBoundingClientRect(children);
  35347. var parentRect = getBoundingClientRect(parent);
  35348. var scrollParent = getScrollParent(children);
  35349. var styles = getStyleComputedProperty(parent);
  35350. var borderTopWidth = parseFloat(styles.borderTopWidth);
  35351. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  35352. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  35353. if (fixedPosition && isHTML) {
  35354. parentRect.top = Math.max(parentRect.top, 0);
  35355. parentRect.left = Math.max(parentRect.left, 0);
  35356. }
  35357. var offsets = getClientRect({
  35358. top: childrenRect.top - parentRect.top - borderTopWidth,
  35359. left: childrenRect.left - parentRect.left - borderLeftWidth,
  35360. width: childrenRect.width,
  35361. height: childrenRect.height
  35362. });
  35363. offsets.marginTop = 0;
  35364. offsets.marginLeft = 0;
  35365. // Subtract margins of documentElement in case it's being used as parent
  35366. // we do this only on HTML because it's the only element that behaves
  35367. // differently when margins are applied to it. The margins are included in
  35368. // the box of the documentElement, in the other cases not.
  35369. if (!isIE10 && isHTML) {
  35370. var marginTop = parseFloat(styles.marginTop);
  35371. var marginLeft = parseFloat(styles.marginLeft);
  35372. offsets.top -= borderTopWidth - marginTop;
  35373. offsets.bottom -= borderTopWidth - marginTop;
  35374. offsets.left -= borderLeftWidth - marginLeft;
  35375. offsets.right -= borderLeftWidth - marginLeft;
  35376. // Attach marginTop and marginLeft because in some circumstances we may need them
  35377. offsets.marginTop = marginTop;
  35378. offsets.marginLeft = marginLeft;
  35379. }
  35380. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  35381. offsets = includeScroll(offsets, parent);
  35382. }
  35383. return offsets;
  35384. }
  35385. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  35386. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35387. var html = element.ownerDocument.documentElement;
  35388. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  35389. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  35390. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  35391. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  35392. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  35393. var offset = {
  35394. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  35395. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  35396. width: width,
  35397. height: height
  35398. };
  35399. return getClientRect(offset);
  35400. }
  35401. /**
  35402. * Check if the given element is fixed or is inside a fixed parent
  35403. * @method
  35404. * @memberof Popper.Utils
  35405. * @argument {Element} element
  35406. * @argument {Element} customContainer
  35407. * @returns {Boolean} answer to "isFixed?"
  35408. */
  35409. function isFixed(element) {
  35410. var nodeName = element.nodeName;
  35411. if (nodeName === 'BODY' || nodeName === 'HTML') {
  35412. return false;
  35413. }
  35414. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  35415. return true;
  35416. }
  35417. var parentNode = getParentNode(element);
  35418. if (!parentNode) {
  35419. return false;
  35420. }
  35421. return isFixed(parentNode);
  35422. }
  35423. /**
  35424. * Finds the first parent of an element that has a transformed property defined
  35425. * @method
  35426. * @memberof Popper.Utils
  35427. * @argument {Element} element
  35428. * @returns {Element} first transformed parent or documentElement
  35429. */
  35430. function getFixedPositionOffsetParent(element) {
  35431. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  35432. if (!element || !element.parentElement || isIE()) {
  35433. return document.documentElement;
  35434. }
  35435. var el = element.parentElement;
  35436. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  35437. el = el.parentElement;
  35438. }
  35439. return el || document.documentElement;
  35440. }
  35441. /**
  35442. * Computed the boundaries limits and return them
  35443. * @method
  35444. * @memberof Popper.Utils
  35445. * @param {HTMLElement} popper
  35446. * @param {HTMLElement} reference
  35447. * @param {number} padding
  35448. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  35449. * @param {Boolean} fixedPosition - Is in fixed position mode
  35450. * @returns {Object} Coordinates of the boundaries
  35451. */
  35452. function getBoundaries(popper, reference, padding, boundariesElement) {
  35453. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  35454. // NOTE: 1 DOM access here
  35455. var boundaries = { top: 0, left: 0 };
  35456. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  35457. // Handle viewport case
  35458. if (boundariesElement === 'viewport') {
  35459. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  35460. } else {
  35461. // Handle other cases based on DOM element used as boundaries
  35462. var boundariesNode = void 0;
  35463. if (boundariesElement === 'scrollParent') {
  35464. boundariesNode = getScrollParent(getParentNode(reference));
  35465. if (boundariesNode.nodeName === 'BODY') {
  35466. boundariesNode = popper.ownerDocument.documentElement;
  35467. }
  35468. } else if (boundariesElement === 'window') {
  35469. boundariesNode = popper.ownerDocument.documentElement;
  35470. } else {
  35471. boundariesNode = boundariesElement;
  35472. }
  35473. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  35474. // In case of HTML, we need a different computation
  35475. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  35476. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  35477. height = _getWindowSizes.height,
  35478. width = _getWindowSizes.width;
  35479. boundaries.top += offsets.top - offsets.marginTop;
  35480. boundaries.bottom = height + offsets.top;
  35481. boundaries.left += offsets.left - offsets.marginLeft;
  35482. boundaries.right = width + offsets.left;
  35483. } else {
  35484. // for all the other DOM elements, this one is good
  35485. boundaries = offsets;
  35486. }
  35487. }
  35488. // Add paddings
  35489. padding = padding || 0;
  35490. var isPaddingNumber = typeof padding === 'number';
  35491. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  35492. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  35493. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  35494. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  35495. return boundaries;
  35496. }
  35497. function getArea(_ref) {
  35498. var width = _ref.width,
  35499. height = _ref.height;
  35500. return width * height;
  35501. }
  35502. /**
  35503. * Utility used to transform the `auto` placement to the placement with more
  35504. * available space.
  35505. * @method
  35506. * @memberof Popper.Utils
  35507. * @argument {Object} data - The data object generated by update method
  35508. * @argument {Object} options - Modifiers configuration and options
  35509. * @returns {Object} The data object, properly modified
  35510. */
  35511. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  35512. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  35513. if (placement.indexOf('auto') === -1) {
  35514. return placement;
  35515. }
  35516. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  35517. var rects = {
  35518. top: {
  35519. width: boundaries.width,
  35520. height: refRect.top - boundaries.top
  35521. },
  35522. right: {
  35523. width: boundaries.right - refRect.right,
  35524. height: boundaries.height
  35525. },
  35526. bottom: {
  35527. width: boundaries.width,
  35528. height: boundaries.bottom - refRect.bottom
  35529. },
  35530. left: {
  35531. width: refRect.left - boundaries.left,
  35532. height: boundaries.height
  35533. }
  35534. };
  35535. var sortedAreas = Object.keys(rects).map(function (key) {
  35536. return _extends({
  35537. key: key
  35538. }, rects[key], {
  35539. area: getArea(rects[key])
  35540. });
  35541. }).sort(function (a, b) {
  35542. return b.area - a.area;
  35543. });
  35544. var filteredAreas = sortedAreas.filter(function (_ref2) {
  35545. var width = _ref2.width,
  35546. height = _ref2.height;
  35547. return width >= popper.clientWidth && height >= popper.clientHeight;
  35548. });
  35549. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  35550. var variation = placement.split('-')[1];
  35551. return computedPlacement + (variation ? '-' + variation : '');
  35552. }
  35553. /**
  35554. * Get offsets to the reference element
  35555. * @method
  35556. * @memberof Popper.Utils
  35557. * @param {Object} state
  35558. * @param {Element} popper - the popper element
  35559. * @param {Element} reference - the reference element (the popper will be relative to this)
  35560. * @param {Element} fixedPosition - is in fixed position mode
  35561. * @returns {Object} An object containing the offsets which will be applied to the popper
  35562. */
  35563. function getReferenceOffsets(state, popper, reference) {
  35564. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  35565. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  35566. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  35567. }
  35568. /**
  35569. * Get the outer sizes of the given element (offset size + margins)
  35570. * @method
  35571. * @memberof Popper.Utils
  35572. * @argument {Element} element
  35573. * @returns {Object} object containing width and height properties
  35574. */
  35575. function getOuterSizes(element) {
  35576. var window = element.ownerDocument.defaultView;
  35577. var styles = window.getComputedStyle(element);
  35578. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  35579. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  35580. var result = {
  35581. width: element.offsetWidth + y,
  35582. height: element.offsetHeight + x
  35583. };
  35584. return result;
  35585. }
  35586. /**
  35587. * Get the opposite placement of the given one
  35588. * @method
  35589. * @memberof Popper.Utils
  35590. * @argument {String} placement
  35591. * @returns {String} flipped placement
  35592. */
  35593. function getOppositePlacement(placement) {
  35594. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  35595. return placement.replace(/left|right|bottom|top/g, function (matched) {
  35596. return hash[matched];
  35597. });
  35598. }
  35599. /**
  35600. * Get offsets to the popper
  35601. * @method
  35602. * @memberof Popper.Utils
  35603. * @param {Object} position - CSS position the Popper will get applied
  35604. * @param {HTMLElement} popper - the popper element
  35605. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  35606. * @param {String} placement - one of the valid placement options
  35607. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  35608. */
  35609. function getPopperOffsets(popper, referenceOffsets, placement) {
  35610. placement = placement.split('-')[0];
  35611. // Get popper node sizes
  35612. var popperRect = getOuterSizes(popper);
  35613. // Add position, width and height to our offsets object
  35614. var popperOffsets = {
  35615. width: popperRect.width,
  35616. height: popperRect.height
  35617. };
  35618. // depending by the popper placement we have to compute its offsets slightly differently
  35619. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  35620. var mainSide = isHoriz ? 'top' : 'left';
  35621. var secondarySide = isHoriz ? 'left' : 'top';
  35622. var measurement = isHoriz ? 'height' : 'width';
  35623. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  35624. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  35625. if (placement === secondarySide) {
  35626. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  35627. } else {
  35628. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  35629. }
  35630. return popperOffsets;
  35631. }
  35632. /**
  35633. * Mimics the `find` method of Array
  35634. * @method
  35635. * @memberof Popper.Utils
  35636. * @argument {Array} arr
  35637. * @argument prop
  35638. * @argument value
  35639. * @returns index or -1
  35640. */
  35641. function find(arr, check) {
  35642. // use native find if supported
  35643. if (Array.prototype.find) {
  35644. return arr.find(check);
  35645. }
  35646. // use `filter` to obtain the same behavior of `find`
  35647. return arr.filter(check)[0];
  35648. }
  35649. /**
  35650. * Return the index of the matching object
  35651. * @method
  35652. * @memberof Popper.Utils
  35653. * @argument {Array} arr
  35654. * @argument prop
  35655. * @argument value
  35656. * @returns index or -1
  35657. */
  35658. function findIndex(arr, prop, value) {
  35659. // use native findIndex if supported
  35660. if (Array.prototype.findIndex) {
  35661. return arr.findIndex(function (cur) {
  35662. return cur[prop] === value;
  35663. });
  35664. }
  35665. // use `find` + `indexOf` if `findIndex` isn't supported
  35666. var match = find(arr, function (obj) {
  35667. return obj[prop] === value;
  35668. });
  35669. return arr.indexOf(match);
  35670. }
  35671. /**
  35672. * Loop trough the list of modifiers and run them in order,
  35673. * each of them will then edit the data object.
  35674. * @method
  35675. * @memberof Popper.Utils
  35676. * @param {dataObject} data
  35677. * @param {Array} modifiers
  35678. * @param {String} ends - Optional modifier name used as stopper
  35679. * @returns {dataObject}
  35680. */
  35681. function runModifiers(modifiers, data, ends) {
  35682. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  35683. modifiersToRun.forEach(function (modifier) {
  35684. if (modifier['function']) {
  35685. // eslint-disable-line dot-notation
  35686. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  35687. }
  35688. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  35689. if (modifier.enabled && isFunction(fn)) {
  35690. // Add properties to offsets to make them a complete clientRect object
  35691. // we do this before each modifier to make sure the previous one doesn't
  35692. // mess with these values
  35693. data.offsets.popper = getClientRect(data.offsets.popper);
  35694. data.offsets.reference = getClientRect(data.offsets.reference);
  35695. data = fn(data, modifier);
  35696. }
  35697. });
  35698. return data;
  35699. }
  35700. /**
  35701. * Updates the position of the popper, computing the new offsets and applying
  35702. * the new style.<br />
  35703. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  35704. * @method
  35705. * @memberof Popper
  35706. */
  35707. function update() {
  35708. // if popper is destroyed, don't perform any further update
  35709. if (this.state.isDestroyed) {
  35710. return;
  35711. }
  35712. var data = {
  35713. instance: this,
  35714. styles: {},
  35715. arrowStyles: {},
  35716. attributes: {},
  35717. flipped: false,
  35718. offsets: {}
  35719. };
  35720. // compute reference element offsets
  35721. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  35722. // compute auto placement, store placement inside the data object,
  35723. // modifiers will be able to edit `placement` if needed
  35724. // and refer to originalPlacement to know the original value
  35725. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  35726. // store the computed placement inside `originalPlacement`
  35727. data.originalPlacement = data.placement;
  35728. data.positionFixed = this.options.positionFixed;
  35729. // compute the popper offsets
  35730. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  35731. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  35732. // run the modifiers
  35733. data = runModifiers(this.modifiers, data);
  35734. // the first `update` will call `onCreate` callback
  35735. // the other ones will call `onUpdate` callback
  35736. if (!this.state.isCreated) {
  35737. this.state.isCreated = true;
  35738. this.options.onCreate(data);
  35739. } else {
  35740. this.options.onUpdate(data);
  35741. }
  35742. }
  35743. /**
  35744. * Helper used to know if the given modifier is enabled.
  35745. * @method
  35746. * @memberof Popper.Utils
  35747. * @returns {Boolean}
  35748. */
  35749. function isModifierEnabled(modifiers, modifierName) {
  35750. return modifiers.some(function (_ref) {
  35751. var name = _ref.name,
  35752. enabled = _ref.enabled;
  35753. return enabled && name === modifierName;
  35754. });
  35755. }
  35756. /**
  35757. * Get the prefixed supported property name
  35758. * @method
  35759. * @memberof Popper.Utils
  35760. * @argument {String} property (camelCase)
  35761. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  35762. */
  35763. function getSupportedPropertyName(property) {
  35764. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  35765. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  35766. for (var i = 0; i < prefixes.length; i++) {
  35767. var prefix = prefixes[i];
  35768. var toCheck = prefix ? '' + prefix + upperProp : property;
  35769. if (typeof document.body.style[toCheck] !== 'undefined') {
  35770. return toCheck;
  35771. }
  35772. }
  35773. return null;
  35774. }
  35775. /**
  35776. * Destroys the popper.
  35777. * @method
  35778. * @memberof Popper
  35779. */
  35780. function destroy() {
  35781. this.state.isDestroyed = true;
  35782. // touch DOM only if `applyStyle` modifier is enabled
  35783. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  35784. this.popper.removeAttribute('x-placement');
  35785. this.popper.style.position = '';
  35786. this.popper.style.top = '';
  35787. this.popper.style.left = '';
  35788. this.popper.style.right = '';
  35789. this.popper.style.bottom = '';
  35790. this.popper.style.willChange = '';
  35791. this.popper.style[getSupportedPropertyName('transform')] = '';
  35792. }
  35793. this.disableEventListeners();
  35794. // remove the popper if user explicitly asked for the deletion on destroy
  35795. // do not use `remove` because IE11 doesn't support it
  35796. if (this.options.removeOnDestroy) {
  35797. this.popper.parentNode.removeChild(this.popper);
  35798. }
  35799. return this;
  35800. }
  35801. /**
  35802. * Get the window associated with the element
  35803. * @argument {Element} element
  35804. * @returns {Window}
  35805. */
  35806. function getWindow(element) {
  35807. var ownerDocument = element.ownerDocument;
  35808. return ownerDocument ? ownerDocument.defaultView : window;
  35809. }
  35810. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  35811. var isBody = scrollParent.nodeName === 'BODY';
  35812. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  35813. target.addEventListener(event, callback, { passive: true });
  35814. if (!isBody) {
  35815. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  35816. }
  35817. scrollParents.push(target);
  35818. }
  35819. /**
  35820. * Setup needed event listeners used to update the popper position
  35821. * @method
  35822. * @memberof Popper.Utils
  35823. * @private
  35824. */
  35825. function setupEventListeners(reference, options, state, updateBound) {
  35826. // Resize event listener on window
  35827. state.updateBound = updateBound;
  35828. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  35829. // Scroll event listener on scroll parents
  35830. var scrollElement = getScrollParent(reference);
  35831. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  35832. state.scrollElement = scrollElement;
  35833. state.eventsEnabled = true;
  35834. return state;
  35835. }
  35836. /**
  35837. * It will add resize/scroll events and start recalculating
  35838. * position of the popper element when they are triggered.
  35839. * @method
  35840. * @memberof Popper
  35841. */
  35842. function enableEventListeners() {
  35843. if (!this.state.eventsEnabled) {
  35844. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  35845. }
  35846. }
  35847. /**
  35848. * Remove event listeners used to update the popper position
  35849. * @method
  35850. * @memberof Popper.Utils
  35851. * @private
  35852. */
  35853. function removeEventListeners(reference, state) {
  35854. // Remove resize event listener on window
  35855. getWindow(reference).removeEventListener('resize', state.updateBound);
  35856. // Remove scroll event listener on scroll parents
  35857. state.scrollParents.forEach(function (target) {
  35858. target.removeEventListener('scroll', state.updateBound);
  35859. });
  35860. // Reset state
  35861. state.updateBound = null;
  35862. state.scrollParents = [];
  35863. state.scrollElement = null;
  35864. state.eventsEnabled = false;
  35865. return state;
  35866. }
  35867. /**
  35868. * It will remove resize/scroll events and won't recalculate popper position
  35869. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  35870. * unless you call `update` method manually.
  35871. * @method
  35872. * @memberof Popper
  35873. */
  35874. function disableEventListeners() {
  35875. if (this.state.eventsEnabled) {
  35876. cancelAnimationFrame(this.scheduleUpdate);
  35877. this.state = removeEventListeners(this.reference, this.state);
  35878. }
  35879. }
  35880. /**
  35881. * Tells if a given input is a number
  35882. * @method
  35883. * @memberof Popper.Utils
  35884. * @param {*} input to check
  35885. * @return {Boolean}
  35886. */
  35887. function isNumeric(n) {
  35888. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  35889. }
  35890. /**
  35891. * Set the style to the given popper
  35892. * @method
  35893. * @memberof Popper.Utils
  35894. * @argument {Element} element - Element to apply the style to
  35895. * @argument {Object} styles
  35896. * Object with a list of properties and values which will be applied to the element
  35897. */
  35898. function setStyles(element, styles) {
  35899. Object.keys(styles).forEach(function (prop) {
  35900. var unit = '';
  35901. // add unit if the value is numeric and is one of the following
  35902. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  35903. unit = 'px';
  35904. }
  35905. element.style[prop] = styles[prop] + unit;
  35906. });
  35907. }
  35908. /**
  35909. * Set the attributes to the given popper
  35910. * @method
  35911. * @memberof Popper.Utils
  35912. * @argument {Element} element - Element to apply the attributes to
  35913. * @argument {Object} styles
  35914. * Object with a list of properties and values which will be applied to the element
  35915. */
  35916. function setAttributes(element, attributes) {
  35917. Object.keys(attributes).forEach(function (prop) {
  35918. var value = attributes[prop];
  35919. if (value !== false) {
  35920. element.setAttribute(prop, attributes[prop]);
  35921. } else {
  35922. element.removeAttribute(prop);
  35923. }
  35924. });
  35925. }
  35926. /**
  35927. * @function
  35928. * @memberof Modifiers
  35929. * @argument {Object} data - The data object generated by `update` method
  35930. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  35931. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  35932. * @argument {Object} options - Modifiers configuration and options
  35933. * @returns {Object} The same data object
  35934. */
  35935. function applyStyle(data) {
  35936. // any property present in `data.styles` will be applied to the popper,
  35937. // in this way we can make the 3rd party modifiers add custom styles to it
  35938. // Be aware, modifiers could override the properties defined in the previous
  35939. // lines of this modifier!
  35940. setStyles(data.instance.popper, data.styles);
  35941. // any property present in `data.attributes` will be applied to the popper,
  35942. // they will be set as HTML attributes of the element
  35943. setAttributes(data.instance.popper, data.attributes);
  35944. // if arrowElement is defined and arrowStyles has some properties
  35945. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  35946. setStyles(data.arrowElement, data.arrowStyles);
  35947. }
  35948. return data;
  35949. }
  35950. /**
  35951. * Set the x-placement attribute before everything else because it could be used
  35952. * to add margins to the popper margins needs to be calculated to get the
  35953. * correct popper offsets.
  35954. * @method
  35955. * @memberof Popper.modifiers
  35956. * @param {HTMLElement} reference - The reference element used to position the popper
  35957. * @param {HTMLElement} popper - The HTML element used as popper
  35958. * @param {Object} options - Popper.js options
  35959. */
  35960. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  35961. // compute reference element offsets
  35962. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  35963. // compute auto placement, store placement inside the data object,
  35964. // modifiers will be able to edit `placement` if needed
  35965. // and refer to originalPlacement to know the original value
  35966. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  35967. popper.setAttribute('x-placement', placement);
  35968. // Apply `position` to popper before anything else because
  35969. // without the position applied we can't guarantee correct computations
  35970. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  35971. return options;
  35972. }
  35973. /**
  35974. * @function
  35975. * @memberof Popper.Utils
  35976. * @argument {Object} data - The data object generated by `update` method
  35977. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  35978. * @returns {Object} The popper's position offsets rounded
  35979. *
  35980. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  35981. * good as it can be within reason.
  35982. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  35983. *
  35984. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  35985. * as well on High DPI screens).
  35986. *
  35987. * Firefox prefers no rounding for positioning and does not have blurriness on
  35988. * high DPI screens.
  35989. *
  35990. * Only horizontal placement and left/right values need to be considered.
  35991. */
  35992. function getRoundedOffsets(data, shouldRound) {
  35993. var _data$offsets = data.offsets,
  35994. popper = _data$offsets.popper,
  35995. reference = _data$offsets.reference;
  35996. var round = Math.round,
  35997. floor = Math.floor;
  35998. var noRound = function noRound(v) {
  35999. return v;
  36000. };
  36001. var referenceWidth = round(reference.width);
  36002. var popperWidth = round(popper.width);
  36003. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  36004. var isVariation = data.placement.indexOf('-') !== -1;
  36005. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  36006. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  36007. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  36008. var verticalToInteger = !shouldRound ? noRound : round;
  36009. return {
  36010. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  36011. top: verticalToInteger(popper.top),
  36012. bottom: verticalToInteger(popper.bottom),
  36013. right: horizontalToInteger(popper.right)
  36014. };
  36015. }
  36016. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  36017. /**
  36018. * @function
  36019. * @memberof Modifiers
  36020. * @argument {Object} data - The data object generated by `update` method
  36021. * @argument {Object} options - Modifiers configuration and options
  36022. * @returns {Object} The data object, properly modified
  36023. */
  36024. function computeStyle(data, options) {
  36025. var x = options.x,
  36026. y = options.y;
  36027. var popper = data.offsets.popper;
  36028. // Remove this legacy support in Popper.js v2
  36029. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  36030. return modifier.name === 'applyStyle';
  36031. }).gpuAcceleration;
  36032. if (legacyGpuAccelerationOption !== undefined) {
  36033. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  36034. }
  36035. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  36036. var offsetParent = getOffsetParent(data.instance.popper);
  36037. var offsetParentRect = getBoundingClientRect(offsetParent);
  36038. // Styles
  36039. var styles = {
  36040. position: popper.position
  36041. };
  36042. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  36043. var sideA = x === 'bottom' ? 'top' : 'bottom';
  36044. var sideB = y === 'right' ? 'left' : 'right';
  36045. // if gpuAcceleration is set to `true` and transform is supported,
  36046. // we use `translate3d` to apply the position to the popper we
  36047. // automatically use the supported prefixed version if needed
  36048. var prefixedProperty = getSupportedPropertyName('transform');
  36049. // now, let's make a step back and look at this code closely (wtf?)
  36050. // If the content of the popper grows once it's been positioned, it
  36051. // may happen that the popper gets misplaced because of the new content
  36052. // overflowing its reference element
  36053. // To avoid this problem, we provide two options (x and y), which allow
  36054. // the consumer to define the offset origin.
  36055. // If we position a popper on top of a reference element, we can set
  36056. // `x` to `top` to make the popper grow towards its top instead of
  36057. // its bottom.
  36058. var left = void 0,
  36059. top = void 0;
  36060. if (sideA === 'bottom') {
  36061. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  36062. // and not the bottom of the html element
  36063. if (offsetParent.nodeName === 'HTML') {
  36064. top = -offsetParent.clientHeight + offsets.bottom;
  36065. } else {
  36066. top = -offsetParentRect.height + offsets.bottom;
  36067. }
  36068. } else {
  36069. top = offsets.top;
  36070. }
  36071. if (sideB === 'right') {
  36072. if (offsetParent.nodeName === 'HTML') {
  36073. left = -offsetParent.clientWidth + offsets.right;
  36074. } else {
  36075. left = -offsetParentRect.width + offsets.right;
  36076. }
  36077. } else {
  36078. left = offsets.left;
  36079. }
  36080. if (gpuAcceleration && prefixedProperty) {
  36081. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  36082. styles[sideA] = 0;
  36083. styles[sideB] = 0;
  36084. styles.willChange = 'transform';
  36085. } else {
  36086. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  36087. var invertTop = sideA === 'bottom' ? -1 : 1;
  36088. var invertLeft = sideB === 'right' ? -1 : 1;
  36089. styles[sideA] = top * invertTop;
  36090. styles[sideB] = left * invertLeft;
  36091. styles.willChange = sideA + ', ' + sideB;
  36092. }
  36093. // Attributes
  36094. var attributes = {
  36095. 'x-placement': data.placement
  36096. };
  36097. // Update `data` attributes, styles and arrowStyles
  36098. data.attributes = _extends({}, attributes, data.attributes);
  36099. data.styles = _extends({}, styles, data.styles);
  36100. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  36101. return data;
  36102. }
  36103. /**
  36104. * Helper used to know if the given modifier depends from another one.<br />
  36105. * It checks if the needed modifier is listed and enabled.
  36106. * @method
  36107. * @memberof Popper.Utils
  36108. * @param {Array} modifiers - list of modifiers
  36109. * @param {String} requestingName - name of requesting modifier
  36110. * @param {String} requestedName - name of requested modifier
  36111. * @returns {Boolean}
  36112. */
  36113. function isModifierRequired(modifiers, requestingName, requestedName) {
  36114. var requesting = find(modifiers, function (_ref) {
  36115. var name = _ref.name;
  36116. return name === requestingName;
  36117. });
  36118. var isRequired = !!requesting && modifiers.some(function (modifier) {
  36119. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  36120. });
  36121. if (!isRequired) {
  36122. var _requesting = '`' + requestingName + '`';
  36123. var requested = '`' + requestedName + '`';
  36124. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  36125. }
  36126. return isRequired;
  36127. }
  36128. /**
  36129. * @function
  36130. * @memberof Modifiers
  36131. * @argument {Object} data - The data object generated by update method
  36132. * @argument {Object} options - Modifiers configuration and options
  36133. * @returns {Object} The data object, properly modified
  36134. */
  36135. function arrow(data, options) {
  36136. var _data$offsets$arrow;
  36137. // arrow depends on keepTogether in order to work
  36138. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  36139. return data;
  36140. }
  36141. var arrowElement = options.element;
  36142. // if arrowElement is a string, suppose it's a CSS selector
  36143. if (typeof arrowElement === 'string') {
  36144. arrowElement = data.instance.popper.querySelector(arrowElement);
  36145. // if arrowElement is not found, don't run the modifier
  36146. if (!arrowElement) {
  36147. return data;
  36148. }
  36149. } else {
  36150. // if the arrowElement isn't a query selector we must check that the
  36151. // provided DOM node is child of its popper node
  36152. if (!data.instance.popper.contains(arrowElement)) {
  36153. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  36154. return data;
  36155. }
  36156. }
  36157. var placement = data.placement.split('-')[0];
  36158. var _data$offsets = data.offsets,
  36159. popper = _data$offsets.popper,
  36160. reference = _data$offsets.reference;
  36161. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  36162. var len = isVertical ? 'height' : 'width';
  36163. var sideCapitalized = isVertical ? 'Top' : 'Left';
  36164. var side = sideCapitalized.toLowerCase();
  36165. var altSide = isVertical ? 'left' : 'top';
  36166. var opSide = isVertical ? 'bottom' : 'right';
  36167. var arrowElementSize = getOuterSizes(arrowElement)[len];
  36168. //
  36169. // extends keepTogether behavior making sure the popper and its
  36170. // reference have enough pixels in conjunction
  36171. //
  36172. // top/left side
  36173. if (reference[opSide] - arrowElementSize < popper[side]) {
  36174. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  36175. }
  36176. // bottom/right side
  36177. if (reference[side] + arrowElementSize > popper[opSide]) {
  36178. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  36179. }
  36180. data.offsets.popper = getClientRect(data.offsets.popper);
  36181. // compute center of the popper
  36182. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  36183. // Compute the sideValue using the updated popper offsets
  36184. // take popper margin in account because we don't have this info available
  36185. var css = getStyleComputedProperty(data.instance.popper);
  36186. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  36187. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  36188. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  36189. // prevent arrowElement from being placed not contiguously to its popper
  36190. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  36191. data.arrowElement = arrowElement;
  36192. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  36193. return data;
  36194. }
  36195. /**
  36196. * Get the opposite placement variation of the given one
  36197. * @method
  36198. * @memberof Popper.Utils
  36199. * @argument {String} placement variation
  36200. * @returns {String} flipped placement variation
  36201. */
  36202. function getOppositeVariation(variation) {
  36203. if (variation === 'end') {
  36204. return 'start';
  36205. } else if (variation === 'start') {
  36206. return 'end';
  36207. }
  36208. return variation;
  36209. }
  36210. /**
  36211. * List of accepted placements to use as values of the `placement` option.<br />
  36212. * Valid placements are:
  36213. * - `auto`
  36214. * - `top`
  36215. * - `right`
  36216. * - `bottom`
  36217. * - `left`
  36218. *
  36219. * Each placement can have a variation from this list:
  36220. * - `-start`
  36221. * - `-end`
  36222. *
  36223. * Variations are interpreted easily if you think of them as the left to right
  36224. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  36225. * is right.<br />
  36226. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  36227. *
  36228. * Some valid examples are:
  36229. * - `top-end` (on top of reference, right aligned)
  36230. * - `right-start` (on right of reference, top aligned)
  36231. * - `bottom` (on bottom, centered)
  36232. * - `auto-end` (on the side with more space available, alignment depends by placement)
  36233. *
  36234. * @static
  36235. * @type {Array}
  36236. * @enum {String}
  36237. * @readonly
  36238. * @method placements
  36239. * @memberof Popper
  36240. */
  36241. 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'];
  36242. // Get rid of `auto` `auto-start` and `auto-end`
  36243. var validPlacements = placements.slice(3);
  36244. /**
  36245. * Given an initial placement, returns all the subsequent placements
  36246. * clockwise (or counter-clockwise).
  36247. *
  36248. * @method
  36249. * @memberof Popper.Utils
  36250. * @argument {String} placement - A valid placement (it accepts variations)
  36251. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  36252. * @returns {Array} placements including their variations
  36253. */
  36254. function clockwise(placement) {
  36255. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  36256. var index = validPlacements.indexOf(placement);
  36257. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  36258. return counter ? arr.reverse() : arr;
  36259. }
  36260. var BEHAVIORS = {
  36261. FLIP: 'flip',
  36262. CLOCKWISE: 'clockwise',
  36263. COUNTERCLOCKWISE: 'counterclockwise'
  36264. };
  36265. /**
  36266. * @function
  36267. * @memberof Modifiers
  36268. * @argument {Object} data - The data object generated by update method
  36269. * @argument {Object} options - Modifiers configuration and options
  36270. * @returns {Object} The data object, properly modified
  36271. */
  36272. function flip(data, options) {
  36273. // if `inner` modifier is enabled, we can't use the `flip` modifier
  36274. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  36275. return data;
  36276. }
  36277. if (data.flipped && data.placement === data.originalPlacement) {
  36278. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  36279. return data;
  36280. }
  36281. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  36282. var placement = data.placement.split('-')[0];
  36283. var placementOpposite = getOppositePlacement(placement);
  36284. var variation = data.placement.split('-')[1] || '';
  36285. var flipOrder = [];
  36286. switch (options.behavior) {
  36287. case BEHAVIORS.FLIP:
  36288. flipOrder = [placement, placementOpposite];
  36289. break;
  36290. case BEHAVIORS.CLOCKWISE:
  36291. flipOrder = clockwise(placement);
  36292. break;
  36293. case BEHAVIORS.COUNTERCLOCKWISE:
  36294. flipOrder = clockwise(placement, true);
  36295. break;
  36296. default:
  36297. flipOrder = options.behavior;
  36298. }
  36299. flipOrder.forEach(function (step, index) {
  36300. if (placement !== step || flipOrder.length === index + 1) {
  36301. return data;
  36302. }
  36303. placement = data.placement.split('-')[0];
  36304. placementOpposite = getOppositePlacement(placement);
  36305. var popperOffsets = data.offsets.popper;
  36306. var refOffsets = data.offsets.reference;
  36307. // using floor because the reference offsets may contain decimals we are not going to consider here
  36308. var floor = Math.floor;
  36309. 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);
  36310. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  36311. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  36312. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  36313. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  36314. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  36315. // flip the variation if required
  36316. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  36317. // flips variation if reference element overflows boundaries
  36318. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  36319. // flips variation if popper content overflows boundaries
  36320. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  36321. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  36322. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  36323. // this boolean to detect any flip loop
  36324. data.flipped = true;
  36325. if (overlapsRef || overflowsBoundaries) {
  36326. placement = flipOrder[index + 1];
  36327. }
  36328. if (flippedVariation) {
  36329. variation = getOppositeVariation(variation);
  36330. }
  36331. data.placement = placement + (variation ? '-' + variation : '');
  36332. // this object contains `position`, we want to preserve it along with
  36333. // any additional property we may add in the future
  36334. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  36335. data = runModifiers(data.instance.modifiers, data, 'flip');
  36336. }
  36337. });
  36338. return data;
  36339. }
  36340. /**
  36341. * @function
  36342. * @memberof Modifiers
  36343. * @argument {Object} data - The data object generated by update method
  36344. * @argument {Object} options - Modifiers configuration and options
  36345. * @returns {Object} The data object, properly modified
  36346. */
  36347. function keepTogether(data) {
  36348. var _data$offsets = data.offsets,
  36349. popper = _data$offsets.popper,
  36350. reference = _data$offsets.reference;
  36351. var placement = data.placement.split('-')[0];
  36352. var floor = Math.floor;
  36353. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  36354. var side = isVertical ? 'right' : 'bottom';
  36355. var opSide = isVertical ? 'left' : 'top';
  36356. var measurement = isVertical ? 'width' : 'height';
  36357. if (popper[side] < floor(reference[opSide])) {
  36358. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  36359. }
  36360. if (popper[opSide] > floor(reference[side])) {
  36361. data.offsets.popper[opSide] = floor(reference[side]);
  36362. }
  36363. return data;
  36364. }
  36365. /**
  36366. * Converts a string containing value + unit into a px value number
  36367. * @function
  36368. * @memberof {modifiers~offset}
  36369. * @private
  36370. * @argument {String} str - Value + unit string
  36371. * @argument {String} measurement - `height` or `width`
  36372. * @argument {Object} popperOffsets
  36373. * @argument {Object} referenceOffsets
  36374. * @returns {Number|String}
  36375. * Value in pixels, or original string if no values were extracted
  36376. */
  36377. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  36378. // separate value from unit
  36379. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  36380. var value = +split[1];
  36381. var unit = split[2];
  36382. // If it's not a number it's an operator, I guess
  36383. if (!value) {
  36384. return str;
  36385. }
  36386. if (unit.indexOf('%') === 0) {
  36387. var element = void 0;
  36388. switch (unit) {
  36389. case '%p':
  36390. element = popperOffsets;
  36391. break;
  36392. case '%':
  36393. case '%r':
  36394. default:
  36395. element = referenceOffsets;
  36396. }
  36397. var rect = getClientRect(element);
  36398. return rect[measurement] / 100 * value;
  36399. } else if (unit === 'vh' || unit === 'vw') {
  36400. // if is a vh or vw, we calculate the size based on the viewport
  36401. var size = void 0;
  36402. if (unit === 'vh') {
  36403. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  36404. } else {
  36405. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  36406. }
  36407. return size / 100 * value;
  36408. } else {
  36409. // if is an explicit pixel unit, we get rid of the unit and keep the value
  36410. // if is an implicit unit, it's px, and we return just the value
  36411. return value;
  36412. }
  36413. }
  36414. /**
  36415. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  36416. * @function
  36417. * @memberof {modifiers~offset}
  36418. * @private
  36419. * @argument {String} offset
  36420. * @argument {Object} popperOffsets
  36421. * @argument {Object} referenceOffsets
  36422. * @argument {String} basePlacement
  36423. * @returns {Array} a two cells array with x and y offsets in numbers
  36424. */
  36425. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  36426. var offsets = [0, 0];
  36427. // Use height if placement is left or right and index is 0 otherwise use width
  36428. // in this way the first offset will use an axis and the second one
  36429. // will use the other one
  36430. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  36431. // Split the offset string to obtain a list of values and operands
  36432. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  36433. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  36434. return frag.trim();
  36435. });
  36436. // Detect if the offset string contains a pair of values or a single one
  36437. // they could be separated by comma or space
  36438. var divider = fragments.indexOf(find(fragments, function (frag) {
  36439. return frag.search(/,|\s/) !== -1;
  36440. }));
  36441. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  36442. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  36443. }
  36444. // If divider is found, we divide the list of values and operands to divide
  36445. // them by ofset X and Y.
  36446. var splitRegex = /\s*,\s*|\s+/;
  36447. 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];
  36448. // Convert the values with units to absolute pixels to allow our computations
  36449. ops = ops.map(function (op, index) {
  36450. // Most of the units rely on the orientation of the popper
  36451. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  36452. var mergeWithPrevious = false;
  36453. return op
  36454. // This aggregates any `+` or `-` sign that aren't considered operators
  36455. // e.g.: 10 + +5 => [10, +, +5]
  36456. .reduce(function (a, b) {
  36457. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  36458. a[a.length - 1] = b;
  36459. mergeWithPrevious = true;
  36460. return a;
  36461. } else if (mergeWithPrevious) {
  36462. a[a.length - 1] += b;
  36463. mergeWithPrevious = false;
  36464. return a;
  36465. } else {
  36466. return a.concat(b);
  36467. }
  36468. }, [])
  36469. // Here we convert the string values into number values (in px)
  36470. .map(function (str) {
  36471. return toValue(str, measurement, popperOffsets, referenceOffsets);
  36472. });
  36473. });
  36474. // Loop trough the offsets arrays and execute the operations
  36475. ops.forEach(function (op, index) {
  36476. op.forEach(function (frag, index2) {
  36477. if (isNumeric(frag)) {
  36478. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  36479. }
  36480. });
  36481. });
  36482. return offsets;
  36483. }
  36484. /**
  36485. * @function
  36486. * @memberof Modifiers
  36487. * @argument {Object} data - The data object generated by update method
  36488. * @argument {Object} options - Modifiers configuration and options
  36489. * @argument {Number|String} options.offset=0
  36490. * The offset value as described in the modifier description
  36491. * @returns {Object} The data object, properly modified
  36492. */
  36493. function offset(data, _ref) {
  36494. var offset = _ref.offset;
  36495. var placement = data.placement,
  36496. _data$offsets = data.offsets,
  36497. popper = _data$offsets.popper,
  36498. reference = _data$offsets.reference;
  36499. var basePlacement = placement.split('-')[0];
  36500. var offsets = void 0;
  36501. if (isNumeric(+offset)) {
  36502. offsets = [+offset, 0];
  36503. } else {
  36504. offsets = parseOffset(offset, popper, reference, basePlacement);
  36505. }
  36506. if (basePlacement === 'left') {
  36507. popper.top += offsets[0];
  36508. popper.left -= offsets[1];
  36509. } else if (basePlacement === 'right') {
  36510. popper.top += offsets[0];
  36511. popper.left += offsets[1];
  36512. } else if (basePlacement === 'top') {
  36513. popper.left += offsets[0];
  36514. popper.top -= offsets[1];
  36515. } else if (basePlacement === 'bottom') {
  36516. popper.left += offsets[0];
  36517. popper.top += offsets[1];
  36518. }
  36519. data.popper = popper;
  36520. return data;
  36521. }
  36522. /**
  36523. * @function
  36524. * @memberof Modifiers
  36525. * @argument {Object} data - The data object generated by `update` method
  36526. * @argument {Object} options - Modifiers configuration and options
  36527. * @returns {Object} The data object, properly modified
  36528. */
  36529. function preventOverflow(data, options) {
  36530. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  36531. // If offsetParent is the reference element, we really want to
  36532. // go one step up and use the next offsetParent as reference to
  36533. // avoid to make this modifier completely useless and look like broken
  36534. if (data.instance.reference === boundariesElement) {
  36535. boundariesElement = getOffsetParent(boundariesElement);
  36536. }
  36537. // NOTE: DOM access here
  36538. // resets the popper's position so that the document size can be calculated excluding
  36539. // the size of the popper element itself
  36540. var transformProp = getSupportedPropertyName('transform');
  36541. var popperStyles = data.instance.popper.style; // assignment to help minification
  36542. var top = popperStyles.top,
  36543. left = popperStyles.left,
  36544. transform = popperStyles[transformProp];
  36545. popperStyles.top = '';
  36546. popperStyles.left = '';
  36547. popperStyles[transformProp] = '';
  36548. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  36549. // NOTE: DOM access here
  36550. // restores the original style properties after the offsets have been computed
  36551. popperStyles.top = top;
  36552. popperStyles.left = left;
  36553. popperStyles[transformProp] = transform;
  36554. options.boundaries = boundaries;
  36555. var order = options.priority;
  36556. var popper = data.offsets.popper;
  36557. var check = {
  36558. primary: function primary(placement) {
  36559. var value = popper[placement];
  36560. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  36561. value = Math.max(popper[placement], boundaries[placement]);
  36562. }
  36563. return defineProperty({}, placement, value);
  36564. },
  36565. secondary: function secondary(placement) {
  36566. var mainSide = placement === 'right' ? 'left' : 'top';
  36567. var value = popper[mainSide];
  36568. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  36569. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  36570. }
  36571. return defineProperty({}, mainSide, value);
  36572. }
  36573. };
  36574. order.forEach(function (placement) {
  36575. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  36576. popper = _extends({}, popper, check[side](placement));
  36577. });
  36578. data.offsets.popper = popper;
  36579. return data;
  36580. }
  36581. /**
  36582. * @function
  36583. * @memberof Modifiers
  36584. * @argument {Object} data - The data object generated by `update` method
  36585. * @argument {Object} options - Modifiers configuration and options
  36586. * @returns {Object} The data object, properly modified
  36587. */
  36588. function shift(data) {
  36589. var placement = data.placement;
  36590. var basePlacement = placement.split('-')[0];
  36591. var shiftvariation = placement.split('-')[1];
  36592. // if shift shiftvariation is specified, run the modifier
  36593. if (shiftvariation) {
  36594. var _data$offsets = data.offsets,
  36595. reference = _data$offsets.reference,
  36596. popper = _data$offsets.popper;
  36597. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  36598. var side = isVertical ? 'left' : 'top';
  36599. var measurement = isVertical ? 'width' : 'height';
  36600. var shiftOffsets = {
  36601. start: defineProperty({}, side, reference[side]),
  36602. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  36603. };
  36604. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  36605. }
  36606. return data;
  36607. }
  36608. /**
  36609. * @function
  36610. * @memberof Modifiers
  36611. * @argument {Object} data - The data object generated by update method
  36612. * @argument {Object} options - Modifiers configuration and options
  36613. * @returns {Object} The data object, properly modified
  36614. */
  36615. function hide(data) {
  36616. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  36617. return data;
  36618. }
  36619. var refRect = data.offsets.reference;
  36620. var bound = find(data.instance.modifiers, function (modifier) {
  36621. return modifier.name === 'preventOverflow';
  36622. }).boundaries;
  36623. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  36624. // Avoid unnecessary DOM access if visibility hasn't changed
  36625. if (data.hide === true) {
  36626. return data;
  36627. }
  36628. data.hide = true;
  36629. data.attributes['x-out-of-boundaries'] = '';
  36630. } else {
  36631. // Avoid unnecessary DOM access if visibility hasn't changed
  36632. if (data.hide === false) {
  36633. return data;
  36634. }
  36635. data.hide = false;
  36636. data.attributes['x-out-of-boundaries'] = false;
  36637. }
  36638. return data;
  36639. }
  36640. /**
  36641. * @function
  36642. * @memberof Modifiers
  36643. * @argument {Object} data - The data object generated by `update` method
  36644. * @argument {Object} options - Modifiers configuration and options
  36645. * @returns {Object} The data object, properly modified
  36646. */
  36647. function inner(data) {
  36648. var placement = data.placement;
  36649. var basePlacement = placement.split('-')[0];
  36650. var _data$offsets = data.offsets,
  36651. popper = _data$offsets.popper,
  36652. reference = _data$offsets.reference;
  36653. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  36654. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  36655. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  36656. data.placement = getOppositePlacement(placement);
  36657. data.offsets.popper = getClientRect(popper);
  36658. return data;
  36659. }
  36660. /**
  36661. * Modifier function, each modifier can have a function of this type assigned
  36662. * to its `fn` property.<br />
  36663. * These functions will be called on each update, this means that you must
  36664. * make sure they are performant enough to avoid performance bottlenecks.
  36665. *
  36666. * @function ModifierFn
  36667. * @argument {dataObject} data - The data object generated by `update` method
  36668. * @argument {Object} options - Modifiers configuration and options
  36669. * @returns {dataObject} The data object, properly modified
  36670. */
  36671. /**
  36672. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  36673. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  36674. * needed by the library.
  36675. *
  36676. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  36677. * All the other properties are configurations that could be tweaked.
  36678. * @namespace modifiers
  36679. */
  36680. var modifiers = {
  36681. /**
  36682. * Modifier used to shift the popper on the start or end of its reference
  36683. * element.<br />
  36684. * It will read the variation of the `placement` property.<br />
  36685. * It can be one either `-end` or `-start`.
  36686. * @memberof modifiers
  36687. * @inner
  36688. */
  36689. shift: {
  36690. /** @prop {number} order=100 - Index used to define the order of execution */
  36691. order: 100,
  36692. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36693. enabled: true,
  36694. /** @prop {ModifierFn} */
  36695. fn: shift
  36696. },
  36697. /**
  36698. * The `offset` modifier can shift your popper on both its axis.
  36699. *
  36700. * It accepts the following units:
  36701. * - `px` or unit-less, interpreted as pixels
  36702. * - `%` or `%r`, percentage relative to the length of the reference element
  36703. * - `%p`, percentage relative to the length of the popper element
  36704. * - `vw`, CSS viewport width unit
  36705. * - `vh`, CSS viewport height unit
  36706. *
  36707. * For length is intended the main axis relative to the placement of the popper.<br />
  36708. * This means that if the placement is `top` or `bottom`, the length will be the
  36709. * `width`. In case of `left` or `right`, it will be the `height`.
  36710. *
  36711. * You can provide a single value (as `Number` or `String`), or a pair of values
  36712. * as `String` divided by a comma or one (or more) white spaces.<br />
  36713. * The latter is a deprecated method because it leads to confusion and will be
  36714. * removed in v2.<br />
  36715. * Additionally, it accepts additions and subtractions between different units.
  36716. * Note that multiplications and divisions aren't supported.
  36717. *
  36718. * Valid examples are:
  36719. * ```
  36720. * 10
  36721. * '10%'
  36722. * '10, 10'
  36723. * '10%, 10'
  36724. * '10 + 10%'
  36725. * '10 - 5vh + 3%'
  36726. * '-10px + 5vh, 5px - 6%'
  36727. * ```
  36728. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  36729. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  36730. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  36731. *
  36732. * @memberof modifiers
  36733. * @inner
  36734. */
  36735. offset: {
  36736. /** @prop {number} order=200 - Index used to define the order of execution */
  36737. order: 200,
  36738. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36739. enabled: true,
  36740. /** @prop {ModifierFn} */
  36741. fn: offset,
  36742. /** @prop {Number|String} offset=0
  36743. * The offset value as described in the modifier description
  36744. */
  36745. offset: 0
  36746. },
  36747. /**
  36748. * Modifier used to prevent the popper from being positioned outside the boundary.
  36749. *
  36750. * A scenario exists where the reference itself is not within the boundaries.<br />
  36751. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  36752. * In this case we need to decide whether the popper should either:
  36753. *
  36754. * - detach from the reference and remain "trapped" in the boundaries, or
  36755. * - if it should ignore the boundary and "escape with its reference"
  36756. *
  36757. * When `escapeWithReference` is set to`true` and reference is completely
  36758. * outside its boundaries, the popper will overflow (or completely leave)
  36759. * the boundaries in order to remain attached to the edge of the reference.
  36760. *
  36761. * @memberof modifiers
  36762. * @inner
  36763. */
  36764. preventOverflow: {
  36765. /** @prop {number} order=300 - Index used to define the order of execution */
  36766. order: 300,
  36767. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36768. enabled: true,
  36769. /** @prop {ModifierFn} */
  36770. fn: preventOverflow,
  36771. /**
  36772. * @prop {Array} [priority=['left','right','top','bottom']]
  36773. * Popper will try to prevent overflow following these priorities by default,
  36774. * then, it could overflow on the left and on top of the `boundariesElement`
  36775. */
  36776. priority: ['left', 'right', 'top', 'bottom'],
  36777. /**
  36778. * @prop {number} padding=5
  36779. * Amount of pixel used to define a minimum distance between the boundaries
  36780. * and the popper. This makes sure the popper always has a little padding
  36781. * between the edges of its container
  36782. */
  36783. padding: 5,
  36784. /**
  36785. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  36786. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  36787. * `viewport` or any DOM element.
  36788. */
  36789. boundariesElement: 'scrollParent'
  36790. },
  36791. /**
  36792. * Modifier used to make sure the reference and its popper stay near each other
  36793. * without leaving any gap between the two. Especially useful when the arrow is
  36794. * enabled and you want to ensure that it points to its reference element.
  36795. * It cares only about the first axis. You can still have poppers with margin
  36796. * between the popper and its reference element.
  36797. * @memberof modifiers
  36798. * @inner
  36799. */
  36800. keepTogether: {
  36801. /** @prop {number} order=400 - Index used to define the order of execution */
  36802. order: 400,
  36803. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36804. enabled: true,
  36805. /** @prop {ModifierFn} */
  36806. fn: keepTogether
  36807. },
  36808. /**
  36809. * This modifier is used to move the `arrowElement` of the popper to make
  36810. * sure it is positioned between the reference element and its popper element.
  36811. * It will read the outer size of the `arrowElement` node to detect how many
  36812. * pixels of conjunction are needed.
  36813. *
  36814. * It has no effect if no `arrowElement` is provided.
  36815. * @memberof modifiers
  36816. * @inner
  36817. */
  36818. arrow: {
  36819. /** @prop {number} order=500 - Index used to define the order of execution */
  36820. order: 500,
  36821. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36822. enabled: true,
  36823. /** @prop {ModifierFn} */
  36824. fn: arrow,
  36825. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  36826. element: '[x-arrow]'
  36827. },
  36828. /**
  36829. * Modifier used to flip the popper's placement when it starts to overlap its
  36830. * reference element.
  36831. *
  36832. * Requires the `preventOverflow` modifier before it in order to work.
  36833. *
  36834. * **NOTE:** this modifier will interrupt the current update cycle and will
  36835. * restart it if it detects the need to flip the placement.
  36836. * @memberof modifiers
  36837. * @inner
  36838. */
  36839. flip: {
  36840. /** @prop {number} order=600 - Index used to define the order of execution */
  36841. order: 600,
  36842. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36843. enabled: true,
  36844. /** @prop {ModifierFn} */
  36845. fn: flip,
  36846. /**
  36847. * @prop {String|Array} behavior='flip'
  36848. * The behavior used to change the popper's placement. It can be one of
  36849. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  36850. * placements (with optional variations)
  36851. */
  36852. behavior: 'flip',
  36853. /**
  36854. * @prop {number} padding=5
  36855. * The popper will flip if it hits the edges of the `boundariesElement`
  36856. */
  36857. padding: 5,
  36858. /**
  36859. * @prop {String|HTMLElement} boundariesElement='viewport'
  36860. * The element which will define the boundaries of the popper position.
  36861. * The popper will never be placed outside of the defined boundaries
  36862. * (except if `keepTogether` is enabled)
  36863. */
  36864. boundariesElement: 'viewport',
  36865. /**
  36866. * @prop {Boolean} flipVariations=false
  36867. * The popper will switch placement variation between `-start` and `-end` when
  36868. * the reference element overlaps its boundaries.
  36869. *
  36870. * The original placement should have a set variation.
  36871. */
  36872. flipVariations: false,
  36873. /**
  36874. * @prop {Boolean} flipVariationsByContent=false
  36875. * The popper will switch placement variation between `-start` and `-end` when
  36876. * the popper element overlaps its reference boundaries.
  36877. *
  36878. * The original placement should have a set variation.
  36879. */
  36880. flipVariationsByContent: false
  36881. },
  36882. /**
  36883. * Modifier used to make the popper flow toward the inner of the reference element.
  36884. * By default, when this modifier is disabled, the popper will be placed outside
  36885. * the reference element.
  36886. * @memberof modifiers
  36887. * @inner
  36888. */
  36889. inner: {
  36890. /** @prop {number} order=700 - Index used to define the order of execution */
  36891. order: 700,
  36892. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  36893. enabled: false,
  36894. /** @prop {ModifierFn} */
  36895. fn: inner
  36896. },
  36897. /**
  36898. * Modifier used to hide the popper when its reference element is outside of the
  36899. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  36900. * be used to hide with a CSS selector the popper when its reference is
  36901. * out of boundaries.
  36902. *
  36903. * Requires the `preventOverflow` modifier before it in order to work.
  36904. * @memberof modifiers
  36905. * @inner
  36906. */
  36907. hide: {
  36908. /** @prop {number} order=800 - Index used to define the order of execution */
  36909. order: 800,
  36910. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36911. enabled: true,
  36912. /** @prop {ModifierFn} */
  36913. fn: hide
  36914. },
  36915. /**
  36916. * Computes the style that will be applied to the popper element to gets
  36917. * properly positioned.
  36918. *
  36919. * Note that this modifier will not touch the DOM, it just prepares the styles
  36920. * so that `applyStyle` modifier can apply it. This separation is useful
  36921. * in case you need to replace `applyStyle` with a custom implementation.
  36922. *
  36923. * This modifier has `850` as `order` value to maintain backward compatibility
  36924. * with previous versions of Popper.js. Expect the modifiers ordering method
  36925. * to change in future major versions of the library.
  36926. *
  36927. * @memberof modifiers
  36928. * @inner
  36929. */
  36930. computeStyle: {
  36931. /** @prop {number} order=850 - Index used to define the order of execution */
  36932. order: 850,
  36933. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36934. enabled: true,
  36935. /** @prop {ModifierFn} */
  36936. fn: computeStyle,
  36937. /**
  36938. * @prop {Boolean} gpuAcceleration=true
  36939. * If true, it uses the CSS 3D transformation to position the popper.
  36940. * Otherwise, it will use the `top` and `left` properties
  36941. */
  36942. gpuAcceleration: true,
  36943. /**
  36944. * @prop {string} [x='bottom']
  36945. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  36946. * Change this if your popper should grow in a direction different from `bottom`
  36947. */
  36948. x: 'bottom',
  36949. /**
  36950. * @prop {string} [x='left']
  36951. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  36952. * Change this if your popper should grow in a direction different from `right`
  36953. */
  36954. y: 'right'
  36955. },
  36956. /**
  36957. * Applies the computed styles to the popper element.
  36958. *
  36959. * All the DOM manipulations are limited to this modifier. This is useful in case
  36960. * you want to integrate Popper.js inside a framework or view library and you
  36961. * want to delegate all the DOM manipulations to it.
  36962. *
  36963. * Note that if you disable this modifier, you must make sure the popper element
  36964. * has its position set to `absolute` before Popper.js can do its work!
  36965. *
  36966. * Just disable this modifier and define your own to achieve the desired effect.
  36967. *
  36968. * @memberof modifiers
  36969. * @inner
  36970. */
  36971. applyStyle: {
  36972. /** @prop {number} order=900 - Index used to define the order of execution */
  36973. order: 900,
  36974. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36975. enabled: true,
  36976. /** @prop {ModifierFn} */
  36977. fn: applyStyle,
  36978. /** @prop {Function} */
  36979. onLoad: applyStyleOnLoad,
  36980. /**
  36981. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  36982. * @prop {Boolean} gpuAcceleration=true
  36983. * If true, it uses the CSS 3D transformation to position the popper.
  36984. * Otherwise, it will use the `top` and `left` properties
  36985. */
  36986. gpuAcceleration: undefined
  36987. }
  36988. };
  36989. /**
  36990. * The `dataObject` is an object containing all the information used by Popper.js.
  36991. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  36992. * @name dataObject
  36993. * @property {Object} data.instance The Popper.js instance
  36994. * @property {String} data.placement Placement applied to popper
  36995. * @property {String} data.originalPlacement Placement originally defined on init
  36996. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  36997. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  36998. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  36999. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  37000. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  37001. * @property {Object} data.boundaries Offsets of the popper boundaries
  37002. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  37003. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  37004. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  37005. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  37006. */
  37007. /**
  37008. * Default options provided to Popper.js constructor.<br />
  37009. * These can be overridden using the `options` argument of Popper.js.<br />
  37010. * To override an option, simply pass an object with the same
  37011. * structure of the `options` object, as the 3rd argument. For example:
  37012. * ```
  37013. * new Popper(ref, pop, {
  37014. * modifiers: {
  37015. * preventOverflow: { enabled: false }
  37016. * }
  37017. * })
  37018. * ```
  37019. * @type {Object}
  37020. * @static
  37021. * @memberof Popper
  37022. */
  37023. var Defaults = {
  37024. /**
  37025. * Popper's placement.
  37026. * @prop {Popper.placements} placement='bottom'
  37027. */
  37028. placement: 'bottom',
  37029. /**
  37030. * Set this to true if you want popper to position it self in 'fixed' mode
  37031. * @prop {Boolean} positionFixed=false
  37032. */
  37033. positionFixed: false,
  37034. /**
  37035. * Whether events (resize, scroll) are initially enabled.
  37036. * @prop {Boolean} eventsEnabled=true
  37037. */
  37038. eventsEnabled: true,
  37039. /**
  37040. * Set to true if you want to automatically remove the popper when
  37041. * you call the `destroy` method.
  37042. * @prop {Boolean} removeOnDestroy=false
  37043. */
  37044. removeOnDestroy: false,
  37045. /**
  37046. * Callback called when the popper is created.<br />
  37047. * By default, it is set to no-op.<br />
  37048. * Access Popper.js instance with `data.instance`.
  37049. * @prop {onCreate}
  37050. */
  37051. onCreate: function onCreate() {},
  37052. /**
  37053. * Callback called when the popper is updated. This callback is not called
  37054. * on the initialization/creation of the popper, but only on subsequent
  37055. * updates.<br />
  37056. * By default, it is set to no-op.<br />
  37057. * Access Popper.js instance with `data.instance`.
  37058. * @prop {onUpdate}
  37059. */
  37060. onUpdate: function onUpdate() {},
  37061. /**
  37062. * List of modifiers used to modify the offsets before they are applied to the popper.
  37063. * They provide most of the functionalities of Popper.js.
  37064. * @prop {modifiers}
  37065. */
  37066. modifiers: modifiers
  37067. };
  37068. /**
  37069. * @callback onCreate
  37070. * @param {dataObject} data
  37071. */
  37072. /**
  37073. * @callback onUpdate
  37074. * @param {dataObject} data
  37075. */
  37076. // Utils
  37077. // Methods
  37078. var Popper = function () {
  37079. /**
  37080. * Creates a new Popper.js instance.
  37081. * @class Popper
  37082. * @param {Element|referenceObject} reference - The reference element used to position the popper
  37083. * @param {Element} popper - The HTML / XML element used as the popper
  37084. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  37085. * @return {Object} instance - The generated Popper.js instance
  37086. */
  37087. function Popper(reference, popper) {
  37088. var _this = this;
  37089. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  37090. classCallCheck(this, Popper);
  37091. this.scheduleUpdate = function () {
  37092. return requestAnimationFrame(_this.update);
  37093. };
  37094. // make update() debounced, so that it only runs at most once-per-tick
  37095. this.update = debounce(this.update.bind(this));
  37096. // with {} we create a new object with the options inside it
  37097. this.options = _extends({}, Popper.Defaults, options);
  37098. // init state
  37099. this.state = {
  37100. isDestroyed: false,
  37101. isCreated: false,
  37102. scrollParents: []
  37103. };
  37104. // get reference and popper elements (allow jQuery wrappers)
  37105. this.reference = reference && reference.jquery ? reference[0] : reference;
  37106. this.popper = popper && popper.jquery ? popper[0] : popper;
  37107. // Deep merge modifiers options
  37108. this.options.modifiers = {};
  37109. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  37110. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  37111. });
  37112. // Refactoring modifiers' list (Object => Array)
  37113. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  37114. return _extends({
  37115. name: name
  37116. }, _this.options.modifiers[name]);
  37117. })
  37118. // sort the modifiers by order
  37119. .sort(function (a, b) {
  37120. return a.order - b.order;
  37121. });
  37122. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  37123. // such code is executed in the same order of its modifier
  37124. // they could add new properties to their options configuration
  37125. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  37126. this.modifiers.forEach(function (modifierOptions) {
  37127. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  37128. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  37129. }
  37130. });
  37131. // fire the first update to position the popper in the right place
  37132. this.update();
  37133. var eventsEnabled = this.options.eventsEnabled;
  37134. if (eventsEnabled) {
  37135. // setup event listeners, they will take care of update the position in specific situations
  37136. this.enableEventListeners();
  37137. }
  37138. this.state.eventsEnabled = eventsEnabled;
  37139. }
  37140. // We can't use class properties because they don't get listed in the
  37141. // class prototype and break stuff like Sinon stubs
  37142. createClass(Popper, [{
  37143. key: 'update',
  37144. value: function update$$1() {
  37145. return update.call(this);
  37146. }
  37147. }, {
  37148. key: 'destroy',
  37149. value: function destroy$$1() {
  37150. return destroy.call(this);
  37151. }
  37152. }, {
  37153. key: 'enableEventListeners',
  37154. value: function enableEventListeners$$1() {
  37155. return enableEventListeners.call(this);
  37156. }
  37157. }, {
  37158. key: 'disableEventListeners',
  37159. value: function disableEventListeners$$1() {
  37160. return disableEventListeners.call(this);
  37161. }
  37162. /**
  37163. * Schedules an update. It will run on the next UI update available.
  37164. * @method scheduleUpdate
  37165. * @memberof Popper
  37166. */
  37167. /**
  37168. * Collection of utilities useful when writing custom modifiers.
  37169. * Starting from version 1.7, this method is available only if you
  37170. * include `popper-utils.js` before `popper.js`.
  37171. *
  37172. * **DEPRECATION**: This way to access PopperUtils is deprecated
  37173. * and will be removed in v2! Use the PopperUtils module directly instead.
  37174. * Due to the high instability of the methods contained in Utils, we can't
  37175. * guarantee them to follow semver. Use them at your own risk!
  37176. * @static
  37177. * @private
  37178. * @type {Object}
  37179. * @deprecated since version 1.8
  37180. * @member Utils
  37181. * @memberof Popper
  37182. */
  37183. }]);
  37184. return Popper;
  37185. }();
  37186. /**
  37187. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  37188. * and lets you use it as replacement of a real DOM node.<br />
  37189. * You can use this method to position a popper relatively to a set of coordinates
  37190. * in case you don't have a DOM node to use as reference.
  37191. *
  37192. * ```
  37193. * new Popper(referenceObject, popperNode);
  37194. * ```
  37195. *
  37196. * NB: This feature isn't supported in Internet Explorer 10.
  37197. * @name referenceObject
  37198. * @property {Function} data.getBoundingClientRect
  37199. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  37200. * @property {number} data.clientWidth
  37201. * An ES6 getter that will return the width of the virtual reference element.
  37202. * @property {number} data.clientHeight
  37203. * An ES6 getter that will return the height of the virtual reference element.
  37204. */
  37205. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  37206. Popper.placements = placements;
  37207. Popper.Defaults = Defaults;
  37208. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  37209. //# sourceMappingURL=popper.js.map
  37210. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  37211. /***/ }),
  37212. /***/ "./node_modules/process/browser.js":
  37213. /*!*****************************************!*\
  37214. !*** ./node_modules/process/browser.js ***!
  37215. \*****************************************/
  37216. /*! no static exports found */
  37217. /***/ (function(module, exports) {
  37218. // shim for using process in browser
  37219. var process = module.exports = {};
  37220. // cached from whatever global is present so that test runners that stub it
  37221. // don't break things. But we need to wrap it in a try catch in case it is
  37222. // wrapped in strict mode code which doesn't define any globals. It's inside a
  37223. // function because try/catches deoptimize in certain engines.
  37224. var cachedSetTimeout;
  37225. var cachedClearTimeout;
  37226. function defaultSetTimout() {
  37227. throw new Error('setTimeout has not been defined');
  37228. }
  37229. function defaultClearTimeout () {
  37230. throw new Error('clearTimeout has not been defined');
  37231. }
  37232. (function () {
  37233. try {
  37234. if (typeof setTimeout === 'function') {
  37235. cachedSetTimeout = setTimeout;
  37236. } else {
  37237. cachedSetTimeout = defaultSetTimout;
  37238. }
  37239. } catch (e) {
  37240. cachedSetTimeout = defaultSetTimout;
  37241. }
  37242. try {
  37243. if (typeof clearTimeout === 'function') {
  37244. cachedClearTimeout = clearTimeout;
  37245. } else {
  37246. cachedClearTimeout = defaultClearTimeout;
  37247. }
  37248. } catch (e) {
  37249. cachedClearTimeout = defaultClearTimeout;
  37250. }
  37251. } ())
  37252. function runTimeout(fun) {
  37253. if (cachedSetTimeout === setTimeout) {
  37254. //normal enviroments in sane situations
  37255. return setTimeout(fun, 0);
  37256. }
  37257. // if setTimeout wasn't available but was latter defined
  37258. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  37259. cachedSetTimeout = setTimeout;
  37260. return setTimeout(fun, 0);
  37261. }
  37262. try {
  37263. // when when somebody has screwed with setTimeout but no I.E. maddness
  37264. return cachedSetTimeout(fun, 0);
  37265. } catch(e){
  37266. try {
  37267. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  37268. return cachedSetTimeout.call(null, fun, 0);
  37269. } catch(e){
  37270. // 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
  37271. return cachedSetTimeout.call(this, fun, 0);
  37272. }
  37273. }
  37274. }
  37275. function runClearTimeout(marker) {
  37276. if (cachedClearTimeout === clearTimeout) {
  37277. //normal enviroments in sane situations
  37278. return clearTimeout(marker);
  37279. }
  37280. // if clearTimeout wasn't available but was latter defined
  37281. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  37282. cachedClearTimeout = clearTimeout;
  37283. return clearTimeout(marker);
  37284. }
  37285. try {
  37286. // when when somebody has screwed with setTimeout but no I.E. maddness
  37287. return cachedClearTimeout(marker);
  37288. } catch (e){
  37289. try {
  37290. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  37291. return cachedClearTimeout.call(null, marker);
  37292. } catch (e){
  37293. // 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.
  37294. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  37295. return cachedClearTimeout.call(this, marker);
  37296. }
  37297. }
  37298. }
  37299. var queue = [];
  37300. var draining = false;
  37301. var currentQueue;
  37302. var queueIndex = -1;
  37303. function cleanUpNextTick() {
  37304. if (!draining || !currentQueue) {
  37305. return;
  37306. }
  37307. draining = false;
  37308. if (currentQueue.length) {
  37309. queue = currentQueue.concat(queue);
  37310. } else {
  37311. queueIndex = -1;
  37312. }
  37313. if (queue.length) {
  37314. drainQueue();
  37315. }
  37316. }
  37317. function drainQueue() {
  37318. if (draining) {
  37319. return;
  37320. }
  37321. var timeout = runTimeout(cleanUpNextTick);
  37322. draining = true;
  37323. var len = queue.length;
  37324. while(len) {
  37325. currentQueue = queue;
  37326. queue = [];
  37327. while (++queueIndex < len) {
  37328. if (currentQueue) {
  37329. currentQueue[queueIndex].run();
  37330. }
  37331. }
  37332. queueIndex = -1;
  37333. len = queue.length;
  37334. }
  37335. currentQueue = null;
  37336. draining = false;
  37337. runClearTimeout(timeout);
  37338. }
  37339. process.nextTick = function (fun) {
  37340. var args = new Array(arguments.length - 1);
  37341. if (arguments.length > 1) {
  37342. for (var i = 1; i < arguments.length; i++) {
  37343. args[i - 1] = arguments[i];
  37344. }
  37345. }
  37346. queue.push(new Item(fun, args));
  37347. if (queue.length === 1 && !draining) {
  37348. runTimeout(drainQueue);
  37349. }
  37350. };
  37351. // v8 likes predictible objects
  37352. function Item(fun, array) {
  37353. this.fun = fun;
  37354. this.array = array;
  37355. }
  37356. Item.prototype.run = function () {
  37357. this.fun.apply(null, this.array);
  37358. };
  37359. process.title = 'browser';
  37360. process.browser = true;
  37361. process.env = {};
  37362. process.argv = [];
  37363. process.version = ''; // empty string to avoid regexp issues
  37364. process.versions = {};
  37365. function noop() {}
  37366. process.on = noop;
  37367. process.addListener = noop;
  37368. process.once = noop;
  37369. process.off = noop;
  37370. process.removeListener = noop;
  37371. process.removeAllListeners = noop;
  37372. process.emit = noop;
  37373. process.prependListener = noop;
  37374. process.prependOnceListener = noop;
  37375. process.listeners = function (name) { return [] }
  37376. process.binding = function (name) {
  37377. throw new Error('process.binding is not supported');
  37378. };
  37379. process.cwd = function () { return '/' };
  37380. process.chdir = function (dir) {
  37381. throw new Error('process.chdir is not supported');
  37382. };
  37383. process.umask = function() { return 0; };
  37384. /***/ }),
  37385. /***/ "./node_modules/pusher-js/dist/web/pusher.js":
  37386. /*!***************************************************!*\
  37387. !*** ./node_modules/pusher-js/dist/web/pusher.js ***!
  37388. \***************************************************/
  37389. /*! no static exports found */
  37390. /***/ (function(module, exports, __webpack_require__) {
  37391. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  37392. * Pusher JavaScript Library v5.0.3
  37393. * https://pusher.com/
  37394. *
  37395. * Copyright 2017, Pusher
  37396. * Released under the MIT licence.
  37397. */
  37398. (function webpackUniversalModuleDefinition(root, factory) {
  37399. if(true)
  37400. module.exports = factory();
  37401. else {}
  37402. })(window, function() {
  37403. return /******/ (function(modules) { // webpackBootstrap
  37404. /******/ // The module cache
  37405. /******/ var installedModules = {};
  37406. /******/
  37407. /******/ // The require function
  37408. /******/ function __webpack_require__(moduleId) {
  37409. /******/
  37410. /******/ // Check if module is in cache
  37411. /******/ if(installedModules[moduleId]) {
  37412. /******/ return installedModules[moduleId].exports;
  37413. /******/ }
  37414. /******/ // Create a new module (and put it into the cache)
  37415. /******/ var module = installedModules[moduleId] = {
  37416. /******/ i: moduleId,
  37417. /******/ l: false,
  37418. /******/ exports: {}
  37419. /******/ };
  37420. /******/
  37421. /******/ // Execute the module function
  37422. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  37423. /******/
  37424. /******/ // Flag the module as loaded
  37425. /******/ module.l = true;
  37426. /******/
  37427. /******/ // Return the exports of the module
  37428. /******/ return module.exports;
  37429. /******/ }
  37430. /******/
  37431. /******/
  37432. /******/ // expose the modules object (__webpack_modules__)
  37433. /******/ __webpack_require__.m = modules;
  37434. /******/
  37435. /******/ // expose the module cache
  37436. /******/ __webpack_require__.c = installedModules;
  37437. /******/
  37438. /******/ // define getter function for harmony exports
  37439. /******/ __webpack_require__.d = function(exports, name, getter) {
  37440. /******/ if(!__webpack_require__.o(exports, name)) {
  37441. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  37442. /******/ }
  37443. /******/ };
  37444. /******/
  37445. /******/ // define __esModule on exports
  37446. /******/ __webpack_require__.r = function(exports) {
  37447. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  37448. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  37449. /******/ }
  37450. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  37451. /******/ };
  37452. /******/
  37453. /******/ // create a fake namespace object
  37454. /******/ // mode & 1: value is a module id, require it
  37455. /******/ // mode & 2: merge all properties of value into the ns
  37456. /******/ // mode & 4: return value when already ns object
  37457. /******/ // mode & 8|1: behave like require
  37458. /******/ __webpack_require__.t = function(value, mode) {
  37459. /******/ if(mode & 1) value = __webpack_require__(value);
  37460. /******/ if(mode & 8) return value;
  37461. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  37462. /******/ var ns = Object.create(null);
  37463. /******/ __webpack_require__.r(ns);
  37464. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  37465. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  37466. /******/ return ns;
  37467. /******/ };
  37468. /******/
  37469. /******/ // getDefaultExport function for compatibility with non-harmony modules
  37470. /******/ __webpack_require__.n = function(module) {
  37471. /******/ var getter = module && module.__esModule ?
  37472. /******/ function getDefault() { return module['default']; } :
  37473. /******/ function getModuleExports() { return module; };
  37474. /******/ __webpack_require__.d(getter, 'a', getter);
  37475. /******/ return getter;
  37476. /******/ };
  37477. /******/
  37478. /******/ // Object.prototype.hasOwnProperty.call
  37479. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  37480. /******/
  37481. /******/ // __webpack_public_path__
  37482. /******/ __webpack_require__.p = "";
  37483. /******/
  37484. /******/
  37485. /******/ // Load entry module and return exports
  37486. /******/ return __webpack_require__(__webpack_require__.s = 2);
  37487. /******/ })
  37488. /************************************************************************/
  37489. /******/ ([
  37490. /* 0 */
  37491. /***/ (function(module, exports, __webpack_require__) {
  37492. (function(nacl) {
  37493. 'use strict';
  37494. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
  37495. // Public domain.
  37496. //
  37497. // Implementation derived from TweetNaCl version 20140427.
  37498. // See for details: http://tweetnacl.cr.yp.to/
  37499. var gf = function(init) {
  37500. var i, r = new Float64Array(16);
  37501. if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
  37502. return r;
  37503. };
  37504. // Pluggable, initialized in high-level API below.
  37505. var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
  37506. var _0 = new Uint8Array(16);
  37507. var _9 = new Uint8Array(32); _9[0] = 9;
  37508. var gf0 = gf(),
  37509. gf1 = gf([1]),
  37510. _121665 = gf([0xdb41, 1]),
  37511. D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
  37512. D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
  37513. X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
  37514. Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
  37515. I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
  37516. function ts64(x, i, h, l) {
  37517. x[i] = (h >> 24) & 0xff;
  37518. x[i+1] = (h >> 16) & 0xff;
  37519. x[i+2] = (h >> 8) & 0xff;
  37520. x[i+3] = h & 0xff;
  37521. x[i+4] = (l >> 24) & 0xff;
  37522. x[i+5] = (l >> 16) & 0xff;
  37523. x[i+6] = (l >> 8) & 0xff;
  37524. x[i+7] = l & 0xff;
  37525. }
  37526. function vn(x, xi, y, yi, n) {
  37527. var i,d = 0;
  37528. for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
  37529. return (1 & ((d - 1) >>> 8)) - 1;
  37530. }
  37531. function crypto_verify_16(x, xi, y, yi) {
  37532. return vn(x,xi,y,yi,16);
  37533. }
  37534. function crypto_verify_32(x, xi, y, yi) {
  37535. return vn(x,xi,y,yi,32);
  37536. }
  37537. function core_salsa20(o, p, k, c) {
  37538. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37539. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37540. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37541. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37542. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37543. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37544. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37545. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37546. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37547. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37548. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37549. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37550. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37551. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37552. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37553. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37554. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37555. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37556. x15 = j15, u;
  37557. for (var i = 0; i < 20; i += 2) {
  37558. u = x0 + x12 | 0;
  37559. x4 ^= u<<7 | u>>>(32-7);
  37560. u = x4 + x0 | 0;
  37561. x8 ^= u<<9 | u>>>(32-9);
  37562. u = x8 + x4 | 0;
  37563. x12 ^= u<<13 | u>>>(32-13);
  37564. u = x12 + x8 | 0;
  37565. x0 ^= u<<18 | u>>>(32-18);
  37566. u = x5 + x1 | 0;
  37567. x9 ^= u<<7 | u>>>(32-7);
  37568. u = x9 + x5 | 0;
  37569. x13 ^= u<<9 | u>>>(32-9);
  37570. u = x13 + x9 | 0;
  37571. x1 ^= u<<13 | u>>>(32-13);
  37572. u = x1 + x13 | 0;
  37573. x5 ^= u<<18 | u>>>(32-18);
  37574. u = x10 + x6 | 0;
  37575. x14 ^= u<<7 | u>>>(32-7);
  37576. u = x14 + x10 | 0;
  37577. x2 ^= u<<9 | u>>>(32-9);
  37578. u = x2 + x14 | 0;
  37579. x6 ^= u<<13 | u>>>(32-13);
  37580. u = x6 + x2 | 0;
  37581. x10 ^= u<<18 | u>>>(32-18);
  37582. u = x15 + x11 | 0;
  37583. x3 ^= u<<7 | u>>>(32-7);
  37584. u = x3 + x15 | 0;
  37585. x7 ^= u<<9 | u>>>(32-9);
  37586. u = x7 + x3 | 0;
  37587. x11 ^= u<<13 | u>>>(32-13);
  37588. u = x11 + x7 | 0;
  37589. x15 ^= u<<18 | u>>>(32-18);
  37590. u = x0 + x3 | 0;
  37591. x1 ^= u<<7 | u>>>(32-7);
  37592. u = x1 + x0 | 0;
  37593. x2 ^= u<<9 | u>>>(32-9);
  37594. u = x2 + x1 | 0;
  37595. x3 ^= u<<13 | u>>>(32-13);
  37596. u = x3 + x2 | 0;
  37597. x0 ^= u<<18 | u>>>(32-18);
  37598. u = x5 + x4 | 0;
  37599. x6 ^= u<<7 | u>>>(32-7);
  37600. u = x6 + x5 | 0;
  37601. x7 ^= u<<9 | u>>>(32-9);
  37602. u = x7 + x6 | 0;
  37603. x4 ^= u<<13 | u>>>(32-13);
  37604. u = x4 + x7 | 0;
  37605. x5 ^= u<<18 | u>>>(32-18);
  37606. u = x10 + x9 | 0;
  37607. x11 ^= u<<7 | u>>>(32-7);
  37608. u = x11 + x10 | 0;
  37609. x8 ^= u<<9 | u>>>(32-9);
  37610. u = x8 + x11 | 0;
  37611. x9 ^= u<<13 | u>>>(32-13);
  37612. u = x9 + x8 | 0;
  37613. x10 ^= u<<18 | u>>>(32-18);
  37614. u = x15 + x14 | 0;
  37615. x12 ^= u<<7 | u>>>(32-7);
  37616. u = x12 + x15 | 0;
  37617. x13 ^= u<<9 | u>>>(32-9);
  37618. u = x13 + x12 | 0;
  37619. x14 ^= u<<13 | u>>>(32-13);
  37620. u = x14 + x13 | 0;
  37621. x15 ^= u<<18 | u>>>(32-18);
  37622. }
  37623. x0 = x0 + j0 | 0;
  37624. x1 = x1 + j1 | 0;
  37625. x2 = x2 + j2 | 0;
  37626. x3 = x3 + j3 | 0;
  37627. x4 = x4 + j4 | 0;
  37628. x5 = x5 + j5 | 0;
  37629. x6 = x6 + j6 | 0;
  37630. x7 = x7 + j7 | 0;
  37631. x8 = x8 + j8 | 0;
  37632. x9 = x9 + j9 | 0;
  37633. x10 = x10 + j10 | 0;
  37634. x11 = x11 + j11 | 0;
  37635. x12 = x12 + j12 | 0;
  37636. x13 = x13 + j13 | 0;
  37637. x14 = x14 + j14 | 0;
  37638. x15 = x15 + j15 | 0;
  37639. o[ 0] = x0 >>> 0 & 0xff;
  37640. o[ 1] = x0 >>> 8 & 0xff;
  37641. o[ 2] = x0 >>> 16 & 0xff;
  37642. o[ 3] = x0 >>> 24 & 0xff;
  37643. o[ 4] = x1 >>> 0 & 0xff;
  37644. o[ 5] = x1 >>> 8 & 0xff;
  37645. o[ 6] = x1 >>> 16 & 0xff;
  37646. o[ 7] = x1 >>> 24 & 0xff;
  37647. o[ 8] = x2 >>> 0 & 0xff;
  37648. o[ 9] = x2 >>> 8 & 0xff;
  37649. o[10] = x2 >>> 16 & 0xff;
  37650. o[11] = x2 >>> 24 & 0xff;
  37651. o[12] = x3 >>> 0 & 0xff;
  37652. o[13] = x3 >>> 8 & 0xff;
  37653. o[14] = x3 >>> 16 & 0xff;
  37654. o[15] = x3 >>> 24 & 0xff;
  37655. o[16] = x4 >>> 0 & 0xff;
  37656. o[17] = x4 >>> 8 & 0xff;
  37657. o[18] = x4 >>> 16 & 0xff;
  37658. o[19] = x4 >>> 24 & 0xff;
  37659. o[20] = x5 >>> 0 & 0xff;
  37660. o[21] = x5 >>> 8 & 0xff;
  37661. o[22] = x5 >>> 16 & 0xff;
  37662. o[23] = x5 >>> 24 & 0xff;
  37663. o[24] = x6 >>> 0 & 0xff;
  37664. o[25] = x6 >>> 8 & 0xff;
  37665. o[26] = x6 >>> 16 & 0xff;
  37666. o[27] = x6 >>> 24 & 0xff;
  37667. o[28] = x7 >>> 0 & 0xff;
  37668. o[29] = x7 >>> 8 & 0xff;
  37669. o[30] = x7 >>> 16 & 0xff;
  37670. o[31] = x7 >>> 24 & 0xff;
  37671. o[32] = x8 >>> 0 & 0xff;
  37672. o[33] = x8 >>> 8 & 0xff;
  37673. o[34] = x8 >>> 16 & 0xff;
  37674. o[35] = x8 >>> 24 & 0xff;
  37675. o[36] = x9 >>> 0 & 0xff;
  37676. o[37] = x9 >>> 8 & 0xff;
  37677. o[38] = x9 >>> 16 & 0xff;
  37678. o[39] = x9 >>> 24 & 0xff;
  37679. o[40] = x10 >>> 0 & 0xff;
  37680. o[41] = x10 >>> 8 & 0xff;
  37681. o[42] = x10 >>> 16 & 0xff;
  37682. o[43] = x10 >>> 24 & 0xff;
  37683. o[44] = x11 >>> 0 & 0xff;
  37684. o[45] = x11 >>> 8 & 0xff;
  37685. o[46] = x11 >>> 16 & 0xff;
  37686. o[47] = x11 >>> 24 & 0xff;
  37687. o[48] = x12 >>> 0 & 0xff;
  37688. o[49] = x12 >>> 8 & 0xff;
  37689. o[50] = x12 >>> 16 & 0xff;
  37690. o[51] = x12 >>> 24 & 0xff;
  37691. o[52] = x13 >>> 0 & 0xff;
  37692. o[53] = x13 >>> 8 & 0xff;
  37693. o[54] = x13 >>> 16 & 0xff;
  37694. o[55] = x13 >>> 24 & 0xff;
  37695. o[56] = x14 >>> 0 & 0xff;
  37696. o[57] = x14 >>> 8 & 0xff;
  37697. o[58] = x14 >>> 16 & 0xff;
  37698. o[59] = x14 >>> 24 & 0xff;
  37699. o[60] = x15 >>> 0 & 0xff;
  37700. o[61] = x15 >>> 8 & 0xff;
  37701. o[62] = x15 >>> 16 & 0xff;
  37702. o[63] = x15 >>> 24 & 0xff;
  37703. }
  37704. function core_hsalsa20(o,p,k,c) {
  37705. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37706. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37707. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37708. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37709. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37710. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37711. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37712. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37713. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37714. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37715. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37716. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37717. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37718. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37719. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37720. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37721. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37722. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37723. x15 = j15, u;
  37724. for (var i = 0; i < 20; i += 2) {
  37725. u = x0 + x12 | 0;
  37726. x4 ^= u<<7 | u>>>(32-7);
  37727. u = x4 + x0 | 0;
  37728. x8 ^= u<<9 | u>>>(32-9);
  37729. u = x8 + x4 | 0;
  37730. x12 ^= u<<13 | u>>>(32-13);
  37731. u = x12 + x8 | 0;
  37732. x0 ^= u<<18 | u>>>(32-18);
  37733. u = x5 + x1 | 0;
  37734. x9 ^= u<<7 | u>>>(32-7);
  37735. u = x9 + x5 | 0;
  37736. x13 ^= u<<9 | u>>>(32-9);
  37737. u = x13 + x9 | 0;
  37738. x1 ^= u<<13 | u>>>(32-13);
  37739. u = x1 + x13 | 0;
  37740. x5 ^= u<<18 | u>>>(32-18);
  37741. u = x10 + x6 | 0;
  37742. x14 ^= u<<7 | u>>>(32-7);
  37743. u = x14 + x10 | 0;
  37744. x2 ^= u<<9 | u>>>(32-9);
  37745. u = x2 + x14 | 0;
  37746. x6 ^= u<<13 | u>>>(32-13);
  37747. u = x6 + x2 | 0;
  37748. x10 ^= u<<18 | u>>>(32-18);
  37749. u = x15 + x11 | 0;
  37750. x3 ^= u<<7 | u>>>(32-7);
  37751. u = x3 + x15 | 0;
  37752. x7 ^= u<<9 | u>>>(32-9);
  37753. u = x7 + x3 | 0;
  37754. x11 ^= u<<13 | u>>>(32-13);
  37755. u = x11 + x7 | 0;
  37756. x15 ^= u<<18 | u>>>(32-18);
  37757. u = x0 + x3 | 0;
  37758. x1 ^= u<<7 | u>>>(32-7);
  37759. u = x1 + x0 | 0;
  37760. x2 ^= u<<9 | u>>>(32-9);
  37761. u = x2 + x1 | 0;
  37762. x3 ^= u<<13 | u>>>(32-13);
  37763. u = x3 + x2 | 0;
  37764. x0 ^= u<<18 | u>>>(32-18);
  37765. u = x5 + x4 | 0;
  37766. x6 ^= u<<7 | u>>>(32-7);
  37767. u = x6 + x5 | 0;
  37768. x7 ^= u<<9 | u>>>(32-9);
  37769. u = x7 + x6 | 0;
  37770. x4 ^= u<<13 | u>>>(32-13);
  37771. u = x4 + x7 | 0;
  37772. x5 ^= u<<18 | u>>>(32-18);
  37773. u = x10 + x9 | 0;
  37774. x11 ^= u<<7 | u>>>(32-7);
  37775. u = x11 + x10 | 0;
  37776. x8 ^= u<<9 | u>>>(32-9);
  37777. u = x8 + x11 | 0;
  37778. x9 ^= u<<13 | u>>>(32-13);
  37779. u = x9 + x8 | 0;
  37780. x10 ^= u<<18 | u>>>(32-18);
  37781. u = x15 + x14 | 0;
  37782. x12 ^= u<<7 | u>>>(32-7);
  37783. u = x12 + x15 | 0;
  37784. x13 ^= u<<9 | u>>>(32-9);
  37785. u = x13 + x12 | 0;
  37786. x14 ^= u<<13 | u>>>(32-13);
  37787. u = x14 + x13 | 0;
  37788. x15 ^= u<<18 | u>>>(32-18);
  37789. }
  37790. o[ 0] = x0 >>> 0 & 0xff;
  37791. o[ 1] = x0 >>> 8 & 0xff;
  37792. o[ 2] = x0 >>> 16 & 0xff;
  37793. o[ 3] = x0 >>> 24 & 0xff;
  37794. o[ 4] = x5 >>> 0 & 0xff;
  37795. o[ 5] = x5 >>> 8 & 0xff;
  37796. o[ 6] = x5 >>> 16 & 0xff;
  37797. o[ 7] = x5 >>> 24 & 0xff;
  37798. o[ 8] = x10 >>> 0 & 0xff;
  37799. o[ 9] = x10 >>> 8 & 0xff;
  37800. o[10] = x10 >>> 16 & 0xff;
  37801. o[11] = x10 >>> 24 & 0xff;
  37802. o[12] = x15 >>> 0 & 0xff;
  37803. o[13] = x15 >>> 8 & 0xff;
  37804. o[14] = x15 >>> 16 & 0xff;
  37805. o[15] = x15 >>> 24 & 0xff;
  37806. o[16] = x6 >>> 0 & 0xff;
  37807. o[17] = x6 >>> 8 & 0xff;
  37808. o[18] = x6 >>> 16 & 0xff;
  37809. o[19] = x6 >>> 24 & 0xff;
  37810. o[20] = x7 >>> 0 & 0xff;
  37811. o[21] = x7 >>> 8 & 0xff;
  37812. o[22] = x7 >>> 16 & 0xff;
  37813. o[23] = x7 >>> 24 & 0xff;
  37814. o[24] = x8 >>> 0 & 0xff;
  37815. o[25] = x8 >>> 8 & 0xff;
  37816. o[26] = x8 >>> 16 & 0xff;
  37817. o[27] = x8 >>> 24 & 0xff;
  37818. o[28] = x9 >>> 0 & 0xff;
  37819. o[29] = x9 >>> 8 & 0xff;
  37820. o[30] = x9 >>> 16 & 0xff;
  37821. o[31] = x9 >>> 24 & 0xff;
  37822. }
  37823. function crypto_core_salsa20(out,inp,k,c) {
  37824. core_salsa20(out,inp,k,c);
  37825. }
  37826. function crypto_core_hsalsa20(out,inp,k,c) {
  37827. core_hsalsa20(out,inp,k,c);
  37828. }
  37829. var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
  37830. // "expand 32-byte k"
  37831. function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  37832. var z = new Uint8Array(16), x = new Uint8Array(64);
  37833. var u, i;
  37834. for (i = 0; i < 16; i++) z[i] = 0;
  37835. for (i = 0; i < 8; i++) z[i] = n[i];
  37836. while (b >= 64) {
  37837. crypto_core_salsa20(x,z,k,sigma);
  37838. for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37839. u = 1;
  37840. for (i = 8; i < 16; i++) {
  37841. u = u + (z[i] & 0xff) | 0;
  37842. z[i] = u & 0xff;
  37843. u >>>= 8;
  37844. }
  37845. b -= 64;
  37846. cpos += 64;
  37847. mpos += 64;
  37848. }
  37849. if (b > 0) {
  37850. crypto_core_salsa20(x,z,k,sigma);
  37851. for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37852. }
  37853. return 0;
  37854. }
  37855. function crypto_stream_salsa20(c,cpos,b,n,k) {
  37856. var z = new Uint8Array(16), x = new Uint8Array(64);
  37857. var u, i;
  37858. for (i = 0; i < 16; i++) z[i] = 0;
  37859. for (i = 0; i < 8; i++) z[i] = n[i];
  37860. while (b >= 64) {
  37861. crypto_core_salsa20(x,z,k,sigma);
  37862. for (i = 0; i < 64; i++) c[cpos+i] = x[i];
  37863. u = 1;
  37864. for (i = 8; i < 16; i++) {
  37865. u = u + (z[i] & 0xff) | 0;
  37866. z[i] = u & 0xff;
  37867. u >>>= 8;
  37868. }
  37869. b -= 64;
  37870. cpos += 64;
  37871. }
  37872. if (b > 0) {
  37873. crypto_core_salsa20(x,z,k,sigma);
  37874. for (i = 0; i < b; i++) c[cpos+i] = x[i];
  37875. }
  37876. return 0;
  37877. }
  37878. function crypto_stream(c,cpos,d,n,k) {
  37879. var s = new Uint8Array(32);
  37880. crypto_core_hsalsa20(s,n,k,sigma);
  37881. var sn = new Uint8Array(8);
  37882. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37883. return crypto_stream_salsa20(c,cpos,d,sn,s);
  37884. }
  37885. function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
  37886. var s = new Uint8Array(32);
  37887. crypto_core_hsalsa20(s,n,k,sigma);
  37888. var sn = new Uint8Array(8);
  37889. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37890. return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
  37891. }
  37892. /*
  37893. * Port of Andrew Moon's Poly1305-donna-16. Public domain.
  37894. * https://github.com/floodyberry/poly1305-donna
  37895. */
  37896. var poly1305 = function(key) {
  37897. this.buffer = new Uint8Array(16);
  37898. this.r = new Uint16Array(10);
  37899. this.h = new Uint16Array(10);
  37900. this.pad = new Uint16Array(8);
  37901. this.leftover = 0;
  37902. this.fin = 0;
  37903. var t0, t1, t2, t3, t4, t5, t6, t7;
  37904. t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
  37905. t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37906. t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
  37907. t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37908. t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
  37909. this.r[5] = ((t4 >>> 1)) & 0x1ffe;
  37910. t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37911. t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
  37912. t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37913. this.r[9] = ((t7 >>> 5)) & 0x007f;
  37914. this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  37915. this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  37916. this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  37917. this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  37918. this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  37919. this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  37920. this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  37921. this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
  37922. };
  37923. poly1305.prototype.blocks = function(m, mpos, bytes) {
  37924. var hibit = this.fin ? 0 : (1 << 11);
  37925. var t0, t1, t2, t3, t4, t5, t6, t7, c;
  37926. var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
  37927. var h0 = this.h[0],
  37928. h1 = this.h[1],
  37929. h2 = this.h[2],
  37930. h3 = this.h[3],
  37931. h4 = this.h[4],
  37932. h5 = this.h[5],
  37933. h6 = this.h[6],
  37934. h7 = this.h[7],
  37935. h8 = this.h[8],
  37936. h9 = this.h[9];
  37937. var r0 = this.r[0],
  37938. r1 = this.r[1],
  37939. r2 = this.r[2],
  37940. r3 = this.r[3],
  37941. r4 = this.r[4],
  37942. r5 = this.r[5],
  37943. r6 = this.r[6],
  37944. r7 = this.r[7],
  37945. r8 = this.r[8],
  37946. r9 = this.r[9];
  37947. while (bytes >= 16) {
  37948. t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
  37949. t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37950. t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
  37951. t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37952. t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
  37953. h5 += ((t4 >>> 1)) & 0x1fff;
  37954. t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37955. t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
  37956. t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37957. h9 += ((t7 >>> 5)) | hibit;
  37958. c = 0;
  37959. d0 = c;
  37960. d0 += h0 * r0;
  37961. d0 += h1 * (5 * r9);
  37962. d0 += h2 * (5 * r8);
  37963. d0 += h3 * (5 * r7);
  37964. d0 += h4 * (5 * r6);
  37965. c = (d0 >>> 13); d0 &= 0x1fff;
  37966. d0 += h5 * (5 * r5);
  37967. d0 += h6 * (5 * r4);
  37968. d0 += h7 * (5 * r3);
  37969. d0 += h8 * (5 * r2);
  37970. d0 += h9 * (5 * r1);
  37971. c += (d0 >>> 13); d0 &= 0x1fff;
  37972. d1 = c;
  37973. d1 += h0 * r1;
  37974. d1 += h1 * r0;
  37975. d1 += h2 * (5 * r9);
  37976. d1 += h3 * (5 * r8);
  37977. d1 += h4 * (5 * r7);
  37978. c = (d1 >>> 13); d1 &= 0x1fff;
  37979. d1 += h5 * (5 * r6);
  37980. d1 += h6 * (5 * r5);
  37981. d1 += h7 * (5 * r4);
  37982. d1 += h8 * (5 * r3);
  37983. d1 += h9 * (5 * r2);
  37984. c += (d1 >>> 13); d1 &= 0x1fff;
  37985. d2 = c;
  37986. d2 += h0 * r2;
  37987. d2 += h1 * r1;
  37988. d2 += h2 * r0;
  37989. d2 += h3 * (5 * r9);
  37990. d2 += h4 * (5 * r8);
  37991. c = (d2 >>> 13); d2 &= 0x1fff;
  37992. d2 += h5 * (5 * r7);
  37993. d2 += h6 * (5 * r6);
  37994. d2 += h7 * (5 * r5);
  37995. d2 += h8 * (5 * r4);
  37996. d2 += h9 * (5 * r3);
  37997. c += (d2 >>> 13); d2 &= 0x1fff;
  37998. d3 = c;
  37999. d3 += h0 * r3;
  38000. d3 += h1 * r2;
  38001. d3 += h2 * r1;
  38002. d3 += h3 * r0;
  38003. d3 += h4 * (5 * r9);
  38004. c = (d3 >>> 13); d3 &= 0x1fff;
  38005. d3 += h5 * (5 * r8);
  38006. d3 += h6 * (5 * r7);
  38007. d3 += h7 * (5 * r6);
  38008. d3 += h8 * (5 * r5);
  38009. d3 += h9 * (5 * r4);
  38010. c += (d3 >>> 13); d3 &= 0x1fff;
  38011. d4 = c;
  38012. d4 += h0 * r4;
  38013. d4 += h1 * r3;
  38014. d4 += h2 * r2;
  38015. d4 += h3 * r1;
  38016. d4 += h4 * r0;
  38017. c = (d4 >>> 13); d4 &= 0x1fff;
  38018. d4 += h5 * (5 * r9);
  38019. d4 += h6 * (5 * r8);
  38020. d4 += h7 * (5 * r7);
  38021. d4 += h8 * (5 * r6);
  38022. d4 += h9 * (5 * r5);
  38023. c += (d4 >>> 13); d4 &= 0x1fff;
  38024. d5 = c;
  38025. d5 += h0 * r5;
  38026. d5 += h1 * r4;
  38027. d5 += h2 * r3;
  38028. d5 += h3 * r2;
  38029. d5 += h4 * r1;
  38030. c = (d5 >>> 13); d5 &= 0x1fff;
  38031. d5 += h5 * r0;
  38032. d5 += h6 * (5 * r9);
  38033. d5 += h7 * (5 * r8);
  38034. d5 += h8 * (5 * r7);
  38035. d5 += h9 * (5 * r6);
  38036. c += (d5 >>> 13); d5 &= 0x1fff;
  38037. d6 = c;
  38038. d6 += h0 * r6;
  38039. d6 += h1 * r5;
  38040. d6 += h2 * r4;
  38041. d6 += h3 * r3;
  38042. d6 += h4 * r2;
  38043. c = (d6 >>> 13); d6 &= 0x1fff;
  38044. d6 += h5 * r1;
  38045. d6 += h6 * r0;
  38046. d6 += h7 * (5 * r9);
  38047. d6 += h8 * (5 * r8);
  38048. d6 += h9 * (5 * r7);
  38049. c += (d6 >>> 13); d6 &= 0x1fff;
  38050. d7 = c;
  38051. d7 += h0 * r7;
  38052. d7 += h1 * r6;
  38053. d7 += h2 * r5;
  38054. d7 += h3 * r4;
  38055. d7 += h4 * r3;
  38056. c = (d7 >>> 13); d7 &= 0x1fff;
  38057. d7 += h5 * r2;
  38058. d7 += h6 * r1;
  38059. d7 += h7 * r0;
  38060. d7 += h8 * (5 * r9);
  38061. d7 += h9 * (5 * r8);
  38062. c += (d7 >>> 13); d7 &= 0x1fff;
  38063. d8 = c;
  38064. d8 += h0 * r8;
  38065. d8 += h1 * r7;
  38066. d8 += h2 * r6;
  38067. d8 += h3 * r5;
  38068. d8 += h4 * r4;
  38069. c = (d8 >>> 13); d8 &= 0x1fff;
  38070. d8 += h5 * r3;
  38071. d8 += h6 * r2;
  38072. d8 += h7 * r1;
  38073. d8 += h8 * r0;
  38074. d8 += h9 * (5 * r9);
  38075. c += (d8 >>> 13); d8 &= 0x1fff;
  38076. d9 = c;
  38077. d9 += h0 * r9;
  38078. d9 += h1 * r8;
  38079. d9 += h2 * r7;
  38080. d9 += h3 * r6;
  38081. d9 += h4 * r5;
  38082. c = (d9 >>> 13); d9 &= 0x1fff;
  38083. d9 += h5 * r4;
  38084. d9 += h6 * r3;
  38085. d9 += h7 * r2;
  38086. d9 += h8 * r1;
  38087. d9 += h9 * r0;
  38088. c += (d9 >>> 13); d9 &= 0x1fff;
  38089. c = (((c << 2) + c)) | 0;
  38090. c = (c + d0) | 0;
  38091. d0 = c & 0x1fff;
  38092. c = (c >>> 13);
  38093. d1 += c;
  38094. h0 = d0;
  38095. h1 = d1;
  38096. h2 = d2;
  38097. h3 = d3;
  38098. h4 = d4;
  38099. h5 = d5;
  38100. h6 = d6;
  38101. h7 = d7;
  38102. h8 = d8;
  38103. h9 = d9;
  38104. mpos += 16;
  38105. bytes -= 16;
  38106. }
  38107. this.h[0] = h0;
  38108. this.h[1] = h1;
  38109. this.h[2] = h2;
  38110. this.h[3] = h3;
  38111. this.h[4] = h4;
  38112. this.h[5] = h5;
  38113. this.h[6] = h6;
  38114. this.h[7] = h7;
  38115. this.h[8] = h8;
  38116. this.h[9] = h9;
  38117. };
  38118. poly1305.prototype.finish = function(mac, macpos) {
  38119. var g = new Uint16Array(10);
  38120. var c, mask, f, i;
  38121. if (this.leftover) {
  38122. i = this.leftover;
  38123. this.buffer[i++] = 1;
  38124. for (; i < 16; i++) this.buffer[i] = 0;
  38125. this.fin = 1;
  38126. this.blocks(this.buffer, 0, 16);
  38127. }
  38128. c = this.h[1] >>> 13;
  38129. this.h[1] &= 0x1fff;
  38130. for (i = 2; i < 10; i++) {
  38131. this.h[i] += c;
  38132. c = this.h[i] >>> 13;
  38133. this.h[i] &= 0x1fff;
  38134. }
  38135. this.h[0] += (c * 5);
  38136. c = this.h[0] >>> 13;
  38137. this.h[0] &= 0x1fff;
  38138. this.h[1] += c;
  38139. c = this.h[1] >>> 13;
  38140. this.h[1] &= 0x1fff;
  38141. this.h[2] += c;
  38142. g[0] = this.h[0] + 5;
  38143. c = g[0] >>> 13;
  38144. g[0] &= 0x1fff;
  38145. for (i = 1; i < 10; i++) {
  38146. g[i] = this.h[i] + c;
  38147. c = g[i] >>> 13;
  38148. g[i] &= 0x1fff;
  38149. }
  38150. g[9] -= (1 << 13);
  38151. mask = (c ^ 1) - 1;
  38152. for (i = 0; i < 10; i++) g[i] &= mask;
  38153. mask = ~mask;
  38154. for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
  38155. this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
  38156. this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
  38157. this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
  38158. this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
  38159. this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
  38160. this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
  38161. this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
  38162. this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
  38163. f = this.h[0] + this.pad[0];
  38164. this.h[0] = f & 0xffff;
  38165. for (i = 1; i < 8; i++) {
  38166. f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
  38167. this.h[i] = f & 0xffff;
  38168. }
  38169. mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
  38170. mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
  38171. mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
  38172. mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
  38173. mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
  38174. mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
  38175. mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
  38176. mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
  38177. mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
  38178. mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
  38179. mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
  38180. mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
  38181. mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
  38182. mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
  38183. mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
  38184. mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
  38185. };
  38186. poly1305.prototype.update = function(m, mpos, bytes) {
  38187. var i, want;
  38188. if (this.leftover) {
  38189. want = (16 - this.leftover);
  38190. if (want > bytes)
  38191. want = bytes;
  38192. for (i = 0; i < want; i++)
  38193. this.buffer[this.leftover + i] = m[mpos+i];
  38194. bytes -= want;
  38195. mpos += want;
  38196. this.leftover += want;
  38197. if (this.leftover < 16)
  38198. return;
  38199. this.blocks(this.buffer, 0, 16);
  38200. this.leftover = 0;
  38201. }
  38202. if (bytes >= 16) {
  38203. want = bytes - (bytes % 16);
  38204. this.blocks(m, mpos, want);
  38205. mpos += want;
  38206. bytes -= want;
  38207. }
  38208. if (bytes) {
  38209. for (i = 0; i < bytes; i++)
  38210. this.buffer[this.leftover + i] = m[mpos+i];
  38211. this.leftover += bytes;
  38212. }
  38213. };
  38214. function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
  38215. var s = new poly1305(k);
  38216. s.update(m, mpos, n);
  38217. s.finish(out, outpos);
  38218. return 0;
  38219. }
  38220. function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
  38221. var x = new Uint8Array(16);
  38222. crypto_onetimeauth(x,0,m,mpos,n,k);
  38223. return crypto_verify_16(h,hpos,x,0);
  38224. }
  38225. function crypto_secretbox(c,m,d,n,k) {
  38226. var i;
  38227. if (d < 32) return -1;
  38228. crypto_stream_xor(c,0,m,0,d,n,k);
  38229. crypto_onetimeauth(c, 16, c, 32, d - 32, c);
  38230. for (i = 0; i < 16; i++) c[i] = 0;
  38231. return 0;
  38232. }
  38233. function crypto_secretbox_open(m,c,d,n,k) {
  38234. var i;
  38235. var x = new Uint8Array(32);
  38236. if (d < 32) return -1;
  38237. crypto_stream(x,0,32,n,k);
  38238. if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
  38239. crypto_stream_xor(m,0,c,0,d,n,k);
  38240. for (i = 0; i < 32; i++) m[i] = 0;
  38241. return 0;
  38242. }
  38243. function set25519(r, a) {
  38244. var i;
  38245. for (i = 0; i < 16; i++) r[i] = a[i]|0;
  38246. }
  38247. function car25519(o) {
  38248. var i, v, c = 1;
  38249. for (i = 0; i < 16; i++) {
  38250. v = o[i] + c + 65535;
  38251. c = Math.floor(v / 65536);
  38252. o[i] = v - c * 65536;
  38253. }
  38254. o[0] += c-1 + 37 * (c-1);
  38255. }
  38256. function sel25519(p, q, b) {
  38257. var t, c = ~(b-1);
  38258. for (var i = 0; i < 16; i++) {
  38259. t = c & (p[i] ^ q[i]);
  38260. p[i] ^= t;
  38261. q[i] ^= t;
  38262. }
  38263. }
  38264. function pack25519(o, n) {
  38265. var i, j, b;
  38266. var m = gf(), t = gf();
  38267. for (i = 0; i < 16; i++) t[i] = n[i];
  38268. car25519(t);
  38269. car25519(t);
  38270. car25519(t);
  38271. for (j = 0; j < 2; j++) {
  38272. m[0] = t[0] - 0xffed;
  38273. for (i = 1; i < 15; i++) {
  38274. m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
  38275. m[i-1] &= 0xffff;
  38276. }
  38277. m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
  38278. b = (m[15]>>16) & 1;
  38279. m[14] &= 0xffff;
  38280. sel25519(t, m, 1-b);
  38281. }
  38282. for (i = 0; i < 16; i++) {
  38283. o[2*i] = t[i] & 0xff;
  38284. o[2*i+1] = t[i]>>8;
  38285. }
  38286. }
  38287. function neq25519(a, b) {
  38288. var c = new Uint8Array(32), d = new Uint8Array(32);
  38289. pack25519(c, a);
  38290. pack25519(d, b);
  38291. return crypto_verify_32(c, 0, d, 0);
  38292. }
  38293. function par25519(a) {
  38294. var d = new Uint8Array(32);
  38295. pack25519(d, a);
  38296. return d[0] & 1;
  38297. }
  38298. function unpack25519(o, n) {
  38299. var i;
  38300. for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
  38301. o[15] &= 0x7fff;
  38302. }
  38303. function A(o, a, b) {
  38304. for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
  38305. }
  38306. function Z(o, a, b) {
  38307. for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
  38308. }
  38309. function M(o, a, b) {
  38310. var v, c,
  38311. t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
  38312. t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
  38313. t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
  38314. t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
  38315. b0 = b[0],
  38316. b1 = b[1],
  38317. b2 = b[2],
  38318. b3 = b[3],
  38319. b4 = b[4],
  38320. b5 = b[5],
  38321. b6 = b[6],
  38322. b7 = b[7],
  38323. b8 = b[8],
  38324. b9 = b[9],
  38325. b10 = b[10],
  38326. b11 = b[11],
  38327. b12 = b[12],
  38328. b13 = b[13],
  38329. b14 = b[14],
  38330. b15 = b[15];
  38331. v = a[0];
  38332. t0 += v * b0;
  38333. t1 += v * b1;
  38334. t2 += v * b2;
  38335. t3 += v * b3;
  38336. t4 += v * b4;
  38337. t5 += v * b5;
  38338. t6 += v * b6;
  38339. t7 += v * b7;
  38340. t8 += v * b8;
  38341. t9 += v * b9;
  38342. t10 += v * b10;
  38343. t11 += v * b11;
  38344. t12 += v * b12;
  38345. t13 += v * b13;
  38346. t14 += v * b14;
  38347. t15 += v * b15;
  38348. v = a[1];
  38349. t1 += v * b0;
  38350. t2 += v * b1;
  38351. t3 += v * b2;
  38352. t4 += v * b3;
  38353. t5 += v * b4;
  38354. t6 += v * b5;
  38355. t7 += v * b6;
  38356. t8 += v * b7;
  38357. t9 += v * b8;
  38358. t10 += v * b9;
  38359. t11 += v * b10;
  38360. t12 += v * b11;
  38361. t13 += v * b12;
  38362. t14 += v * b13;
  38363. t15 += v * b14;
  38364. t16 += v * b15;
  38365. v = a[2];
  38366. t2 += v * b0;
  38367. t3 += v * b1;
  38368. t4 += v * b2;
  38369. t5 += v * b3;
  38370. t6 += v * b4;
  38371. t7 += v * b5;
  38372. t8 += v * b6;
  38373. t9 += v * b7;
  38374. t10 += v * b8;
  38375. t11 += v * b9;
  38376. t12 += v * b10;
  38377. t13 += v * b11;
  38378. t14 += v * b12;
  38379. t15 += v * b13;
  38380. t16 += v * b14;
  38381. t17 += v * b15;
  38382. v = a[3];
  38383. t3 += v * b0;
  38384. t4 += v * b1;
  38385. t5 += v * b2;
  38386. t6 += v * b3;
  38387. t7 += v * b4;
  38388. t8 += v * b5;
  38389. t9 += v * b6;
  38390. t10 += v * b7;
  38391. t11 += v * b8;
  38392. t12 += v * b9;
  38393. t13 += v * b10;
  38394. t14 += v * b11;
  38395. t15 += v * b12;
  38396. t16 += v * b13;
  38397. t17 += v * b14;
  38398. t18 += v * b15;
  38399. v = a[4];
  38400. t4 += v * b0;
  38401. t5 += v * b1;
  38402. t6 += v * b2;
  38403. t7 += v * b3;
  38404. t8 += v * b4;
  38405. t9 += v * b5;
  38406. t10 += v * b6;
  38407. t11 += v * b7;
  38408. t12 += v * b8;
  38409. t13 += v * b9;
  38410. t14 += v * b10;
  38411. t15 += v * b11;
  38412. t16 += v * b12;
  38413. t17 += v * b13;
  38414. t18 += v * b14;
  38415. t19 += v * b15;
  38416. v = a[5];
  38417. t5 += v * b0;
  38418. t6 += v * b1;
  38419. t7 += v * b2;
  38420. t8 += v * b3;
  38421. t9 += v * b4;
  38422. t10 += v * b5;
  38423. t11 += v * b6;
  38424. t12 += v * b7;
  38425. t13 += v * b8;
  38426. t14 += v * b9;
  38427. t15 += v * b10;
  38428. t16 += v * b11;
  38429. t17 += v * b12;
  38430. t18 += v * b13;
  38431. t19 += v * b14;
  38432. t20 += v * b15;
  38433. v = a[6];
  38434. t6 += v * b0;
  38435. t7 += v * b1;
  38436. t8 += v * b2;
  38437. t9 += v * b3;
  38438. t10 += v * b4;
  38439. t11 += v * b5;
  38440. t12 += v * b6;
  38441. t13 += v * b7;
  38442. t14 += v * b8;
  38443. t15 += v * b9;
  38444. t16 += v * b10;
  38445. t17 += v * b11;
  38446. t18 += v * b12;
  38447. t19 += v * b13;
  38448. t20 += v * b14;
  38449. t21 += v * b15;
  38450. v = a[7];
  38451. t7 += v * b0;
  38452. t8 += v * b1;
  38453. t9 += v * b2;
  38454. t10 += v * b3;
  38455. t11 += v * b4;
  38456. t12 += v * b5;
  38457. t13 += v * b6;
  38458. t14 += v * b7;
  38459. t15 += v * b8;
  38460. t16 += v * b9;
  38461. t17 += v * b10;
  38462. t18 += v * b11;
  38463. t19 += v * b12;
  38464. t20 += v * b13;
  38465. t21 += v * b14;
  38466. t22 += v * b15;
  38467. v = a[8];
  38468. t8 += v * b0;
  38469. t9 += v * b1;
  38470. t10 += v * b2;
  38471. t11 += v * b3;
  38472. t12 += v * b4;
  38473. t13 += v * b5;
  38474. t14 += v * b6;
  38475. t15 += v * b7;
  38476. t16 += v * b8;
  38477. t17 += v * b9;
  38478. t18 += v * b10;
  38479. t19 += v * b11;
  38480. t20 += v * b12;
  38481. t21 += v * b13;
  38482. t22 += v * b14;
  38483. t23 += v * b15;
  38484. v = a[9];
  38485. t9 += v * b0;
  38486. t10 += v * b1;
  38487. t11 += v * b2;
  38488. t12 += v * b3;
  38489. t13 += v * b4;
  38490. t14 += v * b5;
  38491. t15 += v * b6;
  38492. t16 += v * b7;
  38493. t17 += v * b8;
  38494. t18 += v * b9;
  38495. t19 += v * b10;
  38496. t20 += v * b11;
  38497. t21 += v * b12;
  38498. t22 += v * b13;
  38499. t23 += v * b14;
  38500. t24 += v * b15;
  38501. v = a[10];
  38502. t10 += v * b0;
  38503. t11 += v * b1;
  38504. t12 += v * b2;
  38505. t13 += v * b3;
  38506. t14 += v * b4;
  38507. t15 += v * b5;
  38508. t16 += v * b6;
  38509. t17 += v * b7;
  38510. t18 += v * b8;
  38511. t19 += v * b9;
  38512. t20 += v * b10;
  38513. t21 += v * b11;
  38514. t22 += v * b12;
  38515. t23 += v * b13;
  38516. t24 += v * b14;
  38517. t25 += v * b15;
  38518. v = a[11];
  38519. t11 += v * b0;
  38520. t12 += v * b1;
  38521. t13 += v * b2;
  38522. t14 += v * b3;
  38523. t15 += v * b4;
  38524. t16 += v * b5;
  38525. t17 += v * b6;
  38526. t18 += v * b7;
  38527. t19 += v * b8;
  38528. t20 += v * b9;
  38529. t21 += v * b10;
  38530. t22 += v * b11;
  38531. t23 += v * b12;
  38532. t24 += v * b13;
  38533. t25 += v * b14;
  38534. t26 += v * b15;
  38535. v = a[12];
  38536. t12 += v * b0;
  38537. t13 += v * b1;
  38538. t14 += v * b2;
  38539. t15 += v * b3;
  38540. t16 += v * b4;
  38541. t17 += v * b5;
  38542. t18 += v * b6;
  38543. t19 += v * b7;
  38544. t20 += v * b8;
  38545. t21 += v * b9;
  38546. t22 += v * b10;
  38547. t23 += v * b11;
  38548. t24 += v * b12;
  38549. t25 += v * b13;
  38550. t26 += v * b14;
  38551. t27 += v * b15;
  38552. v = a[13];
  38553. t13 += v * b0;
  38554. t14 += v * b1;
  38555. t15 += v * b2;
  38556. t16 += v * b3;
  38557. t17 += v * b4;
  38558. t18 += v * b5;
  38559. t19 += v * b6;
  38560. t20 += v * b7;
  38561. t21 += v * b8;
  38562. t22 += v * b9;
  38563. t23 += v * b10;
  38564. t24 += v * b11;
  38565. t25 += v * b12;
  38566. t26 += v * b13;
  38567. t27 += v * b14;
  38568. t28 += v * b15;
  38569. v = a[14];
  38570. t14 += v * b0;
  38571. t15 += v * b1;
  38572. t16 += v * b2;
  38573. t17 += v * b3;
  38574. t18 += v * b4;
  38575. t19 += v * b5;
  38576. t20 += v * b6;
  38577. t21 += v * b7;
  38578. t22 += v * b8;
  38579. t23 += v * b9;
  38580. t24 += v * b10;
  38581. t25 += v * b11;
  38582. t26 += v * b12;
  38583. t27 += v * b13;
  38584. t28 += v * b14;
  38585. t29 += v * b15;
  38586. v = a[15];
  38587. t15 += v * b0;
  38588. t16 += v * b1;
  38589. t17 += v * b2;
  38590. t18 += v * b3;
  38591. t19 += v * b4;
  38592. t20 += v * b5;
  38593. t21 += v * b6;
  38594. t22 += v * b7;
  38595. t23 += v * b8;
  38596. t24 += v * b9;
  38597. t25 += v * b10;
  38598. t26 += v * b11;
  38599. t27 += v * b12;
  38600. t28 += v * b13;
  38601. t29 += v * b14;
  38602. t30 += v * b15;
  38603. t0 += 38 * t16;
  38604. t1 += 38 * t17;
  38605. t2 += 38 * t18;
  38606. t3 += 38 * t19;
  38607. t4 += 38 * t20;
  38608. t5 += 38 * t21;
  38609. t6 += 38 * t22;
  38610. t7 += 38 * t23;
  38611. t8 += 38 * t24;
  38612. t9 += 38 * t25;
  38613. t10 += 38 * t26;
  38614. t11 += 38 * t27;
  38615. t12 += 38 * t28;
  38616. t13 += 38 * t29;
  38617. t14 += 38 * t30;
  38618. // t15 left as is
  38619. // first car
  38620. c = 1;
  38621. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38622. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38623. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38624. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38625. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38626. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38627. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38628. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38629. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38630. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38631. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38632. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38633. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38634. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38635. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38636. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38637. t0 += c-1 + 37 * (c-1);
  38638. // second car
  38639. c = 1;
  38640. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38641. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38642. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38643. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38644. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38645. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38646. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38647. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38648. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38649. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38650. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38651. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38652. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38653. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38654. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38655. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38656. t0 += c-1 + 37 * (c-1);
  38657. o[ 0] = t0;
  38658. o[ 1] = t1;
  38659. o[ 2] = t2;
  38660. o[ 3] = t3;
  38661. o[ 4] = t4;
  38662. o[ 5] = t5;
  38663. o[ 6] = t6;
  38664. o[ 7] = t7;
  38665. o[ 8] = t8;
  38666. o[ 9] = t9;
  38667. o[10] = t10;
  38668. o[11] = t11;
  38669. o[12] = t12;
  38670. o[13] = t13;
  38671. o[14] = t14;
  38672. o[15] = t15;
  38673. }
  38674. function S(o, a) {
  38675. M(o, a, a);
  38676. }
  38677. function inv25519(o, i) {
  38678. var c = gf();
  38679. var a;
  38680. for (a = 0; a < 16; a++) c[a] = i[a];
  38681. for (a = 253; a >= 0; a--) {
  38682. S(c, c);
  38683. if(a !== 2 && a !== 4) M(c, c, i);
  38684. }
  38685. for (a = 0; a < 16; a++) o[a] = c[a];
  38686. }
  38687. function pow2523(o, i) {
  38688. var c = gf();
  38689. var a;
  38690. for (a = 0; a < 16; a++) c[a] = i[a];
  38691. for (a = 250; a >= 0; a--) {
  38692. S(c, c);
  38693. if(a !== 1) M(c, c, i);
  38694. }
  38695. for (a = 0; a < 16; a++) o[a] = c[a];
  38696. }
  38697. function crypto_scalarmult(q, n, p) {
  38698. var z = new Uint8Array(32);
  38699. var x = new Float64Array(80), r, i;
  38700. var a = gf(), b = gf(), c = gf(),
  38701. d = gf(), e = gf(), f = gf();
  38702. for (i = 0; i < 31; i++) z[i] = n[i];
  38703. z[31]=(n[31]&127)|64;
  38704. z[0]&=248;
  38705. unpack25519(x,p);
  38706. for (i = 0; i < 16; i++) {
  38707. b[i]=x[i];
  38708. d[i]=a[i]=c[i]=0;
  38709. }
  38710. a[0]=d[0]=1;
  38711. for (i=254; i>=0; --i) {
  38712. r=(z[i>>>3]>>>(i&7))&1;
  38713. sel25519(a,b,r);
  38714. sel25519(c,d,r);
  38715. A(e,a,c);
  38716. Z(a,a,c);
  38717. A(c,b,d);
  38718. Z(b,b,d);
  38719. S(d,e);
  38720. S(f,a);
  38721. M(a,c,a);
  38722. M(c,b,e);
  38723. A(e,a,c);
  38724. Z(a,a,c);
  38725. S(b,a);
  38726. Z(c,d,f);
  38727. M(a,c,_121665);
  38728. A(a,a,d);
  38729. M(c,c,a);
  38730. M(a,d,f);
  38731. M(d,b,x);
  38732. S(b,e);
  38733. sel25519(a,b,r);
  38734. sel25519(c,d,r);
  38735. }
  38736. for (i = 0; i < 16; i++) {
  38737. x[i+16]=a[i];
  38738. x[i+32]=c[i];
  38739. x[i+48]=b[i];
  38740. x[i+64]=d[i];
  38741. }
  38742. var x32 = x.subarray(32);
  38743. var x16 = x.subarray(16);
  38744. inv25519(x32,x32);
  38745. M(x16,x16,x32);
  38746. pack25519(q,x16);
  38747. return 0;
  38748. }
  38749. function crypto_scalarmult_base(q, n) {
  38750. return crypto_scalarmult(q, n, _9);
  38751. }
  38752. function crypto_box_keypair(y, x) {
  38753. randombytes(x, 32);
  38754. return crypto_scalarmult_base(y, x);
  38755. }
  38756. function crypto_box_beforenm(k, y, x) {
  38757. var s = new Uint8Array(32);
  38758. crypto_scalarmult(s, x, y);
  38759. return crypto_core_hsalsa20(k, _0, s, sigma);
  38760. }
  38761. var crypto_box_afternm = crypto_secretbox;
  38762. var crypto_box_open_afternm = crypto_secretbox_open;
  38763. function crypto_box(c, m, d, n, y, x) {
  38764. var k = new Uint8Array(32);
  38765. crypto_box_beforenm(k, y, x);
  38766. return crypto_box_afternm(c, m, d, n, k);
  38767. }
  38768. function crypto_box_open(m, c, d, n, y, x) {
  38769. var k = new Uint8Array(32);
  38770. crypto_box_beforenm(k, y, x);
  38771. return crypto_box_open_afternm(m, c, d, n, k);
  38772. }
  38773. var K = [
  38774. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  38775. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  38776. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  38777. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  38778. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  38779. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  38780. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  38781. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  38782. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  38783. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  38784. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  38785. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  38786. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  38787. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  38788. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  38789. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  38790. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  38791. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  38792. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  38793. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  38794. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  38795. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  38796. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  38797. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  38798. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  38799. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  38800. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  38801. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  38802. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  38803. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  38804. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  38805. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  38806. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  38807. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  38808. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  38809. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  38810. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  38811. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  38812. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  38813. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  38814. ];
  38815. function crypto_hashblocks_hl(hh, hl, m, n) {
  38816. var wh = new Int32Array(16), wl = new Int32Array(16),
  38817. bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
  38818. bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
  38819. th, tl, i, j, h, l, a, b, c, d;
  38820. var ah0 = hh[0],
  38821. ah1 = hh[1],
  38822. ah2 = hh[2],
  38823. ah3 = hh[3],
  38824. ah4 = hh[4],
  38825. ah5 = hh[5],
  38826. ah6 = hh[6],
  38827. ah7 = hh[7],
  38828. al0 = hl[0],
  38829. al1 = hl[1],
  38830. al2 = hl[2],
  38831. al3 = hl[3],
  38832. al4 = hl[4],
  38833. al5 = hl[5],
  38834. al6 = hl[6],
  38835. al7 = hl[7];
  38836. var pos = 0;
  38837. while (n >= 128) {
  38838. for (i = 0; i < 16; i++) {
  38839. j = 8 * i + pos;
  38840. wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
  38841. wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
  38842. }
  38843. for (i = 0; i < 80; i++) {
  38844. bh0 = ah0;
  38845. bh1 = ah1;
  38846. bh2 = ah2;
  38847. bh3 = ah3;
  38848. bh4 = ah4;
  38849. bh5 = ah5;
  38850. bh6 = ah6;
  38851. bh7 = ah7;
  38852. bl0 = al0;
  38853. bl1 = al1;
  38854. bl2 = al2;
  38855. bl3 = al3;
  38856. bl4 = al4;
  38857. bl5 = al5;
  38858. bl6 = al6;
  38859. bl7 = al7;
  38860. // add
  38861. h = ah7;
  38862. l = al7;
  38863. a = l & 0xffff; b = l >>> 16;
  38864. c = h & 0xffff; d = h >>> 16;
  38865. // Sigma1
  38866. h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
  38867. l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
  38868. a += l & 0xffff; b += l >>> 16;
  38869. c += h & 0xffff; d += h >>> 16;
  38870. // Ch
  38871. h = (ah4 & ah5) ^ (~ah4 & ah6);
  38872. l = (al4 & al5) ^ (~al4 & al6);
  38873. a += l & 0xffff; b += l >>> 16;
  38874. c += h & 0xffff; d += h >>> 16;
  38875. // K
  38876. h = K[i*2];
  38877. l = K[i*2+1];
  38878. a += l & 0xffff; b += l >>> 16;
  38879. c += h & 0xffff; d += h >>> 16;
  38880. // w
  38881. h = wh[i%16];
  38882. l = wl[i%16];
  38883. a += l & 0xffff; b += l >>> 16;
  38884. c += h & 0xffff; d += h >>> 16;
  38885. b += a >>> 16;
  38886. c += b >>> 16;
  38887. d += c >>> 16;
  38888. th = c & 0xffff | d << 16;
  38889. tl = a & 0xffff | b << 16;
  38890. // add
  38891. h = th;
  38892. l = tl;
  38893. a = l & 0xffff; b = l >>> 16;
  38894. c = h & 0xffff; d = h >>> 16;
  38895. // Sigma0
  38896. h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
  38897. l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
  38898. a += l & 0xffff; b += l >>> 16;
  38899. c += h & 0xffff; d += h >>> 16;
  38900. // Maj
  38901. h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
  38902. l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
  38903. a += l & 0xffff; b += l >>> 16;
  38904. c += h & 0xffff; d += h >>> 16;
  38905. b += a >>> 16;
  38906. c += b >>> 16;
  38907. d += c >>> 16;
  38908. bh7 = (c & 0xffff) | (d << 16);
  38909. bl7 = (a & 0xffff) | (b << 16);
  38910. // add
  38911. h = bh3;
  38912. l = bl3;
  38913. a = l & 0xffff; b = l >>> 16;
  38914. c = h & 0xffff; d = h >>> 16;
  38915. h = th;
  38916. l = tl;
  38917. a += l & 0xffff; b += l >>> 16;
  38918. c += h & 0xffff; d += h >>> 16;
  38919. b += a >>> 16;
  38920. c += b >>> 16;
  38921. d += c >>> 16;
  38922. bh3 = (c & 0xffff) | (d << 16);
  38923. bl3 = (a & 0xffff) | (b << 16);
  38924. ah1 = bh0;
  38925. ah2 = bh1;
  38926. ah3 = bh2;
  38927. ah4 = bh3;
  38928. ah5 = bh4;
  38929. ah6 = bh5;
  38930. ah7 = bh6;
  38931. ah0 = bh7;
  38932. al1 = bl0;
  38933. al2 = bl1;
  38934. al3 = bl2;
  38935. al4 = bl3;
  38936. al5 = bl4;
  38937. al6 = bl5;
  38938. al7 = bl6;
  38939. al0 = bl7;
  38940. if (i%16 === 15) {
  38941. for (j = 0; j < 16; j++) {
  38942. // add
  38943. h = wh[j];
  38944. l = wl[j];
  38945. a = l & 0xffff; b = l >>> 16;
  38946. c = h & 0xffff; d = h >>> 16;
  38947. h = wh[(j+9)%16];
  38948. l = wl[(j+9)%16];
  38949. a += l & 0xffff; b += l >>> 16;
  38950. c += h & 0xffff; d += h >>> 16;
  38951. // sigma0
  38952. th = wh[(j+1)%16];
  38953. tl = wl[(j+1)%16];
  38954. h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
  38955. l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
  38956. a += l & 0xffff; b += l >>> 16;
  38957. c += h & 0xffff; d += h >>> 16;
  38958. // sigma1
  38959. th = wh[(j+14)%16];
  38960. tl = wl[(j+14)%16];
  38961. h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
  38962. l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
  38963. a += l & 0xffff; b += l >>> 16;
  38964. c += h & 0xffff; d += h >>> 16;
  38965. b += a >>> 16;
  38966. c += b >>> 16;
  38967. d += c >>> 16;
  38968. wh[j] = (c & 0xffff) | (d << 16);
  38969. wl[j] = (a & 0xffff) | (b << 16);
  38970. }
  38971. }
  38972. }
  38973. // add
  38974. h = ah0;
  38975. l = al0;
  38976. a = l & 0xffff; b = l >>> 16;
  38977. c = h & 0xffff; d = h >>> 16;
  38978. h = hh[0];
  38979. l = hl[0];
  38980. a += l & 0xffff; b += l >>> 16;
  38981. c += h & 0xffff; d += h >>> 16;
  38982. b += a >>> 16;
  38983. c += b >>> 16;
  38984. d += c >>> 16;
  38985. hh[0] = ah0 = (c & 0xffff) | (d << 16);
  38986. hl[0] = al0 = (a & 0xffff) | (b << 16);
  38987. h = ah1;
  38988. l = al1;
  38989. a = l & 0xffff; b = l >>> 16;
  38990. c = h & 0xffff; d = h >>> 16;
  38991. h = hh[1];
  38992. l = hl[1];
  38993. a += l & 0xffff; b += l >>> 16;
  38994. c += h & 0xffff; d += h >>> 16;
  38995. b += a >>> 16;
  38996. c += b >>> 16;
  38997. d += c >>> 16;
  38998. hh[1] = ah1 = (c & 0xffff) | (d << 16);
  38999. hl[1] = al1 = (a & 0xffff) | (b << 16);
  39000. h = ah2;
  39001. l = al2;
  39002. a = l & 0xffff; b = l >>> 16;
  39003. c = h & 0xffff; d = h >>> 16;
  39004. h = hh[2];
  39005. l = hl[2];
  39006. a += l & 0xffff; b += l >>> 16;
  39007. c += h & 0xffff; d += h >>> 16;
  39008. b += a >>> 16;
  39009. c += b >>> 16;
  39010. d += c >>> 16;
  39011. hh[2] = ah2 = (c & 0xffff) | (d << 16);
  39012. hl[2] = al2 = (a & 0xffff) | (b << 16);
  39013. h = ah3;
  39014. l = al3;
  39015. a = l & 0xffff; b = l >>> 16;
  39016. c = h & 0xffff; d = h >>> 16;
  39017. h = hh[3];
  39018. l = hl[3];
  39019. a += l & 0xffff; b += l >>> 16;
  39020. c += h & 0xffff; d += h >>> 16;
  39021. b += a >>> 16;
  39022. c += b >>> 16;
  39023. d += c >>> 16;
  39024. hh[3] = ah3 = (c & 0xffff) | (d << 16);
  39025. hl[3] = al3 = (a & 0xffff) | (b << 16);
  39026. h = ah4;
  39027. l = al4;
  39028. a = l & 0xffff; b = l >>> 16;
  39029. c = h & 0xffff; d = h >>> 16;
  39030. h = hh[4];
  39031. l = hl[4];
  39032. a += l & 0xffff; b += l >>> 16;
  39033. c += h & 0xffff; d += h >>> 16;
  39034. b += a >>> 16;
  39035. c += b >>> 16;
  39036. d += c >>> 16;
  39037. hh[4] = ah4 = (c & 0xffff) | (d << 16);
  39038. hl[4] = al4 = (a & 0xffff) | (b << 16);
  39039. h = ah5;
  39040. l = al5;
  39041. a = l & 0xffff; b = l >>> 16;
  39042. c = h & 0xffff; d = h >>> 16;
  39043. h = hh[5];
  39044. l = hl[5];
  39045. a += l & 0xffff; b += l >>> 16;
  39046. c += h & 0xffff; d += h >>> 16;
  39047. b += a >>> 16;
  39048. c += b >>> 16;
  39049. d += c >>> 16;
  39050. hh[5] = ah5 = (c & 0xffff) | (d << 16);
  39051. hl[5] = al5 = (a & 0xffff) | (b << 16);
  39052. h = ah6;
  39053. l = al6;
  39054. a = l & 0xffff; b = l >>> 16;
  39055. c = h & 0xffff; d = h >>> 16;
  39056. h = hh[6];
  39057. l = hl[6];
  39058. a += l & 0xffff; b += l >>> 16;
  39059. c += h & 0xffff; d += h >>> 16;
  39060. b += a >>> 16;
  39061. c += b >>> 16;
  39062. d += c >>> 16;
  39063. hh[6] = ah6 = (c & 0xffff) | (d << 16);
  39064. hl[6] = al6 = (a & 0xffff) | (b << 16);
  39065. h = ah7;
  39066. l = al7;
  39067. a = l & 0xffff; b = l >>> 16;
  39068. c = h & 0xffff; d = h >>> 16;
  39069. h = hh[7];
  39070. l = hl[7];
  39071. a += l & 0xffff; b += l >>> 16;
  39072. c += h & 0xffff; d += h >>> 16;
  39073. b += a >>> 16;
  39074. c += b >>> 16;
  39075. d += c >>> 16;
  39076. hh[7] = ah7 = (c & 0xffff) | (d << 16);
  39077. hl[7] = al7 = (a & 0xffff) | (b << 16);
  39078. pos += 128;
  39079. n -= 128;
  39080. }
  39081. return n;
  39082. }
  39083. function crypto_hash(out, m, n) {
  39084. var hh = new Int32Array(8),
  39085. hl = new Int32Array(8),
  39086. x = new Uint8Array(256),
  39087. i, b = n;
  39088. hh[0] = 0x6a09e667;
  39089. hh[1] = 0xbb67ae85;
  39090. hh[2] = 0x3c6ef372;
  39091. hh[3] = 0xa54ff53a;
  39092. hh[4] = 0x510e527f;
  39093. hh[5] = 0x9b05688c;
  39094. hh[6] = 0x1f83d9ab;
  39095. hh[7] = 0x5be0cd19;
  39096. hl[0] = 0xf3bcc908;
  39097. hl[1] = 0x84caa73b;
  39098. hl[2] = 0xfe94f82b;
  39099. hl[3] = 0x5f1d36f1;
  39100. hl[4] = 0xade682d1;
  39101. hl[5] = 0x2b3e6c1f;
  39102. hl[6] = 0xfb41bd6b;
  39103. hl[7] = 0x137e2179;
  39104. crypto_hashblocks_hl(hh, hl, m, n);
  39105. n %= 128;
  39106. for (i = 0; i < n; i++) x[i] = m[b-n+i];
  39107. x[n] = 128;
  39108. n = 256-128*(n<112?1:0);
  39109. x[n-9] = 0;
  39110. ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
  39111. crypto_hashblocks_hl(hh, hl, x, n);
  39112. for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
  39113. return 0;
  39114. }
  39115. function add(p, q) {
  39116. var a = gf(), b = gf(), c = gf(),
  39117. d = gf(), e = gf(), f = gf(),
  39118. g = gf(), h = gf(), t = gf();
  39119. Z(a, p[1], p[0]);
  39120. Z(t, q[1], q[0]);
  39121. M(a, a, t);
  39122. A(b, p[0], p[1]);
  39123. A(t, q[0], q[1]);
  39124. M(b, b, t);
  39125. M(c, p[3], q[3]);
  39126. M(c, c, D2);
  39127. M(d, p[2], q[2]);
  39128. A(d, d, d);
  39129. Z(e, b, a);
  39130. Z(f, d, c);
  39131. A(g, d, c);
  39132. A(h, b, a);
  39133. M(p[0], e, f);
  39134. M(p[1], h, g);
  39135. M(p[2], g, f);
  39136. M(p[3], e, h);
  39137. }
  39138. function cswap(p, q, b) {
  39139. var i;
  39140. for (i = 0; i < 4; i++) {
  39141. sel25519(p[i], q[i], b);
  39142. }
  39143. }
  39144. function pack(r, p) {
  39145. var tx = gf(), ty = gf(), zi = gf();
  39146. inv25519(zi, p[2]);
  39147. M(tx, p[0], zi);
  39148. M(ty, p[1], zi);
  39149. pack25519(r, ty);
  39150. r[31] ^= par25519(tx) << 7;
  39151. }
  39152. function scalarmult(p, q, s) {
  39153. var b, i;
  39154. set25519(p[0], gf0);
  39155. set25519(p[1], gf1);
  39156. set25519(p[2], gf1);
  39157. set25519(p[3], gf0);
  39158. for (i = 255; i >= 0; --i) {
  39159. b = (s[(i/8)|0] >> (i&7)) & 1;
  39160. cswap(p, q, b);
  39161. add(q, p);
  39162. add(p, p);
  39163. cswap(p, q, b);
  39164. }
  39165. }
  39166. function scalarbase(p, s) {
  39167. var q = [gf(), gf(), gf(), gf()];
  39168. set25519(q[0], X);
  39169. set25519(q[1], Y);
  39170. set25519(q[2], gf1);
  39171. M(q[3], X, Y);
  39172. scalarmult(p, q, s);
  39173. }
  39174. function crypto_sign_keypair(pk, sk, seeded) {
  39175. var d = new Uint8Array(64);
  39176. var p = [gf(), gf(), gf(), gf()];
  39177. var i;
  39178. if (!seeded) randombytes(sk, 32);
  39179. crypto_hash(d, sk, 32);
  39180. d[0] &= 248;
  39181. d[31] &= 127;
  39182. d[31] |= 64;
  39183. scalarbase(p, d);
  39184. pack(pk, p);
  39185. for (i = 0; i < 32; i++) sk[i+32] = pk[i];
  39186. return 0;
  39187. }
  39188. 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]);
  39189. function modL(r, x) {
  39190. var carry, i, j, k;
  39191. for (i = 63; i >= 32; --i) {
  39192. carry = 0;
  39193. for (j = i - 32, k = i - 12; j < k; ++j) {
  39194. x[j] += carry - 16 * x[i] * L[j - (i - 32)];
  39195. carry = (x[j] + 128) >> 8;
  39196. x[j] -= carry * 256;
  39197. }
  39198. x[j] += carry;
  39199. x[i] = 0;
  39200. }
  39201. carry = 0;
  39202. for (j = 0; j < 32; j++) {
  39203. x[j] += carry - (x[31] >> 4) * L[j];
  39204. carry = x[j] >> 8;
  39205. x[j] &= 255;
  39206. }
  39207. for (j = 0; j < 32; j++) x[j] -= carry * L[j];
  39208. for (i = 0; i < 32; i++) {
  39209. x[i+1] += x[i] >> 8;
  39210. r[i] = x[i] & 255;
  39211. }
  39212. }
  39213. function reduce(r) {
  39214. var x = new Float64Array(64), i;
  39215. for (i = 0; i < 64; i++) x[i] = r[i];
  39216. for (i = 0; i < 64; i++) r[i] = 0;
  39217. modL(r, x);
  39218. }
  39219. // Note: difference from C - smlen returned, not passed as argument.
  39220. function crypto_sign(sm, m, n, sk) {
  39221. var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
  39222. var i, j, x = new Float64Array(64);
  39223. var p = [gf(), gf(), gf(), gf()];
  39224. crypto_hash(d, sk, 32);
  39225. d[0] &= 248;
  39226. d[31] &= 127;
  39227. d[31] |= 64;
  39228. var smlen = n + 64;
  39229. for (i = 0; i < n; i++) sm[64 + i] = m[i];
  39230. for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
  39231. crypto_hash(r, sm.subarray(32), n+32);
  39232. reduce(r);
  39233. scalarbase(p, r);
  39234. pack(sm, p);
  39235. for (i = 32; i < 64; i++) sm[i] = sk[i];
  39236. crypto_hash(h, sm, n + 64);
  39237. reduce(h);
  39238. for (i = 0; i < 64; i++) x[i] = 0;
  39239. for (i = 0; i < 32; i++) x[i] = r[i];
  39240. for (i = 0; i < 32; i++) {
  39241. for (j = 0; j < 32; j++) {
  39242. x[i+j] += h[i] * d[j];
  39243. }
  39244. }
  39245. modL(sm.subarray(32), x);
  39246. return smlen;
  39247. }
  39248. function unpackneg(r, p) {
  39249. var t = gf(), chk = gf(), num = gf(),
  39250. den = gf(), den2 = gf(), den4 = gf(),
  39251. den6 = gf();
  39252. set25519(r[2], gf1);
  39253. unpack25519(r[1], p);
  39254. S(num, r[1]);
  39255. M(den, num, D);
  39256. Z(num, num, r[2]);
  39257. A(den, r[2], den);
  39258. S(den2, den);
  39259. S(den4, den2);
  39260. M(den6, den4, den2);
  39261. M(t, den6, num);
  39262. M(t, t, den);
  39263. pow2523(t, t);
  39264. M(t, t, num);
  39265. M(t, t, den);
  39266. M(t, t, den);
  39267. M(r[0], t, den);
  39268. S(chk, r[0]);
  39269. M(chk, chk, den);
  39270. if (neq25519(chk, num)) M(r[0], r[0], I);
  39271. S(chk, r[0]);
  39272. M(chk, chk, den);
  39273. if (neq25519(chk, num)) return -1;
  39274. if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
  39275. M(r[3], r[0], r[1]);
  39276. return 0;
  39277. }
  39278. function crypto_sign_open(m, sm, n, pk) {
  39279. var i, mlen;
  39280. var t = new Uint8Array(32), h = new Uint8Array(64);
  39281. var p = [gf(), gf(), gf(), gf()],
  39282. q = [gf(), gf(), gf(), gf()];
  39283. mlen = -1;
  39284. if (n < 64) return -1;
  39285. if (unpackneg(q, pk)) return -1;
  39286. for (i = 0; i < n; i++) m[i] = sm[i];
  39287. for (i = 0; i < 32; i++) m[i+32] = pk[i];
  39288. crypto_hash(h, m, n);
  39289. reduce(h);
  39290. scalarmult(p, q, h);
  39291. scalarbase(q, sm.subarray(32));
  39292. add(p, q);
  39293. pack(t, p);
  39294. n -= 64;
  39295. if (crypto_verify_32(sm, 0, t, 0)) {
  39296. for (i = 0; i < n; i++) m[i] = 0;
  39297. return -1;
  39298. }
  39299. for (i = 0; i < n; i++) m[i] = sm[i + 64];
  39300. mlen = n;
  39301. return mlen;
  39302. }
  39303. var crypto_secretbox_KEYBYTES = 32,
  39304. crypto_secretbox_NONCEBYTES = 24,
  39305. crypto_secretbox_ZEROBYTES = 32,
  39306. crypto_secretbox_BOXZEROBYTES = 16,
  39307. crypto_scalarmult_BYTES = 32,
  39308. crypto_scalarmult_SCALARBYTES = 32,
  39309. crypto_box_PUBLICKEYBYTES = 32,
  39310. crypto_box_SECRETKEYBYTES = 32,
  39311. crypto_box_BEFORENMBYTES = 32,
  39312. crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
  39313. crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
  39314. crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
  39315. crypto_sign_BYTES = 64,
  39316. crypto_sign_PUBLICKEYBYTES = 32,
  39317. crypto_sign_SECRETKEYBYTES = 64,
  39318. crypto_sign_SEEDBYTES = 32,
  39319. crypto_hash_BYTES = 64;
  39320. nacl.lowlevel = {
  39321. crypto_core_hsalsa20: crypto_core_hsalsa20,
  39322. crypto_stream_xor: crypto_stream_xor,
  39323. crypto_stream: crypto_stream,
  39324. crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
  39325. crypto_stream_salsa20: crypto_stream_salsa20,
  39326. crypto_onetimeauth: crypto_onetimeauth,
  39327. crypto_onetimeauth_verify: crypto_onetimeauth_verify,
  39328. crypto_verify_16: crypto_verify_16,
  39329. crypto_verify_32: crypto_verify_32,
  39330. crypto_secretbox: crypto_secretbox,
  39331. crypto_secretbox_open: crypto_secretbox_open,
  39332. crypto_scalarmult: crypto_scalarmult,
  39333. crypto_scalarmult_base: crypto_scalarmult_base,
  39334. crypto_box_beforenm: crypto_box_beforenm,
  39335. crypto_box_afternm: crypto_box_afternm,
  39336. crypto_box: crypto_box,
  39337. crypto_box_open: crypto_box_open,
  39338. crypto_box_keypair: crypto_box_keypair,
  39339. crypto_hash: crypto_hash,
  39340. crypto_sign: crypto_sign,
  39341. crypto_sign_keypair: crypto_sign_keypair,
  39342. crypto_sign_open: crypto_sign_open,
  39343. crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
  39344. crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
  39345. crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
  39346. crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
  39347. crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
  39348. crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
  39349. crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
  39350. crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
  39351. crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
  39352. crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
  39353. crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
  39354. crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
  39355. crypto_sign_BYTES: crypto_sign_BYTES,
  39356. crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
  39357. crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
  39358. crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
  39359. crypto_hash_BYTES: crypto_hash_BYTES
  39360. };
  39361. /* High-level API */
  39362. function checkLengths(k, n) {
  39363. if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  39364. if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
  39365. }
  39366. function checkBoxLengths(pk, sk) {
  39367. if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
  39368. if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
  39369. }
  39370. function checkArrayTypes() {
  39371. for (var i = 0; i < arguments.length; i++) {
  39372. if (!(arguments[i] instanceof Uint8Array))
  39373. throw new TypeError('unexpected type, use Uint8Array');
  39374. }
  39375. }
  39376. function cleanup(arr) {
  39377. for (var i = 0; i < arr.length; i++) arr[i] = 0;
  39378. }
  39379. nacl.randomBytes = function(n) {
  39380. var b = new Uint8Array(n);
  39381. randombytes(b, n);
  39382. return b;
  39383. };
  39384. nacl.secretbox = function(msg, nonce, key) {
  39385. checkArrayTypes(msg, nonce, key);
  39386. checkLengths(key, nonce);
  39387. var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
  39388. var c = new Uint8Array(m.length);
  39389. for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
  39390. crypto_secretbox(c, m, m.length, nonce, key);
  39391. return c.subarray(crypto_secretbox_BOXZEROBYTES);
  39392. };
  39393. nacl.secretbox.open = function(box, nonce, key) {
  39394. checkArrayTypes(box, nonce, key);
  39395. checkLengths(key, nonce);
  39396. var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
  39397. var m = new Uint8Array(c.length);
  39398. for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
  39399. if (c.length < 32) return null;
  39400. if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
  39401. return m.subarray(crypto_secretbox_ZEROBYTES);
  39402. };
  39403. nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
  39404. nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
  39405. nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
  39406. nacl.scalarMult = function(n, p) {
  39407. checkArrayTypes(n, p);
  39408. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  39409. if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
  39410. var q = new Uint8Array(crypto_scalarmult_BYTES);
  39411. crypto_scalarmult(q, n, p);
  39412. return q;
  39413. };
  39414. nacl.scalarMult.base = function(n) {
  39415. checkArrayTypes(n);
  39416. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  39417. var q = new Uint8Array(crypto_scalarmult_BYTES);
  39418. crypto_scalarmult_base(q, n);
  39419. return q;
  39420. };
  39421. nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
  39422. nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
  39423. nacl.box = function(msg, nonce, publicKey, secretKey) {
  39424. var k = nacl.box.before(publicKey, secretKey);
  39425. return nacl.secretbox(msg, nonce, k);
  39426. };
  39427. nacl.box.before = function(publicKey, secretKey) {
  39428. checkArrayTypes(publicKey, secretKey);
  39429. checkBoxLengths(publicKey, secretKey);
  39430. var k = new Uint8Array(crypto_box_BEFORENMBYTES);
  39431. crypto_box_beforenm(k, publicKey, secretKey);
  39432. return k;
  39433. };
  39434. nacl.box.after = nacl.secretbox;
  39435. nacl.box.open = function(msg, nonce, publicKey, secretKey) {
  39436. var k = nacl.box.before(publicKey, secretKey);
  39437. return nacl.secretbox.open(msg, nonce, k);
  39438. };
  39439. nacl.box.open.after = nacl.secretbox.open;
  39440. nacl.box.keyPair = function() {
  39441. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  39442. var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
  39443. crypto_box_keypair(pk, sk);
  39444. return {publicKey: pk, secretKey: sk};
  39445. };
  39446. nacl.box.keyPair.fromSecretKey = function(secretKey) {
  39447. checkArrayTypes(secretKey);
  39448. if (secretKey.length !== crypto_box_SECRETKEYBYTES)
  39449. throw new Error('bad secret key size');
  39450. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  39451. crypto_scalarmult_base(pk, secretKey);
  39452. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  39453. };
  39454. nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
  39455. nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
  39456. nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
  39457. nacl.box.nonceLength = crypto_box_NONCEBYTES;
  39458. nacl.box.overheadLength = nacl.secretbox.overheadLength;
  39459. nacl.sign = function(msg, secretKey) {
  39460. checkArrayTypes(msg, secretKey);
  39461. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  39462. throw new Error('bad secret key size');
  39463. var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
  39464. crypto_sign(signedMsg, msg, msg.length, secretKey);
  39465. return signedMsg;
  39466. };
  39467. nacl.sign.open = function(signedMsg, publicKey) {
  39468. checkArrayTypes(signedMsg, publicKey);
  39469. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  39470. throw new Error('bad public key size');
  39471. var tmp = new Uint8Array(signedMsg.length);
  39472. var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
  39473. if (mlen < 0) return null;
  39474. var m = new Uint8Array(mlen);
  39475. for (var i = 0; i < m.length; i++) m[i] = tmp[i];
  39476. return m;
  39477. };
  39478. nacl.sign.detached = function(msg, secretKey) {
  39479. var signedMsg = nacl.sign(msg, secretKey);
  39480. var sig = new Uint8Array(crypto_sign_BYTES);
  39481. for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
  39482. return sig;
  39483. };
  39484. nacl.sign.detached.verify = function(msg, sig, publicKey) {
  39485. checkArrayTypes(msg, sig, publicKey);
  39486. if (sig.length !== crypto_sign_BYTES)
  39487. throw new Error('bad signature size');
  39488. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  39489. throw new Error('bad public key size');
  39490. var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
  39491. var m = new Uint8Array(crypto_sign_BYTES + msg.length);
  39492. var i;
  39493. for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
  39494. for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
  39495. return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
  39496. };
  39497. nacl.sign.keyPair = function() {
  39498. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39499. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  39500. crypto_sign_keypair(pk, sk);
  39501. return {publicKey: pk, secretKey: sk};
  39502. };
  39503. nacl.sign.keyPair.fromSecretKey = function(secretKey) {
  39504. checkArrayTypes(secretKey);
  39505. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  39506. throw new Error('bad secret key size');
  39507. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39508. for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
  39509. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  39510. };
  39511. nacl.sign.keyPair.fromSeed = function(seed) {
  39512. checkArrayTypes(seed);
  39513. if (seed.length !== crypto_sign_SEEDBYTES)
  39514. throw new Error('bad seed size');
  39515. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39516. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  39517. for (var i = 0; i < 32; i++) sk[i] = seed[i];
  39518. crypto_sign_keypair(pk, sk, true);
  39519. return {publicKey: pk, secretKey: sk};
  39520. };
  39521. nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
  39522. nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
  39523. nacl.sign.seedLength = crypto_sign_SEEDBYTES;
  39524. nacl.sign.signatureLength = crypto_sign_BYTES;
  39525. nacl.hash = function(msg) {
  39526. checkArrayTypes(msg);
  39527. var h = new Uint8Array(crypto_hash_BYTES);
  39528. crypto_hash(h, msg, msg.length);
  39529. return h;
  39530. };
  39531. nacl.hash.hashLength = crypto_hash_BYTES;
  39532. nacl.verify = function(x, y) {
  39533. checkArrayTypes(x, y);
  39534. // Zero length arguments are considered not equal.
  39535. if (x.length === 0 || y.length === 0) return false;
  39536. if (x.length !== y.length) return false;
  39537. return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
  39538. };
  39539. nacl.setPRNG = function(fn) {
  39540. randombytes = fn;
  39541. };
  39542. (function() {
  39543. // Initialize PRNG if environment provides CSPRNG.
  39544. // If not, methods calling randombytes will throw.
  39545. var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
  39546. if (crypto && crypto.getRandomValues) {
  39547. // Browsers.
  39548. var QUOTA = 65536;
  39549. nacl.setPRNG(function(x, n) {
  39550. var i, v = new Uint8Array(n);
  39551. for (i = 0; i < n; i += QUOTA) {
  39552. crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
  39553. }
  39554. for (i = 0; i < n; i++) x[i] = v[i];
  39555. cleanup(v);
  39556. });
  39557. } else if (true) {
  39558. // Node.js.
  39559. crypto = __webpack_require__(3);
  39560. if (crypto && crypto.randomBytes) {
  39561. nacl.setPRNG(function(x, n) {
  39562. var i, v = crypto.randomBytes(n);
  39563. for (i = 0; i < n; i++) x[i] = v[i];
  39564. cleanup(v);
  39565. });
  39566. }
  39567. }
  39568. })();
  39569. })( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
  39570. /***/ }),
  39571. /* 1 */
  39572. /***/ (function(module, exports, __webpack_require__) {
  39573. // Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
  39574. // Public domain.
  39575. (function(root, f) {
  39576. 'use strict';
  39577. if ( true && module.exports) module.exports = f();
  39578. else if (root.nacl) root.nacl.util = f();
  39579. else {
  39580. root.nacl = {};
  39581. root.nacl.util = f();
  39582. }
  39583. }(this, function() {
  39584. 'use strict';
  39585. var util = {};
  39586. function validateBase64(s) {
  39587. if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) {
  39588. throw new TypeError('invalid encoding');
  39589. }
  39590. }
  39591. util.decodeUTF8 = function(s) {
  39592. if (typeof s !== 'string') throw new TypeError('expected string');
  39593. var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
  39594. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39595. return b;
  39596. };
  39597. util.encodeUTF8 = function(arr) {
  39598. var i, s = [];
  39599. for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
  39600. return decodeURIComponent(escape(s.join('')));
  39601. };
  39602. if (typeof atob === 'undefined') {
  39603. // Node.js
  39604. if (typeof Buffer.from !== 'undefined') {
  39605. // Node v6 and later
  39606. util.encodeBase64 = function (arr) { // v6 and later
  39607. return Buffer.from(arr).toString('base64');
  39608. };
  39609. util.decodeBase64 = function (s) {
  39610. validateBase64(s);
  39611. return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
  39612. };
  39613. } else {
  39614. // Node earlier than v6
  39615. util.encodeBase64 = function (arr) { // v6 and later
  39616. return (new Buffer(arr)).toString('base64');
  39617. };
  39618. util.decodeBase64 = function(s) {
  39619. validateBase64(s);
  39620. return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
  39621. };
  39622. }
  39623. } else {
  39624. // Browsers
  39625. util.encodeBase64 = function(arr) {
  39626. var i, s = [], len = arr.length;
  39627. for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
  39628. return btoa(s.join(''));
  39629. };
  39630. util.decodeBase64 = function(s) {
  39631. validateBase64(s);
  39632. var i, d = atob(s), b = new Uint8Array(d.length);
  39633. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39634. return b;
  39635. };
  39636. }
  39637. return util;
  39638. }));
  39639. /***/ }),
  39640. /* 2 */
  39641. /***/ (function(module, exports, __webpack_require__) {
  39642. // required so we don't have to do require('pusher').default etc.
  39643. module.exports = __webpack_require__(4).default;
  39644. /***/ }),
  39645. /* 3 */
  39646. /***/ (function(module, exports) {
  39647. /* (ignored) */
  39648. /***/ }),
  39649. /* 4 */
  39650. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  39651. "use strict";
  39652. __webpack_require__.r(__webpack_exports__);
  39653. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
  39654. var ScriptReceiverFactory = (function () {
  39655. function ScriptReceiverFactory(prefix, name) {
  39656. this.lastId = 0;
  39657. this.prefix = prefix;
  39658. this.name = name;
  39659. }
  39660. ScriptReceiverFactory.prototype.create = function (callback) {
  39661. this.lastId++;
  39662. var number = this.lastId;
  39663. var id = this.prefix + number;
  39664. var name = this.name + "[" + number + "]";
  39665. var called = false;
  39666. var callbackWrapper = function () {
  39667. if (!called) {
  39668. callback.apply(null, arguments);
  39669. called = true;
  39670. }
  39671. };
  39672. this[number] = callbackWrapper;
  39673. return { number: number, id: id, name: name, callback: callbackWrapper };
  39674. };
  39675. ScriptReceiverFactory.prototype.remove = function (receiver) {
  39676. delete this[receiver.number];
  39677. };
  39678. return ScriptReceiverFactory;
  39679. }());
  39680. var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
  39681. // CONCATENATED MODULE: ./src/core/defaults.ts
  39682. var Defaults = {
  39683. VERSION: "5.0.3",
  39684. PROTOCOL: 7,
  39685. host: 'ws.pusherapp.com',
  39686. ws_port: 80,
  39687. wss_port: 443,
  39688. ws_path: '',
  39689. sockjs_host: 'sockjs.pusher.com',
  39690. sockjs_http_port: 80,
  39691. sockjs_https_port: 443,
  39692. sockjs_path: '/pusher',
  39693. stats_host: 'stats.pusher.com',
  39694. channel_auth_endpoint: '/pusher/auth',
  39695. channel_auth_transport: 'ajax',
  39696. activity_timeout: 120000,
  39697. pong_timeout: 30000,
  39698. unavailable_timeout: 10000,
  39699. cdn_http: "http://js.pusher.com",
  39700. cdn_https: "https://js.pusher.com",
  39701. dependency_suffix: ""
  39702. };
  39703. /* harmony default export */ var defaults = (Defaults);
  39704. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
  39705. var dependency_loader_DependencyLoader = (function () {
  39706. function DependencyLoader(options) {
  39707. this.options = options;
  39708. this.receivers = options.receivers || ScriptReceivers;
  39709. this.loading = {};
  39710. }
  39711. DependencyLoader.prototype.load = function (name, options, callback) {
  39712. var self = this;
  39713. if (self.loading[name] && self.loading[name].length > 0) {
  39714. self.loading[name].push(callback);
  39715. }
  39716. else {
  39717. self.loading[name] = [callback];
  39718. var request = runtime.createScriptRequest(self.getPath(name, options));
  39719. var receiver = self.receivers.create(function (error) {
  39720. self.receivers.remove(receiver);
  39721. if (self.loading[name]) {
  39722. var callbacks = self.loading[name];
  39723. delete self.loading[name];
  39724. var successCallback = function (wasSuccessful) {
  39725. if (!wasSuccessful) {
  39726. request.cleanup();
  39727. }
  39728. };
  39729. for (var i = 0; i < callbacks.length; i++) {
  39730. callbacks[i](error, successCallback);
  39731. }
  39732. }
  39733. });
  39734. request.send(receiver);
  39735. }
  39736. };
  39737. DependencyLoader.prototype.getRoot = function (options) {
  39738. var cdn;
  39739. var protocol = runtime.getDocument().location.protocol;
  39740. if ((options && options.useTLS) || protocol === "https:") {
  39741. cdn = this.options.cdn_https;
  39742. }
  39743. else {
  39744. cdn = this.options.cdn_http;
  39745. }
  39746. return cdn.replace(/\/*$/, "") + "/" + this.options.version;
  39747. };
  39748. DependencyLoader.prototype.getPath = function (name, options) {
  39749. return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
  39750. };
  39751. ;
  39752. return DependencyLoader;
  39753. }());
  39754. /* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
  39755. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
  39756. var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
  39757. var Dependencies = new dependency_loader({
  39758. cdn_http: defaults.cdn_http,
  39759. cdn_https: defaults.cdn_https,
  39760. version: defaults.VERSION,
  39761. suffix: defaults.dependency_suffix,
  39762. receivers: DependenciesReceivers
  39763. });
  39764. // CONCATENATED MODULE: ./src/core/base64.ts
  39765. function encode(s) {
  39766. return btoa(utob(s));
  39767. }
  39768. var fromCharCode = String.fromCharCode;
  39769. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  39770. var b64tab = {};
  39771. for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
  39772. b64tab[b64chars.charAt(base64_i)] = base64_i;
  39773. }
  39774. var cb_utob = function (c) {
  39775. var cc = c.charCodeAt(0);
  39776. return cc < 0x80
  39777. ? c
  39778. : cc < 0x800
  39779. ? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
  39780. : fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
  39781. fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
  39782. fromCharCode(0x80 | (cc & 0x3f));
  39783. };
  39784. var utob = function (u) {
  39785. return u.replace(/[^\x00-\x7F]/g, cb_utob);
  39786. };
  39787. var cb_encode = function (ccc) {
  39788. var padlen = [0, 2, 1][ccc.length % 3];
  39789. var ord = (ccc.charCodeAt(0) << 16) |
  39790. ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
  39791. (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
  39792. var chars = [
  39793. b64chars.charAt(ord >>> 18),
  39794. b64chars.charAt((ord >>> 12) & 63),
  39795. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  39796. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  39797. ];
  39798. return chars.join('');
  39799. };
  39800. var btoa = window.btoa ||
  39801. function (b) {
  39802. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  39803. };
  39804. // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
  39805. var Timer = (function () {
  39806. function Timer(set, clear, delay, callback) {
  39807. var _this = this;
  39808. this.clear = clear;
  39809. this.timer = set(function () {
  39810. if (_this.timer) {
  39811. _this.timer = callback(_this.timer);
  39812. }
  39813. }, delay);
  39814. }
  39815. Timer.prototype.isRunning = function () {
  39816. return this.timer !== null;
  39817. };
  39818. Timer.prototype.ensureAborted = function () {
  39819. if (this.timer) {
  39820. this.clear(this.timer);
  39821. this.timer = null;
  39822. }
  39823. };
  39824. return Timer;
  39825. }());
  39826. /* harmony default export */ var abstract_timer = (Timer);
  39827. // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
  39828. var __extends = (undefined && undefined.__extends) || (function () {
  39829. var extendStatics = function (d, b) {
  39830. extendStatics = Object.setPrototypeOf ||
  39831. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39832. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39833. return extendStatics(d, b);
  39834. };
  39835. return function (d, b) {
  39836. extendStatics(d, b);
  39837. function __() { this.constructor = d; }
  39838. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39839. };
  39840. })();
  39841. function timers_clearTimeout(timer) {
  39842. window.clearTimeout(timer);
  39843. }
  39844. function timers_clearInterval(timer) {
  39845. window.clearInterval(timer);
  39846. }
  39847. var OneOffTimer = (function (_super) {
  39848. __extends(OneOffTimer, _super);
  39849. function OneOffTimer(delay, callback) {
  39850. return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
  39851. callback();
  39852. return null;
  39853. }) || this;
  39854. }
  39855. return OneOffTimer;
  39856. }(abstract_timer));
  39857. var PeriodicTimer = (function (_super) {
  39858. __extends(PeriodicTimer, _super);
  39859. function PeriodicTimer(delay, callback) {
  39860. return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
  39861. callback();
  39862. return timer;
  39863. }) || this;
  39864. }
  39865. return PeriodicTimer;
  39866. }(abstract_timer));
  39867. // CONCATENATED MODULE: ./src/core/util.ts
  39868. var Util = {
  39869. now: function () {
  39870. if (Date.now) {
  39871. return Date.now();
  39872. }
  39873. else {
  39874. return new Date().valueOf();
  39875. }
  39876. },
  39877. defer: function (callback) {
  39878. return new OneOffTimer(0, callback);
  39879. },
  39880. method: function (name) {
  39881. var args = [];
  39882. for (var _i = 1; _i < arguments.length; _i++) {
  39883. args[_i - 1] = arguments[_i];
  39884. }
  39885. var boundArguments = Array.prototype.slice.call(arguments, 1);
  39886. return function (object) {
  39887. return object[name].apply(object, boundArguments.concat(arguments));
  39888. };
  39889. }
  39890. };
  39891. /* harmony default export */ var util = (Util);
  39892. // CONCATENATED MODULE: ./src/core/utils/collections.ts
  39893. function extend(target) {
  39894. var sources = [];
  39895. for (var _i = 1; _i < arguments.length; _i++) {
  39896. sources[_i - 1] = arguments[_i];
  39897. }
  39898. for (var i = 0; i < sources.length; i++) {
  39899. var extensions = sources[i];
  39900. for (var property in extensions) {
  39901. if (extensions[property] && extensions[property].constructor &&
  39902. extensions[property].constructor === Object) {
  39903. target[property] = extend(target[property] || {}, extensions[property]);
  39904. }
  39905. else {
  39906. target[property] = extensions[property];
  39907. }
  39908. }
  39909. }
  39910. return target;
  39911. }
  39912. function stringify() {
  39913. var m = ["Pusher"];
  39914. for (var i = 0; i < arguments.length; i++) {
  39915. if (typeof arguments[i] === "string") {
  39916. m.push(arguments[i]);
  39917. }
  39918. else {
  39919. m.push(safeJSONStringify(arguments[i]));
  39920. }
  39921. }
  39922. return m.join(" : ");
  39923. }
  39924. function arrayIndexOf(array, item) {
  39925. var nativeIndexOf = Array.prototype.indexOf;
  39926. if (array === null) {
  39927. return -1;
  39928. }
  39929. if (nativeIndexOf && array.indexOf === nativeIndexOf) {
  39930. return array.indexOf(item);
  39931. }
  39932. for (var i = 0, l = array.length; i < l; i++) {
  39933. if (array[i] === item) {
  39934. return i;
  39935. }
  39936. }
  39937. return -1;
  39938. }
  39939. function objectApply(object, f) {
  39940. for (var key in object) {
  39941. if (Object.prototype.hasOwnProperty.call(object, key)) {
  39942. f(object[key], key, object);
  39943. }
  39944. }
  39945. }
  39946. function keys(object) {
  39947. var keys = [];
  39948. objectApply(object, function (_, key) {
  39949. keys.push(key);
  39950. });
  39951. return keys;
  39952. }
  39953. function values(object) {
  39954. var values = [];
  39955. objectApply(object, function (value) {
  39956. values.push(value);
  39957. });
  39958. return values;
  39959. }
  39960. function apply(array, f, context) {
  39961. for (var i = 0; i < array.length; i++) {
  39962. f.call(context || window, array[i], i, array);
  39963. }
  39964. }
  39965. function map(array, f) {
  39966. var result = [];
  39967. for (var i = 0; i < array.length; i++) {
  39968. result.push(f(array[i], i, array, result));
  39969. }
  39970. return result;
  39971. }
  39972. function mapObject(object, f) {
  39973. var result = {};
  39974. objectApply(object, function (value, key) {
  39975. result[key] = f(value);
  39976. });
  39977. return result;
  39978. }
  39979. function filter(array, test) {
  39980. test = test || function (value) { return !!value; };
  39981. var result = [];
  39982. for (var i = 0; i < array.length; i++) {
  39983. if (test(array[i], i, array, result)) {
  39984. result.push(array[i]);
  39985. }
  39986. }
  39987. return result;
  39988. }
  39989. function filterObject(object, test) {
  39990. var result = {};
  39991. objectApply(object, function (value, key) {
  39992. if ((test && test(value, key, object, result)) || Boolean(value)) {
  39993. result[key] = value;
  39994. }
  39995. });
  39996. return result;
  39997. }
  39998. function flatten(object) {
  39999. var result = [];
  40000. objectApply(object, function (value, key) {
  40001. result.push([key, value]);
  40002. });
  40003. return result;
  40004. }
  40005. function any(array, test) {
  40006. for (var i = 0; i < array.length; i++) {
  40007. if (test(array[i], i, array)) {
  40008. return true;
  40009. }
  40010. }
  40011. return false;
  40012. }
  40013. function collections_all(array, test) {
  40014. for (var i = 0; i < array.length; i++) {
  40015. if (!test(array[i], i, array)) {
  40016. return false;
  40017. }
  40018. }
  40019. return true;
  40020. }
  40021. function encodeParamsObject(data) {
  40022. return mapObject(data, function (value) {
  40023. if (typeof value === "object") {
  40024. value = safeJSONStringify(value);
  40025. }
  40026. return encodeURIComponent(encode(value.toString()));
  40027. });
  40028. }
  40029. function buildQueryString(data) {
  40030. var params = filterObject(data, function (value) {
  40031. return value !== undefined;
  40032. });
  40033. var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
  40034. return query;
  40035. }
  40036. function decycleObject(object) {
  40037. var objects = [], paths = [];
  40038. return (function derez(value, path) {
  40039. var i, name, nu;
  40040. switch (typeof value) {
  40041. case 'object':
  40042. if (!value) {
  40043. return null;
  40044. }
  40045. for (i = 0; i < objects.length; i += 1) {
  40046. if (objects[i] === value) {
  40047. return { $ref: paths[i] };
  40048. }
  40049. }
  40050. objects.push(value);
  40051. paths.push(path);
  40052. if (Object.prototype.toString.apply(value) === '[object Array]') {
  40053. nu = [];
  40054. for (i = 0; i < value.length; i += 1) {
  40055. nu[i] = derez(value[i], path + '[' + i + ']');
  40056. }
  40057. }
  40058. else {
  40059. nu = {};
  40060. for (name in value) {
  40061. if (Object.prototype.hasOwnProperty.call(value, name)) {
  40062. nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
  40063. }
  40064. }
  40065. }
  40066. return nu;
  40067. case 'number':
  40068. case 'string':
  40069. case 'boolean':
  40070. return value;
  40071. }
  40072. }(object, '$'));
  40073. }
  40074. function safeJSONStringify(source) {
  40075. try {
  40076. return JSON.stringify(source);
  40077. }
  40078. catch (e) {
  40079. return JSON.stringify(decycleObject(source));
  40080. }
  40081. }
  40082. // CONCATENATED MODULE: ./src/core/logger.ts
  40083. var logger_Logger = (function () {
  40084. function Logger() {
  40085. this.globalLog = function (message) {
  40086. if (window.console && window.console.log) {
  40087. window.console.log(message);
  40088. }
  40089. };
  40090. }
  40091. Logger.prototype.debug = function () {
  40092. var args = [];
  40093. for (var _i = 0; _i < arguments.length; _i++) {
  40094. args[_i] = arguments[_i];
  40095. }
  40096. this.log(this.globalLog, args);
  40097. };
  40098. Logger.prototype.warn = function () {
  40099. var args = [];
  40100. for (var _i = 0; _i < arguments.length; _i++) {
  40101. args[_i] = arguments[_i];
  40102. }
  40103. this.log(this.globalLogWarn, args);
  40104. };
  40105. Logger.prototype.error = function () {
  40106. var args = [];
  40107. for (var _i = 0; _i < arguments.length; _i++) {
  40108. args[_i] = arguments[_i];
  40109. }
  40110. this.log(this.globalLogError, args);
  40111. };
  40112. Logger.prototype.globalLogWarn = function (message) {
  40113. if (window.console && window.console.warn) {
  40114. window.console.warn(message);
  40115. }
  40116. else {
  40117. this.globalLog(message);
  40118. }
  40119. };
  40120. Logger.prototype.globalLogError = function (message) {
  40121. if (window.console && window.console.error) {
  40122. window.console.error(message);
  40123. }
  40124. else {
  40125. this.globalLogWarn(message);
  40126. }
  40127. };
  40128. Logger.prototype.log = function (defaultLoggingFunction) {
  40129. var args = [];
  40130. for (var _i = 1; _i < arguments.length; _i++) {
  40131. args[_i - 1] = arguments[_i];
  40132. }
  40133. var message = stringify.apply(this, arguments);
  40134. if (core_pusher.log) {
  40135. core_pusher.log(message);
  40136. }
  40137. else if (core_pusher.logToConsole) {
  40138. var log = defaultLoggingFunction.bind(this);
  40139. log(message);
  40140. }
  40141. };
  40142. return Logger;
  40143. }());
  40144. /* harmony default export */ var logger = (new logger_Logger());
  40145. // CONCATENATED MODULE: ./src/core/utils/url_store.ts
  40146. var urlStore = {
  40147. baseUrl: "https://pusher.com",
  40148. urls: {
  40149. authenticationEndpoint: {
  40150. path: "/docs/authenticating_users",
  40151. },
  40152. javascriptQuickStart: {
  40153. path: "/docs/javascript_quick_start"
  40154. },
  40155. triggeringClientEvents: {
  40156. path: "/docs/client_api_guide/client_events#trigger-events"
  40157. }
  40158. }
  40159. };
  40160. var buildLogSuffix = function (key) {
  40161. var urlPrefix = "See:";
  40162. var urlObj = urlStore.urls[key];
  40163. if (!urlObj)
  40164. return "";
  40165. var url;
  40166. if (urlObj.fullUrl) {
  40167. url = urlObj.fullUrl;
  40168. }
  40169. else if (urlObj.path) {
  40170. url = urlStore.baseUrl + urlObj.path;
  40171. }
  40172. if (!url)
  40173. return "";
  40174. return urlPrefix + " " + url;
  40175. };
  40176. /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
  40177. // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
  40178. var ajax = function (context, socketId, callback) {
  40179. var self = this, xhr;
  40180. xhr = runtime.createXHR();
  40181. xhr.open("POST", self.options.authEndpoint, true);
  40182. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  40183. for (var headerName in this.authOptions.headers) {
  40184. xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
  40185. }
  40186. xhr.onreadystatechange = function () {
  40187. if (xhr.readyState === 4) {
  40188. if (xhr.status === 200) {
  40189. var data, parsed = false;
  40190. try {
  40191. data = JSON.parse(xhr.responseText);
  40192. parsed = true;
  40193. }
  40194. catch (e) {
  40195. callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
  40196. }
  40197. if (parsed) {
  40198. callback(false, data);
  40199. }
  40200. }
  40201. else {
  40202. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  40203. logger.error('Unable to retrieve auth string from auth endpoint - ' +
  40204. ("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
  40205. ("Clients must be authenticated to join private or presence channels. " + suffix));
  40206. callback(true, xhr.status);
  40207. }
  40208. }
  40209. };
  40210. xhr.send(this.composeQuery(socketId));
  40211. return xhr;
  40212. };
  40213. /* harmony default export */ var xhr_auth = (ajax);
  40214. // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
  40215. var jsonp = function (context, socketId, callback) {
  40216. if (this.authOptions.headers !== undefined) {
  40217. logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
  40218. }
  40219. var callbackName = context.nextAuthCallbackID.toString();
  40220. context.nextAuthCallbackID++;
  40221. var document = context.getDocument();
  40222. var script = document.createElement("script");
  40223. context.auth_callbacks[callbackName] = function (data) {
  40224. callback(false, data);
  40225. };
  40226. var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  40227. script.src = this.options.authEndpoint +
  40228. '?callback=' +
  40229. encodeURIComponent(callback_name) +
  40230. '&' +
  40231. this.composeQuery(socketId);
  40232. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  40233. head.insertBefore(script, head.firstChild);
  40234. };
  40235. /* harmony default export */ var jsonp_auth = (jsonp);
  40236. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
  40237. var ScriptRequest = (function () {
  40238. function ScriptRequest(src) {
  40239. this.src = src;
  40240. }
  40241. ScriptRequest.prototype.send = function (receiver) {
  40242. var self = this;
  40243. var errorString = "Error loading " + self.src;
  40244. self.script = document.createElement("script");
  40245. self.script.id = receiver.id;
  40246. self.script.src = self.src;
  40247. self.script.type = "text/javascript";
  40248. self.script.charset = "UTF-8";
  40249. if (self.script.addEventListener) {
  40250. self.script.onerror = function () {
  40251. receiver.callback(errorString);
  40252. };
  40253. self.script.onload = function () {
  40254. receiver.callback(null);
  40255. };
  40256. }
  40257. else {
  40258. self.script.onreadystatechange = function () {
  40259. if (self.script.readyState === 'loaded' ||
  40260. self.script.readyState === 'complete') {
  40261. receiver.callback(null);
  40262. }
  40263. };
  40264. }
  40265. if (self.script.async === undefined && document.attachEvent &&
  40266. /opera/i.test(navigator.userAgent)) {
  40267. self.errorScript = document.createElement("script");
  40268. self.errorScript.id = receiver.id + "_error";
  40269. self.errorScript.text = receiver.name + "('" + errorString + "');";
  40270. self.script.async = self.errorScript.async = false;
  40271. }
  40272. else {
  40273. self.script.async = true;
  40274. }
  40275. var head = document.getElementsByTagName('head')[0];
  40276. head.insertBefore(self.script, head.firstChild);
  40277. if (self.errorScript) {
  40278. head.insertBefore(self.errorScript, self.script.nextSibling);
  40279. }
  40280. };
  40281. ScriptRequest.prototype.cleanup = function () {
  40282. if (this.script) {
  40283. this.script.onload = this.script.onerror = null;
  40284. this.script.onreadystatechange = null;
  40285. }
  40286. if (this.script && this.script.parentNode) {
  40287. this.script.parentNode.removeChild(this.script);
  40288. }
  40289. if (this.errorScript && this.errorScript.parentNode) {
  40290. this.errorScript.parentNode.removeChild(this.errorScript);
  40291. }
  40292. this.script = null;
  40293. this.errorScript = null;
  40294. };
  40295. return ScriptRequest;
  40296. }());
  40297. /* harmony default export */ var script_request = (ScriptRequest);
  40298. // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
  40299. var jsonp_request_JSONPRequest = (function () {
  40300. function JSONPRequest(url, data) {
  40301. this.url = url;
  40302. this.data = data;
  40303. }
  40304. JSONPRequest.prototype.send = function (receiver) {
  40305. if (this.request) {
  40306. return;
  40307. }
  40308. var query = buildQueryString(this.data);
  40309. var url = this.url + "/" + receiver.number + "?" + query;
  40310. this.request = runtime.createScriptRequest(url);
  40311. this.request.send(receiver);
  40312. };
  40313. JSONPRequest.prototype.cleanup = function () {
  40314. if (this.request) {
  40315. this.request.cleanup();
  40316. }
  40317. };
  40318. return JSONPRequest;
  40319. }());
  40320. /* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
  40321. // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
  40322. var getAgent = function (sender, useTLS) {
  40323. return function (data, callback) {
  40324. var scheme = "http" + (useTLS ? "s" : "") + "://";
  40325. var url = scheme + (sender.host || sender.options.host) + sender.options.path;
  40326. var request = runtime.createJSONPRequest(url, data);
  40327. var receiver = runtime.ScriptReceivers.create(function (error, result) {
  40328. ScriptReceivers.remove(receiver);
  40329. request.cleanup();
  40330. if (result && result.host) {
  40331. sender.host = result.host;
  40332. }
  40333. if (callback) {
  40334. callback(error, result);
  40335. }
  40336. });
  40337. request.send(receiver);
  40338. };
  40339. };
  40340. var jsonp_timeline_jsonp = {
  40341. name: 'jsonp',
  40342. getAgent: getAgent
  40343. };
  40344. /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
  40345. // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
  40346. function getGenericURL(baseScheme, params, path) {
  40347. var scheme = baseScheme + (params.useTLS ? "s" : "");
  40348. var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
  40349. return scheme + "://" + host + path;
  40350. }
  40351. function getGenericPath(key, queryString) {
  40352. var path = "/app/" + key;
  40353. var query = "?protocol=" + defaults.PROTOCOL +
  40354. "&client=js" +
  40355. "&version=" + defaults.VERSION +
  40356. (queryString ? ("&" + queryString) : "");
  40357. return path + query;
  40358. }
  40359. var ws = {
  40360. getInitial: function (key, params) {
  40361. var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
  40362. return getGenericURL("ws", params, path);
  40363. }
  40364. };
  40365. var http = {
  40366. getInitial: function (key, params) {
  40367. var path = (params.httpPath || "/pusher") + getGenericPath(key);
  40368. return getGenericURL("http", params, path);
  40369. }
  40370. };
  40371. var sockjs = {
  40372. getInitial: function (key, params) {
  40373. return getGenericURL("http", params, params.httpPath || "/pusher");
  40374. },
  40375. getPath: function (key, params) {
  40376. return getGenericPath(key);
  40377. }
  40378. };
  40379. // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
  40380. var callback_registry_CallbackRegistry = (function () {
  40381. function CallbackRegistry() {
  40382. this._callbacks = {};
  40383. }
  40384. CallbackRegistry.prototype.get = function (name) {
  40385. return this._callbacks[prefix(name)];
  40386. };
  40387. CallbackRegistry.prototype.add = function (name, callback, context) {
  40388. var prefixedEventName = prefix(name);
  40389. this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
  40390. this._callbacks[prefixedEventName].push({
  40391. fn: callback,
  40392. context: context
  40393. });
  40394. };
  40395. CallbackRegistry.prototype.remove = function (name, callback, context) {
  40396. if (!name && !callback && !context) {
  40397. this._callbacks = {};
  40398. return;
  40399. }
  40400. var names = name ? [prefix(name)] : keys(this._callbacks);
  40401. if (callback || context) {
  40402. this.removeCallback(names, callback, context);
  40403. }
  40404. else {
  40405. this.removeAllCallbacks(names);
  40406. }
  40407. };
  40408. CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
  40409. apply(names, function (name) {
  40410. this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
  40411. return (callback && callback !== binding.fn) ||
  40412. (context && context !== binding.context);
  40413. });
  40414. if (this._callbacks[name].length === 0) {
  40415. delete this._callbacks[name];
  40416. }
  40417. }, this);
  40418. };
  40419. CallbackRegistry.prototype.removeAllCallbacks = function (names) {
  40420. apply(names, function (name) {
  40421. delete this._callbacks[name];
  40422. }, this);
  40423. };
  40424. return CallbackRegistry;
  40425. }());
  40426. /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
  40427. function prefix(name) {
  40428. return "_" + name;
  40429. }
  40430. // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
  40431. var dispatcher_Dispatcher = (function () {
  40432. function Dispatcher(failThrough) {
  40433. this.callbacks = new callback_registry();
  40434. this.global_callbacks = [];
  40435. this.failThrough = failThrough;
  40436. }
  40437. Dispatcher.prototype.bind = function (eventName, callback, context) {
  40438. this.callbacks.add(eventName, callback, context);
  40439. return this;
  40440. };
  40441. Dispatcher.prototype.bind_global = function (callback) {
  40442. this.global_callbacks.push(callback);
  40443. return this;
  40444. };
  40445. Dispatcher.prototype.unbind = function (eventName, callback, context) {
  40446. this.callbacks.remove(eventName, callback, context);
  40447. return this;
  40448. };
  40449. Dispatcher.prototype.unbind_global = function (callback) {
  40450. if (!callback) {
  40451. this.global_callbacks = [];
  40452. return this;
  40453. }
  40454. this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
  40455. return this;
  40456. };
  40457. Dispatcher.prototype.unbind_all = function () {
  40458. this.unbind();
  40459. this.unbind_global();
  40460. return this;
  40461. };
  40462. Dispatcher.prototype.emit = function (eventName, data, metadata) {
  40463. for (var i = 0; i < this.global_callbacks.length; i++) {
  40464. this.global_callbacks[i](eventName, data);
  40465. }
  40466. var callbacks = this.callbacks.get(eventName);
  40467. var args = [];
  40468. if (metadata) {
  40469. args.push(data, metadata);
  40470. }
  40471. else if (data) {
  40472. args.push(data);
  40473. }
  40474. if (callbacks && callbacks.length > 0) {
  40475. for (var i = 0; i < callbacks.length; i++) {
  40476. callbacks[i].fn.apply(callbacks[i].context || window, args);
  40477. }
  40478. }
  40479. else if (this.failThrough) {
  40480. this.failThrough(eventName, data);
  40481. }
  40482. return this;
  40483. };
  40484. return Dispatcher;
  40485. }());
  40486. /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
  40487. // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
  40488. var transport_connection_extends = (undefined && undefined.__extends) || (function () {
  40489. var extendStatics = function (d, b) {
  40490. extendStatics = Object.setPrototypeOf ||
  40491. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40492. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40493. return extendStatics(d, b);
  40494. };
  40495. return function (d, b) {
  40496. extendStatics(d, b);
  40497. function __() { this.constructor = d; }
  40498. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40499. };
  40500. })();
  40501. var transport_connection_TransportConnection = (function (_super) {
  40502. transport_connection_extends(TransportConnection, _super);
  40503. function TransportConnection(hooks, name, priority, key, options) {
  40504. var _this = _super.call(this) || this;
  40505. _this.initialize = runtime.transportConnectionInitializer;
  40506. _this.hooks = hooks;
  40507. _this.name = name;
  40508. _this.priority = priority;
  40509. _this.key = key;
  40510. _this.options = options;
  40511. _this.state = "new";
  40512. _this.timeline = options.timeline;
  40513. _this.activityTimeout = options.activityTimeout;
  40514. _this.id = _this.timeline.generateUniqueID();
  40515. return _this;
  40516. }
  40517. TransportConnection.prototype.handlesActivityChecks = function () {
  40518. return Boolean(this.hooks.handlesActivityChecks);
  40519. };
  40520. TransportConnection.prototype.supportsPing = function () {
  40521. return Boolean(this.hooks.supportsPing);
  40522. };
  40523. TransportConnection.prototype.connect = function () {
  40524. var _this = this;
  40525. if (this.socket || this.state !== "initialized") {
  40526. return false;
  40527. }
  40528. var url = this.hooks.urls.getInitial(this.key, this.options);
  40529. try {
  40530. this.socket = this.hooks.getSocket(url, this.options);
  40531. }
  40532. catch (e) {
  40533. util.defer(function () {
  40534. _this.onError(e);
  40535. _this.changeState("closed");
  40536. });
  40537. return false;
  40538. }
  40539. this.bindListeners();
  40540. logger.debug("Connecting", { transport: this.name, url: url });
  40541. this.changeState("connecting");
  40542. return true;
  40543. };
  40544. TransportConnection.prototype.close = function () {
  40545. if (this.socket) {
  40546. this.socket.close();
  40547. return true;
  40548. }
  40549. else {
  40550. return false;
  40551. }
  40552. };
  40553. TransportConnection.prototype.send = function (data) {
  40554. var _this = this;
  40555. if (this.state === "open") {
  40556. util.defer(function () {
  40557. if (_this.socket) {
  40558. _this.socket.send(data);
  40559. }
  40560. });
  40561. return true;
  40562. }
  40563. else {
  40564. return false;
  40565. }
  40566. };
  40567. TransportConnection.prototype.ping = function () {
  40568. if (this.state === "open" && this.supportsPing()) {
  40569. this.socket.ping();
  40570. }
  40571. };
  40572. TransportConnection.prototype.onOpen = function () {
  40573. if (this.hooks.beforeOpen) {
  40574. this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
  40575. }
  40576. this.changeState("open");
  40577. this.socket.onopen = undefined;
  40578. };
  40579. TransportConnection.prototype.onError = function (error) {
  40580. this.emit("error", { type: 'WebSocketError', error: error });
  40581. this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
  40582. };
  40583. TransportConnection.prototype.onClose = function (closeEvent) {
  40584. if (closeEvent) {
  40585. this.changeState("closed", {
  40586. code: closeEvent.code,
  40587. reason: closeEvent.reason,
  40588. wasClean: closeEvent.wasClean
  40589. });
  40590. }
  40591. else {
  40592. this.changeState("closed");
  40593. }
  40594. this.unbindListeners();
  40595. this.socket = undefined;
  40596. };
  40597. TransportConnection.prototype.onMessage = function (message) {
  40598. this.emit("message", message);
  40599. };
  40600. TransportConnection.prototype.onActivity = function () {
  40601. this.emit("activity");
  40602. };
  40603. TransportConnection.prototype.bindListeners = function () {
  40604. var _this = this;
  40605. this.socket.onopen = function () {
  40606. _this.onOpen();
  40607. };
  40608. this.socket.onerror = function (error) {
  40609. _this.onError(error);
  40610. };
  40611. this.socket.onclose = function (closeEvent) {
  40612. _this.onClose(closeEvent);
  40613. };
  40614. this.socket.onmessage = function (message) {
  40615. _this.onMessage(message);
  40616. };
  40617. if (this.supportsPing()) {
  40618. this.socket.onactivity = function () { _this.onActivity(); };
  40619. }
  40620. };
  40621. TransportConnection.prototype.unbindListeners = function () {
  40622. if (this.socket) {
  40623. this.socket.onopen = undefined;
  40624. this.socket.onerror = undefined;
  40625. this.socket.onclose = undefined;
  40626. this.socket.onmessage = undefined;
  40627. if (this.supportsPing()) {
  40628. this.socket.onactivity = undefined;
  40629. }
  40630. }
  40631. };
  40632. TransportConnection.prototype.changeState = function (state, params) {
  40633. this.state = state;
  40634. this.timeline.info(this.buildTimelineMessage({
  40635. state: state,
  40636. params: params
  40637. }));
  40638. this.emit(state, params);
  40639. };
  40640. TransportConnection.prototype.buildTimelineMessage = function (message) {
  40641. return extend({ cid: this.id }, message);
  40642. };
  40643. return TransportConnection;
  40644. }(dispatcher));
  40645. /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
  40646. // CONCATENATED MODULE: ./src/core/transports/transport.ts
  40647. var transport_Transport = (function () {
  40648. function Transport(hooks) {
  40649. this.hooks = hooks;
  40650. }
  40651. Transport.prototype.isSupported = function (environment) {
  40652. return this.hooks.isSupported(environment);
  40653. };
  40654. Transport.prototype.createConnection = function (name, priority, key, options) {
  40655. return new transport_connection(this.hooks, name, priority, key, options);
  40656. };
  40657. return Transport;
  40658. }());
  40659. /* harmony default export */ var transports_transport = (transport_Transport);
  40660. // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
  40661. var WSTransport = new transports_transport({
  40662. urls: ws,
  40663. handlesActivityChecks: false,
  40664. supportsPing: false,
  40665. isInitialized: function () {
  40666. return Boolean(runtime.getWebSocketAPI());
  40667. },
  40668. isSupported: function () {
  40669. return Boolean(runtime.getWebSocketAPI());
  40670. },
  40671. getSocket: function (url) {
  40672. return runtime.createWebSocket(url);
  40673. }
  40674. });
  40675. var httpConfiguration = {
  40676. urls: http,
  40677. handlesActivityChecks: false,
  40678. supportsPing: true,
  40679. isInitialized: function () {
  40680. return true;
  40681. }
  40682. };
  40683. var streamingConfiguration = extend({ getSocket: function (url) {
  40684. return runtime.HTTPFactory.createStreamingSocket(url);
  40685. }
  40686. }, httpConfiguration);
  40687. var pollingConfiguration = extend({ getSocket: function (url) {
  40688. return runtime.HTTPFactory.createPollingSocket(url);
  40689. }
  40690. }, httpConfiguration);
  40691. var xhrConfiguration = {
  40692. isSupported: function () {
  40693. return runtime.isXHRSupported();
  40694. }
  40695. };
  40696. var XHRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xhrConfiguration));
  40697. var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
  40698. var Transports = {
  40699. ws: WSTransport,
  40700. xhr_streaming: XHRStreamingTransport,
  40701. xhr_polling: XHRPollingTransport
  40702. };
  40703. /* harmony default export */ var transports = (Transports);
  40704. // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
  40705. var SockJSTransport = new transports_transport({
  40706. file: "sockjs",
  40707. urls: sockjs,
  40708. handlesActivityChecks: true,
  40709. supportsPing: false,
  40710. isSupported: function () {
  40711. return true;
  40712. },
  40713. isInitialized: function () {
  40714. return window.SockJS !== undefined;
  40715. },
  40716. getSocket: function (url, options) {
  40717. return new window.SockJS(url, null, {
  40718. js_path: Dependencies.getPath("sockjs", {
  40719. useTLS: options.useTLS
  40720. }),
  40721. ignore_null_origin: options.ignoreNullOrigin
  40722. });
  40723. },
  40724. beforeOpen: function (socket, path) {
  40725. socket.send(JSON.stringify({
  40726. path: path
  40727. }));
  40728. }
  40729. });
  40730. var xdrConfiguration = {
  40731. isSupported: function (environment) {
  40732. var yes = runtime.isXDRSupported(environment.useTLS);
  40733. return yes;
  40734. }
  40735. };
  40736. var XDRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xdrConfiguration));
  40737. var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
  40738. transports.xdr_streaming = XDRStreamingTransport;
  40739. transports.xdr_polling = XDRPollingTransport;
  40740. transports.sockjs = SockJSTransport;
  40741. /* harmony default export */ var transports_transports = (transports);
  40742. // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
  40743. var net_info_extends = (undefined && undefined.__extends) || (function () {
  40744. var extendStatics = function (d, b) {
  40745. extendStatics = Object.setPrototypeOf ||
  40746. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40747. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40748. return extendStatics(d, b);
  40749. };
  40750. return function (d, b) {
  40751. extendStatics(d, b);
  40752. function __() { this.constructor = d; }
  40753. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40754. };
  40755. })();
  40756. var NetInfo = (function (_super) {
  40757. net_info_extends(NetInfo, _super);
  40758. function NetInfo() {
  40759. var _this = _super.call(this) || this;
  40760. var self = _this;
  40761. if (window.addEventListener !== undefined) {
  40762. window.addEventListener("online", function () {
  40763. self.emit('online');
  40764. }, false);
  40765. window.addEventListener("offline", function () {
  40766. self.emit('offline');
  40767. }, false);
  40768. }
  40769. return _this;
  40770. }
  40771. NetInfo.prototype.isOnline = function () {
  40772. if (window.navigator.onLine === undefined) {
  40773. return true;
  40774. }
  40775. else {
  40776. return window.navigator.onLine;
  40777. }
  40778. };
  40779. return NetInfo;
  40780. }(dispatcher));
  40781. var net_info_Network = new NetInfo();
  40782. // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
  40783. var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
  40784. function AssistantToTheTransportManager(manager, transport, options) {
  40785. this.manager = manager;
  40786. this.transport = transport;
  40787. this.minPingDelay = options.minPingDelay;
  40788. this.maxPingDelay = options.maxPingDelay;
  40789. this.pingDelay = undefined;
  40790. }
  40791. AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
  40792. var _this = this;
  40793. options = extend({}, options, {
  40794. activityTimeout: this.pingDelay
  40795. });
  40796. var connection = this.transport.createConnection(name, priority, key, options);
  40797. var openTimestamp = null;
  40798. var onOpen = function () {
  40799. connection.unbind("open", onOpen);
  40800. connection.bind("closed", onClosed);
  40801. openTimestamp = util.now();
  40802. };
  40803. var onClosed = function (closeEvent) {
  40804. connection.unbind("closed", onClosed);
  40805. if (closeEvent.code === 1002 || closeEvent.code === 1003) {
  40806. _this.manager.reportDeath();
  40807. }
  40808. else if (!closeEvent.wasClean && openTimestamp) {
  40809. var lifespan = util.now() - openTimestamp;
  40810. if (lifespan < 2 * _this.maxPingDelay) {
  40811. _this.manager.reportDeath();
  40812. _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
  40813. }
  40814. }
  40815. };
  40816. connection.bind("open", onOpen);
  40817. return connection;
  40818. };
  40819. AssistantToTheTransportManager.prototype.isSupported = function (environment) {
  40820. return this.manager.isAlive() && this.transport.isSupported(environment);
  40821. };
  40822. return AssistantToTheTransportManager;
  40823. }());
  40824. /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
  40825. // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
  40826. var Protocol = {
  40827. decodeMessage: function (messageEvent) {
  40828. try {
  40829. var messageData = JSON.parse(messageEvent.data);
  40830. var pusherEventData = messageData.data;
  40831. if (typeof pusherEventData === 'string') {
  40832. try {
  40833. pusherEventData = JSON.parse(messageData.data);
  40834. }
  40835. catch (e) { }
  40836. }
  40837. var pusherEvent = {
  40838. event: messageData.event,
  40839. channel: messageData.channel,
  40840. data: pusherEventData,
  40841. };
  40842. if (messageData.user_id) {
  40843. pusherEvent.user_id = messageData.user_id;
  40844. }
  40845. return pusherEvent;
  40846. }
  40847. catch (e) {
  40848. throw { type: 'MessageParseError', error: e, data: messageEvent.data };
  40849. }
  40850. },
  40851. encodeMessage: function (event) {
  40852. return JSON.stringify(event);
  40853. },
  40854. processHandshake: function (messageEvent) {
  40855. var message = Protocol.decodeMessage(messageEvent);
  40856. if (message.event === "pusher:connection_established") {
  40857. if (!message.data.activity_timeout) {
  40858. throw "No activity timeout specified in handshake";
  40859. }
  40860. return {
  40861. action: "connected",
  40862. id: message.data.socket_id,
  40863. activityTimeout: message.data.activity_timeout * 1000
  40864. };
  40865. }
  40866. else if (message.event === "pusher:error") {
  40867. return {
  40868. action: this.getCloseAction(message.data),
  40869. error: this.getCloseError(message.data)
  40870. };
  40871. }
  40872. else {
  40873. throw "Invalid handshake";
  40874. }
  40875. },
  40876. getCloseAction: function (closeEvent) {
  40877. if (closeEvent.code < 4000) {
  40878. if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
  40879. return "backoff";
  40880. }
  40881. else {
  40882. return null;
  40883. }
  40884. }
  40885. else if (closeEvent.code === 4000) {
  40886. return "tls_only";
  40887. }
  40888. else if (closeEvent.code < 4100) {
  40889. return "refused";
  40890. }
  40891. else if (closeEvent.code < 4200) {
  40892. return "backoff";
  40893. }
  40894. else if (closeEvent.code < 4300) {
  40895. return "retry";
  40896. }
  40897. else {
  40898. return "refused";
  40899. }
  40900. },
  40901. getCloseError: function (closeEvent) {
  40902. if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
  40903. return {
  40904. type: 'PusherError',
  40905. data: {
  40906. code: closeEvent.code,
  40907. message: closeEvent.reason || closeEvent.message
  40908. }
  40909. };
  40910. }
  40911. else {
  40912. return null;
  40913. }
  40914. }
  40915. };
  40916. /* harmony default export */ var protocol_protocol = (Protocol);
  40917. // CONCATENATED MODULE: ./src/core/connection/connection.ts
  40918. var connection_extends = (undefined && undefined.__extends) || (function () {
  40919. var extendStatics = function (d, b) {
  40920. extendStatics = Object.setPrototypeOf ||
  40921. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40922. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40923. return extendStatics(d, b);
  40924. };
  40925. return function (d, b) {
  40926. extendStatics(d, b);
  40927. function __() { this.constructor = d; }
  40928. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40929. };
  40930. })();
  40931. var connection_Connection = (function (_super) {
  40932. connection_extends(Connection, _super);
  40933. function Connection(id, transport) {
  40934. var _this = _super.call(this) || this;
  40935. _this.id = id;
  40936. _this.transport = transport;
  40937. _this.activityTimeout = transport.activityTimeout;
  40938. _this.bindListeners();
  40939. return _this;
  40940. }
  40941. Connection.prototype.handlesActivityChecks = function () {
  40942. return this.transport.handlesActivityChecks();
  40943. };
  40944. Connection.prototype.send = function (data) {
  40945. return this.transport.send(data);
  40946. };
  40947. Connection.prototype.send_event = function (name, data, channel) {
  40948. var event = { event: name, data: data };
  40949. if (channel) {
  40950. event.channel = channel;
  40951. }
  40952. logger.debug('Event sent', event);
  40953. return this.send(protocol_protocol.encodeMessage(event));
  40954. };
  40955. Connection.prototype.ping = function () {
  40956. if (this.transport.supportsPing()) {
  40957. this.transport.ping();
  40958. }
  40959. else {
  40960. this.send_event('pusher:ping', {});
  40961. }
  40962. };
  40963. Connection.prototype.close = function () {
  40964. this.transport.close();
  40965. };
  40966. Connection.prototype.bindListeners = function () {
  40967. var _this = this;
  40968. var listeners = {
  40969. message: function (messageEvent) {
  40970. var pusherEvent;
  40971. try {
  40972. pusherEvent = protocol_protocol.decodeMessage(messageEvent);
  40973. }
  40974. catch (e) {
  40975. _this.emit('error', {
  40976. type: 'MessageParseError',
  40977. error: e,
  40978. data: messageEvent.data
  40979. });
  40980. }
  40981. if (pusherEvent !== undefined) {
  40982. logger.debug('Event recd', pusherEvent);
  40983. switch (pusherEvent.event) {
  40984. case 'pusher:error':
  40985. _this.emit('error', { type: 'PusherError', data: pusherEvent.data });
  40986. break;
  40987. case 'pusher:ping':
  40988. _this.emit("ping");
  40989. break;
  40990. case 'pusher:pong':
  40991. _this.emit("pong");
  40992. break;
  40993. }
  40994. _this.emit('message', pusherEvent);
  40995. }
  40996. },
  40997. activity: function () {
  40998. _this.emit("activity");
  40999. },
  41000. error: function (error) {
  41001. _this.emit("error", { type: "WebSocketError", error: error });
  41002. },
  41003. closed: function (closeEvent) {
  41004. unbindListeners();
  41005. if (closeEvent && closeEvent.code) {
  41006. _this.handleCloseEvent(closeEvent);
  41007. }
  41008. _this.transport = null;
  41009. _this.emit("closed");
  41010. }
  41011. };
  41012. var unbindListeners = function () {
  41013. objectApply(listeners, function (listener, event) {
  41014. _this.transport.unbind(event, listener);
  41015. });
  41016. };
  41017. objectApply(listeners, function (listener, event) {
  41018. _this.transport.bind(event, listener);
  41019. });
  41020. };
  41021. Connection.prototype.handleCloseEvent = function (closeEvent) {
  41022. var action = protocol_protocol.getCloseAction(closeEvent);
  41023. var error = protocol_protocol.getCloseError(closeEvent);
  41024. if (error) {
  41025. this.emit('error', error);
  41026. }
  41027. if (action) {
  41028. this.emit(action, { action: action, error: error });
  41029. }
  41030. };
  41031. return Connection;
  41032. }(dispatcher));
  41033. /* harmony default export */ var connection_connection = (connection_Connection);
  41034. // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
  41035. var handshake_Handshake = (function () {
  41036. function Handshake(transport, callback) {
  41037. this.transport = transport;
  41038. this.callback = callback;
  41039. this.bindListeners();
  41040. }
  41041. Handshake.prototype.close = function () {
  41042. this.unbindListeners();
  41043. this.transport.close();
  41044. };
  41045. Handshake.prototype.bindListeners = function () {
  41046. var _this = this;
  41047. this.onMessage = function (m) {
  41048. _this.unbindListeners();
  41049. var result;
  41050. try {
  41051. result = protocol_protocol.processHandshake(m);
  41052. }
  41053. catch (e) {
  41054. _this.finish("error", { error: e });
  41055. _this.transport.close();
  41056. return;
  41057. }
  41058. if (result.action === "connected") {
  41059. _this.finish("connected", {
  41060. connection: new connection_connection(result.id, _this.transport),
  41061. activityTimeout: result.activityTimeout
  41062. });
  41063. }
  41064. else {
  41065. _this.finish(result.action, { error: result.error });
  41066. _this.transport.close();
  41067. }
  41068. };
  41069. this.onClosed = function (closeEvent) {
  41070. _this.unbindListeners();
  41071. var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
  41072. var error = protocol_protocol.getCloseError(closeEvent);
  41073. _this.finish(action, { error: error });
  41074. };
  41075. this.transport.bind("message", this.onMessage);
  41076. this.transport.bind("closed", this.onClosed);
  41077. };
  41078. Handshake.prototype.unbindListeners = function () {
  41079. this.transport.unbind("message", this.onMessage);
  41080. this.transport.unbind("closed", this.onClosed);
  41081. };
  41082. Handshake.prototype.finish = function (action, params) {
  41083. this.callback(extend({ transport: this.transport, action: action }, params));
  41084. };
  41085. return Handshake;
  41086. }());
  41087. /* harmony default export */ var connection_handshake = (handshake_Handshake);
  41088. // CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
  41089. var pusher_authorizer_PusherAuthorizer = (function () {
  41090. function PusherAuthorizer(channel, options) {
  41091. this.channel = channel;
  41092. var authTransport = options.authTransport;
  41093. if (typeof runtime.getAuthorizers()[authTransport] === "undefined") {
  41094. throw "'" + authTransport + "' is not a recognized auth transport";
  41095. }
  41096. this.type = authTransport;
  41097. this.options = options;
  41098. this.authOptions = (options || {}).auth || {};
  41099. }
  41100. PusherAuthorizer.prototype.composeQuery = function (socketId) {
  41101. var query = 'socket_id=' + encodeURIComponent(socketId) +
  41102. '&channel_name=' + encodeURIComponent(this.channel.name);
  41103. for (var i in this.authOptions.params) {
  41104. query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]);
  41105. }
  41106. return query;
  41107. };
  41108. PusherAuthorizer.prototype.authorize = function (socketId, callback) {
  41109. PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers();
  41110. return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
  41111. };
  41112. return PusherAuthorizer;
  41113. }());
  41114. /* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
  41115. // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
  41116. var timeline_sender_TimelineSender = (function () {
  41117. function TimelineSender(timeline, options) {
  41118. this.timeline = timeline;
  41119. this.options = options || {};
  41120. }
  41121. TimelineSender.prototype.send = function (useTLS, callback) {
  41122. if (this.timeline.isEmpty()) {
  41123. return;
  41124. }
  41125. this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
  41126. };
  41127. return TimelineSender;
  41128. }());
  41129. /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
  41130. // CONCATENATED MODULE: ./src/core/errors.ts
  41131. var errors_extends = (undefined && undefined.__extends) || (function () {
  41132. var extendStatics = function (d, b) {
  41133. extendStatics = Object.setPrototypeOf ||
  41134. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41135. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41136. return extendStatics(d, b);
  41137. };
  41138. return function (d, b) {
  41139. extendStatics(d, b);
  41140. function __() { this.constructor = d; }
  41141. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41142. };
  41143. })();
  41144. var BadEventName = (function (_super) {
  41145. errors_extends(BadEventName, _super);
  41146. function BadEventName(msg) {
  41147. var _newTarget = this.constructor;
  41148. var _this = _super.call(this, msg) || this;
  41149. Object.setPrototypeOf(_this, _newTarget.prototype);
  41150. return _this;
  41151. }
  41152. return BadEventName;
  41153. }(Error));
  41154. var RequestTimedOut = (function (_super) {
  41155. errors_extends(RequestTimedOut, _super);
  41156. function RequestTimedOut(msg) {
  41157. var _newTarget = this.constructor;
  41158. var _this = _super.call(this, msg) || this;
  41159. Object.setPrototypeOf(_this, _newTarget.prototype);
  41160. return _this;
  41161. }
  41162. return RequestTimedOut;
  41163. }(Error));
  41164. var TransportPriorityTooLow = (function (_super) {
  41165. errors_extends(TransportPriorityTooLow, _super);
  41166. function TransportPriorityTooLow(msg) {
  41167. var _newTarget = this.constructor;
  41168. var _this = _super.call(this, msg) || this;
  41169. Object.setPrototypeOf(_this, _newTarget.prototype);
  41170. return _this;
  41171. }
  41172. return TransportPriorityTooLow;
  41173. }(Error));
  41174. var TransportClosed = (function (_super) {
  41175. errors_extends(TransportClosed, _super);
  41176. function TransportClosed(msg) {
  41177. var _newTarget = this.constructor;
  41178. var _this = _super.call(this, msg) || this;
  41179. Object.setPrototypeOf(_this, _newTarget.prototype);
  41180. return _this;
  41181. }
  41182. return TransportClosed;
  41183. }(Error));
  41184. var UnsupportedFeature = (function (_super) {
  41185. errors_extends(UnsupportedFeature, _super);
  41186. function UnsupportedFeature(msg) {
  41187. var _newTarget = this.constructor;
  41188. var _this = _super.call(this, msg) || this;
  41189. Object.setPrototypeOf(_this, _newTarget.prototype);
  41190. return _this;
  41191. }
  41192. return UnsupportedFeature;
  41193. }(Error));
  41194. var UnsupportedTransport = (function (_super) {
  41195. errors_extends(UnsupportedTransport, _super);
  41196. function UnsupportedTransport(msg) {
  41197. var _newTarget = this.constructor;
  41198. var _this = _super.call(this, msg) || this;
  41199. Object.setPrototypeOf(_this, _newTarget.prototype);
  41200. return _this;
  41201. }
  41202. return UnsupportedTransport;
  41203. }(Error));
  41204. var UnsupportedStrategy = (function (_super) {
  41205. errors_extends(UnsupportedStrategy, _super);
  41206. function UnsupportedStrategy(msg) {
  41207. var _newTarget = this.constructor;
  41208. var _this = _super.call(this, msg) || this;
  41209. Object.setPrototypeOf(_this, _newTarget.prototype);
  41210. return _this;
  41211. }
  41212. return UnsupportedStrategy;
  41213. }(Error));
  41214. // CONCATENATED MODULE: ./src/core/channels/channel.ts
  41215. var channel_extends = (undefined && undefined.__extends) || (function () {
  41216. var extendStatics = function (d, b) {
  41217. extendStatics = Object.setPrototypeOf ||
  41218. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41219. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41220. return extendStatics(d, b);
  41221. };
  41222. return function (d, b) {
  41223. extendStatics(d, b);
  41224. function __() { this.constructor = d; }
  41225. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41226. };
  41227. })();
  41228. var channel_Channel = (function (_super) {
  41229. channel_extends(Channel, _super);
  41230. function Channel(name, pusher) {
  41231. var _this = _super.call(this, function (event, data) {
  41232. logger.debug('No callbacks on ' + name + ' for ' + event);
  41233. }) || this;
  41234. _this.name = name;
  41235. _this.pusher = pusher;
  41236. _this.subscribed = false;
  41237. _this.subscriptionPending = false;
  41238. _this.subscriptionCancelled = false;
  41239. return _this;
  41240. }
  41241. Channel.prototype.authorize = function (socketId, callback) {
  41242. return callback(false, {});
  41243. };
  41244. Channel.prototype.trigger = function (event, data) {
  41245. if (event.indexOf("client-") !== 0) {
  41246. throw new BadEventName("Event '" + event + "' does not start with 'client-'");
  41247. }
  41248. if (!this.subscribed) {
  41249. var suffix = url_store.buildLogSuffix("triggeringClientEvents");
  41250. logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
  41251. }
  41252. return this.pusher.send_event(event, data, this.name);
  41253. };
  41254. Channel.prototype.disconnect = function () {
  41255. this.subscribed = false;
  41256. this.subscriptionPending = false;
  41257. };
  41258. Channel.prototype.handleEvent = function (event) {
  41259. var eventName = event.event;
  41260. var data = event.data;
  41261. if (eventName === "pusher_internal:subscription_succeeded") {
  41262. this.handleSubscriptionSucceededEvent(event);
  41263. }
  41264. else if (eventName.indexOf("pusher_internal:") !== 0) {
  41265. var metadata = {};
  41266. this.emit(eventName, data, metadata);
  41267. }
  41268. };
  41269. Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
  41270. this.subscriptionPending = false;
  41271. this.subscribed = true;
  41272. if (this.subscriptionCancelled) {
  41273. this.pusher.unsubscribe(this.name);
  41274. }
  41275. else {
  41276. this.emit("pusher:subscription_succeeded", event.data);
  41277. }
  41278. };
  41279. Channel.prototype.subscribe = function () {
  41280. var _this = this;
  41281. if (this.subscribed) {
  41282. return;
  41283. }
  41284. this.subscriptionPending = true;
  41285. this.subscriptionCancelled = false;
  41286. this.authorize(this.pusher.connection.socket_id, function (error, data) {
  41287. if (error) {
  41288. logger.error(data);
  41289. _this.emit('pusher:subscription_error', data);
  41290. }
  41291. else {
  41292. _this.pusher.send_event('pusher:subscribe', {
  41293. auth: data.auth,
  41294. channel_data: data.channel_data,
  41295. channel: _this.name
  41296. });
  41297. }
  41298. });
  41299. };
  41300. Channel.prototype.unsubscribe = function () {
  41301. this.subscribed = false;
  41302. this.pusher.send_event('pusher:unsubscribe', {
  41303. channel: this.name
  41304. });
  41305. };
  41306. Channel.prototype.cancelSubscription = function () {
  41307. this.subscriptionCancelled = true;
  41308. };
  41309. Channel.prototype.reinstateSubscription = function () {
  41310. this.subscriptionCancelled = false;
  41311. };
  41312. return Channel;
  41313. }(dispatcher));
  41314. /* harmony default export */ var channels_channel = (channel_Channel);
  41315. // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
  41316. var private_channel_extends = (undefined && undefined.__extends) || (function () {
  41317. var extendStatics = function (d, b) {
  41318. extendStatics = Object.setPrototypeOf ||
  41319. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41320. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41321. return extendStatics(d, b);
  41322. };
  41323. return function (d, b) {
  41324. extendStatics(d, b);
  41325. function __() { this.constructor = d; }
  41326. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41327. };
  41328. })();
  41329. var private_channel_PrivateChannel = (function (_super) {
  41330. private_channel_extends(PrivateChannel, _super);
  41331. function PrivateChannel() {
  41332. return _super !== null && _super.apply(this, arguments) || this;
  41333. }
  41334. PrivateChannel.prototype.authorize = function (socketId, callback) {
  41335. var authorizer = factory.createAuthorizer(this, this.pusher.config);
  41336. return authorizer.authorize(socketId, callback);
  41337. };
  41338. return PrivateChannel;
  41339. }(channels_channel));
  41340. /* harmony default export */ var private_channel = (private_channel_PrivateChannel);
  41341. // CONCATENATED MODULE: ./src/core/channels/members.ts
  41342. var members_Members = (function () {
  41343. function Members() {
  41344. this.reset();
  41345. }
  41346. Members.prototype.get = function (id) {
  41347. if (Object.prototype.hasOwnProperty.call(this.members, id)) {
  41348. return {
  41349. id: id,
  41350. info: this.members[id]
  41351. };
  41352. }
  41353. else {
  41354. return null;
  41355. }
  41356. };
  41357. Members.prototype.each = function (callback) {
  41358. var _this = this;
  41359. objectApply(this.members, function (member, id) {
  41360. callback(_this.get(id));
  41361. });
  41362. };
  41363. Members.prototype.setMyID = function (id) {
  41364. this.myID = id;
  41365. };
  41366. Members.prototype.onSubscription = function (subscriptionData) {
  41367. this.members = subscriptionData.presence.hash;
  41368. this.count = subscriptionData.presence.count;
  41369. this.me = this.get(this.myID);
  41370. };
  41371. Members.prototype.addMember = function (memberData) {
  41372. if (this.get(memberData.user_id) === null) {
  41373. this.count++;
  41374. }
  41375. this.members[memberData.user_id] = memberData.user_info;
  41376. return this.get(memberData.user_id);
  41377. };
  41378. Members.prototype.removeMember = function (memberData) {
  41379. var member = this.get(memberData.user_id);
  41380. if (member) {
  41381. delete this.members[memberData.user_id];
  41382. this.count--;
  41383. }
  41384. return member;
  41385. };
  41386. Members.prototype.reset = function () {
  41387. this.members = {};
  41388. this.count = 0;
  41389. this.myID = null;
  41390. this.me = null;
  41391. };
  41392. return Members;
  41393. }());
  41394. /* harmony default export */ var members = (members_Members);
  41395. // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
  41396. var presence_channel_extends = (undefined && undefined.__extends) || (function () {
  41397. var extendStatics = function (d, b) {
  41398. extendStatics = Object.setPrototypeOf ||
  41399. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41400. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41401. return extendStatics(d, b);
  41402. };
  41403. return function (d, b) {
  41404. extendStatics(d, b);
  41405. function __() { this.constructor = d; }
  41406. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41407. };
  41408. })();
  41409. var presence_channel_PresenceChannel = (function (_super) {
  41410. presence_channel_extends(PresenceChannel, _super);
  41411. function PresenceChannel(name, pusher) {
  41412. var _this = _super.call(this, name, pusher) || this;
  41413. _this.members = new members();
  41414. return _this;
  41415. }
  41416. PresenceChannel.prototype.authorize = function (socketId, callback) {
  41417. var _this = this;
  41418. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  41419. if (!error) {
  41420. if (authData.channel_data === undefined) {
  41421. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  41422. logger.error("Invalid auth response for channel '" + _this.name + "'," +
  41423. ("expected 'channel_data' field. " + suffix));
  41424. callback("Invalid auth response");
  41425. return;
  41426. }
  41427. var channelData = JSON.parse(authData.channel_data);
  41428. _this.members.setMyID(channelData.user_id);
  41429. }
  41430. callback(error, authData);
  41431. });
  41432. };
  41433. PresenceChannel.prototype.handleEvent = function (event) {
  41434. var eventName = event.event;
  41435. if (eventName.indexOf("pusher_internal:") === 0) {
  41436. this.handleInternalEvent(event);
  41437. }
  41438. else {
  41439. var data = event.data;
  41440. var metadata = {};
  41441. if (event.user_id) {
  41442. metadata.user_id = event.user_id;
  41443. }
  41444. this.emit(eventName, data, metadata);
  41445. }
  41446. };
  41447. PresenceChannel.prototype.handleInternalEvent = function (event) {
  41448. var eventName = event.event;
  41449. var data = event.data;
  41450. switch (eventName) {
  41451. case "pusher_internal:subscription_succeeded":
  41452. this.handleSubscriptionSucceededEvent(event);
  41453. break;
  41454. case "pusher_internal:member_added":
  41455. var addedMember = this.members.addMember(data);
  41456. this.emit('pusher:member_added', addedMember);
  41457. break;
  41458. case "pusher_internal:member_removed":
  41459. var removedMember = this.members.removeMember(data);
  41460. if (removedMember) {
  41461. this.emit('pusher:member_removed', removedMember);
  41462. }
  41463. break;
  41464. }
  41465. };
  41466. PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
  41467. this.subscriptionPending = false;
  41468. this.subscribed = true;
  41469. if (this.subscriptionCancelled) {
  41470. this.pusher.unsubscribe(this.name);
  41471. }
  41472. else {
  41473. this.members.onSubscription(event.data);
  41474. this.emit("pusher:subscription_succeeded", this.members);
  41475. }
  41476. };
  41477. PresenceChannel.prototype.disconnect = function () {
  41478. this.members.reset();
  41479. _super.prototype.disconnect.call(this);
  41480. };
  41481. return PresenceChannel;
  41482. }(private_channel));
  41483. /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
  41484. // EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
  41485. var nacl_fast = __webpack_require__(0);
  41486. // EXTERNAL MODULE: ./node_modules/tweetnacl-util/nacl-util.js
  41487. var nacl_util = __webpack_require__(1);
  41488. // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
  41489. var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
  41490. var extendStatics = function (d, b) {
  41491. extendStatics = Object.setPrototypeOf ||
  41492. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41493. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41494. return extendStatics(d, b);
  41495. };
  41496. return function (d, b) {
  41497. extendStatics(d, b);
  41498. function __() { this.constructor = d; }
  41499. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41500. };
  41501. })();
  41502. var encrypted_channel_EncryptedChannel = (function (_super) {
  41503. encrypted_channel_extends(EncryptedChannel, _super);
  41504. function EncryptedChannel() {
  41505. var _this = _super !== null && _super.apply(this, arguments) || this;
  41506. _this.key = null;
  41507. return _this;
  41508. }
  41509. EncryptedChannel.prototype.authorize = function (socketId, callback) {
  41510. var _this = this;
  41511. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  41512. if (error) {
  41513. callback(true, authData);
  41514. return;
  41515. }
  41516. var sharedSecret = authData["shared_secret"];
  41517. if (!sharedSecret) {
  41518. var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
  41519. callback(true, errorMsg);
  41520. return;
  41521. }
  41522. _this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
  41523. delete authData["shared_secret"];
  41524. callback(false, authData);
  41525. });
  41526. };
  41527. EncryptedChannel.prototype.trigger = function (event, data) {
  41528. throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
  41529. };
  41530. EncryptedChannel.prototype.handleEvent = function (event) {
  41531. var eventName = event.event;
  41532. var data = event.data;
  41533. if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
  41534. _super.prototype.handleEvent.call(this, event);
  41535. return;
  41536. }
  41537. this.handleEncryptedEvent(eventName, data);
  41538. };
  41539. EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
  41540. var _this = this;
  41541. if (!this.key) {
  41542. logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
  41543. return;
  41544. }
  41545. if (!data.ciphertext || !data.nonce) {
  41546. logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
  41547. return;
  41548. }
  41549. var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
  41550. if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
  41551. logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
  41552. return;
  41553. }
  41554. var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
  41555. if (nonce.length < nacl_fast["secretbox"].nonceLength) {
  41556. logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
  41557. return;
  41558. }
  41559. var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
  41560. if (bytes === null) {
  41561. logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
  41562. this.authorize(this.pusher.connection.socket_id, function (error, authData) {
  41563. if (error) {
  41564. logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
  41565. return;
  41566. }
  41567. bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
  41568. if (bytes === null) {
  41569. logger.error("Failed to decrypt event with new key. Dropping encrypted event");
  41570. return;
  41571. }
  41572. _this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41573. return;
  41574. });
  41575. return;
  41576. }
  41577. this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41578. };
  41579. EncryptedChannel.prototype.emitJSON = function (eventName, data) {
  41580. try {
  41581. this.emit(eventName, JSON.parse(data));
  41582. }
  41583. catch (e) {
  41584. this.emit(eventName, data);
  41585. }
  41586. return this;
  41587. };
  41588. return EncryptedChannel;
  41589. }(private_channel));
  41590. /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
  41591. // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
  41592. var connection_manager_extends = (undefined && undefined.__extends) || (function () {
  41593. var extendStatics = function (d, b) {
  41594. extendStatics = Object.setPrototypeOf ||
  41595. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41596. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41597. return extendStatics(d, b);
  41598. };
  41599. return function (d, b) {
  41600. extendStatics(d, b);
  41601. function __() { this.constructor = d; }
  41602. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41603. };
  41604. })();
  41605. var connection_manager_ConnectionManager = (function (_super) {
  41606. connection_manager_extends(ConnectionManager, _super);
  41607. function ConnectionManager(key, options) {
  41608. var _this = _super.call(this) || this;
  41609. _this.key = key;
  41610. _this.options = options || {};
  41611. _this.state = "initialized";
  41612. _this.connection = null;
  41613. _this.usingTLS = !!options.useTLS;
  41614. _this.timeline = _this.options.timeline;
  41615. _this.errorCallbacks = _this.buildErrorCallbacks();
  41616. _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
  41617. _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
  41618. var Network = runtime.getNetwork();
  41619. Network.bind("online", function () {
  41620. _this.timeline.info({ netinfo: "online" });
  41621. if (_this.state === "connecting" || _this.state === "unavailable") {
  41622. _this.retryIn(0);
  41623. }
  41624. });
  41625. Network.bind("offline", function () {
  41626. _this.timeline.info({ netinfo: "offline" });
  41627. if (_this.connection) {
  41628. _this.sendActivityCheck();
  41629. }
  41630. });
  41631. _this.updateStrategy();
  41632. return _this;
  41633. }
  41634. ConnectionManager.prototype.connect = function () {
  41635. if (this.connection || this.runner) {
  41636. return;
  41637. }
  41638. if (!this.strategy.isSupported()) {
  41639. this.updateState("failed");
  41640. return;
  41641. }
  41642. this.updateState("connecting");
  41643. this.startConnecting();
  41644. this.setUnavailableTimer();
  41645. };
  41646. ;
  41647. ConnectionManager.prototype.send = function (data) {
  41648. if (this.connection) {
  41649. return this.connection.send(data);
  41650. }
  41651. else {
  41652. return false;
  41653. }
  41654. };
  41655. ;
  41656. ConnectionManager.prototype.send_event = function (name, data, channel) {
  41657. if (this.connection) {
  41658. return this.connection.send_event(name, data, channel);
  41659. }
  41660. else {
  41661. return false;
  41662. }
  41663. };
  41664. ;
  41665. ConnectionManager.prototype.disconnect = function () {
  41666. this.disconnectInternally();
  41667. this.updateState("disconnected");
  41668. };
  41669. ;
  41670. ConnectionManager.prototype.isUsingTLS = function () {
  41671. return this.usingTLS;
  41672. };
  41673. ;
  41674. ConnectionManager.prototype.startConnecting = function () {
  41675. var _this = this;
  41676. var callback = function (error, handshake) {
  41677. if (error) {
  41678. _this.runner = _this.strategy.connect(0, callback);
  41679. }
  41680. else {
  41681. if (handshake.action === "error") {
  41682. _this.emit("error", { type: "HandshakeError", error: handshake.error });
  41683. _this.timeline.error({ handshakeError: handshake.error });
  41684. }
  41685. else {
  41686. _this.abortConnecting();
  41687. _this.handshakeCallbacks[handshake.action](handshake);
  41688. }
  41689. }
  41690. };
  41691. this.runner = this.strategy.connect(0, callback);
  41692. };
  41693. ;
  41694. ConnectionManager.prototype.abortConnecting = function () {
  41695. if (this.runner) {
  41696. this.runner.abort();
  41697. this.runner = null;
  41698. }
  41699. };
  41700. ;
  41701. ConnectionManager.prototype.disconnectInternally = function () {
  41702. this.abortConnecting();
  41703. this.clearRetryTimer();
  41704. this.clearUnavailableTimer();
  41705. if (this.connection) {
  41706. var connection = this.abandonConnection();
  41707. connection.close();
  41708. }
  41709. };
  41710. ;
  41711. ConnectionManager.prototype.updateStrategy = function () {
  41712. this.strategy = this.options.getStrategy({
  41713. key: this.key,
  41714. timeline: this.timeline,
  41715. useTLS: this.usingTLS
  41716. });
  41717. };
  41718. ;
  41719. ConnectionManager.prototype.retryIn = function (delay) {
  41720. var _this = this;
  41721. this.timeline.info({ action: "retry", delay: delay });
  41722. if (delay > 0) {
  41723. this.emit("connecting_in", Math.round(delay / 1000));
  41724. }
  41725. this.retryTimer = new OneOffTimer(delay || 0, function () {
  41726. _this.disconnectInternally();
  41727. _this.connect();
  41728. });
  41729. };
  41730. ;
  41731. ConnectionManager.prototype.clearRetryTimer = function () {
  41732. if (this.retryTimer) {
  41733. this.retryTimer.ensureAborted();
  41734. this.retryTimer = null;
  41735. }
  41736. };
  41737. ;
  41738. ConnectionManager.prototype.setUnavailableTimer = function () {
  41739. var _this = this;
  41740. this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
  41741. _this.updateState("unavailable");
  41742. });
  41743. };
  41744. ;
  41745. ConnectionManager.prototype.clearUnavailableTimer = function () {
  41746. if (this.unavailableTimer) {
  41747. this.unavailableTimer.ensureAborted();
  41748. }
  41749. };
  41750. ;
  41751. ConnectionManager.prototype.sendActivityCheck = function () {
  41752. var _this = this;
  41753. this.stopActivityCheck();
  41754. this.connection.ping();
  41755. this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
  41756. _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
  41757. _this.retryIn(0);
  41758. });
  41759. };
  41760. ;
  41761. ConnectionManager.prototype.resetActivityCheck = function () {
  41762. var _this = this;
  41763. this.stopActivityCheck();
  41764. if (this.connection && !this.connection.handlesActivityChecks()) {
  41765. this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
  41766. _this.sendActivityCheck();
  41767. });
  41768. }
  41769. };
  41770. ;
  41771. ConnectionManager.prototype.stopActivityCheck = function () {
  41772. if (this.activityTimer) {
  41773. this.activityTimer.ensureAborted();
  41774. }
  41775. };
  41776. ;
  41777. ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
  41778. var _this = this;
  41779. return extend({}, errorCallbacks, {
  41780. message: function (message) {
  41781. _this.resetActivityCheck();
  41782. _this.emit('message', message);
  41783. },
  41784. ping: function () {
  41785. _this.send_event('pusher:pong', {});
  41786. },
  41787. activity: function () {
  41788. _this.resetActivityCheck();
  41789. },
  41790. error: function (error) {
  41791. _this.emit("error", { type: "WebSocketError", error: error });
  41792. },
  41793. closed: function () {
  41794. _this.abandonConnection();
  41795. if (_this.shouldRetry()) {
  41796. _this.retryIn(1000);
  41797. }
  41798. }
  41799. });
  41800. };
  41801. ;
  41802. ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
  41803. var _this = this;
  41804. return extend({}, errorCallbacks, {
  41805. connected: function (handshake) {
  41806. _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
  41807. _this.clearUnavailableTimer();
  41808. _this.setConnection(handshake.connection);
  41809. _this.socket_id = _this.connection.id;
  41810. _this.updateState("connected", { socket_id: _this.socket_id });
  41811. }
  41812. });
  41813. };
  41814. ;
  41815. ConnectionManager.prototype.buildErrorCallbacks = function () {
  41816. var _this = this;
  41817. var withErrorEmitted = function (callback) {
  41818. return function (result) {
  41819. if (result.error) {
  41820. _this.emit("error", { type: "WebSocketError", error: result.error });
  41821. }
  41822. callback(result);
  41823. };
  41824. };
  41825. return {
  41826. tls_only: withErrorEmitted(function () {
  41827. _this.usingTLS = true;
  41828. _this.updateStrategy();
  41829. _this.retryIn(0);
  41830. }),
  41831. refused: withErrorEmitted(function () {
  41832. _this.disconnect();
  41833. }),
  41834. backoff: withErrorEmitted(function () {
  41835. _this.retryIn(1000);
  41836. }),
  41837. retry: withErrorEmitted(function () {
  41838. _this.retryIn(0);
  41839. })
  41840. };
  41841. };
  41842. ;
  41843. ConnectionManager.prototype.setConnection = function (connection) {
  41844. this.connection = connection;
  41845. for (var event in this.connectionCallbacks) {
  41846. this.connection.bind(event, this.connectionCallbacks[event]);
  41847. }
  41848. this.resetActivityCheck();
  41849. };
  41850. ;
  41851. ConnectionManager.prototype.abandonConnection = function () {
  41852. if (!this.connection) {
  41853. return;
  41854. }
  41855. this.stopActivityCheck();
  41856. for (var event in this.connectionCallbacks) {
  41857. this.connection.unbind(event, this.connectionCallbacks[event]);
  41858. }
  41859. var connection = this.connection;
  41860. this.connection = null;
  41861. return connection;
  41862. };
  41863. ConnectionManager.prototype.updateState = function (newState, data) {
  41864. var previousState = this.state;
  41865. this.state = newState;
  41866. if (previousState !== newState) {
  41867. var newStateDescription = newState;
  41868. if (newStateDescription === "connected") {
  41869. newStateDescription += " with new socket ID " + data.socket_id;
  41870. }
  41871. logger.debug('State changed', previousState + ' -> ' + newStateDescription);
  41872. this.timeline.info({ state: newState, params: data });
  41873. this.emit('state_change', { previous: previousState, current: newState });
  41874. this.emit(newState, data);
  41875. }
  41876. };
  41877. ConnectionManager.prototype.shouldRetry = function () {
  41878. return this.state === "connecting" || this.state === "connected";
  41879. };
  41880. return ConnectionManager;
  41881. }(dispatcher));
  41882. /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
  41883. // CONCATENATED MODULE: ./src/core/channels/channels.ts
  41884. var channels_Channels = (function () {
  41885. function Channels() {
  41886. this.channels = {};
  41887. }
  41888. Channels.prototype.add = function (name, pusher) {
  41889. if (!this.channels[name]) {
  41890. this.channels[name] = createChannel(name, pusher);
  41891. }
  41892. return this.channels[name];
  41893. };
  41894. Channels.prototype.all = function () {
  41895. return values(this.channels);
  41896. };
  41897. Channels.prototype.find = function (name) {
  41898. return this.channels[name];
  41899. };
  41900. Channels.prototype.remove = function (name) {
  41901. var channel = this.channels[name];
  41902. delete this.channels[name];
  41903. return channel;
  41904. };
  41905. Channels.prototype.disconnect = function () {
  41906. objectApply(this.channels, function (channel) {
  41907. channel.disconnect();
  41908. });
  41909. };
  41910. return Channels;
  41911. }());
  41912. /* harmony default export */ var channels = (channels_Channels);
  41913. function createChannel(name, pusher) {
  41914. if (name.indexOf('private-encrypted-') === 0) {
  41915. if (false) { var errorMsg; }
  41916. return factory.createEncryptedChannel(name, pusher);
  41917. }
  41918. else if (name.indexOf('private-') === 0) {
  41919. return factory.createPrivateChannel(name, pusher);
  41920. }
  41921. else if (name.indexOf('presence-') === 0) {
  41922. return factory.createPresenceChannel(name, pusher);
  41923. }
  41924. else {
  41925. return factory.createChannel(name, pusher);
  41926. }
  41927. }
  41928. // CONCATENATED MODULE: ./src/core/utils/factory.ts
  41929. var Factory = {
  41930. createChannels: function () {
  41931. return new channels();
  41932. },
  41933. createConnectionManager: function (key, options) {
  41934. return new connection_manager(key, options);
  41935. },
  41936. createChannel: function (name, pusher) {
  41937. return new channels_channel(name, pusher);
  41938. },
  41939. createPrivateChannel: function (name, pusher) {
  41940. return new private_channel(name, pusher);
  41941. },
  41942. createPresenceChannel: function (name, pusher) {
  41943. return new presence_channel(name, pusher);
  41944. },
  41945. createEncryptedChannel: function (name, pusher) {
  41946. return new encrypted_channel(name, pusher);
  41947. },
  41948. createTimelineSender: function (timeline, options) {
  41949. return new timeline_sender(timeline, options);
  41950. },
  41951. createAuthorizer: function (channel, options) {
  41952. if (options.authorizer) {
  41953. return options.authorizer(channel, options);
  41954. }
  41955. return new pusher_authorizer(channel, options);
  41956. },
  41957. createHandshake: function (transport, callback) {
  41958. return new connection_handshake(transport, callback);
  41959. },
  41960. createAssistantToTheTransportManager: function (manager, transport, options) {
  41961. return new assistant_to_the_transport_manager(manager, transport, options);
  41962. }
  41963. };
  41964. /* harmony default export */ var factory = (Factory);
  41965. // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
  41966. var transport_manager_TransportManager = (function () {
  41967. function TransportManager(options) {
  41968. this.options = options || {};
  41969. this.livesLeft = this.options.lives || Infinity;
  41970. }
  41971. TransportManager.prototype.getAssistant = function (transport) {
  41972. return factory.createAssistantToTheTransportManager(this, transport, {
  41973. minPingDelay: this.options.minPingDelay,
  41974. maxPingDelay: this.options.maxPingDelay
  41975. });
  41976. };
  41977. TransportManager.prototype.isAlive = function () {
  41978. return this.livesLeft > 0;
  41979. };
  41980. TransportManager.prototype.reportDeath = function () {
  41981. this.livesLeft -= 1;
  41982. };
  41983. return TransportManager;
  41984. }());
  41985. /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
  41986. // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
  41987. var sequential_strategy_SequentialStrategy = (function () {
  41988. function SequentialStrategy(strategies, options) {
  41989. this.strategies = strategies;
  41990. this.loop = Boolean(options.loop);
  41991. this.failFast = Boolean(options.failFast);
  41992. this.timeout = options.timeout;
  41993. this.timeoutLimit = options.timeoutLimit;
  41994. }
  41995. SequentialStrategy.prototype.isSupported = function () {
  41996. return any(this.strategies, util.method("isSupported"));
  41997. };
  41998. SequentialStrategy.prototype.connect = function (minPriority, callback) {
  41999. var _this = this;
  42000. var strategies = this.strategies;
  42001. var current = 0;
  42002. var timeout = this.timeout;
  42003. var runner = null;
  42004. var tryNextStrategy = function (error, handshake) {
  42005. if (handshake) {
  42006. callback(null, handshake);
  42007. }
  42008. else {
  42009. current = current + 1;
  42010. if (_this.loop) {
  42011. current = current % strategies.length;
  42012. }
  42013. if (current < strategies.length) {
  42014. if (timeout) {
  42015. timeout = timeout * 2;
  42016. if (_this.timeoutLimit) {
  42017. timeout = Math.min(timeout, _this.timeoutLimit);
  42018. }
  42019. }
  42020. runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
  42021. }
  42022. else {
  42023. callback(true);
  42024. }
  42025. }
  42026. };
  42027. runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
  42028. return {
  42029. abort: function () {
  42030. runner.abort();
  42031. },
  42032. forceMinPriority: function (p) {
  42033. minPriority = p;
  42034. if (runner) {
  42035. runner.forceMinPriority(p);
  42036. }
  42037. }
  42038. };
  42039. };
  42040. SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
  42041. var timer = null;
  42042. var runner = null;
  42043. if (options.timeout > 0) {
  42044. timer = new OneOffTimer(options.timeout, function () {
  42045. runner.abort();
  42046. callback(true);
  42047. });
  42048. }
  42049. runner = strategy.connect(minPriority, function (error, handshake) {
  42050. if (error && timer && timer.isRunning() && !options.failFast) {
  42051. return;
  42052. }
  42053. if (timer) {
  42054. timer.ensureAborted();
  42055. }
  42056. callback(error, handshake);
  42057. });
  42058. return {
  42059. abort: function () {
  42060. if (timer) {
  42061. timer.ensureAborted();
  42062. }
  42063. runner.abort();
  42064. },
  42065. forceMinPriority: function (p) {
  42066. runner.forceMinPriority(p);
  42067. }
  42068. };
  42069. };
  42070. return SequentialStrategy;
  42071. }());
  42072. /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
  42073. // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
  42074. var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
  42075. function BestConnectedEverStrategy(strategies) {
  42076. this.strategies = strategies;
  42077. }
  42078. BestConnectedEverStrategy.prototype.isSupported = function () {
  42079. return any(this.strategies, util.method("isSupported"));
  42080. };
  42081. BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
  42082. return connect(this.strategies, minPriority, function (i, runners) {
  42083. return function (error, handshake) {
  42084. runners[i].error = error;
  42085. if (error) {
  42086. if (allRunnersFailed(runners)) {
  42087. callback(true);
  42088. }
  42089. return;
  42090. }
  42091. apply(runners, function (runner) {
  42092. runner.forceMinPriority(handshake.transport.priority);
  42093. });
  42094. callback(null, handshake);
  42095. };
  42096. });
  42097. };
  42098. return BestConnectedEverStrategy;
  42099. }());
  42100. /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
  42101. function connect(strategies, minPriority, callbackBuilder) {
  42102. var runners = map(strategies, function (strategy, i, _, rs) {
  42103. return strategy.connect(minPriority, callbackBuilder(i, rs));
  42104. });
  42105. return {
  42106. abort: function () {
  42107. apply(runners, abortRunner);
  42108. },
  42109. forceMinPriority: function (p) {
  42110. apply(runners, function (runner) {
  42111. runner.forceMinPriority(p);
  42112. });
  42113. }
  42114. };
  42115. }
  42116. function allRunnersFailed(runners) {
  42117. return collections_all(runners, function (runner) {
  42118. return Boolean(runner.error);
  42119. });
  42120. }
  42121. function abortRunner(runner) {
  42122. if (!runner.error && !runner.aborted) {
  42123. runner.abort();
  42124. runner.aborted = true;
  42125. }
  42126. }
  42127. // CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
  42128. var cached_strategy_CachedStrategy = (function () {
  42129. function CachedStrategy(strategy, transports, options) {
  42130. this.strategy = strategy;
  42131. this.transports = transports;
  42132. this.ttl = options.ttl || 1800 * 1000;
  42133. this.usingTLS = options.useTLS;
  42134. this.timeline = options.timeline;
  42135. }
  42136. CachedStrategy.prototype.isSupported = function () {
  42137. return this.strategy.isSupported();
  42138. };
  42139. CachedStrategy.prototype.connect = function (minPriority, callback) {
  42140. var usingTLS = this.usingTLS;
  42141. var info = fetchTransportCache(usingTLS);
  42142. var strategies = [this.strategy];
  42143. if (info && info.timestamp + this.ttl >= util.now()) {
  42144. var transport = this.transports[info.transport];
  42145. if (transport) {
  42146. this.timeline.info({
  42147. cached: true,
  42148. transport: info.transport,
  42149. latency: info.latency
  42150. });
  42151. strategies.push(new sequential_strategy([transport], {
  42152. timeout: info.latency * 2 + 1000,
  42153. failFast: true
  42154. }));
  42155. }
  42156. }
  42157. var startTimestamp = util.now();
  42158. var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
  42159. if (error) {
  42160. flushTransportCache(usingTLS);
  42161. if (strategies.length > 0) {
  42162. startTimestamp = util.now();
  42163. runner = strategies.pop().connect(minPriority, cb);
  42164. }
  42165. else {
  42166. callback(error);
  42167. }
  42168. }
  42169. else {
  42170. storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
  42171. callback(null, handshake);
  42172. }
  42173. });
  42174. return {
  42175. abort: function () {
  42176. runner.abort();
  42177. },
  42178. forceMinPriority: function (p) {
  42179. minPriority = p;
  42180. if (runner) {
  42181. runner.forceMinPriority(p);
  42182. }
  42183. }
  42184. };
  42185. };
  42186. return CachedStrategy;
  42187. }());
  42188. /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
  42189. function getTransportCacheKey(usingTLS) {
  42190. return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
  42191. }
  42192. function fetchTransportCache(usingTLS) {
  42193. var storage = runtime.getLocalStorage();
  42194. if (storage) {
  42195. try {
  42196. var serializedCache = storage[getTransportCacheKey(usingTLS)];
  42197. if (serializedCache) {
  42198. return JSON.parse(serializedCache);
  42199. }
  42200. }
  42201. catch (e) {
  42202. flushTransportCache(usingTLS);
  42203. }
  42204. }
  42205. return null;
  42206. }
  42207. function storeTransportCache(usingTLS, transport, latency) {
  42208. var storage = runtime.getLocalStorage();
  42209. if (storage) {
  42210. try {
  42211. storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
  42212. timestamp: util.now(),
  42213. transport: transport,
  42214. latency: latency
  42215. });
  42216. }
  42217. catch (e) {
  42218. }
  42219. }
  42220. }
  42221. function flushTransportCache(usingTLS) {
  42222. var storage = runtime.getLocalStorage();
  42223. if (storage) {
  42224. try {
  42225. delete storage[getTransportCacheKey(usingTLS)];
  42226. }
  42227. catch (e) {
  42228. }
  42229. }
  42230. }
  42231. // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
  42232. var delayed_strategy_DelayedStrategy = (function () {
  42233. function DelayedStrategy(strategy, _a) {
  42234. var number = _a.delay;
  42235. this.strategy = strategy;
  42236. this.options = { delay: number };
  42237. }
  42238. DelayedStrategy.prototype.isSupported = function () {
  42239. return this.strategy.isSupported();
  42240. };
  42241. DelayedStrategy.prototype.connect = function (minPriority, callback) {
  42242. var strategy = this.strategy;
  42243. var runner;
  42244. var timer = new OneOffTimer(this.options.delay, function () {
  42245. runner = strategy.connect(minPriority, callback);
  42246. });
  42247. return {
  42248. abort: function () {
  42249. timer.ensureAborted();
  42250. if (runner) {
  42251. runner.abort();
  42252. }
  42253. },
  42254. forceMinPriority: function (p) {
  42255. minPriority = p;
  42256. if (runner) {
  42257. runner.forceMinPriority(p);
  42258. }
  42259. }
  42260. };
  42261. };
  42262. return DelayedStrategy;
  42263. }());
  42264. /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
  42265. // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
  42266. var IfStrategy = (function () {
  42267. function IfStrategy(test, trueBranch, falseBranch) {
  42268. this.test = test;
  42269. this.trueBranch = trueBranch;
  42270. this.falseBranch = falseBranch;
  42271. }
  42272. IfStrategy.prototype.isSupported = function () {
  42273. var branch = this.test() ? this.trueBranch : this.falseBranch;
  42274. return branch.isSupported();
  42275. };
  42276. IfStrategy.prototype.connect = function (minPriority, callback) {
  42277. var branch = this.test() ? this.trueBranch : this.falseBranch;
  42278. return branch.connect(minPriority, callback);
  42279. };
  42280. return IfStrategy;
  42281. }());
  42282. /* harmony default export */ var if_strategy = (IfStrategy);
  42283. // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
  42284. var FirstConnectedStrategy = (function () {
  42285. function FirstConnectedStrategy(strategy) {
  42286. this.strategy = strategy;
  42287. }
  42288. FirstConnectedStrategy.prototype.isSupported = function () {
  42289. return this.strategy.isSupported();
  42290. };
  42291. FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
  42292. var runner = this.strategy.connect(minPriority, function (error, handshake) {
  42293. if (handshake) {
  42294. runner.abort();
  42295. }
  42296. callback(error, handshake);
  42297. });
  42298. return runner;
  42299. };
  42300. return FirstConnectedStrategy;
  42301. }());
  42302. /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
  42303. // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
  42304. function testSupportsStrategy(strategy) {
  42305. return function () {
  42306. return strategy.isSupported();
  42307. };
  42308. }
  42309. var getDefaultStrategy = function (config, defineTransport) {
  42310. var definedTransports = {};
  42311. function defineTransportStrategy(name, type, priority, options, manager) {
  42312. var transport = defineTransport(config, name, type, priority, options, manager);
  42313. definedTransports[name] = transport;
  42314. return transport;
  42315. }
  42316. var ws_options = {
  42317. hostNonTLS: config.wsHost + ":" + config.wsPort,
  42318. hostTLS: config.wsHost + ":" + config.wssPort,
  42319. httpPath: config.wsPath
  42320. };
  42321. var wss_options = extend({}, ws_options, {
  42322. useTLS: true
  42323. });
  42324. var sockjs_options = {
  42325. hostNonTLS: config.httpHost + ":" + config.httpPort,
  42326. hostTLS: config.httpHost + ":" + config.httpsPort,
  42327. httpPath: config.httpPath
  42328. };
  42329. var timeouts = {
  42330. loop: true,
  42331. timeout: 15000,
  42332. timeoutLimit: 60000
  42333. };
  42334. var ws_manager = new transport_manager({
  42335. lives: 2,
  42336. minPingDelay: 10000,
  42337. maxPingDelay: config.activity_timeout
  42338. });
  42339. var streaming_manager = new transport_manager({
  42340. lives: 2,
  42341. minPingDelay: 10000,
  42342. maxPingDelay: config.activity_timeout
  42343. });
  42344. var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
  42345. var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
  42346. var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
  42347. var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
  42348. var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
  42349. var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
  42350. var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
  42351. var ws_loop = new sequential_strategy([ws_transport], timeouts);
  42352. var wss_loop = new sequential_strategy([wss_transport], timeouts);
  42353. var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
  42354. var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts);
  42355. var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts);
  42356. 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);
  42357. var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
  42358. var wsStrategy;
  42359. if (config.useTLS) {
  42360. wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]);
  42361. }
  42362. else {
  42363. wsStrategy = new best_connected_ever_strategy([
  42364. ws_loop,
  42365. new delayed_strategy(wss_loop, { delay: 2000 }),
  42366. new delayed_strategy(http_fallback_loop, { delay: 5000 })
  42367. ]);
  42368. }
  42369. return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
  42370. ttl: 1800000,
  42371. timeline: config.timeline,
  42372. useTLS: config.useTLS
  42373. });
  42374. };
  42375. /* harmony default export */ var default_strategy = (getDefaultStrategy);
  42376. // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
  42377. /* harmony default export */ var transport_connection_initializer = (function () {
  42378. var self = this;
  42379. self.timeline.info(self.buildTimelineMessage({
  42380. transport: self.name + (self.options.useTLS ? "s" : "")
  42381. }));
  42382. if (self.hooks.isInitialized()) {
  42383. self.changeState("initialized");
  42384. }
  42385. else if (self.hooks.file) {
  42386. self.changeState("initializing");
  42387. Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
  42388. if (self.hooks.isInitialized()) {
  42389. self.changeState("initialized");
  42390. callback(true);
  42391. }
  42392. else {
  42393. if (error) {
  42394. self.onError(error);
  42395. }
  42396. self.onClose();
  42397. callback(false);
  42398. }
  42399. });
  42400. }
  42401. else {
  42402. self.onClose();
  42403. }
  42404. });
  42405. // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
  42406. var http_xdomain_request_hooks = {
  42407. getRequest: function (socket) {
  42408. var xdr = new window.XDomainRequest();
  42409. xdr.ontimeout = function () {
  42410. socket.emit("error", new RequestTimedOut());
  42411. socket.close();
  42412. };
  42413. xdr.onerror = function (e) {
  42414. socket.emit("error", e);
  42415. socket.close();
  42416. };
  42417. xdr.onprogress = function () {
  42418. if (xdr.responseText && xdr.responseText.length > 0) {
  42419. socket.onChunk(200, xdr.responseText);
  42420. }
  42421. };
  42422. xdr.onload = function () {
  42423. if (xdr.responseText && xdr.responseText.length > 0) {
  42424. socket.onChunk(200, xdr.responseText);
  42425. }
  42426. socket.emit("finished", 200);
  42427. socket.close();
  42428. };
  42429. return xdr;
  42430. },
  42431. abortRequest: function (xdr) {
  42432. xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
  42433. xdr.abort();
  42434. }
  42435. };
  42436. /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
  42437. // CONCATENATED MODULE: ./src/core/http/http_request.ts
  42438. var http_request_extends = (undefined && undefined.__extends) || (function () {
  42439. var extendStatics = function (d, b) {
  42440. extendStatics = Object.setPrototypeOf ||
  42441. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  42442. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  42443. return extendStatics(d, b);
  42444. };
  42445. return function (d, b) {
  42446. extendStatics(d, b);
  42447. function __() { this.constructor = d; }
  42448. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  42449. };
  42450. })();
  42451. var MAX_BUFFER_LENGTH = 256 * 1024;
  42452. var http_request_HTTPRequest = (function (_super) {
  42453. http_request_extends(HTTPRequest, _super);
  42454. function HTTPRequest(hooks, method, url) {
  42455. var _this = _super.call(this) || this;
  42456. _this.hooks = hooks;
  42457. _this.method = method;
  42458. _this.url = url;
  42459. return _this;
  42460. }
  42461. HTTPRequest.prototype.start = function (payload) {
  42462. var _this = this;
  42463. this.position = 0;
  42464. this.xhr = this.hooks.getRequest(this);
  42465. this.unloader = function () {
  42466. _this.close();
  42467. };
  42468. runtime.addUnloadListener(this.unloader);
  42469. this.xhr.open(this.method, this.url, true);
  42470. if (this.xhr.setRequestHeader) {
  42471. this.xhr.setRequestHeader("Content-Type", "application/json");
  42472. }
  42473. this.xhr.send(payload);
  42474. };
  42475. HTTPRequest.prototype.close = function () {
  42476. if (this.unloader) {
  42477. runtime.removeUnloadListener(this.unloader);
  42478. this.unloader = null;
  42479. }
  42480. if (this.xhr) {
  42481. this.hooks.abortRequest(this.xhr);
  42482. this.xhr = null;
  42483. }
  42484. };
  42485. HTTPRequest.prototype.onChunk = function (status, data) {
  42486. while (true) {
  42487. var chunk = this.advanceBuffer(data);
  42488. if (chunk) {
  42489. this.emit("chunk", { status: status, data: chunk });
  42490. }
  42491. else {
  42492. break;
  42493. }
  42494. }
  42495. if (this.isBufferTooLong(data)) {
  42496. this.emit("buffer_too_long");
  42497. }
  42498. };
  42499. HTTPRequest.prototype.advanceBuffer = function (buffer) {
  42500. var unreadData = buffer.slice(this.position);
  42501. var endOfLinePosition = unreadData.indexOf("\n");
  42502. if (endOfLinePosition !== -1) {
  42503. this.position += endOfLinePosition + 1;
  42504. return unreadData.slice(0, endOfLinePosition);
  42505. }
  42506. else {
  42507. return null;
  42508. }
  42509. };
  42510. HTTPRequest.prototype.isBufferTooLong = function (buffer) {
  42511. return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
  42512. };
  42513. return HTTPRequest;
  42514. }(dispatcher));
  42515. /* harmony default export */ var http_request = (http_request_HTTPRequest);
  42516. // CONCATENATED MODULE: ./src/core/http/state.ts
  42517. var State;
  42518. (function (State) {
  42519. State[State["CONNECTING"] = 0] = "CONNECTING";
  42520. State[State["OPEN"] = 1] = "OPEN";
  42521. State[State["CLOSED"] = 3] = "CLOSED";
  42522. })(State || (State = {}));
  42523. /* harmony default export */ var state = (State);
  42524. // CONCATENATED MODULE: ./src/core/http/http_socket.ts
  42525. var autoIncrement = 1;
  42526. var http_socket_HTTPSocket = (function () {
  42527. function HTTPSocket(hooks, url) {
  42528. this.hooks = hooks;
  42529. this.session = randomNumber(1000) + "/" + randomString(8);
  42530. this.location = getLocation(url);
  42531. this.readyState = state.CONNECTING;
  42532. this.openStream();
  42533. }
  42534. HTTPSocket.prototype.send = function (payload) {
  42535. return this.sendRaw(JSON.stringify([payload]));
  42536. };
  42537. HTTPSocket.prototype.ping = function () {
  42538. this.hooks.sendHeartbeat(this);
  42539. };
  42540. HTTPSocket.prototype.close = function (code, reason) {
  42541. this.onClose(code, reason, true);
  42542. };
  42543. HTTPSocket.prototype.sendRaw = function (payload) {
  42544. if (this.readyState === state.OPEN) {
  42545. try {
  42546. runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
  42547. return true;
  42548. }
  42549. catch (e) {
  42550. return false;
  42551. }
  42552. }
  42553. else {
  42554. return false;
  42555. }
  42556. };
  42557. HTTPSocket.prototype.reconnect = function () {
  42558. this.closeStream();
  42559. this.openStream();
  42560. };
  42561. ;
  42562. HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
  42563. this.closeStream();
  42564. this.readyState = state.CLOSED;
  42565. if (this.onclose) {
  42566. this.onclose({
  42567. code: code,
  42568. reason: reason,
  42569. wasClean: wasClean
  42570. });
  42571. }
  42572. };
  42573. HTTPSocket.prototype.onChunk = function (chunk) {
  42574. if (chunk.status !== 200) {
  42575. return;
  42576. }
  42577. if (this.readyState === state.OPEN) {
  42578. this.onActivity();
  42579. }
  42580. var payload;
  42581. var type = chunk.data.slice(0, 1);
  42582. switch (type) {
  42583. case 'o':
  42584. payload = JSON.parse(chunk.data.slice(1) || '{}');
  42585. this.onOpen(payload);
  42586. break;
  42587. case 'a':
  42588. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42589. for (var i = 0; i < payload.length; i++) {
  42590. this.onEvent(payload[i]);
  42591. }
  42592. break;
  42593. case 'm':
  42594. payload = JSON.parse(chunk.data.slice(1) || 'null');
  42595. this.onEvent(payload);
  42596. break;
  42597. case 'h':
  42598. this.hooks.onHeartbeat(this);
  42599. break;
  42600. case 'c':
  42601. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42602. this.onClose(payload[0], payload[1], true);
  42603. break;
  42604. }
  42605. };
  42606. HTTPSocket.prototype.onOpen = function (options) {
  42607. if (this.readyState === state.CONNECTING) {
  42608. if (options && options.hostname) {
  42609. this.location.base = replaceHost(this.location.base, options.hostname);
  42610. }
  42611. this.readyState = state.OPEN;
  42612. if (this.onopen) {
  42613. this.onopen();
  42614. }
  42615. }
  42616. else {
  42617. this.onClose(1006, "Server lost session", true);
  42618. }
  42619. };
  42620. HTTPSocket.prototype.onEvent = function (event) {
  42621. if (this.readyState === state.OPEN && this.onmessage) {
  42622. this.onmessage({ data: event });
  42623. }
  42624. };
  42625. HTTPSocket.prototype.onActivity = function () {
  42626. if (this.onactivity) {
  42627. this.onactivity();
  42628. }
  42629. };
  42630. HTTPSocket.prototype.onError = function (error) {
  42631. if (this.onerror) {
  42632. this.onerror(error);
  42633. }
  42634. };
  42635. HTTPSocket.prototype.openStream = function () {
  42636. var _this = this;
  42637. this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
  42638. this.stream.bind("chunk", function (chunk) {
  42639. _this.onChunk(chunk);
  42640. });
  42641. this.stream.bind("finished", function (status) {
  42642. _this.hooks.onFinished(_this, status);
  42643. });
  42644. this.stream.bind("buffer_too_long", function () {
  42645. _this.reconnect();
  42646. });
  42647. try {
  42648. this.stream.start();
  42649. }
  42650. catch (error) {
  42651. util.defer(function () {
  42652. _this.onError(error);
  42653. _this.onClose(1006, "Could not start streaming", false);
  42654. });
  42655. }
  42656. };
  42657. HTTPSocket.prototype.closeStream = function () {
  42658. if (this.stream) {
  42659. this.stream.unbind_all();
  42660. this.stream.close();
  42661. this.stream = null;
  42662. }
  42663. };
  42664. return HTTPSocket;
  42665. }());
  42666. function getLocation(url) {
  42667. var parts = /([^\?]*)\/*(\??.*)/.exec(url);
  42668. return {
  42669. base: parts[1],
  42670. queryString: parts[2]
  42671. };
  42672. }
  42673. function getSendURL(url, session) {
  42674. return url.base + "/" + session + "/xhr_send";
  42675. }
  42676. function getUniqueURL(url) {
  42677. var separator = (url.indexOf('?') === -1) ? "?" : "&";
  42678. return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++;
  42679. }
  42680. function replaceHost(url, hostname) {
  42681. var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
  42682. return urlParts[1] + hostname + urlParts[3];
  42683. }
  42684. function randomNumber(max) {
  42685. return Math.floor(Math.random() * max);
  42686. }
  42687. function randomString(length) {
  42688. var result = [];
  42689. for (var i = 0; i < length; i++) {
  42690. result.push(randomNumber(32).toString(32));
  42691. }
  42692. return result.join('');
  42693. }
  42694. /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
  42695. // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
  42696. var http_streaming_socket_hooks = {
  42697. getReceiveURL: function (url, session) {
  42698. return url.base + "/" + session + "/xhr_streaming" + url.queryString;
  42699. },
  42700. onHeartbeat: function (socket) {
  42701. socket.sendRaw("[]");
  42702. },
  42703. sendHeartbeat: function (socket) {
  42704. socket.sendRaw("[]");
  42705. },
  42706. onFinished: function (socket, status) {
  42707. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42708. }
  42709. };
  42710. /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
  42711. // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
  42712. var http_polling_socket_hooks = {
  42713. getReceiveURL: function (url, session) {
  42714. return url.base + "/" + session + "/xhr" + url.queryString;
  42715. },
  42716. onHeartbeat: function () {
  42717. },
  42718. sendHeartbeat: function (socket) {
  42719. socket.sendRaw("[]");
  42720. },
  42721. onFinished: function (socket, status) {
  42722. if (status === 200) {
  42723. socket.reconnect();
  42724. }
  42725. else {
  42726. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42727. }
  42728. }
  42729. };
  42730. /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
  42731. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
  42732. var http_xhr_request_hooks = {
  42733. getRequest: function (socket) {
  42734. var Constructor = runtime.getXHRAPI();
  42735. var xhr = new Constructor();
  42736. xhr.onreadystatechange = xhr.onprogress = function () {
  42737. switch (xhr.readyState) {
  42738. case 3:
  42739. if (xhr.responseText && xhr.responseText.length > 0) {
  42740. socket.onChunk(xhr.status, xhr.responseText);
  42741. }
  42742. break;
  42743. case 4:
  42744. if (xhr.responseText && xhr.responseText.length > 0) {
  42745. socket.onChunk(xhr.status, xhr.responseText);
  42746. }
  42747. socket.emit("finished", xhr.status);
  42748. socket.close();
  42749. break;
  42750. }
  42751. };
  42752. return xhr;
  42753. },
  42754. abortRequest: function (xhr) {
  42755. xhr.onreadystatechange = null;
  42756. xhr.abort();
  42757. }
  42758. };
  42759. /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
  42760. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
  42761. var HTTP = {
  42762. createStreamingSocket: function (url) {
  42763. return this.createSocket(http_streaming_socket, url);
  42764. },
  42765. createPollingSocket: function (url) {
  42766. return this.createSocket(http_polling_socket, url);
  42767. },
  42768. createSocket: function (hooks, url) {
  42769. return new http_socket(hooks, url);
  42770. },
  42771. createXHR: function (method, url) {
  42772. return this.createRequest(http_xhr_request, method, url);
  42773. },
  42774. createRequest: function (hooks, method, url) {
  42775. return new http_request(hooks, method, url);
  42776. }
  42777. };
  42778. /* harmony default export */ var http_http = (HTTP);
  42779. // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
  42780. http_http.createXDR = function (method, url) {
  42781. return this.createRequest(http_xdomain_request, method, url);
  42782. };
  42783. /* harmony default export */ var web_http_http = (http_http);
  42784. // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
  42785. var Runtime = {
  42786. nextAuthCallbackID: 1,
  42787. auth_callbacks: {},
  42788. ScriptReceivers: ScriptReceivers,
  42789. DependenciesReceivers: DependenciesReceivers,
  42790. getDefaultStrategy: default_strategy,
  42791. Transports: transports_transports,
  42792. transportConnectionInitializer: transport_connection_initializer,
  42793. HTTPFactory: web_http_http,
  42794. TimelineTransport: jsonp_timeline,
  42795. getXHRAPI: function () {
  42796. return window.XMLHttpRequest;
  42797. },
  42798. getWebSocketAPI: function () {
  42799. return window.WebSocket || window.MozWebSocket;
  42800. },
  42801. setup: function (PusherClass) {
  42802. var _this = this;
  42803. window.Pusher = PusherClass;
  42804. var initializeOnDocumentBody = function () {
  42805. _this.onDocumentBody(PusherClass.ready);
  42806. };
  42807. if (!window.JSON) {
  42808. Dependencies.load("json2", {}, initializeOnDocumentBody);
  42809. }
  42810. else {
  42811. initializeOnDocumentBody();
  42812. }
  42813. },
  42814. getDocument: function () {
  42815. return document;
  42816. },
  42817. getProtocol: function () {
  42818. return this.getDocument().location.protocol;
  42819. },
  42820. getAuthorizers: function () {
  42821. return { ajax: xhr_auth, jsonp: jsonp_auth };
  42822. },
  42823. onDocumentBody: function (callback) {
  42824. var _this = this;
  42825. if (document.body) {
  42826. callback();
  42827. }
  42828. else {
  42829. setTimeout(function () {
  42830. _this.onDocumentBody(callback);
  42831. }, 0);
  42832. }
  42833. },
  42834. createJSONPRequest: function (url, data) {
  42835. return new jsonp_request(url, data);
  42836. },
  42837. createScriptRequest: function (src) {
  42838. return new script_request(src);
  42839. },
  42840. getLocalStorage: function () {
  42841. try {
  42842. return window.localStorage;
  42843. }
  42844. catch (e) {
  42845. return undefined;
  42846. }
  42847. },
  42848. createXHR: function () {
  42849. if (this.getXHRAPI()) {
  42850. return this.createXMLHttpRequest();
  42851. }
  42852. else {
  42853. return this.createMicrosoftXHR();
  42854. }
  42855. },
  42856. createXMLHttpRequest: function () {
  42857. var Constructor = this.getXHRAPI();
  42858. return new Constructor();
  42859. },
  42860. createMicrosoftXHR: function () {
  42861. return new ActiveXObject("Microsoft.XMLHTTP");
  42862. },
  42863. getNetwork: function () {
  42864. return net_info_Network;
  42865. },
  42866. createWebSocket: function (url) {
  42867. var Constructor = this.getWebSocketAPI();
  42868. return new Constructor(url);
  42869. },
  42870. createSocketRequest: function (method, url) {
  42871. if (this.isXHRSupported()) {
  42872. return this.HTTPFactory.createXHR(method, url);
  42873. }
  42874. else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
  42875. return this.HTTPFactory.createXDR(method, url);
  42876. }
  42877. else {
  42878. throw "Cross-origin HTTP requests are not supported";
  42879. }
  42880. },
  42881. isXHRSupported: function () {
  42882. var Constructor = this.getXHRAPI();
  42883. return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined;
  42884. },
  42885. isXDRSupported: function (useTLS) {
  42886. var protocol = useTLS ? "https:" : "http:";
  42887. var documentProtocol = this.getProtocol();
  42888. return Boolean((window['XDomainRequest'])) && documentProtocol === protocol;
  42889. },
  42890. addUnloadListener: function (listener) {
  42891. if (window.addEventListener !== undefined) {
  42892. window.addEventListener("unload", listener, false);
  42893. }
  42894. else if (window.attachEvent !== undefined) {
  42895. window.attachEvent("onunload", listener);
  42896. }
  42897. },
  42898. removeUnloadListener: function (listener) {
  42899. if (window.addEventListener !== undefined) {
  42900. window.removeEventListener("unload", listener, false);
  42901. }
  42902. else if (window.detachEvent !== undefined) {
  42903. window.detachEvent("onunload", listener);
  42904. }
  42905. }
  42906. };
  42907. /* harmony default export */ var runtime = (Runtime);
  42908. // CONCATENATED MODULE: ./src/core/timeline/level.ts
  42909. var TimelineLevel;
  42910. (function (TimelineLevel) {
  42911. TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
  42912. TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
  42913. TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
  42914. })(TimelineLevel || (TimelineLevel = {}));
  42915. /* harmony default export */ var timeline_level = (TimelineLevel);
  42916. // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
  42917. var timeline_Timeline = (function () {
  42918. function Timeline(key, session, options) {
  42919. this.key = key;
  42920. this.session = session;
  42921. this.events = [];
  42922. this.options = options || {};
  42923. this.sent = 0;
  42924. this.uniqueID = 0;
  42925. }
  42926. Timeline.prototype.log = function (level, event) {
  42927. if (level <= this.options.level) {
  42928. this.events.push(extend({}, event, { timestamp: util.now() }));
  42929. if (this.options.limit && this.events.length > this.options.limit) {
  42930. this.events.shift();
  42931. }
  42932. }
  42933. };
  42934. Timeline.prototype.error = function (event) {
  42935. this.log(timeline_level.ERROR, event);
  42936. };
  42937. Timeline.prototype.info = function (event) {
  42938. this.log(timeline_level.INFO, event);
  42939. };
  42940. Timeline.prototype.debug = function (event) {
  42941. this.log(timeline_level.DEBUG, event);
  42942. };
  42943. Timeline.prototype.isEmpty = function () {
  42944. return this.events.length === 0;
  42945. };
  42946. Timeline.prototype.send = function (sendfn, callback) {
  42947. var _this = this;
  42948. var data = extend({
  42949. session: this.session,
  42950. bundle: this.sent + 1,
  42951. key: this.key,
  42952. lib: "js",
  42953. version: this.options.version,
  42954. cluster: this.options.cluster,
  42955. features: this.options.features,
  42956. timeline: this.events
  42957. }, this.options.params);
  42958. this.events = [];
  42959. sendfn(data, function (error, result) {
  42960. if (!error) {
  42961. _this.sent++;
  42962. }
  42963. if (callback) {
  42964. callback(error, result);
  42965. }
  42966. });
  42967. return true;
  42968. };
  42969. Timeline.prototype.generateUniqueID = function () {
  42970. this.uniqueID++;
  42971. return this.uniqueID;
  42972. };
  42973. return Timeline;
  42974. }());
  42975. /* harmony default export */ var timeline_timeline = (timeline_Timeline);
  42976. // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
  42977. var transport_strategy_TransportStrategy = (function () {
  42978. function TransportStrategy(name, priority, transport, options) {
  42979. this.name = name;
  42980. this.priority = priority;
  42981. this.transport = transport;
  42982. this.options = options || {};
  42983. }
  42984. TransportStrategy.prototype.isSupported = function () {
  42985. return this.transport.isSupported({
  42986. useTLS: this.options.useTLS
  42987. });
  42988. };
  42989. TransportStrategy.prototype.connect = function (minPriority, callback) {
  42990. var _this = this;
  42991. if (!this.isSupported()) {
  42992. return failAttempt(new UnsupportedStrategy(), callback);
  42993. }
  42994. else if (this.priority < minPriority) {
  42995. return failAttempt(new TransportPriorityTooLow(), callback);
  42996. }
  42997. var connected = false;
  42998. var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
  42999. var handshake = null;
  43000. var onInitialized = function () {
  43001. transport.unbind("initialized", onInitialized);
  43002. transport.connect();
  43003. };
  43004. var onOpen = function () {
  43005. handshake = factory.createHandshake(transport, function (result) {
  43006. connected = true;
  43007. unbindListeners();
  43008. callback(null, result);
  43009. });
  43010. };
  43011. var onError = function (error) {
  43012. unbindListeners();
  43013. callback(error);
  43014. };
  43015. var onClosed = function () {
  43016. unbindListeners();
  43017. var serializedTransport;
  43018. serializedTransport = safeJSONStringify(transport);
  43019. callback(new TransportClosed(serializedTransport));
  43020. };
  43021. var unbindListeners = function () {
  43022. transport.unbind("initialized", onInitialized);
  43023. transport.unbind("open", onOpen);
  43024. transport.unbind("error", onError);
  43025. transport.unbind("closed", onClosed);
  43026. };
  43027. transport.bind("initialized", onInitialized);
  43028. transport.bind("open", onOpen);
  43029. transport.bind("error", onError);
  43030. transport.bind("closed", onClosed);
  43031. transport.initialize();
  43032. return {
  43033. abort: function () {
  43034. if (connected) {
  43035. return;
  43036. }
  43037. unbindListeners();
  43038. if (handshake) {
  43039. handshake.close();
  43040. }
  43041. else {
  43042. transport.close();
  43043. }
  43044. },
  43045. forceMinPriority: function (p) {
  43046. if (connected) {
  43047. return;
  43048. }
  43049. if (_this.priority < p) {
  43050. if (handshake) {
  43051. handshake.close();
  43052. }
  43053. else {
  43054. transport.close();
  43055. }
  43056. }
  43057. }
  43058. };
  43059. };
  43060. return TransportStrategy;
  43061. }());
  43062. /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
  43063. function failAttempt(error, callback) {
  43064. util.defer(function () {
  43065. callback(error);
  43066. });
  43067. return {
  43068. abort: function () { },
  43069. forceMinPriority: function () { }
  43070. };
  43071. }
  43072. // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
  43073. var strategy_builder_Transports = runtime.Transports;
  43074. var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
  43075. var transportClass = strategy_builder_Transports[type];
  43076. if (!transportClass) {
  43077. throw new UnsupportedTransport(type);
  43078. }
  43079. var enabled = (!config.enabledTransports ||
  43080. arrayIndexOf(config.enabledTransports, name) !== -1) &&
  43081. (!config.disabledTransports ||
  43082. arrayIndexOf(config.disabledTransports, name) === -1);
  43083. var transport;
  43084. if (enabled) {
  43085. transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, extend({
  43086. key: config.key,
  43087. useTLS: config.useTLS,
  43088. timeline: config.timeline,
  43089. ignoreNullOrigin: config.ignoreNullOrigin
  43090. }, options));
  43091. }
  43092. else {
  43093. transport = strategy_builder_UnsupportedStrategy;
  43094. }
  43095. return transport;
  43096. };
  43097. var strategy_builder_UnsupportedStrategy = {
  43098. isSupported: function () {
  43099. return false;
  43100. },
  43101. connect: function (_, callback) {
  43102. var deferred = util.defer(function () {
  43103. callback(new UnsupportedStrategy());
  43104. });
  43105. return {
  43106. abort: function () {
  43107. deferred.ensureAborted();
  43108. },
  43109. forceMinPriority: function () { }
  43110. };
  43111. }
  43112. };
  43113. // CONCATENATED MODULE: ./src/core/config.ts
  43114. var getGlobalConfig = function () {
  43115. return {
  43116. wsHost: defaults.host,
  43117. wsPort: defaults.ws_port,
  43118. wssPort: defaults.wss_port,
  43119. wsPath: defaults.ws_path,
  43120. httpHost: defaults.sockjs_host,
  43121. httpPort: defaults.sockjs_http_port,
  43122. httpsPort: defaults.sockjs_https_port,
  43123. httpPath: defaults.sockjs_path,
  43124. statsHost: defaults.stats_host,
  43125. authEndpoint: defaults.channel_auth_endpoint,
  43126. authTransport: defaults.channel_auth_transport,
  43127. activity_timeout: defaults.activity_timeout,
  43128. pong_timeout: defaults.pong_timeout,
  43129. unavailable_timeout: defaults.unavailable_timeout
  43130. };
  43131. };
  43132. var getClusterConfig = function (clusterName) {
  43133. return {
  43134. wsHost: 'ws-' + clusterName + '.pusher.com',
  43135. httpHost: 'sockjs-' + clusterName + '.pusher.com'
  43136. };
  43137. };
  43138. // CONCATENATED MODULE: ./src/core/pusher.ts
  43139. var pusher_Pusher = (function () {
  43140. function Pusher(app_key, options) {
  43141. var _this = this;
  43142. checkAppKey(app_key);
  43143. options = options || {};
  43144. if (!options.cluster && !(options.wsHost || options.httpHost)) {
  43145. var suffix = url_store.buildLogSuffix('javascriptQuickStart');
  43146. logger.warn("You should always specify a cluster when connecting. " + suffix);
  43147. }
  43148. this.key = app_key;
  43149. this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options);
  43150. this.channels = factory.createChannels();
  43151. this.global_emitter = new dispatcher();
  43152. this.sessionID = Math.floor(Math.random() * 1000000000);
  43153. this.timeline = new timeline_timeline(this.key, this.sessionID, {
  43154. cluster: this.config.cluster,
  43155. features: Pusher.getClientFeatures(),
  43156. params: this.config.timelineParams || {},
  43157. limit: 50,
  43158. level: timeline_level.INFO,
  43159. version: defaults.VERSION
  43160. });
  43161. if (!this.config.disableStats) {
  43162. this.timelineSender = factory.createTimelineSender(this.timeline, {
  43163. host: this.config.statsHost,
  43164. path: '/timeline/v2/' + runtime.TimelineTransport.name
  43165. });
  43166. }
  43167. var getStrategy = function (options) {
  43168. var config = extend({}, _this.config, options);
  43169. return runtime.getDefaultStrategy(config, strategy_builder_defineTransport);
  43170. };
  43171. this.connection = factory.createConnectionManager(this.key, extend({
  43172. getStrategy: getStrategy,
  43173. timeline: this.timeline,
  43174. activityTimeout: this.config.activity_timeout,
  43175. pongTimeout: this.config.pong_timeout,
  43176. unavailableTimeout: this.config.unavailable_timeout
  43177. }, this.config, { useTLS: this.shouldUseTLS() }));
  43178. this.connection.bind('connected', function () {
  43179. _this.subscribeAll();
  43180. if (_this.timelineSender) {
  43181. _this.timelineSender.send(_this.connection.isUsingTLS());
  43182. }
  43183. });
  43184. this.connection.bind('message', function (event) {
  43185. var eventName = event.event;
  43186. var internal = eventName.indexOf('pusher_internal:') === 0;
  43187. if (event.channel) {
  43188. var channel = _this.channel(event.channel);
  43189. if (channel) {
  43190. channel.handleEvent(event);
  43191. }
  43192. }
  43193. if (!internal) {
  43194. _this.global_emitter.emit(event.event, event.data);
  43195. }
  43196. });
  43197. this.connection.bind('connecting', function () {
  43198. _this.channels.disconnect();
  43199. });
  43200. this.connection.bind('disconnected', function () {
  43201. _this.channels.disconnect();
  43202. });
  43203. this.connection.bind('error', function (err) {
  43204. logger.warn(err);
  43205. });
  43206. Pusher.instances.push(this);
  43207. this.timeline.info({ instances: Pusher.instances.length });
  43208. if (Pusher.isReady) {
  43209. this.connect();
  43210. }
  43211. }
  43212. Pusher.ready = function () {
  43213. Pusher.isReady = true;
  43214. for (var i = 0, l = Pusher.instances.length; i < l; i++) {
  43215. Pusher.instances[i].connect();
  43216. }
  43217. };
  43218. Pusher.getClientFeatures = function () {
  43219. return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
  43220. return t.isSupported({});
  43221. }));
  43222. };
  43223. Pusher.prototype.channel = function (name) {
  43224. return this.channels.find(name);
  43225. };
  43226. Pusher.prototype.allChannels = function () {
  43227. return this.channels.all();
  43228. };
  43229. Pusher.prototype.connect = function () {
  43230. this.connection.connect();
  43231. if (this.timelineSender) {
  43232. if (!this.timelineSenderTimer) {
  43233. var usingTLS = this.connection.isUsingTLS();
  43234. var timelineSender = this.timelineSender;
  43235. this.timelineSenderTimer = new PeriodicTimer(60000, function () {
  43236. timelineSender.send(usingTLS);
  43237. });
  43238. }
  43239. }
  43240. };
  43241. Pusher.prototype.disconnect = function () {
  43242. this.connection.disconnect();
  43243. if (this.timelineSenderTimer) {
  43244. this.timelineSenderTimer.ensureAborted();
  43245. this.timelineSenderTimer = null;
  43246. }
  43247. };
  43248. Pusher.prototype.bind = function (event_name, callback, context) {
  43249. this.global_emitter.bind(event_name, callback, context);
  43250. return this;
  43251. };
  43252. Pusher.prototype.unbind = function (event_name, callback, context) {
  43253. this.global_emitter.unbind(event_name, callback, context);
  43254. return this;
  43255. };
  43256. Pusher.prototype.bind_global = function (callback) {
  43257. this.global_emitter.bind_global(callback);
  43258. return this;
  43259. };
  43260. Pusher.prototype.unbind_global = function (callback) {
  43261. this.global_emitter.unbind_global(callback);
  43262. return this;
  43263. };
  43264. Pusher.prototype.unbind_all = function (callback) {
  43265. this.global_emitter.unbind_all();
  43266. return this;
  43267. };
  43268. Pusher.prototype.subscribeAll = function () {
  43269. var channelName;
  43270. for (channelName in this.channels.channels) {
  43271. if (this.channels.channels.hasOwnProperty(channelName)) {
  43272. this.subscribe(channelName);
  43273. }
  43274. }
  43275. };
  43276. Pusher.prototype.subscribe = function (channel_name) {
  43277. var channel = this.channels.add(channel_name, this);
  43278. if (channel.subscriptionPending && channel.subscriptionCancelled) {
  43279. channel.reinstateSubscription();
  43280. }
  43281. else if (!channel.subscriptionPending &&
  43282. this.connection.state === 'connected') {
  43283. channel.subscribe();
  43284. }
  43285. return channel;
  43286. };
  43287. Pusher.prototype.unsubscribe = function (channel_name) {
  43288. var channel = this.channels.find(channel_name);
  43289. if (channel && channel.subscriptionPending) {
  43290. channel.cancelSubscription();
  43291. }
  43292. else {
  43293. channel = this.channels.remove(channel_name);
  43294. if (channel && this.connection.state === 'connected') {
  43295. channel.unsubscribe();
  43296. }
  43297. }
  43298. };
  43299. Pusher.prototype.send_event = function (event_name, data, channel) {
  43300. return this.connection.send_event(event_name, data, channel);
  43301. };
  43302. Pusher.prototype.shouldUseTLS = function () {
  43303. if (runtime.getProtocol() === 'https:') {
  43304. return true;
  43305. }
  43306. else if (this.config.forceTLS === true) {
  43307. return true;
  43308. }
  43309. else {
  43310. return Boolean(this.config.encrypted);
  43311. }
  43312. };
  43313. Pusher.instances = [];
  43314. Pusher.isReady = false;
  43315. Pusher.logToConsole = false;
  43316. Pusher.Runtime = runtime;
  43317. Pusher.ScriptReceivers = runtime.ScriptReceivers;
  43318. Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
  43319. Pusher.auth_callbacks = runtime.auth_callbacks;
  43320. return Pusher;
  43321. }());
  43322. /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
  43323. function checkAppKey(key) {
  43324. if (key === null || key === undefined) {
  43325. throw 'You must pass your app key when you instantiate Pusher.';
  43326. }
  43327. }
  43328. runtime.setup(pusher_Pusher);
  43329. /***/ })
  43330. /******/ ]);
  43331. });
  43332. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  43333. /***/ }),
  43334. /***/ "./node_modules/setimmediate/setImmediate.js":
  43335. /*!***************************************************!*\
  43336. !*** ./node_modules/setimmediate/setImmediate.js ***!
  43337. \***************************************************/
  43338. /*! no static exports found */
  43339. /***/ (function(module, exports, __webpack_require__) {
  43340. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  43341. "use strict";
  43342. if (global.setImmediate) {
  43343. return;
  43344. }
  43345. var nextHandle = 1; // Spec says greater than zero
  43346. var tasksByHandle = {};
  43347. var currentlyRunningATask = false;
  43348. var doc = global.document;
  43349. var registerImmediate;
  43350. function setImmediate(callback) {
  43351. // Callback can either be a function or a string
  43352. if (typeof callback !== "function") {
  43353. callback = new Function("" + callback);
  43354. }
  43355. // Copy function arguments
  43356. var args = new Array(arguments.length - 1);
  43357. for (var i = 0; i < args.length; i++) {
  43358. args[i] = arguments[i + 1];
  43359. }
  43360. // Store and register the task
  43361. var task = { callback: callback, args: args };
  43362. tasksByHandle[nextHandle] = task;
  43363. registerImmediate(nextHandle);
  43364. return nextHandle++;
  43365. }
  43366. function clearImmediate(handle) {
  43367. delete tasksByHandle[handle];
  43368. }
  43369. function run(task) {
  43370. var callback = task.callback;
  43371. var args = task.args;
  43372. switch (args.length) {
  43373. case 0:
  43374. callback();
  43375. break;
  43376. case 1:
  43377. callback(args[0]);
  43378. break;
  43379. case 2:
  43380. callback(args[0], args[1]);
  43381. break;
  43382. case 3:
  43383. callback(args[0], args[1], args[2]);
  43384. break;
  43385. default:
  43386. callback.apply(undefined, args);
  43387. break;
  43388. }
  43389. }
  43390. function runIfPresent(handle) {
  43391. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  43392. // So if we're currently running a task, we'll need to delay this invocation.
  43393. if (currentlyRunningATask) {
  43394. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  43395. // "too much recursion" error.
  43396. setTimeout(runIfPresent, 0, handle);
  43397. } else {
  43398. var task = tasksByHandle[handle];
  43399. if (task) {
  43400. currentlyRunningATask = true;
  43401. try {
  43402. run(task);
  43403. } finally {
  43404. clearImmediate(handle);
  43405. currentlyRunningATask = false;
  43406. }
  43407. }
  43408. }
  43409. }
  43410. function installNextTickImplementation() {
  43411. registerImmediate = function(handle) {
  43412. process.nextTick(function () { runIfPresent(handle); });
  43413. };
  43414. }
  43415. function canUsePostMessage() {
  43416. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  43417. // where `global.postMessage` means something completely different and can't be used for this purpose.
  43418. if (global.postMessage && !global.importScripts) {
  43419. var postMessageIsAsynchronous = true;
  43420. var oldOnMessage = global.onmessage;
  43421. global.onmessage = function() {
  43422. postMessageIsAsynchronous = false;
  43423. };
  43424. global.postMessage("", "*");
  43425. global.onmessage = oldOnMessage;
  43426. return postMessageIsAsynchronous;
  43427. }
  43428. }
  43429. function installPostMessageImplementation() {
  43430. // Installs an event handler on `global` for the `message` event: see
  43431. // * https://developer.mozilla.org/en/DOM/window.postMessage
  43432. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  43433. var messagePrefix = "setImmediate$" + Math.random() + "$";
  43434. var onGlobalMessage = function(event) {
  43435. if (event.source === global &&
  43436. typeof event.data === "string" &&
  43437. event.data.indexOf(messagePrefix) === 0) {
  43438. runIfPresent(+event.data.slice(messagePrefix.length));
  43439. }
  43440. };
  43441. if (global.addEventListener) {
  43442. global.addEventListener("message", onGlobalMessage, false);
  43443. } else {
  43444. global.attachEvent("onmessage", onGlobalMessage);
  43445. }
  43446. registerImmediate = function(handle) {
  43447. global.postMessage(messagePrefix + handle, "*");
  43448. };
  43449. }
  43450. function installMessageChannelImplementation() {
  43451. var channel = new MessageChannel();
  43452. channel.port1.onmessage = function(event) {
  43453. var handle = event.data;
  43454. runIfPresent(handle);
  43455. };
  43456. registerImmediate = function(handle) {
  43457. channel.port2.postMessage(handle);
  43458. };
  43459. }
  43460. function installReadyStateChangeImplementation() {
  43461. var html = doc.documentElement;
  43462. registerImmediate = function(handle) {
  43463. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  43464. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  43465. var script = doc.createElement("script");
  43466. script.onreadystatechange = function () {
  43467. runIfPresent(handle);
  43468. script.onreadystatechange = null;
  43469. html.removeChild(script);
  43470. script = null;
  43471. };
  43472. html.appendChild(script);
  43473. };
  43474. }
  43475. function installSetTimeoutImplementation() {
  43476. registerImmediate = function(handle) {
  43477. setTimeout(runIfPresent, 0, handle);
  43478. };
  43479. }
  43480. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  43481. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  43482. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  43483. // Don't get fooled by e.g. browserify environments.
  43484. if ({}.toString.call(global.process) === "[object process]") {
  43485. // For Node.js before 0.9
  43486. installNextTickImplementation();
  43487. } else if (canUsePostMessage()) {
  43488. // For non-IE10 modern browsers
  43489. installPostMessageImplementation();
  43490. } else if (global.MessageChannel) {
  43491. // For web workers, where supported
  43492. installMessageChannelImplementation();
  43493. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  43494. // For IE 6–8
  43495. installReadyStateChangeImplementation();
  43496. } else {
  43497. // For older browsers
  43498. installSetTimeoutImplementation();
  43499. }
  43500. attachTo.setImmediate = setImmediate;
  43501. attachTo.clearImmediate = clearImmediate;
  43502. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  43503. /* 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")))
  43504. /***/ }),
  43505. /***/ "./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/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css&":
  43506. /*!***********************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
  43507. !*** ./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/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css& ***!
  43508. \***********************************************************************************************************************************************************************************************************************************************************************************************************************************/
  43509. /*! no static exports found */
  43510. /***/ (function(module, exports, __webpack_require__) {
  43511. 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!./CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&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/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css&");
  43512. if(typeof content === 'string') content = [[module.i, content, '']];
  43513. var transform;
  43514. var insertInto;
  43515. var options = {"hmr":true}
  43516. options.transform = transform
  43517. options.insertInto = undefined;
  43518. var update = __webpack_require__(/*! ../../../node_modules/style-loader/lib/addStyles.js */ "./node_modules/style-loader/lib/addStyles.js")(content, options);
  43519. if(content.locals) module.exports = content.locals;
  43520. if(false) {}
  43521. /***/ }),
  43522. /***/ "./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&":
  43523. /*!************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
  43524. !*** ./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& ***!
  43525. \************************************************************************************************************************************************************************************************************************************************************************************************************************/
  43526. /*! no static exports found */
  43527. /***/ (function(module, exports, __webpack_require__) {
  43528. 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&");
  43529. if(typeof content === 'string') content = [[module.i, content, '']];
  43530. var transform;
  43531. var insertInto;
  43532. var options = {"hmr":true}
  43533. options.transform = transform
  43534. options.insertInto = undefined;
  43535. var update = __webpack_require__(/*! ../../../node_modules/style-loader/lib/addStyles.js */ "./node_modules/style-loader/lib/addStyles.js")(content, options);
  43536. if(content.locals) module.exports = content.locals;
  43537. if(false) {}
  43538. /***/ }),
  43539. /***/ "./node_modules/style-loader/lib/addStyles.js":
  43540. /*!****************************************************!*\
  43541. !*** ./node_modules/style-loader/lib/addStyles.js ***!
  43542. \****************************************************/
  43543. /*! no static exports found */
  43544. /***/ (function(module, exports, __webpack_require__) {
  43545. /*
  43546. MIT License http://www.opensource.org/licenses/mit-license.php
  43547. Author Tobias Koppers @sokra
  43548. */
  43549. var stylesInDom = {};
  43550. var memoize = function (fn) {
  43551. var memo;
  43552. return function () {
  43553. if (typeof memo === "undefined") memo = fn.apply(this, arguments);
  43554. return memo;
  43555. };
  43556. };
  43557. var isOldIE = memoize(function () {
  43558. // Test for IE <= 9 as proposed by Browserhacks
  43559. // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
  43560. // Tests for existence of standard globals is to allow style-loader
  43561. // to operate correctly into non-standard environments
  43562. // @see https://github.com/webpack-contrib/style-loader/issues/177
  43563. return window && document && document.all && !window.atob;
  43564. });
  43565. var getTarget = function (target, parent) {
  43566. if (parent){
  43567. return parent.querySelector(target);
  43568. }
  43569. return document.querySelector(target);
  43570. };
  43571. var getElement = (function (fn) {
  43572. var memo = {};
  43573. return function(target, parent) {
  43574. // If passing function in options, then use it for resolve "head" element.
  43575. // Useful for Shadow Root style i.e
  43576. // {
  43577. // insertInto: function () { return document.querySelector("#foo").shadowRoot }
  43578. // }
  43579. if (typeof target === 'function') {
  43580. return target();
  43581. }
  43582. if (typeof memo[target] === "undefined") {
  43583. var styleTarget = getTarget.call(this, target, parent);
  43584. // Special case to return head of iframe instead of iframe itself
  43585. if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
  43586. try {
  43587. // This will throw an exception if access to iframe is blocked
  43588. // due to cross-origin restrictions
  43589. styleTarget = styleTarget.contentDocument.head;
  43590. } catch(e) {
  43591. styleTarget = null;
  43592. }
  43593. }
  43594. memo[target] = styleTarget;
  43595. }
  43596. return memo[target]
  43597. };
  43598. })();
  43599. var singleton = null;
  43600. var singletonCounter = 0;
  43601. var stylesInsertedAtTop = [];
  43602. var fixUrls = __webpack_require__(/*! ./urls */ "./node_modules/style-loader/lib/urls.js");
  43603. module.exports = function(list, options) {
  43604. if (typeof DEBUG !== "undefined" && DEBUG) {
  43605. if (typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
  43606. }
  43607. options = options || {};
  43608. options.attrs = typeof options.attrs === "object" ? options.attrs : {};
  43609. // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
  43610. // tags it will allow on a page
  43611. if (!options.singleton && typeof options.singleton !== "boolean") options.singleton = isOldIE();
  43612. // By default, add <style> tags to the <head> element
  43613. if (!options.insertInto) options.insertInto = "head";
  43614. // By default, add <style> tags to the bottom of the target
  43615. if (!options.insertAt) options.insertAt = "bottom";
  43616. var styles = listToStyles(list, options);
  43617. addStylesToDom(styles, options);
  43618. return function update (newList) {
  43619. var mayRemove = [];
  43620. for (var i = 0; i < styles.length; i++) {
  43621. var item = styles[i];
  43622. var domStyle = stylesInDom[item.id];
  43623. domStyle.refs--;
  43624. mayRemove.push(domStyle);
  43625. }
  43626. if(newList) {
  43627. var newStyles = listToStyles(newList, options);
  43628. addStylesToDom(newStyles, options);
  43629. }
  43630. for (var i = 0; i < mayRemove.length; i++) {
  43631. var domStyle = mayRemove[i];
  43632. if(domStyle.refs === 0) {
  43633. for (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j]();
  43634. delete stylesInDom[domStyle.id];
  43635. }
  43636. }
  43637. };
  43638. };
  43639. function addStylesToDom (styles, options) {
  43640. for (var i = 0; i < styles.length; i++) {
  43641. var item = styles[i];
  43642. var domStyle = stylesInDom[item.id];
  43643. if(domStyle) {
  43644. domStyle.refs++;
  43645. for(var j = 0; j < domStyle.parts.length; j++) {
  43646. domStyle.parts[j](item.parts[j]);
  43647. }
  43648. for(; j < item.parts.length; j++) {
  43649. domStyle.parts.push(addStyle(item.parts[j], options));
  43650. }
  43651. } else {
  43652. var parts = [];
  43653. for(var j = 0; j < item.parts.length; j++) {
  43654. parts.push(addStyle(item.parts[j], options));
  43655. }
  43656. stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
  43657. }
  43658. }
  43659. }
  43660. function listToStyles (list, options) {
  43661. var styles = [];
  43662. var newStyles = {};
  43663. for (var i = 0; i < list.length; i++) {
  43664. var item = list[i];
  43665. var id = options.base ? item[0] + options.base : item[0];
  43666. var css = item[1];
  43667. var media = item[2];
  43668. var sourceMap = item[3];
  43669. var part = {css: css, media: media, sourceMap: sourceMap};
  43670. if(!newStyles[id]) styles.push(newStyles[id] = {id: id, parts: [part]});
  43671. else newStyles[id].parts.push(part);
  43672. }
  43673. return styles;
  43674. }
  43675. function insertStyleElement (options, style) {
  43676. var target = getElement(options.insertInto)
  43677. if (!target) {
  43678. throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");
  43679. }
  43680. var lastStyleElementInsertedAtTop = stylesInsertedAtTop[stylesInsertedAtTop.length - 1];
  43681. if (options.insertAt === "top") {
  43682. if (!lastStyleElementInsertedAtTop) {
  43683. target.insertBefore(style, target.firstChild);
  43684. } else if (lastStyleElementInsertedAtTop.nextSibling) {
  43685. target.insertBefore(style, lastStyleElementInsertedAtTop.nextSibling);
  43686. } else {
  43687. target.appendChild(style);
  43688. }
  43689. stylesInsertedAtTop.push(style);
  43690. } else if (options.insertAt === "bottom") {
  43691. target.appendChild(style);
  43692. } else if (typeof options.insertAt === "object" && options.insertAt.before) {
  43693. var nextSibling = getElement(options.insertAt.before, target);
  43694. target.insertBefore(style, nextSibling);
  43695. } else {
  43696. 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");
  43697. }
  43698. }
  43699. function removeStyleElement (style) {
  43700. if (style.parentNode === null) return false;
  43701. style.parentNode.removeChild(style);
  43702. var idx = stylesInsertedAtTop.indexOf(style);
  43703. if(idx >= 0) {
  43704. stylesInsertedAtTop.splice(idx, 1);
  43705. }
  43706. }
  43707. function createStyleElement (options) {
  43708. var style = document.createElement("style");
  43709. if(options.attrs.type === undefined) {
  43710. options.attrs.type = "text/css";
  43711. }
  43712. if(options.attrs.nonce === undefined) {
  43713. var nonce = getNonce();
  43714. if (nonce) {
  43715. options.attrs.nonce = nonce;
  43716. }
  43717. }
  43718. addAttrs(style, options.attrs);
  43719. insertStyleElement(options, style);
  43720. return style;
  43721. }
  43722. function createLinkElement (options) {
  43723. var link = document.createElement("link");
  43724. if(options.attrs.type === undefined) {
  43725. options.attrs.type = "text/css";
  43726. }
  43727. options.attrs.rel = "stylesheet";
  43728. addAttrs(link, options.attrs);
  43729. insertStyleElement(options, link);
  43730. return link;
  43731. }
  43732. function addAttrs (el, attrs) {
  43733. Object.keys(attrs).forEach(function (key) {
  43734. el.setAttribute(key, attrs[key]);
  43735. });
  43736. }
  43737. function getNonce() {
  43738. if (false) {}
  43739. return __webpack_require__.nc;
  43740. }
  43741. function addStyle (obj, options) {
  43742. var style, update, remove, result;
  43743. // If a transform function was defined, run it on the css
  43744. if (options.transform && obj.css) {
  43745. result = typeof options.transform === 'function'
  43746. ? options.transform(obj.css)
  43747. : options.transform.default(obj.css);
  43748. if (result) {
  43749. // If transform returns a value, use that instead of the original css.
  43750. // This allows running runtime transformations on the css.
  43751. obj.css = result;
  43752. } else {
  43753. // If the transform function returns a falsy value, don't add this css.
  43754. // This allows conditional loading of css
  43755. return function() {
  43756. // noop
  43757. };
  43758. }
  43759. }
  43760. if (options.singleton) {
  43761. var styleIndex = singletonCounter++;
  43762. style = singleton || (singleton = createStyleElement(options));
  43763. update = applyToSingletonTag.bind(null, style, styleIndex, false);
  43764. remove = applyToSingletonTag.bind(null, style, styleIndex, true);
  43765. } else if (
  43766. obj.sourceMap &&
  43767. typeof URL === "function" &&
  43768. typeof URL.createObjectURL === "function" &&
  43769. typeof URL.revokeObjectURL === "function" &&
  43770. typeof Blob === "function" &&
  43771. typeof btoa === "function"
  43772. ) {
  43773. style = createLinkElement(options);
  43774. update = updateLink.bind(null, style, options);
  43775. remove = function () {
  43776. removeStyleElement(style);
  43777. if(style.href) URL.revokeObjectURL(style.href);
  43778. };
  43779. } else {
  43780. style = createStyleElement(options);
  43781. update = applyToTag.bind(null, style);
  43782. remove = function () {
  43783. removeStyleElement(style);
  43784. };
  43785. }
  43786. update(obj);
  43787. return function updateStyle (newObj) {
  43788. if (newObj) {
  43789. if (
  43790. newObj.css === obj.css &&
  43791. newObj.media === obj.media &&
  43792. newObj.sourceMap === obj.sourceMap
  43793. ) {
  43794. return;
  43795. }
  43796. update(obj = newObj);
  43797. } else {
  43798. remove();
  43799. }
  43800. };
  43801. }
  43802. var replaceText = (function () {
  43803. var textStore = [];
  43804. return function (index, replacement) {
  43805. textStore[index] = replacement;
  43806. return textStore.filter(Boolean).join('\n');
  43807. };
  43808. })();
  43809. function applyToSingletonTag (style, index, remove, obj) {
  43810. var css = remove ? "" : obj.css;
  43811. if (style.styleSheet) {
  43812. style.styleSheet.cssText = replaceText(index, css);
  43813. } else {
  43814. var cssNode = document.createTextNode(css);
  43815. var childNodes = style.childNodes;
  43816. if (childNodes[index]) style.removeChild(childNodes[index]);
  43817. if (childNodes.length) {
  43818. style.insertBefore(cssNode, childNodes[index]);
  43819. } else {
  43820. style.appendChild(cssNode);
  43821. }
  43822. }
  43823. }
  43824. function applyToTag (style, obj) {
  43825. var css = obj.css;
  43826. var media = obj.media;
  43827. if(media) {
  43828. style.setAttribute("media", media)
  43829. }
  43830. if(style.styleSheet) {
  43831. style.styleSheet.cssText = css;
  43832. } else {
  43833. while(style.firstChild) {
  43834. style.removeChild(style.firstChild);
  43835. }
  43836. style.appendChild(document.createTextNode(css));
  43837. }
  43838. }
  43839. function updateLink (link, options, obj) {
  43840. var css = obj.css;
  43841. var sourceMap = obj.sourceMap;
  43842. /*
  43843. If convertToAbsoluteUrls isn't defined, but sourcemaps are enabled
  43844. and there is no publicPath defined then lets turn convertToAbsoluteUrls
  43845. on by default. Otherwise default to the convertToAbsoluteUrls option
  43846. directly
  43847. */
  43848. var autoFixUrls = options.convertToAbsoluteUrls === undefined && sourceMap;
  43849. if (options.convertToAbsoluteUrls || autoFixUrls) {
  43850. css = fixUrls(css);
  43851. }
  43852. if (sourceMap) {
  43853. // http://stackoverflow.com/a/26603875
  43854. css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
  43855. }
  43856. var blob = new Blob([css], { type: "text/css" });
  43857. var oldSrc = link.href;
  43858. link.href = URL.createObjectURL(blob);
  43859. if(oldSrc) URL.revokeObjectURL(oldSrc);
  43860. }
  43861. /***/ }),
  43862. /***/ "./node_modules/style-loader/lib/urls.js":
  43863. /*!***********************************************!*\
  43864. !*** ./node_modules/style-loader/lib/urls.js ***!
  43865. \***********************************************/
  43866. /*! no static exports found */
  43867. /***/ (function(module, exports) {
  43868. /**
  43869. * When source maps are enabled, `style-loader` uses a link element with a data-uri to
  43870. * embed the css on the page. This breaks all relative urls because now they are relative to a
  43871. * bundle instead of the current page.
  43872. *
  43873. * One solution is to only use full urls, but that may be impossible.
  43874. *
  43875. * Instead, this function "fixes" the relative urls to be absolute according to the current page location.
  43876. *
  43877. * A rudimentary test suite is located at `test/fixUrls.js` and can be run via the `npm test` command.
  43878. *
  43879. */
  43880. module.exports = function (css) {
  43881. // get current location
  43882. var location = typeof window !== "undefined" && window.location;
  43883. if (!location) {
  43884. throw new Error("fixUrls requires window.location");
  43885. }
  43886. // blank or null?
  43887. if (!css || typeof css !== "string") {
  43888. return css;
  43889. }
  43890. var baseUrl = location.protocol + "//" + location.host;
  43891. var currentDir = baseUrl + location.pathname.replace(/\/[^\/]*$/, "/");
  43892. // convert each url(...)
  43893. /*
  43894. This regular expression is just a way to recursively match brackets within
  43895. a string.
  43896. /url\s*\( = Match on the word "url" with any whitespace after it and then a parens
  43897. ( = Start a capturing group
  43898. (?: = Start a non-capturing group
  43899. [^)(] = Match anything that isn't a parentheses
  43900. | = OR
  43901. \( = Match a start parentheses
  43902. (?: = Start another non-capturing groups
  43903. [^)(]+ = Match anything that isn't a parentheses
  43904. | = OR
  43905. \( = Match a start parentheses
  43906. [^)(]* = Match anything that isn't a parentheses
  43907. \) = Match a end parentheses
  43908. ) = End Group
  43909. *\) = Match anything and then a close parens
  43910. ) = Close non-capturing group
  43911. * = Match anything
  43912. ) = Close capturing group
  43913. \) = Match a close parens
  43914. /gi = Get all matches, not the first. Be case insensitive.
  43915. */
  43916. var fixedCss = css.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function(fullMatch, origUrl) {
  43917. // strip quotes (if they exist)
  43918. var unquotedOrigUrl = origUrl
  43919. .trim()
  43920. .replace(/^"(.*)"$/, function(o, $1){ return $1; })
  43921. .replace(/^'(.*)'$/, function(o, $1){ return $1; });
  43922. // already a full url? no change
  43923. if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(unquotedOrigUrl)) {
  43924. return fullMatch;
  43925. }
  43926. // convert the url to a full url
  43927. var newUrl;
  43928. if (unquotedOrigUrl.indexOf("//") === 0) {
  43929. //TODO: should we add protocol?
  43930. newUrl = unquotedOrigUrl;
  43931. } else if (unquotedOrigUrl.indexOf("/") === 0) {
  43932. // path should be relative to the base url
  43933. newUrl = baseUrl + unquotedOrigUrl; // already starts with '/'
  43934. } else {
  43935. // path should be relative to current directory
  43936. newUrl = currentDir + unquotedOrigUrl.replace(/^\.\//, ""); // Strip leading './'
  43937. }
  43938. // send back the fixed url(...)
  43939. return "url(" + JSON.stringify(newUrl) + ")";
  43940. });
  43941. // send back the fixed css
  43942. return fixedCss;
  43943. };
  43944. /***/ }),
  43945. /***/ "./node_modules/timers-browserify/main.js":
  43946. /*!************************************************!*\
  43947. !*** ./node_modules/timers-browserify/main.js ***!
  43948. \************************************************/
  43949. /*! no static exports found */
  43950. /***/ (function(module, exports, __webpack_require__) {
  43951. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  43952. (typeof self !== "undefined" && self) ||
  43953. window;
  43954. var apply = Function.prototype.apply;
  43955. // DOM APIs, for completeness
  43956. exports.setTimeout = function() {
  43957. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  43958. };
  43959. exports.setInterval = function() {
  43960. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  43961. };
  43962. exports.clearTimeout =
  43963. exports.clearInterval = function(timeout) {
  43964. if (timeout) {
  43965. timeout.close();
  43966. }
  43967. };
  43968. function Timeout(id, clearFn) {
  43969. this._id = id;
  43970. this._clearFn = clearFn;
  43971. }
  43972. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  43973. Timeout.prototype.close = function() {
  43974. this._clearFn.call(scope, this._id);
  43975. };
  43976. // Does not start the time, just sets up the members needed.
  43977. exports.enroll = function(item, msecs) {
  43978. clearTimeout(item._idleTimeoutId);
  43979. item._idleTimeout = msecs;
  43980. };
  43981. exports.unenroll = function(item) {
  43982. clearTimeout(item._idleTimeoutId);
  43983. item._idleTimeout = -1;
  43984. };
  43985. exports._unrefActive = exports.active = function(item) {
  43986. clearTimeout(item._idleTimeoutId);
  43987. var msecs = item._idleTimeout;
  43988. if (msecs >= 0) {
  43989. item._idleTimeoutId = setTimeout(function onTimeout() {
  43990. if (item._onTimeout)
  43991. item._onTimeout();
  43992. }, msecs);
  43993. }
  43994. };
  43995. // setimmediate attaches itself to the global object
  43996. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  43997. // On some exotic environments, it's not clear which object `setimmediate` was
  43998. // able to install onto. Search each possibility in the same order as the
  43999. // `setimmediate` library.
  44000. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  44001. (typeof global !== "undefined" && global.setImmediate) ||
  44002. (this && this.setImmediate);
  44003. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  44004. (typeof global !== "undefined" && global.clearImmediate) ||
  44005. (this && this.clearImmediate);
  44006. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  44007. /***/ }),
  44008. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AssetInfo.vue?vue&type=template&id=f949323a&":
  44009. /*!************************************************************************************************************************************************************************************************************!*\
  44010. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/AssetInfo.vue?vue&type=template&id=f949323a& ***!
  44011. \************************************************************************************************************************************************************************************************************/
  44012. /*! exports provided: render, staticRenderFns */
  44013. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44014. "use strict";
  44015. __webpack_require__.r(__webpack_exports__);
  44016. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44017. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44018. var render = function() {
  44019. var _vm = this
  44020. var _h = _vm.$createElement
  44021. var _c = _vm._self._c || _h
  44022. return _c(
  44023. "div",
  44024. [
  44025. _c("asset-info-edit-modal", {
  44026. attrs: {
  44027. "modal-id": "asset" + _vm.asset.pcid + "editModal",
  44028. "populate-with": _vm.asset
  44029. }
  44030. }),
  44031. _vm._v(" "),
  44032. _c("h4", { staticClass: "text-center" }, [
  44033. _vm._v(
  44034. _vm._s(this.asset.pcmanu) + " " + _vm._s(this.asset.pcmake) + " - "
  44035. ),
  44036. _c("small", { staticClass: "text-muted" }, [
  44037. _vm._v(_vm._s(this.asset.pcnickname))
  44038. ])
  44039. ]),
  44040. _vm._v(" "),
  44041. _c("p", [_vm._v("OS: " + _vm._s(this.asset.pcextra[2]))]),
  44042. _vm._v(" "),
  44043. _c("p", [_vm._v("S/N: " + _vm._s(this.asset.pcextra[104]))]),
  44044. _vm._v(" "),
  44045. _c("p", [_vm._v("CPU: " + _vm._s(this.asset.pcextra[101]))]),
  44046. _vm._v(" "),
  44047. _c("p", [_vm._v("RAM: " + _vm._s(this.asset.pcextra[100]))]),
  44048. _vm._v(" "),
  44049. _c("p", [_vm._v("Graphics: " + _vm._s(this.asset.pcextra[4]))]),
  44050. _vm._v(" "),
  44051. _c(
  44052. "button",
  44053. {
  44054. staticClass: "btn btn-primary",
  44055. attrs: {
  44056. type: "button",
  44057. "data-toggle": "modal",
  44058. "data-target": "#asset" + _vm.asset.pcid + "editModal"
  44059. }
  44060. },
  44061. [_vm._v("Edit")]
  44062. )
  44063. ],
  44064. 1
  44065. )
  44066. }
  44067. var staticRenderFns = []
  44068. render._withStripped = true
  44069. /***/ }),
  44070. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AssetInfoEditModal.vue?vue&type=template&id=24c98bd0&":
  44071. /*!*********************************************************************************************************************************************************************************************************************!*\
  44072. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/AssetInfoEditModal.vue?vue&type=template&id=24c98bd0& ***!
  44073. \*********************************************************************************************************************************************************************************************************************/
  44074. /*! exports provided: render, staticRenderFns */
  44075. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44076. "use strict";
  44077. __webpack_require__.r(__webpack_exports__);
  44078. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44079. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44080. var render = function() {
  44081. var _vm = this
  44082. var _h = _vm.$createElement
  44083. var _c = _vm._self._c || _h
  44084. return _c(
  44085. "modal",
  44086. {
  44087. attrs: {
  44088. id: _vm.modalId,
  44089. tabindex: "-1",
  44090. role: "dialog",
  44091. "aria-labelledby": _vm.modalId + "Label"
  44092. }
  44093. },
  44094. [
  44095. _c(
  44096. "h5",
  44097. {
  44098. staticClass: "modal-title",
  44099. attrs: { slot: "header", id: _vm.modalId + "Label" },
  44100. slot: "header"
  44101. },
  44102. [_vm._v("\n Edit Work Order Information\n ")]
  44103. ),
  44104. _vm._v(" "),
  44105. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44106. _c("div", { staticClass: "form-group" }, [
  44107. _c("label", { attrs: { for: "manufacturer" } }, [
  44108. _vm._v("Manufacturer")
  44109. ]),
  44110. _vm._v(" "),
  44111. _c("input", {
  44112. directives: [
  44113. {
  44114. name: "model",
  44115. rawName: "v-model",
  44116. value: _vm.asset.pcmanu,
  44117. expression: "asset.pcmanu"
  44118. }
  44119. ],
  44120. staticClass: "form-control",
  44121. attrs: { type: "text", name: "manufacturer", id: "manufacturer" },
  44122. domProps: { value: _vm.asset.pcmanu },
  44123. on: {
  44124. input: function($event) {
  44125. if ($event.target.composing) {
  44126. return
  44127. }
  44128. _vm.$set(_vm.asset, "pcmanu", $event.target.value)
  44129. }
  44130. }
  44131. })
  44132. ]),
  44133. _vm._v(" "),
  44134. _c("div", { staticClass: "form-group" }, [
  44135. _c("label", { attrs: { for: "make" } }, [_vm._v("Make")]),
  44136. _vm._v(" "),
  44137. _c("input", {
  44138. directives: [
  44139. {
  44140. name: "model",
  44141. rawName: "v-model",
  44142. value: _vm.asset.pcmake,
  44143. expression: "asset.pcmake"
  44144. }
  44145. ],
  44146. staticClass: "form-control",
  44147. attrs: { type: "text", name: "make", id: "make" },
  44148. domProps: { value: _vm.asset.pcmake },
  44149. on: {
  44150. input: function($event) {
  44151. if ($event.target.composing) {
  44152. return
  44153. }
  44154. _vm.$set(_vm.asset, "pcmake", $event.target.value)
  44155. }
  44156. }
  44157. })
  44158. ]),
  44159. _vm._v(" "),
  44160. _c("div", { staticClass: "form-group" }, [
  44161. _c("label", { attrs: { for: "nickname" } }, [_vm._v("Nickname")]),
  44162. _vm._v(" "),
  44163. _c("input", {
  44164. directives: [
  44165. {
  44166. name: "model",
  44167. rawName: "v-model",
  44168. value: _vm.asset.pcnickname,
  44169. expression: "asset.pcnickname"
  44170. }
  44171. ],
  44172. staticClass: "form-control",
  44173. attrs: { type: "text", name: "nickname", id: "nickname" },
  44174. domProps: { value: _vm.asset.pcnickname },
  44175. on: {
  44176. input: function($event) {
  44177. if ($event.target.composing) {
  44178. return
  44179. }
  44180. _vm.$set(_vm.asset, "pcnickname", $event.target.value)
  44181. }
  44182. }
  44183. })
  44184. ]),
  44185. _vm._v(" "),
  44186. _c("div", { staticClass: "form-group" }, [
  44187. _c("label", { attrs: { for: "os" } }, [_vm._v("OS")]),
  44188. _vm._v(" "),
  44189. _c("input", {
  44190. directives: [
  44191. {
  44192. name: "model",
  44193. rawName: "v-model",
  44194. value: _vm.asset.pcextra[2],
  44195. expression: "asset.pcextra[2]"
  44196. }
  44197. ],
  44198. staticClass: "form-control",
  44199. attrs: { type: "text", name: "os", id: "os" },
  44200. domProps: { value: _vm.asset.pcextra[2] },
  44201. on: {
  44202. input: function($event) {
  44203. if ($event.target.composing) {
  44204. return
  44205. }
  44206. _vm.$set(_vm.asset.pcextra, 2, $event.target.value)
  44207. }
  44208. }
  44209. })
  44210. ]),
  44211. _vm._v(" "),
  44212. _c("div", { staticClass: "form-group" }, [
  44213. _c("label", { attrs: { for: "serial" } }, [_vm._v("Serial Number")]),
  44214. _vm._v(" "),
  44215. _c("input", {
  44216. directives: [
  44217. {
  44218. name: "model",
  44219. rawName: "v-model",
  44220. value: _vm.asset.pcextra[104],
  44221. expression: "asset.pcextra[104]"
  44222. }
  44223. ],
  44224. staticClass: "form-control",
  44225. attrs: { type: "text", id: "serial", name: "serial" },
  44226. domProps: { value: _vm.asset.pcextra[104] },
  44227. on: {
  44228. input: function($event) {
  44229. if ($event.target.composing) {
  44230. return
  44231. }
  44232. _vm.$set(_vm.asset.pcextra, 104, $event.target.value)
  44233. }
  44234. }
  44235. })
  44236. ]),
  44237. _vm._v(" "),
  44238. _c("div", { staticClass: "form-group" }, [
  44239. _c("label", { attrs: { for: "cpu" } }, [_vm._v("CPU")]),
  44240. _vm._v(" "),
  44241. _c("input", {
  44242. directives: [
  44243. {
  44244. name: "model",
  44245. rawName: "v-model",
  44246. value: _vm.asset.pcextra[101],
  44247. expression: "asset.pcextra[101]"
  44248. }
  44249. ],
  44250. staticClass: "form-control",
  44251. attrs: { type: "text", id: "cpu", name: "cpu" },
  44252. domProps: { value: _vm.asset.pcextra[101] },
  44253. on: {
  44254. input: function($event) {
  44255. if ($event.target.composing) {
  44256. return
  44257. }
  44258. _vm.$set(_vm.asset.pcextra, 101, $event.target.value)
  44259. }
  44260. }
  44261. })
  44262. ]),
  44263. _vm._v(" "),
  44264. _c("div", { staticClass: "form-group" }, [
  44265. _c("label", { attrs: { for: "ram" } }, [_vm._v("RAM")]),
  44266. _vm._v(" "),
  44267. _c("input", {
  44268. directives: [
  44269. {
  44270. name: "model",
  44271. rawName: "v-model",
  44272. value: _vm.asset.pcextra[100],
  44273. expression: "asset.pcextra[100]"
  44274. }
  44275. ],
  44276. staticClass: "form-control",
  44277. attrs: { type: "text", name: "ram", id: "ram" },
  44278. domProps: { value: _vm.asset.pcextra[100] },
  44279. on: {
  44280. input: function($event) {
  44281. if ($event.target.composing) {
  44282. return
  44283. }
  44284. _vm.$set(_vm.asset.pcextra, 100, $event.target.value)
  44285. }
  44286. }
  44287. })
  44288. ]),
  44289. _vm._v(" "),
  44290. _c("div", { staticClass: "form-group" }, [
  44291. _c("label", { attrs: { for: "graphics" } }, [_vm._v("Graphics")]),
  44292. _vm._v(" "),
  44293. _c("input", {
  44294. directives: [
  44295. {
  44296. name: "model",
  44297. rawName: "v-model",
  44298. value: _vm.asset.pcextra[4],
  44299. expression: "asset.pcextra[4]"
  44300. }
  44301. ],
  44302. staticClass: "form-control",
  44303. attrs: { type: "text", name: "graphics", id: "grapics" },
  44304. domProps: { value: _vm.asset.pcextra[4] },
  44305. on: {
  44306. input: function($event) {
  44307. if ($event.target.composing) {
  44308. return
  44309. }
  44310. _vm.$set(_vm.asset.pcextra, 4, $event.target.value)
  44311. }
  44312. }
  44313. })
  44314. ])
  44315. ]),
  44316. _vm._v(" "),
  44317. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44318. _c(
  44319. "button",
  44320. {
  44321. staticClass: "btn btn-secondary",
  44322. attrs: { type: "button", "data-dismiss": "modal" }
  44323. },
  44324. [_vm._v("Close")]
  44325. ),
  44326. _vm._v(" "),
  44327. _c(
  44328. "button",
  44329. {
  44330. staticClass: "btn btn-primary",
  44331. attrs: { type: "button" },
  44332. on: {
  44333. click: function($event) {
  44334. return _vm.updateAsset()
  44335. }
  44336. }
  44337. },
  44338. [
  44339. !_vm.assetSaving
  44340. ? _c("div", [_vm._v("Save")])
  44341. : _c("circle-spinner", { attrs: { size: 2 } })
  44342. ],
  44343. 1
  44344. )
  44345. ])
  44346. ]
  44347. )
  44348. }
  44349. var staticRenderFns = []
  44350. render._withStripped = true
  44351. /***/ }),
  44352. /***/ "./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&":
  44353. /*!*****************************************************************************************************************************************************************************************************************************!*\
  44354. !*** ./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& ***!
  44355. \*****************************************************************************************************************************************************************************************************************************/
  44356. /*! exports provided: render, staticRenderFns */
  44357. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44358. "use strict";
  44359. __webpack_require__.r(__webpack_exports__);
  44360. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44361. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44362. var render = function() {
  44363. var _vm = this
  44364. var _h = _vm.$createElement
  44365. var _c = _vm._self._c || _h
  44366. return _c("div", { staticClass: "dropdown", class: { open: _vm.open } }, [
  44367. _c("div", { staticClass: "input-group" }, [
  44368. _c("input", {
  44369. directives: [
  44370. {
  44371. name: "model",
  44372. rawName: "v-model",
  44373. value: _vm.searchText,
  44374. expression: "searchText"
  44375. }
  44376. ],
  44377. staticClass: "form-control",
  44378. attrs: { type: "text" },
  44379. domProps: { value: _vm.searchText },
  44380. on: {
  44381. input: [
  44382. function($event) {
  44383. if ($event.target.composing) {
  44384. return
  44385. }
  44386. _vm.searchText = $event.target.value
  44387. },
  44388. _vm.searchChanged
  44389. ]
  44390. }
  44391. }),
  44392. _vm._v(" "),
  44393. _c("div", { staticClass: "form-group-append" }, [
  44394. _c(
  44395. "a",
  44396. {
  44397. staticClass: "toggle input-group-text bg-primary text-light",
  44398. on: {
  44399. mousedown: function($event) {
  44400. $event.preventDefault()
  44401. },
  44402. click: function($event) {
  44403. return _vm.setOpen(!_vm.open)
  44404. }
  44405. }
  44406. },
  44407. [
  44408. _c("span", { staticClass: "arrow-up" }, [_vm._v("▲")]),
  44409. _vm._v(" "),
  44410. _c("span", { staticClass: "arrow-down" }, [_vm._v("▼")])
  44411. ]
  44412. )
  44413. ])
  44414. ]),
  44415. _vm._v(" "),
  44416. _c(
  44417. "ul",
  44418. { staticClass: "suggestion-list list-unstyled" },
  44419. _vm._l(_vm.matches, function(suggestion, index) {
  44420. return _c(
  44421. "li",
  44422. {
  44423. key: index,
  44424. on: {
  44425. mousedown: function($event) {
  44426. $event.preventDefault()
  44427. },
  44428. click: function($event) {
  44429. return _vm.suggestionSelected(suggestion)
  44430. }
  44431. }
  44432. },
  44433. [_vm._v("\n " + _vm._s(suggestion[1]) + "\n ")]
  44434. )
  44435. }),
  44436. 0
  44437. )
  44438. ])
  44439. }
  44440. var staticRenderFns = []
  44441. render._withStripped = true
  44442. /***/ }),
  44443. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true&":
  44444. /*!****************************************************************************************************************************************************************************************************************************!*\
  44445. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true& ***!
  44446. \****************************************************************************************************************************************************************************************************************************/
  44447. /*! exports provided: render, staticRenderFns */
  44448. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44449. "use strict";
  44450. __webpack_require__.r(__webpack_exports__);
  44451. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44452. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44453. var render = function() {
  44454. var _vm = this
  44455. var _h = _vm.$createElement
  44456. var _c = _vm._self._c || _h
  44457. return _c(
  44458. "div",
  44459. {
  44460. staticClass: "loader",
  44461. style: {
  44462. fontSize: _vm.size + "px",
  44463. borderLeft: "1.1em solid " + _vm.color
  44464. }
  44465. },
  44466. [_vm._v("Loading...")]
  44467. )
  44468. }
  44469. var staticRenderFns = []
  44470. render._withStripped = true
  44471. /***/ }),
  44472. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/Credential.vue?vue&type=template&id=58b8dcfc&":
  44473. /*!*************************************************************************************************************************************************************************************************************!*\
  44474. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/Credential.vue?vue&type=template&id=58b8dcfc& ***!
  44475. \*************************************************************************************************************************************************************************************************************/
  44476. /*! exports provided: render, staticRenderFns */
  44477. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44478. "use strict";
  44479. __webpack_require__.r(__webpack_exports__);
  44480. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44481. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44482. var render = function() {
  44483. var _vm = this
  44484. var _h = _vm.$createElement
  44485. var _c = _vm._self._c || _h
  44486. return _c(
  44487. "div",
  44488. { staticClass: "bg-lightgray m-1 p-2 border rounded container-fluid" },
  44489. [
  44490. _c("credential-form-modal", {
  44491. attrs: {
  44492. descriptions: _vm.creddescList,
  44493. "modal-id": "credential" + this.data.credid + "editModal",
  44494. populateWith: this.data
  44495. }
  44496. }),
  44497. _vm._v(" "),
  44498. _c(
  44499. "modal",
  44500. {
  44501. attrs: {
  44502. id: "credential" + this.data.credid + "deleteModal",
  44503. tabindex: "-1"
  44504. }
  44505. },
  44506. [
  44507. _c(
  44508. "h5",
  44509. {
  44510. staticClass: "modal-title",
  44511. attrs: {
  44512. slot: "header",
  44513. id: "credential" + this.data.credid + "deleteModalLabel"
  44514. },
  44515. slot: "header"
  44516. },
  44517. [_vm._v("\r\n Delete Credential\r\n ")]
  44518. ),
  44519. _vm._v(" "),
  44520. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44521. _vm._v("\r\n Are you sure?\r\n ")
  44522. ]),
  44523. _vm._v(" "),
  44524. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44525. _c(
  44526. "button",
  44527. {
  44528. staticClass: "btn btn-secondary",
  44529. attrs: { type: "button", "data-dismiss": "modal" }
  44530. },
  44531. [_vm._v("Cancel")]
  44532. ),
  44533. _vm._v(" "),
  44534. _c(
  44535. "button",
  44536. {
  44537. staticClass: "btn btn-danger",
  44538. attrs: { type: "button" },
  44539. on: {
  44540. click: function($event) {
  44541. return _vm.deleteCredential()
  44542. }
  44543. }
  44544. },
  44545. [_vm._v("Confirm")]
  44546. )
  44547. ])
  44548. ]
  44549. ),
  44550. _vm._v(" "),
  44551. _c("div", { staticClass: "row no-gutters" }, [
  44552. _c("div", { staticClass: "h5 col-3 text-left" }, [
  44553. _vm._v(_vm._s(this.data.creddesc))
  44554. ]),
  44555. _vm._v(" "),
  44556. _c("div", { staticClass: "col-9 text-right" }, [
  44557. _vm._v(_vm._s(this.data.creddate))
  44558. ])
  44559. ]),
  44560. _vm._v(" "),
  44561. _c("div", { staticClass: "row" }, [
  44562. _c("div", { staticClass: "col-lg-9" }, [
  44563. _c("div", [
  44564. _vm._m(0),
  44565. _vm._v(" "),
  44566. _c("input", {
  44567. staticClass: "border-0 credential",
  44568. attrs: {
  44569. type: "text",
  44570. id: "username" + this.data.credid,
  44571. readonly: ""
  44572. },
  44573. domProps: { value: this.data.creduser }
  44574. }),
  44575. _vm._v(" "),
  44576. _c(
  44577. "button",
  44578. {
  44579. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  44580. attrs: {
  44581. id: "btn-username" + this.data.credid,
  44582. "data-clipboard-target": "#username" + this.data.credid
  44583. }
  44584. },
  44585. [_c("i", { staticClass: "far fa-clone" })]
  44586. )
  44587. ]),
  44588. _vm._v(" "),
  44589. _c("div", [
  44590. _vm._m(1),
  44591. _vm._v(" "),
  44592. _c("input", {
  44593. staticClass: "border-0 credential",
  44594. attrs: {
  44595. type: "text",
  44596. id: "password" + this.data.credid,
  44597. readonly: ""
  44598. },
  44599. domProps: { value: this.data.credpass }
  44600. }),
  44601. _vm._v(" "),
  44602. _c(
  44603. "button",
  44604. {
  44605. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  44606. attrs: {
  44607. id: "btn-password" + this.data.credid,
  44608. "data-clipboard-target": "#password" + this.data.credid
  44609. }
  44610. },
  44611. [_c("i", { staticClass: "far fa-clone" })]
  44612. )
  44613. ])
  44614. ]),
  44615. _vm._v(" "),
  44616. _c(
  44617. "div",
  44618. {
  44619. staticClass: "btn-group col-lg-2 align-self-end w-25 w-lg-auto",
  44620. attrs: { role: "group", "aria-label": "Edit and Delete" }
  44621. },
  44622. [
  44623. _c(
  44624. "button",
  44625. {
  44626. staticClass: "btn btn-sm btn-secondary p-lg-1",
  44627. attrs: {
  44628. type: "button",
  44629. "data-toggle": "modal",
  44630. "data-target": "#credential" + this.data.credid + "editModal"
  44631. }
  44632. },
  44633. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  44634. ),
  44635. _vm._v(" "),
  44636. _c(
  44637. "button",
  44638. {
  44639. staticClass: "btn btn-sm btn-danger p-lg-1",
  44640. attrs: {
  44641. type: "button",
  44642. "data-toggle": "modal",
  44643. "data-target":
  44644. "#credential" + this.data.credid + "deleteModal"
  44645. }
  44646. },
  44647. [_c("i", { staticClass: "fas fa-fw fa-trash-alt" })]
  44648. )
  44649. ]
  44650. )
  44651. ])
  44652. ],
  44653. 1
  44654. )
  44655. }
  44656. var staticRenderFns = [
  44657. function() {
  44658. var _vm = this
  44659. var _h = _vm.$createElement
  44660. var _c = _vm._self._c || _h
  44661. return _c("label", { attrs: { for: "username" } }, [
  44662. _c("i", { staticClass: "fas fa-fw fa-user" })
  44663. ])
  44664. },
  44665. function() {
  44666. var _vm = this
  44667. var _h = _vm.$createElement
  44668. var _c = _vm._self._c || _h
  44669. return _c("label", { attrs: { for: "password" } }, [
  44670. _c("i", { staticClass: "fas fa-fw fa-key" })
  44671. ])
  44672. }
  44673. ]
  44674. render._withStripped = true
  44675. /***/ }),
  44676. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CredentialFormModal.vue?vue&type=template&id=3cdb3697&":
  44677. /*!**********************************************************************************************************************************************************************************************************************!*\
  44678. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/CredentialFormModal.vue?vue&type=template&id=3cdb3697& ***!
  44679. \**********************************************************************************************************************************************************************************************************************/
  44680. /*! exports provided: render, staticRenderFns */
  44681. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44682. "use strict";
  44683. __webpack_require__.r(__webpack_exports__);
  44684. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44685. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44686. var render = function() {
  44687. var _vm = this
  44688. var _h = _vm.$createElement
  44689. var _c = _vm._self._c || _h
  44690. return _c(
  44691. "modal",
  44692. {
  44693. attrs: {
  44694. id: _vm.id,
  44695. tabindex: "-1",
  44696. role: "dialog",
  44697. "aria-labelledby": _vm.id + "Label"
  44698. }
  44699. },
  44700. [
  44701. _c(
  44702. "h5",
  44703. {
  44704. staticClass: "modal-title",
  44705. attrs: { slot: "header", id: _vm.id + "Label" },
  44706. slot: "header"
  44707. },
  44708. [_vm._v("\n Edit Credential\n ")]
  44709. ),
  44710. _vm._v(" "),
  44711. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44712. _c(
  44713. "div",
  44714. { staticClass: "form" },
  44715. [
  44716. _c("autocomplete-custom-dropdown", {
  44717. attrs: {
  44718. options: _vm.descriptions,
  44719. value: _vm.creddesc,
  44720. "allow-custom": true
  44721. },
  44722. model: {
  44723. value: _vm.creddesc,
  44724. callback: function($$v) {
  44725. _vm.creddesc = $$v
  44726. },
  44727. expression: "creddesc"
  44728. }
  44729. })
  44730. ],
  44731. 1
  44732. ),
  44733. _vm._v(" "),
  44734. _c("div", { staticClass: "form-group" }, [
  44735. _c("label", { attrs: { for: "newusername" } }, [_vm._v("Username")]),
  44736. _vm._v(" "),
  44737. _c("input", {
  44738. directives: [
  44739. {
  44740. name: "model",
  44741. rawName: "v-model",
  44742. value: _vm.data.creduser,
  44743. expression: "data.creduser"
  44744. }
  44745. ],
  44746. staticClass: "form-control credential",
  44747. attrs: {
  44748. type: "text",
  44749. name: "newusername" + _vm.data.credid,
  44750. id: "newusername" + _vm.data.credid
  44751. },
  44752. domProps: { value: _vm.data.creduser },
  44753. on: {
  44754. input: function($event) {
  44755. if ($event.target.composing) {
  44756. return
  44757. }
  44758. _vm.$set(_vm.data, "creduser", $event.target.value)
  44759. }
  44760. }
  44761. })
  44762. ]),
  44763. _vm._v(" "),
  44764. _c("div", { staticClass: "form-group" }, [
  44765. _c("label", { attrs: { for: "newpassword" } }, [_vm._v("Password")]),
  44766. _vm._v(" "),
  44767. _c("input", {
  44768. directives: [
  44769. {
  44770. name: "model",
  44771. rawName: "v-model",
  44772. value: _vm.data.credpass,
  44773. expression: "data.credpass"
  44774. }
  44775. ],
  44776. staticClass: "form-control credential",
  44777. attrs: {
  44778. type: "text",
  44779. name: "newpassword" + _vm.data.credid,
  44780. id: "newpassword" + _vm.data.credid
  44781. },
  44782. domProps: { value: _vm.data.credpass },
  44783. on: {
  44784. input: function($event) {
  44785. if ($event.target.composing) {
  44786. return
  44787. }
  44788. _vm.$set(_vm.data, "credpass", $event.target.value)
  44789. }
  44790. }
  44791. }),
  44792. _vm._v(" "),
  44793. _c(
  44794. "button",
  44795. {
  44796. staticClass: "btn btn-secondary",
  44797. attrs: { type: "button" },
  44798. on: {
  44799. click: function($event) {
  44800. return _vm.getRandomPassword(_vm.data.credid)
  44801. }
  44802. }
  44803. },
  44804. [_vm._v("Generate Random")]
  44805. )
  44806. ]),
  44807. _vm._v(" "),
  44808. _c("div", { staticClass: "form-group" })
  44809. ]),
  44810. _vm._v(" "),
  44811. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44812. _c(
  44813. "button",
  44814. {
  44815. staticClass: "btn btn-secondary",
  44816. attrs: { type: "button", "data-dismiss": "modal" }
  44817. },
  44818. [_vm._v("Close")]
  44819. ),
  44820. _vm._v(" "),
  44821. _c(
  44822. "button",
  44823. {
  44824. staticClass: "btn btn-primary",
  44825. attrs: { type: "button" },
  44826. on: {
  44827. click: function($event) {
  44828. return _vm.updateCredential()
  44829. }
  44830. }
  44831. },
  44832. [_vm._v("Save")]
  44833. )
  44834. ])
  44835. ]
  44836. )
  44837. }
  44838. var staticRenderFns = []
  44839. render._withStripped = true
  44840. /***/ }),
  44841. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CredentialList.vue?vue&type=template&id=7264bb80&":
  44842. /*!*****************************************************************************************************************************************************************************************************************!*\
  44843. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/CredentialList.vue?vue&type=template&id=7264bb80& ***!
  44844. \*****************************************************************************************************************************************************************************************************************/
  44845. /*! exports provided: render, staticRenderFns */
  44846. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44847. "use strict";
  44848. __webpack_require__.r(__webpack_exports__);
  44849. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44850. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44851. var render = function() {
  44852. var _vm = this
  44853. var _h = _vm.$createElement
  44854. var _c = _vm._self._c || _h
  44855. return _c(
  44856. "div",
  44857. [
  44858. _c("credential-form-modal", {
  44859. attrs: {
  44860. "modal-id": "newCredentialModal",
  44861. descriptions: _vm.creddescList,
  44862. create: true,
  44863. pcid: _vm.pcid
  44864. }
  44865. }),
  44866. _vm._v(" "),
  44867. _c(
  44868. "button",
  44869. {
  44870. staticClass: "btn btn-primary",
  44871. attrs: {
  44872. type: "button",
  44873. "data-toggle": "modal",
  44874. "data-target": "#newCredentialModal"
  44875. }
  44876. },
  44877. [_vm._v("New Credential")]
  44878. ),
  44879. _vm._v(" "),
  44880. _vm._l(_vm.credentials, function(credential) {
  44881. return _c(
  44882. "div",
  44883. { key: credential.credid },
  44884. [
  44885. _c("credential", {
  44886. attrs: { credential: credential, descriptions: _vm.creddescList }
  44887. })
  44888. ],
  44889. 1
  44890. )
  44891. })
  44892. ],
  44893. 2
  44894. )
  44895. }
  44896. var staticRenderFns = []
  44897. render._withStripped = true
  44898. /***/ }),
  44899. /***/ "./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&":
  44900. /*!********************************************************************************************************************************************************************************************************!*\
  44901. !*** ./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& ***!
  44902. \********************************************************************************************************************************************************************************************************/
  44903. /*! exports provided: render, staticRenderFns */
  44904. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44905. "use strict";
  44906. __webpack_require__.r(__webpack_exports__);
  44907. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44908. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44909. var render = function() {
  44910. var _vm = this
  44911. var _h = _vm.$createElement
  44912. var _c = _vm._self._c || _h
  44913. return _c("div", { staticClass: "modal fade" }, [
  44914. _c(
  44915. "div",
  44916. { staticClass: "modal-dialog modal-lg", attrs: { role: "document" } },
  44917. [
  44918. _c("div", { staticClass: "modal-content" }, [
  44919. _c(
  44920. "div",
  44921. { staticClass: "modal-header" },
  44922. [_vm._m(0), _vm._v(" "), _vm._t("header")],
  44923. 2
  44924. ),
  44925. _vm._v(" "),
  44926. _c("div", { staticClass: "modal-body" }, [_vm._t("body")], 2),
  44927. _vm._v(" "),
  44928. _c("div", { staticClass: "modal-footer" }, [_vm._t("footer")], 2)
  44929. ])
  44930. ]
  44931. )
  44932. ])
  44933. }
  44934. var staticRenderFns = [
  44935. function() {
  44936. var _vm = this
  44937. var _h = _vm.$createElement
  44938. var _c = _vm._self._c || _h
  44939. return _c(
  44940. "button",
  44941. {
  44942. staticClass: "close",
  44943. attrs: {
  44944. type: "button",
  44945. "data-dismiss": "modal",
  44946. "aria-label": "Close"
  44947. }
  44948. },
  44949. [_c("span", { attrs: { "aria-hidden": "true" } }, [_vm._v("×")])]
  44950. )
  44951. }
  44952. ]
  44953. render._withStripped = true
  44954. /***/ }),
  44955. /***/ "./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&":
  44956. /*!******************************************************************************************************************************************************************************************************************!*\
  44957. !*** ./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& ***!
  44958. \******************************************************************************************************************************************************************************************************************/
  44959. /*! exports provided: render, staticRenderFns */
  44960. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44961. "use strict";
  44962. __webpack_require__.r(__webpack_exports__);
  44963. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44964. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44965. var render = function() {
  44966. var _vm = this
  44967. var _h = _vm.$createElement
  44968. var _c = _vm._self._c || _h
  44969. return _c(
  44970. "modal",
  44971. {
  44972. attrs: {
  44973. id: _vm.id,
  44974. tabindex: "-1",
  44975. role: "dialog",
  44976. "aria-labelledby": _vm.id + "Label"
  44977. }
  44978. },
  44979. [
  44980. _c(
  44981. "h5",
  44982. {
  44983. staticClass: "modal-title",
  44984. attrs: { slot: "header", id: _vm.id + "Label" },
  44985. slot: "header"
  44986. },
  44987. [_vm._v("\r\n Edit Work Order Information\r\n ")]
  44988. ),
  44989. _vm._v(" "),
  44990. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44991. _c(
  44992. "div",
  44993. { staticClass: "form-group" },
  44994. [
  44995. _c("label", { attrs: { for: "probdesc" } }, [
  44996. _vm._v("Problem Description")
  44997. ]),
  44998. _vm._v(" "),
  44999. _c("textarea", {
  45000. directives: [
  45001. {
  45002. name: "model",
  45003. rawName: "v-model",
  45004. value: _vm.data.probdesc,
  45005. expression: "data.probdesc"
  45006. }
  45007. ],
  45008. class: {
  45009. "form-control": true,
  45010. "is-invalid": _vm.errors.probdesc
  45011. },
  45012. attrs: { id: "probdesc", name: "probdesc" },
  45013. domProps: { value: _vm.data.probdesc },
  45014. on: {
  45015. input: function($event) {
  45016. if ($event.target.composing) {
  45017. return
  45018. }
  45019. _vm.$set(_vm.data, "probdesc", $event.target.value)
  45020. }
  45021. }
  45022. }),
  45023. _vm._v(" "),
  45024. _c("errorlist", { attrs: { errors: _vm.errors.probdesc } })
  45025. ],
  45026. 1
  45027. ),
  45028. _vm._v(" "),
  45029. _c(
  45030. "div",
  45031. { staticClass: "form-group" },
  45032. [
  45033. _c("label", { attrs: { for: "suggested" } }, [
  45034. _vm._v("Suggested Solution")
  45035. ]),
  45036. _vm._v(" "),
  45037. _c("textarea", {
  45038. directives: [
  45039. {
  45040. name: "model",
  45041. rawName: "v-model",
  45042. value: _vm.data.suggested,
  45043. expression: "data.suggested"
  45044. }
  45045. ],
  45046. class: {
  45047. "form-control": true,
  45048. "is-invalid": _vm.errors.suggested
  45049. },
  45050. attrs: { id: "suggested", name: "suggested" },
  45051. domProps: { value: _vm.data.suggested },
  45052. on: {
  45053. input: function($event) {
  45054. if ($event.target.composing) {
  45055. return
  45056. }
  45057. _vm.$set(_vm.data, "suggested", $event.target.value)
  45058. }
  45059. }
  45060. }),
  45061. _vm._v(" "),
  45062. _c("errorlist", { attrs: { errors: _vm.errors.suggested } })
  45063. ],
  45064. 1
  45065. ),
  45066. _vm._v(" "),
  45067. _c(
  45068. "div",
  45069. { staticClass: "form-group" },
  45070. [
  45071. _c("label", { attrs: { for: "storelist" } }, [_vm._v("Store")]),
  45072. _vm._v(" "),
  45073. _c("autocomplete-custom-dropdown", {
  45074. attrs: { options: _vm.storeList, value: this.store },
  45075. model: {
  45076. value: _vm.store,
  45077. callback: function($$v) {
  45078. _vm.store = $$v
  45079. },
  45080. expression: "store"
  45081. }
  45082. })
  45083. ],
  45084. 1
  45085. )
  45086. ]),
  45087. _vm._v(" "),
  45088. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  45089. _c(
  45090. "button",
  45091. {
  45092. staticClass: "btn btn-secondary",
  45093. attrs: { type: "button", "data-dismiss": "modal" }
  45094. },
  45095. [_vm._v("Close")]
  45096. ),
  45097. _vm._v(" "),
  45098. _c(
  45099. "button",
  45100. {
  45101. staticClass: "btn btn-primary",
  45102. attrs: { type: "button" },
  45103. on: {
  45104. click: function($event) {
  45105. return _vm.updateWorkOrder()
  45106. }
  45107. }
  45108. },
  45109. [_vm._v("Save")]
  45110. )
  45111. ])
  45112. ]
  45113. )
  45114. }
  45115. var staticRenderFns = []
  45116. render._withStripped = true
  45117. /***/ }),
  45118. /***/ "./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&":
  45119. /*!****************************************************************************************************************************************************************************************************************!*\
  45120. !*** ./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& ***!
  45121. \****************************************************************************************************************************************************************************************************************/
  45122. /*! exports provided: render, staticRenderFns */
  45123. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45124. "use strict";
  45125. __webpack_require__.r(__webpack_exports__);
  45126. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45127. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45128. var render = function() {
  45129. var _vm = this
  45130. var _h = _vm.$createElement
  45131. var _c = _vm._self._c || _h
  45132. return _c(
  45133. "div",
  45134. [
  45135. _c("wo-info-edit-modal", {
  45136. attrs: {
  45137. "modal-id": "workordereditModal",
  45138. "populate-with": _vm.workOrder,
  45139. "store-list": this.storeList
  45140. }
  45141. }),
  45142. _vm._v(" "),
  45143. _c("p", [
  45144. _c("i", { staticClass: "fas fa-fw fa-info-circle" }),
  45145. _vm._v(" "),
  45146. _c("span", {
  45147. domProps: { textContent: _vm._s(_vm.workOrder.probdesc) }
  45148. })
  45149. ]),
  45150. _vm._v(" "),
  45151. _c("p", [
  45152. _c("i", { staticClass: "far fa-fw fa-lightbulb" }),
  45153. _vm._v(" "),
  45154. _c("span", {
  45155. domProps: { textContent: _vm._s(_vm.workOrder.suggested) }
  45156. })
  45157. ]),
  45158. _vm._v(" "),
  45159. _c("p", [
  45160. _c("i", { staticClass: "fas fa-fw fa-paste" }),
  45161. _vm._v(" "),
  45162. _c("span", { domProps: { textContent: _vm._s(_vm.workOrder.woid) } })
  45163. ]),
  45164. _vm._v(" "),
  45165. _c("p", [
  45166. _c("i", { staticClass: "fas fa-fw fa-building" }),
  45167. _vm._v(" "),
  45168. _c("span", [_vm._v(_vm._s(_vm.storeList[_vm.workOrder.storeid]))])
  45169. ]),
  45170. _vm._v(" "),
  45171. _c("p", [
  45172. _c("i", { staticClass: "fas fa-fw fa-sign-in-alt" }),
  45173. _vm._v(" "),
  45174. _c(
  45175. "span",
  45176. {
  45177. staticClass: "dashed-underline",
  45178. attrs: {
  45179. "data-toggle": "tooltip",
  45180. "data-placement": "bottom",
  45181. title: this.getHRDate(_vm.workOrder.dropdate)
  45182. }
  45183. },
  45184. [
  45185. _vm._v(
  45186. "\n " +
  45187. _vm._s(
  45188. Math.floor(this.daysSinceToday(_vm.workOrder.dropdate))
  45189. ) +
  45190. " days ago\n "
  45191. )
  45192. ]
  45193. )
  45194. ]),
  45195. _vm._v(" "),
  45196. _c("p", [
  45197. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  45198. _vm._v(" "),
  45199. !this.isZero(_vm.workOrder.pickupdate)
  45200. ? _c(
  45201. "span",
  45202. {
  45203. staticClass: "dashed-underline",
  45204. attrs: {
  45205. "data-toggle": "tooltip",
  45206. "data-placement": "bottom",
  45207. title: this.getHRDate(_vm.workOrder.pickupdate)
  45208. }
  45209. },
  45210. [
  45211. _vm._v(
  45212. "\n " +
  45213. _vm._s(
  45214. Math.floor(this.daysSinceToday(_vm.workOrder.pickupdate))
  45215. ) +
  45216. " days ago\n "
  45217. )
  45218. ]
  45219. )
  45220. : _vm._e()
  45221. ]),
  45222. _vm._v(" "),
  45223. _c(
  45224. "button",
  45225. {
  45226. staticClass: "btn btn-primary",
  45227. attrs: {
  45228. type: "button",
  45229. "data-toggle": "modal",
  45230. "data-target": "#workordereditModal"
  45231. }
  45232. },
  45233. [_vm._v("Edit")]
  45234. )
  45235. ],
  45236. 1
  45237. )
  45238. }
  45239. var staticRenderFns = []
  45240. render._withStripped = true
  45241. /***/ }),
  45242. /***/ "./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&":
  45243. /*!*************************************************************************************************************************************************************************************************!*\
  45244. !*** ./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& ***!
  45245. \*************************************************************************************************************************************************************************************************/
  45246. /*! exports provided: render, staticRenderFns */
  45247. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45248. "use strict";
  45249. __webpack_require__.r(__webpack_exports__);
  45250. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45251. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45252. var render = function() {
  45253. var _vm = this
  45254. var _h = _vm.$createElement
  45255. var _c = _vm._self._c || _h
  45256. return _c("div", [
  45257. _c(
  45258. "nav",
  45259. {
  45260. staticClass:
  45261. "navbar navbar-expand navbar-dark bg-primary text-light shadow-sm"
  45262. },
  45263. [
  45264. _c(
  45265. "div",
  45266. { staticClass: "container-fluid" },
  45267. [
  45268. _c(
  45269. "router-link",
  45270. { staticClass: "navbar-brand", attrs: { to: { name: "home" } } },
  45271. [_vm._v("\n UPCCRT\n ")]
  45272. ),
  45273. _vm._v(" "),
  45274. _vm._m(0),
  45275. _vm._v(" "),
  45276. _c(
  45277. "div",
  45278. {
  45279. staticClass: "collapse navbar-collapse",
  45280. attrs: { id: "navbarSupportedContent" }
  45281. },
  45282. [
  45283. _c("ul", { staticClass: "navbar-nav mr-auto text-center" }, [
  45284. _vm._m(1),
  45285. _vm._v(" "),
  45286. _vm._m(2),
  45287. _vm._v(" "),
  45288. _c(
  45289. "li",
  45290. { staticClass: "nav-item" },
  45291. [
  45292. _c(
  45293. "router-link",
  45294. {
  45295. staticClass: "nav-link",
  45296. attrs: { to: { name: "dashboard" } }
  45297. },
  45298. [
  45299. _c("i", { staticClass: "fas fa-tachometer-alt" }),
  45300. _vm._v(" "),
  45301. _c(
  45302. "span",
  45303. { staticClass: "d-none d-sm-block d-md-inline" },
  45304. [_vm._v("Dashboard")]
  45305. )
  45306. ]
  45307. )
  45308. ],
  45309. 1
  45310. ),
  45311. _vm._v(" "),
  45312. _vm._m(3)
  45313. ]),
  45314. _vm._v(" "),
  45315. _c(
  45316. "ul",
  45317. { staticClass: "navbar-nav ml-auto" },
  45318. [
  45319. !_vm.isLoggedIn
  45320. ? _c(
  45321. "router-link",
  45322. {
  45323. staticClass: "nav-link",
  45324. attrs: { to: { name: "login" } }
  45325. },
  45326. [_vm._v("Login")]
  45327. )
  45328. : _vm._e(),
  45329. _vm._v(" "),
  45330. _vm.isLoggedIn
  45331. ? _c("li", { staticClass: "nav-link" }, [
  45332. _vm._v(_vm._s(_vm.username))
  45333. ])
  45334. : _vm._e(),
  45335. _vm._v(" "),
  45336. _vm.isLoggedIn
  45337. ? _c(
  45338. "router-link",
  45339. {
  45340. staticClass: "nav-link",
  45341. attrs: { to: { name: "home" } }
  45342. },
  45343. [_vm._v("Home")]
  45344. )
  45345. : _vm._e()
  45346. ],
  45347. 1
  45348. )
  45349. ]
  45350. )
  45351. ],
  45352. 1
  45353. )
  45354. ]
  45355. ),
  45356. _vm._v(" "),
  45357. _c("main", { staticClass: "py-4" }, [_c("router-view")], 1)
  45358. ])
  45359. }
  45360. var staticRenderFns = [
  45361. function() {
  45362. var _vm = this
  45363. var _h = _vm.$createElement
  45364. var _c = _vm._self._c || _h
  45365. return _c(
  45366. "button",
  45367. {
  45368. staticClass: "navbar-toggler",
  45369. attrs: {
  45370. type: "button",
  45371. "data-toggle": "collapse",
  45372. "data-target": "#navbarSupportedContent",
  45373. "aria-controls": "navbarSupportedContent",
  45374. "aria-expanded": "false"
  45375. }
  45376. },
  45377. [_c("span", { staticClass: "navbar-toggler-icon" })]
  45378. )
  45379. },
  45380. function() {
  45381. var _vm = this
  45382. var _h = _vm.$createElement
  45383. var _c = _vm._self._c || _h
  45384. return _c("li", { staticClass: "nav-item" }, [
  45385. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  45386. _c("i", { staticClass: "fas fa-sign-in-alt" }),
  45387. _vm._v(" "),
  45388. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  45389. _vm._v("Check-In")
  45390. ])
  45391. ])
  45392. ])
  45393. },
  45394. function() {
  45395. var _vm = this
  45396. var _h = _vm.$createElement
  45397. var _c = _vm._self._c || _h
  45398. return _c("li", { staticClass: "nav-item" }, [
  45399. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  45400. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  45401. _vm._v(" "),
  45402. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  45403. _vm._v("Check-Out")
  45404. ])
  45405. ])
  45406. ])
  45407. },
  45408. function() {
  45409. var _vm = this
  45410. var _h = _vm.$createElement
  45411. var _c = _vm._self._c || _h
  45412. return _c("li", { staticClass: "nav-item" }, [
  45413. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  45414. _c("i", { staticClass: "fas fa-chart-bar" }),
  45415. _vm._v(" "),
  45416. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  45417. _vm._v("Reports")
  45418. ])
  45419. ])
  45420. ])
  45421. }
  45422. ]
  45423. render._withStripped = true
  45424. /***/ }),
  45425. /***/ "./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&":
  45426. /*!*******************************************************************************************************************************************************************************************************!*\
  45427. !*** ./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& ***!
  45428. \*******************************************************************************************************************************************************************************************************/
  45429. /*! exports provided: render, staticRenderFns */
  45430. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45431. "use strict";
  45432. __webpack_require__.r(__webpack_exports__);
  45433. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45434. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45435. var render = function() {
  45436. var _vm = this
  45437. var _h = _vm.$createElement
  45438. var _c = _vm._self._c || _h
  45439. return _c("div", { staticClass: "container" }, [
  45440. _c("div", { staticClass: "row justify-content-center" }, [
  45441. !_vm.isLoading
  45442. ? _c(
  45443. "div",
  45444. { staticClass: "col-md-12" },
  45445. _vm._l(_vm.workOrders, function(workOrder, index) {
  45446. return _c(
  45447. "div",
  45448. { key: workOrder.woid, staticClass: "col-md-4" },
  45449. [
  45450. _c("div", { staticClass: "card" }, [
  45451. _c(
  45452. "div",
  45453. { staticClass: "card-header" },
  45454. [
  45455. _c(
  45456. "router-link",
  45457. {
  45458. staticClass: "h4 card-title",
  45459. attrs: {
  45460. to: {
  45461. name: "workorders",
  45462. params: { id: workOrder.woid }
  45463. }
  45464. }
  45465. },
  45466. [_vm._v(_vm._s(workOrder.woid))]
  45467. )
  45468. ],
  45469. 1
  45470. ),
  45471. _vm._v(" "),
  45472. _c("div", { staticClass: "card-body card-body-dark" }, [
  45473. _c("div", [
  45474. _vm._v(
  45475. "\n " +
  45476. _vm._s(workOrder.probdesc) +
  45477. "\n "
  45478. )
  45479. ]),
  45480. _vm._v(" "),
  45481. _c("div", [
  45482. _vm._v(
  45483. "\n " +
  45484. _vm._s(workOrder.suggested) +
  45485. "\n "
  45486. )
  45487. ])
  45488. ])
  45489. ])
  45490. ]
  45491. )
  45492. }),
  45493. 0
  45494. )
  45495. : _c(
  45496. "div",
  45497. { staticClass: "col-md-12" },
  45498. [_c("circle-spinner", { attrs: { color: "#663399" } })],
  45499. 1
  45500. )
  45501. ])
  45502. ])
  45503. }
  45504. var staticRenderFns = []
  45505. render._withStripped = true
  45506. /***/ }),
  45507. /***/ "./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&":
  45508. /*!***************************************************************************************************************************************************************************************************!*\
  45509. !*** ./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& ***!
  45510. \***************************************************************************************************************************************************************************************************/
  45511. /*! exports provided: render, staticRenderFns */
  45512. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45513. "use strict";
  45514. __webpack_require__.r(__webpack_exports__);
  45515. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45516. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45517. var render = function() {
  45518. var _vm = this
  45519. var _h = _vm.$createElement
  45520. var _c = _vm._self._c || _h
  45521. return _c("div", { staticClass: "container" }, [
  45522. _c("div", { staticClass: "row justify-content-center" }, [
  45523. _c("div", { staticClass: "col-md-8" }, [
  45524. _c("div", { staticClass: "card card-default" }, [
  45525. _c("div", { staticClass: "card-header" }, [_vm._v("Login")]),
  45526. _vm._v(" "),
  45527. _c("div", { staticClass: "card-body" }, [
  45528. _c("form", { attrs: { method: "POST", action: "/login" } }, [
  45529. _c("div", { staticClass: "form-group row" }, [
  45530. _c(
  45531. "label",
  45532. {
  45533. staticClass: "col-sm-4 col-form-label text-md-right",
  45534. attrs: { for: "username" }
  45535. },
  45536. [_vm._v("Username")]
  45537. ),
  45538. _vm._v(" "),
  45539. _c("div", { staticClass: "col-md-6" }, [
  45540. _c("input", {
  45541. directives: [
  45542. {
  45543. name: "model",
  45544. rawName: "v-model",
  45545. value: _vm.username,
  45546. expression: "username"
  45547. }
  45548. ],
  45549. staticClass: "form-control",
  45550. attrs: {
  45551. id: "username",
  45552. type: "username",
  45553. required: "",
  45554. autofocus: ""
  45555. },
  45556. domProps: { value: _vm.username },
  45557. on: {
  45558. input: function($event) {
  45559. if ($event.target.composing) {
  45560. return
  45561. }
  45562. _vm.username = $event.target.value
  45563. }
  45564. }
  45565. })
  45566. ])
  45567. ]),
  45568. _vm._v(" "),
  45569. _c("div", { staticClass: "form-group row" }, [
  45570. _c(
  45571. "label",
  45572. {
  45573. staticClass: "col-md-4 col-form-label text-md-right",
  45574. attrs: { for: "password" }
  45575. },
  45576. [_vm._v("Password")]
  45577. ),
  45578. _vm._v(" "),
  45579. _c("div", { staticClass: "col-md-6" }, [
  45580. _c("input", {
  45581. directives: [
  45582. {
  45583. name: "model",
  45584. rawName: "v-model",
  45585. value: _vm.password,
  45586. expression: "password"
  45587. }
  45588. ],
  45589. staticClass: "form-control",
  45590. attrs: { id: "password", type: "password", required: "" },
  45591. domProps: { value: _vm.password },
  45592. on: {
  45593. input: function($event) {
  45594. if ($event.target.composing) {
  45595. return
  45596. }
  45597. _vm.password = $event.target.value
  45598. }
  45599. }
  45600. })
  45601. ])
  45602. ]),
  45603. _vm._v(" "),
  45604. _c("div", { staticClass: "form-group row mb-0" }, [
  45605. _c("div", { staticClass: "col-md-8 offset-md-4" }, [
  45606. _c(
  45607. "button",
  45608. {
  45609. staticClass: "btn btn-primary",
  45610. attrs: { type: "submit" },
  45611. on: { click: _vm.handleSubmit }
  45612. },
  45613. [
  45614. _vm._v(
  45615. "\n Login\n "
  45616. )
  45617. ]
  45618. )
  45619. ])
  45620. ])
  45621. ])
  45622. ])
  45623. ])
  45624. ])
  45625. ])
  45626. ])
  45627. }
  45628. var staticRenderFns = []
  45629. render._withStripped = true
  45630. /***/ }),
  45631. /***/ "./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&":
  45632. /*!*****************************************************************************************************************************************************************************************************************!*\
  45633. !*** ./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& ***!
  45634. \*****************************************************************************************************************************************************************************************************************/
  45635. /*! exports provided: render, staticRenderFns */
  45636. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45637. "use strict";
  45638. __webpack_require__.r(__webpack_exports__);
  45639. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45640. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45641. var render = function() {
  45642. var _vm = this
  45643. var _h = _vm.$createElement
  45644. var _c = _vm._self._c || _h
  45645. return _vm._m(0)
  45646. }
  45647. var staticRenderFns = [
  45648. function() {
  45649. var _vm = this
  45650. var _h = _vm.$createElement
  45651. var _c = _vm._self._c || _h
  45652. return _c("div", { staticClass: "flex-center position-ref full-height" }, [
  45653. _c("div", { staticClass: "content" }, [
  45654. _c("div", { staticClass: "m-b-md" }, [
  45655. _c("h2", { staticClass: "title m-b-md" }, [
  45656. _vm._v("\n UPCCRT\n ")
  45657. ]),
  45658. _vm._v(" "),
  45659. _c("h3", [
  45660. _vm._v(
  45661. "\n University PC Care Repair Tracker\n "
  45662. )
  45663. ])
  45664. ])
  45665. ])
  45666. ])
  45667. }
  45668. ]
  45669. render._withStripped = true
  45670. /***/ }),
  45671. /***/ "./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&":
  45672. /*!*******************************************************************************************************************************************************************************************************!*\
  45673. !*** ./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& ***!
  45674. \*******************************************************************************************************************************************************************************************************/
  45675. /*! exports provided: render, staticRenderFns */
  45676. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45677. "use strict";
  45678. __webpack_require__.r(__webpack_exports__);
  45679. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45680. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45681. var render = function() {
  45682. var _vm = this
  45683. var _h = _vm.$createElement
  45684. var _c = _vm._self._c || _h
  45685. return _c("div", { staticClass: "container-fluid" }, [
  45686. _c("div", { staticClass: "row my-3" }, [
  45687. _c("div", { staticClass: "col-lg-6" }, [
  45688. _c("div", { staticClass: "card h-100" }, [
  45689. _vm._m(0),
  45690. _vm._v(" "),
  45691. _c("div", { staticClass: "card-body" }, [
  45692. _c("div", { staticClass: "tab-content" }, [
  45693. _c(
  45694. "div",
  45695. {
  45696. staticClass: "tab-pane active",
  45697. attrs: {
  45698. id: "assetinfo",
  45699. role: "tabpanel",
  45700. "aria-labelledby": "assetinfo-tab"
  45701. }
  45702. },
  45703. [
  45704. !_vm.assetLoading
  45705. ? _c("asset-info", { attrs: { asset: _vm.asset } })
  45706. : _c("circle-spinner", { attrs: { color: "#663399" } })
  45707. ],
  45708. 1
  45709. ),
  45710. _vm._v(" "),
  45711. _c(
  45712. "div",
  45713. {
  45714. staticClass: "tab-pane",
  45715. attrs: {
  45716. id: "credentials",
  45717. role: "tabpanel",
  45718. "aria-labelledby": "credentials-tab"
  45719. }
  45720. },
  45721. [
  45722. !_vm.credentialsLoading && !_vm.credentialDescriptionsLoading
  45723. ? _c("credential-list", {
  45724. attrs: {
  45725. credentials: _vm.credentials,
  45726. descriptions: _vm.credentialDescriptions,
  45727. pcid: _vm.asset.pcid
  45728. }
  45729. })
  45730. : _c("circle-spinner", { attrs: { color: "#663399" } })
  45731. ],
  45732. 1
  45733. )
  45734. ])
  45735. ])
  45736. ])
  45737. ]),
  45738. _vm._v(" "),
  45739. _c("div", { staticClass: "col-lg-6" }, [
  45740. _c("div", { staticClass: "card h-100" }, [
  45741. _vm._m(1),
  45742. _vm._v(" "),
  45743. _c("div", { staticClass: "card-body" }, [
  45744. _c("div", { staticClass: "tab-content" }, [
  45745. _c(
  45746. "div",
  45747. {
  45748. staticClass: "tab-pane active",
  45749. attrs: {
  45750. id: "workordersumm",
  45751. role: "tabpanel",
  45752. "aria-labelledby": "workordersumm-tab"
  45753. }
  45754. },
  45755. [
  45756. !_vm.woLoading && !_vm.storesLoading
  45757. ? _c("work-order-info", {
  45758. attrs: {
  45759. "work-order": _vm.workOrder,
  45760. stores: _vm.stores
  45761. }
  45762. })
  45763. : _c("circle-spinner", { attrs: { color: "#663399" } })
  45764. ],
  45765. 1
  45766. ),
  45767. _vm._v(" "),
  45768. _c(
  45769. "div",
  45770. {
  45771. staticClass: "tab-pane",
  45772. attrs: {
  45773. id: "attachments",
  45774. role: "tabpanel",
  45775. "aria-labelledby": "attachments-tab"
  45776. }
  45777. },
  45778. [
  45779. _vm._v(
  45780. "\n TODO 2\n "
  45781. )
  45782. ]
  45783. )
  45784. ])
  45785. ])
  45786. ])
  45787. ])
  45788. ])
  45789. ])
  45790. }
  45791. var staticRenderFns = [
  45792. function() {
  45793. var _vm = this
  45794. var _h = _vm.$createElement
  45795. var _c = _vm._self._c || _h
  45796. return _c("div", { staticClass: "card-header text-right" }, [
  45797. _c(
  45798. "button",
  45799. {
  45800. staticClass: "btn btn-default xs-toggle",
  45801. attrs: {
  45802. type: "button",
  45803. "data-toggle": "collapse",
  45804. "data-target": "#assetTab"
  45805. }
  45806. },
  45807. [
  45808. _c("span", { staticClass: "sr-only" }, [_vm._v("Toggle Navigation")]),
  45809. _vm._v(" "),
  45810. _c("span", { staticClass: "icon-bar" }),
  45811. _vm._v(" "),
  45812. _c("span", { staticClass: "icon-bar" }),
  45813. _vm._v(" "),
  45814. _c("span", { staticClass: "icon-bar" })
  45815. ]
  45816. ),
  45817. _vm._v(" "),
  45818. _c(
  45819. "ul",
  45820. {
  45821. staticClass:
  45822. "nav nav-pills card-header-pills nav-justified xs-collapse collapse",
  45823. attrs: { id: "assetTab", role: "tablist" }
  45824. },
  45825. [
  45826. _c("li", { staticClass: "nav-item" }, [
  45827. _c(
  45828. "a",
  45829. {
  45830. staticClass: "nav-link active",
  45831. attrs: {
  45832. id: "assetinfo-tab",
  45833. "data-toggle": "pill",
  45834. href: "#assetinfo",
  45835. role: "tab",
  45836. "aria-controls": "assetinfo",
  45837. "aria-selected": "true"
  45838. }
  45839. },
  45840. [_vm._v("Hardware")]
  45841. )
  45842. ]),
  45843. _vm._v(" "),
  45844. _c("li", { staticClass: "nav-item" }, [
  45845. _c(
  45846. "a",
  45847. {
  45848. staticClass: "nav-link",
  45849. attrs: {
  45850. id: "credentials-tab",
  45851. "data-toggle": "pill",
  45852. href: "#credentials",
  45853. role: "tab",
  45854. "aria-controls": "credentials",
  45855. "aria-selected": "false"
  45856. }
  45857. },
  45858. [_vm._v("Credentials")]
  45859. )
  45860. ])
  45861. ]
  45862. )
  45863. ])
  45864. },
  45865. function() {
  45866. var _vm = this
  45867. var _h = _vm.$createElement
  45868. var _c = _vm._self._c || _h
  45869. return _c("div", { staticClass: "card-header text-right" }, [
  45870. _c(
  45871. "button",
  45872. {
  45873. staticClass: "btn btn-default xs-toggle",
  45874. attrs: {
  45875. type: "button",
  45876. "data-toggle": "collapse",
  45877. "data-target": "#workorderTab"
  45878. }
  45879. },
  45880. [
  45881. _c("span", { staticClass: "sr-only" }, [_vm._v("Toggle Navigation")]),
  45882. _vm._v(" "),
  45883. _c("span", { staticClass: "icon-bar" }),
  45884. _vm._v(" "),
  45885. _c("span", { staticClass: "icon-bar" }),
  45886. _vm._v(" "),
  45887. _c("span", { staticClass: "icon-bar" })
  45888. ]
  45889. ),
  45890. _vm._v(" "),
  45891. _c(
  45892. "ul",
  45893. {
  45894. staticClass:
  45895. "nav nav-pills card-header-pills nav-justified xs-collapse collapse",
  45896. attrs: { id: "workorderTab", role: "tablist" }
  45897. },
  45898. [
  45899. _c("li", { staticClass: "nav-item" }, [
  45900. _c(
  45901. "a",
  45902. {
  45903. staticClass: "nav-link active",
  45904. attrs: {
  45905. id: "workordersumm-tab",
  45906. "data-toggle": "pill",
  45907. href: "#workordersumm",
  45908. role: "tab",
  45909. "aria-controls": "workordersumm",
  45910. "aria-selected": "true"
  45911. }
  45912. },
  45913. [_vm._v("Summary")]
  45914. )
  45915. ]),
  45916. _vm._v(" "),
  45917. _c("li", { staticClass: "nav-item" }, [
  45918. _c(
  45919. "a",
  45920. {
  45921. staticClass: "nav-link",
  45922. attrs: {
  45923. id: "attachments-tab",
  45924. "data-toggle": "pill",
  45925. href: "#attachments",
  45926. role: "tab",
  45927. "aria-controls": "attachments",
  45928. "aria-selected": "false"
  45929. }
  45930. },
  45931. [_vm._v("Attachments")]
  45932. )
  45933. ])
  45934. ]
  45935. )
  45936. ])
  45937. }
  45938. ]
  45939. render._withStripped = true
  45940. /***/ }),
  45941. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  45942. /*!********************************************************************!*\
  45943. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  45944. \********************************************************************/
  45945. /*! exports provided: default */
  45946. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45947. "use strict";
  45948. __webpack_require__.r(__webpack_exports__);
  45949. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  45950. /* globals __VUE_SSR_CONTEXT__ */
  45951. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  45952. // This module is a runtime utility for cleaner component module output and will
  45953. // be included in the final webpack user bundle.
  45954. function normalizeComponent (
  45955. scriptExports,
  45956. render,
  45957. staticRenderFns,
  45958. functionalTemplate,
  45959. injectStyles,
  45960. scopeId,
  45961. moduleIdentifier, /* server only */
  45962. shadowMode /* vue-cli only */
  45963. ) {
  45964. // Vue.extend constructor export interop
  45965. var options = typeof scriptExports === 'function'
  45966. ? scriptExports.options
  45967. : scriptExports
  45968. // render functions
  45969. if (render) {
  45970. options.render = render
  45971. options.staticRenderFns = staticRenderFns
  45972. options._compiled = true
  45973. }
  45974. // functional template
  45975. if (functionalTemplate) {
  45976. options.functional = true
  45977. }
  45978. // scopedId
  45979. if (scopeId) {
  45980. options._scopeId = 'data-v-' + scopeId
  45981. }
  45982. var hook
  45983. if (moduleIdentifier) { // server build
  45984. hook = function (context) {
  45985. // 2.3 injection
  45986. context =
  45987. context || // cached call
  45988. (this.$vnode && this.$vnode.ssrContext) || // stateful
  45989. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  45990. // 2.2 with runInNewContext: true
  45991. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  45992. context = __VUE_SSR_CONTEXT__
  45993. }
  45994. // inject component styles
  45995. if (injectStyles) {
  45996. injectStyles.call(this, context)
  45997. }
  45998. // register component module identifier for async chunk inferrence
  45999. if (context && context._registeredComponents) {
  46000. context._registeredComponents.add(moduleIdentifier)
  46001. }
  46002. }
  46003. // used by ssr in case component is cached and beforeCreate
  46004. // never gets called
  46005. options._ssrRegister = hook
  46006. } else if (injectStyles) {
  46007. hook = shadowMode
  46008. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  46009. : injectStyles
  46010. }
  46011. if (hook) {
  46012. if (options.functional) {
  46013. // for template-only hot-reload because in that case the render fn doesn't
  46014. // go through the normalizer
  46015. options._injectStyles = hook
  46016. // register for functioal component in vue file
  46017. var originalRender = options.render
  46018. options.render = function renderWithStyleInjection (h, context) {
  46019. hook.call(context)
  46020. return originalRender(h, context)
  46021. }
  46022. } else {
  46023. // inject component registration as beforeCreate hook
  46024. var existing = options.beforeCreate
  46025. options.beforeCreate = existing
  46026. ? [].concat(existing, hook)
  46027. : [hook]
  46028. }
  46029. }
  46030. return {
  46031. exports: scriptExports,
  46032. options: options
  46033. }
  46034. }
  46035. /***/ }),
  46036. /***/ "./node_modules/vue-router/dist/vue-router.esm.js":
  46037. /*!********************************************************!*\
  46038. !*** ./node_modules/vue-router/dist/vue-router.esm.js ***!
  46039. \********************************************************/
  46040. /*! exports provided: default */
  46041. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46042. "use strict";
  46043. __webpack_require__.r(__webpack_exports__);
  46044. /*!
  46045. * vue-router v3.1.6
  46046. * (c) 2020 Evan You
  46047. * @license MIT
  46048. */
  46049. /* */
  46050. function assert (condition, message) {
  46051. if (!condition) {
  46052. throw new Error(("[vue-router] " + message))
  46053. }
  46054. }
  46055. function warn (condition, message) {
  46056. if ( true && !condition) {
  46057. typeof console !== 'undefined' && console.warn(("[vue-router] " + message));
  46058. }
  46059. }
  46060. function isError (err) {
  46061. return Object.prototype.toString.call(err).indexOf('Error') > -1
  46062. }
  46063. function isExtendedError (constructor, err) {
  46064. return (
  46065. err instanceof constructor ||
  46066. // _name is to support IE9 too
  46067. (err && (err.name === constructor.name || err._name === constructor._name))
  46068. )
  46069. }
  46070. function extend (a, b) {
  46071. for (var key in b) {
  46072. a[key] = b[key];
  46073. }
  46074. return a
  46075. }
  46076. var View = {
  46077. name: 'RouterView',
  46078. functional: true,
  46079. props: {
  46080. name: {
  46081. type: String,
  46082. default: 'default'
  46083. }
  46084. },
  46085. render: function render (_, ref) {
  46086. var props = ref.props;
  46087. var children = ref.children;
  46088. var parent = ref.parent;
  46089. var data = ref.data;
  46090. // used by devtools to display a router-view badge
  46091. data.routerView = true;
  46092. // directly use parent context's createElement() function
  46093. // so that components rendered by router-view can resolve named slots
  46094. var h = parent.$createElement;
  46095. var name = props.name;
  46096. var route = parent.$route;
  46097. var cache = parent._routerViewCache || (parent._routerViewCache = {});
  46098. // determine current view depth, also check to see if the tree
  46099. // has been toggled inactive but kept-alive.
  46100. var depth = 0;
  46101. var inactive = false;
  46102. while (parent && parent._routerRoot !== parent) {
  46103. var vnodeData = parent.$vnode ? parent.$vnode.data : {};
  46104. if (vnodeData.routerView) {
  46105. depth++;
  46106. }
  46107. if (vnodeData.keepAlive && parent._directInactive && parent._inactive) {
  46108. inactive = true;
  46109. }
  46110. parent = parent.$parent;
  46111. }
  46112. data.routerViewDepth = depth;
  46113. // render previous view if the tree is inactive and kept-alive
  46114. if (inactive) {
  46115. var cachedData = cache[name];
  46116. var cachedComponent = cachedData && cachedData.component;
  46117. if (cachedComponent) {
  46118. // #2301
  46119. // pass props
  46120. if (cachedData.configProps) {
  46121. fillPropsinData(cachedComponent, data, cachedData.route, cachedData.configProps);
  46122. }
  46123. return h(cachedComponent, data, children)
  46124. } else {
  46125. // render previous empty view
  46126. return h()
  46127. }
  46128. }
  46129. var matched = route.matched[depth];
  46130. var component = matched && matched.components[name];
  46131. // render empty node if no matched route or no config component
  46132. if (!matched || !component) {
  46133. cache[name] = null;
  46134. return h()
  46135. }
  46136. // cache component
  46137. cache[name] = { component: component };
  46138. // attach instance registration hook
  46139. // this will be called in the instance's injected lifecycle hooks
  46140. data.registerRouteInstance = function (vm, val) {
  46141. // val could be undefined for unregistration
  46142. var current = matched.instances[name];
  46143. if (
  46144. (val && current !== vm) ||
  46145. (!val && current === vm)
  46146. ) {
  46147. matched.instances[name] = val;
  46148. }
  46149. }
  46150. // also register instance in prepatch hook
  46151. // in case the same component instance is reused across different routes
  46152. ;(data.hook || (data.hook = {})).prepatch = function (_, vnode) {
  46153. matched.instances[name] = vnode.componentInstance;
  46154. };
  46155. // register instance in init hook
  46156. // in case kept-alive component be actived when routes changed
  46157. data.hook.init = function (vnode) {
  46158. if (vnode.data.keepAlive &&
  46159. vnode.componentInstance &&
  46160. vnode.componentInstance !== matched.instances[name]
  46161. ) {
  46162. matched.instances[name] = vnode.componentInstance;
  46163. }
  46164. };
  46165. var configProps = matched.props && matched.props[name];
  46166. // save route and configProps in cachce
  46167. if (configProps) {
  46168. extend(cache[name], {
  46169. route: route,
  46170. configProps: configProps
  46171. });
  46172. fillPropsinData(component, data, route, configProps);
  46173. }
  46174. return h(component, data, children)
  46175. }
  46176. };
  46177. function fillPropsinData (component, data, route, configProps) {
  46178. // resolve props
  46179. var propsToPass = data.props = resolveProps(route, configProps);
  46180. if (propsToPass) {
  46181. // clone to prevent mutation
  46182. propsToPass = data.props = extend({}, propsToPass);
  46183. // pass non-declared props as attrs
  46184. var attrs = data.attrs = data.attrs || {};
  46185. for (var key in propsToPass) {
  46186. if (!component.props || !(key in component.props)) {
  46187. attrs[key] = propsToPass[key];
  46188. delete propsToPass[key];
  46189. }
  46190. }
  46191. }
  46192. }
  46193. function resolveProps (route, config) {
  46194. switch (typeof config) {
  46195. case 'undefined':
  46196. return
  46197. case 'object':
  46198. return config
  46199. case 'function':
  46200. return config(route)
  46201. case 'boolean':
  46202. return config ? route.params : undefined
  46203. default:
  46204. if (true) {
  46205. warn(
  46206. false,
  46207. "props in \"" + (route.path) + "\" is a " + (typeof config) + ", " +
  46208. "expecting an object, function or boolean."
  46209. );
  46210. }
  46211. }
  46212. }
  46213. /* */
  46214. var encodeReserveRE = /[!'()*]/g;
  46215. var encodeReserveReplacer = function (c) { return '%' + c.charCodeAt(0).toString(16); };
  46216. var commaRE = /%2C/g;
  46217. // fixed encodeURIComponent which is more conformant to RFC3986:
  46218. // - escapes [!'()*]
  46219. // - preserve commas
  46220. var encode = function (str) { return encodeURIComponent(str)
  46221. .replace(encodeReserveRE, encodeReserveReplacer)
  46222. .replace(commaRE, ','); };
  46223. var decode = decodeURIComponent;
  46224. function resolveQuery (
  46225. query,
  46226. extraQuery,
  46227. _parseQuery
  46228. ) {
  46229. if ( extraQuery === void 0 ) extraQuery = {};
  46230. var parse = _parseQuery || parseQuery;
  46231. var parsedQuery;
  46232. try {
  46233. parsedQuery = parse(query || '');
  46234. } catch (e) {
  46235. true && warn(false, e.message);
  46236. parsedQuery = {};
  46237. }
  46238. for (var key in extraQuery) {
  46239. parsedQuery[key] = extraQuery[key];
  46240. }
  46241. return parsedQuery
  46242. }
  46243. function parseQuery (query) {
  46244. var res = {};
  46245. query = query.trim().replace(/^(\?|#|&)/, '');
  46246. if (!query) {
  46247. return res
  46248. }
  46249. query.split('&').forEach(function (param) {
  46250. var parts = param.replace(/\+/g, ' ').split('=');
  46251. var key = decode(parts.shift());
  46252. var val = parts.length > 0
  46253. ? decode(parts.join('='))
  46254. : null;
  46255. if (res[key] === undefined) {
  46256. res[key] = val;
  46257. } else if (Array.isArray(res[key])) {
  46258. res[key].push(val);
  46259. } else {
  46260. res[key] = [res[key], val];
  46261. }
  46262. });
  46263. return res
  46264. }
  46265. function stringifyQuery (obj) {
  46266. var res = obj ? Object.keys(obj).map(function (key) {
  46267. var val = obj[key];
  46268. if (val === undefined) {
  46269. return ''
  46270. }
  46271. if (val === null) {
  46272. return encode(key)
  46273. }
  46274. if (Array.isArray(val)) {
  46275. var result = [];
  46276. val.forEach(function (val2) {
  46277. if (val2 === undefined) {
  46278. return
  46279. }
  46280. if (val2 === null) {
  46281. result.push(encode(key));
  46282. } else {
  46283. result.push(encode(key) + '=' + encode(val2));
  46284. }
  46285. });
  46286. return result.join('&')
  46287. }
  46288. return encode(key) + '=' + encode(val)
  46289. }).filter(function (x) { return x.length > 0; }).join('&') : null;
  46290. return res ? ("?" + res) : ''
  46291. }
  46292. /* */
  46293. var trailingSlashRE = /\/?$/;
  46294. function createRoute (
  46295. record,
  46296. location,
  46297. redirectedFrom,
  46298. router
  46299. ) {
  46300. var stringifyQuery = router && router.options.stringifyQuery;
  46301. var query = location.query || {};
  46302. try {
  46303. query = clone(query);
  46304. } catch (e) {}
  46305. var route = {
  46306. name: location.name || (record && record.name),
  46307. meta: (record && record.meta) || {},
  46308. path: location.path || '/',
  46309. hash: location.hash || '',
  46310. query: query,
  46311. params: location.params || {},
  46312. fullPath: getFullPath(location, stringifyQuery),
  46313. matched: record ? formatMatch(record) : []
  46314. };
  46315. if (redirectedFrom) {
  46316. route.redirectedFrom = getFullPath(redirectedFrom, stringifyQuery);
  46317. }
  46318. return Object.freeze(route)
  46319. }
  46320. function clone (value) {
  46321. if (Array.isArray(value)) {
  46322. return value.map(clone)
  46323. } else if (value && typeof value === 'object') {
  46324. var res = {};
  46325. for (var key in value) {
  46326. res[key] = clone(value[key]);
  46327. }
  46328. return res
  46329. } else {
  46330. return value
  46331. }
  46332. }
  46333. // the starting route that represents the initial state
  46334. var START = createRoute(null, {
  46335. path: '/'
  46336. });
  46337. function formatMatch (record) {
  46338. var res = [];
  46339. while (record) {
  46340. res.unshift(record);
  46341. record = record.parent;
  46342. }
  46343. return res
  46344. }
  46345. function getFullPath (
  46346. ref,
  46347. _stringifyQuery
  46348. ) {
  46349. var path = ref.path;
  46350. var query = ref.query; if ( query === void 0 ) query = {};
  46351. var hash = ref.hash; if ( hash === void 0 ) hash = '';
  46352. var stringify = _stringifyQuery || stringifyQuery;
  46353. return (path || '/') + stringify(query) + hash
  46354. }
  46355. function isSameRoute (a, b) {
  46356. if (b === START) {
  46357. return a === b
  46358. } else if (!b) {
  46359. return false
  46360. } else if (a.path && b.path) {
  46361. return (
  46362. a.path.replace(trailingSlashRE, '') === b.path.replace(trailingSlashRE, '') &&
  46363. a.hash === b.hash &&
  46364. isObjectEqual(a.query, b.query)
  46365. )
  46366. } else if (a.name && b.name) {
  46367. return (
  46368. a.name === b.name &&
  46369. a.hash === b.hash &&
  46370. isObjectEqual(a.query, b.query) &&
  46371. isObjectEqual(a.params, b.params)
  46372. )
  46373. } else {
  46374. return false
  46375. }
  46376. }
  46377. function isObjectEqual (a, b) {
  46378. if ( a === void 0 ) a = {};
  46379. if ( b === void 0 ) b = {};
  46380. // handle null value #1566
  46381. if (!a || !b) { return a === b }
  46382. var aKeys = Object.keys(a);
  46383. var bKeys = Object.keys(b);
  46384. if (aKeys.length !== bKeys.length) {
  46385. return false
  46386. }
  46387. return aKeys.every(function (key) {
  46388. var aVal = a[key];
  46389. var bVal = b[key];
  46390. // check nested equality
  46391. if (typeof aVal === 'object' && typeof bVal === 'object') {
  46392. return isObjectEqual(aVal, bVal)
  46393. }
  46394. return String(aVal) === String(bVal)
  46395. })
  46396. }
  46397. function isIncludedRoute (current, target) {
  46398. return (
  46399. current.path.replace(trailingSlashRE, '/').indexOf(
  46400. target.path.replace(trailingSlashRE, '/')
  46401. ) === 0 &&
  46402. (!target.hash || current.hash === target.hash) &&
  46403. queryIncludes(current.query, target.query)
  46404. )
  46405. }
  46406. function queryIncludes (current, target) {
  46407. for (var key in target) {
  46408. if (!(key in current)) {
  46409. return false
  46410. }
  46411. }
  46412. return true
  46413. }
  46414. /* */
  46415. function resolvePath (
  46416. relative,
  46417. base,
  46418. append
  46419. ) {
  46420. var firstChar = relative.charAt(0);
  46421. if (firstChar === '/') {
  46422. return relative
  46423. }
  46424. if (firstChar === '?' || firstChar === '#') {
  46425. return base + relative
  46426. }
  46427. var stack = base.split('/');
  46428. // remove trailing segment if:
  46429. // - not appending
  46430. // - appending to trailing slash (last segment is empty)
  46431. if (!append || !stack[stack.length - 1]) {
  46432. stack.pop();
  46433. }
  46434. // resolve relative path
  46435. var segments = relative.replace(/^\//, '').split('/');
  46436. for (var i = 0; i < segments.length; i++) {
  46437. var segment = segments[i];
  46438. if (segment === '..') {
  46439. stack.pop();
  46440. } else if (segment !== '.') {
  46441. stack.push(segment);
  46442. }
  46443. }
  46444. // ensure leading slash
  46445. if (stack[0] !== '') {
  46446. stack.unshift('');
  46447. }
  46448. return stack.join('/')
  46449. }
  46450. function parsePath (path) {
  46451. var hash = '';
  46452. var query = '';
  46453. var hashIndex = path.indexOf('#');
  46454. if (hashIndex >= 0) {
  46455. hash = path.slice(hashIndex);
  46456. path = path.slice(0, hashIndex);
  46457. }
  46458. var queryIndex = path.indexOf('?');
  46459. if (queryIndex >= 0) {
  46460. query = path.slice(queryIndex + 1);
  46461. path = path.slice(0, queryIndex);
  46462. }
  46463. return {
  46464. path: path,
  46465. query: query,
  46466. hash: hash
  46467. }
  46468. }
  46469. function cleanPath (path) {
  46470. return path.replace(/\/\//g, '/')
  46471. }
  46472. var isarray = Array.isArray || function (arr) {
  46473. return Object.prototype.toString.call(arr) == '[object Array]';
  46474. };
  46475. /**
  46476. * Expose `pathToRegexp`.
  46477. */
  46478. var pathToRegexp_1 = pathToRegexp;
  46479. var parse_1 = parse;
  46480. var compile_1 = compile;
  46481. var tokensToFunction_1 = tokensToFunction;
  46482. var tokensToRegExp_1 = tokensToRegExp;
  46483. /**
  46484. * The main path matching regexp utility.
  46485. *
  46486. * @type {RegExp}
  46487. */
  46488. var PATH_REGEXP = new RegExp([
  46489. // Match escaped characters that would otherwise appear in future matches.
  46490. // This allows the user to escape special characters that won't transform.
  46491. '(\\\\.)',
  46492. // Match Express-style parameters and un-named parameters with a prefix
  46493. // and optional suffixes. Matches appear as:
  46494. //
  46495. // "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined]
  46496. // "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined]
  46497. // "/*" => ["/", undefined, undefined, undefined, undefined, "*"]
  46498. '([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))'
  46499. ].join('|'), 'g');
  46500. /**
  46501. * Parse a string for the raw tokens.
  46502. *
  46503. * @param {string} str
  46504. * @param {Object=} options
  46505. * @return {!Array}
  46506. */
  46507. function parse (str, options) {
  46508. var tokens = [];
  46509. var key = 0;
  46510. var index = 0;
  46511. var path = '';
  46512. var defaultDelimiter = options && options.delimiter || '/';
  46513. var res;
  46514. while ((res = PATH_REGEXP.exec(str)) != null) {
  46515. var m = res[0];
  46516. var escaped = res[1];
  46517. var offset = res.index;
  46518. path += str.slice(index, offset);
  46519. index = offset + m.length;
  46520. // Ignore already escaped sequences.
  46521. if (escaped) {
  46522. path += escaped[1];
  46523. continue
  46524. }
  46525. var next = str[index];
  46526. var prefix = res[2];
  46527. var name = res[3];
  46528. var capture = res[4];
  46529. var group = res[5];
  46530. var modifier = res[6];
  46531. var asterisk = res[7];
  46532. // Push the current path onto the tokens.
  46533. if (path) {
  46534. tokens.push(path);
  46535. path = '';
  46536. }
  46537. var partial = prefix != null && next != null && next !== prefix;
  46538. var repeat = modifier === '+' || modifier === '*';
  46539. var optional = modifier === '?' || modifier === '*';
  46540. var delimiter = res[2] || defaultDelimiter;
  46541. var pattern = capture || group;
  46542. tokens.push({
  46543. name: name || key++,
  46544. prefix: prefix || '',
  46545. delimiter: delimiter,
  46546. optional: optional,
  46547. repeat: repeat,
  46548. partial: partial,
  46549. asterisk: !!asterisk,
  46550. pattern: pattern ? escapeGroup(pattern) : (asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?')
  46551. });
  46552. }
  46553. // Match any characters still remaining.
  46554. if (index < str.length) {
  46555. path += str.substr(index);
  46556. }
  46557. // If the path exists, push it onto the end.
  46558. if (path) {
  46559. tokens.push(path);
  46560. }
  46561. return tokens
  46562. }
  46563. /**
  46564. * Compile a string to a template function for the path.
  46565. *
  46566. * @param {string} str
  46567. * @param {Object=} options
  46568. * @return {!function(Object=, Object=)}
  46569. */
  46570. function compile (str, options) {
  46571. return tokensToFunction(parse(str, options))
  46572. }
  46573. /**
  46574. * Prettier encoding of URI path segments.
  46575. *
  46576. * @param {string}
  46577. * @return {string}
  46578. */
  46579. function encodeURIComponentPretty (str) {
  46580. return encodeURI(str).replace(/[\/?#]/g, function (c) {
  46581. return '%' + c.charCodeAt(0).toString(16).toUpperCase()
  46582. })
  46583. }
  46584. /**
  46585. * Encode the asterisk parameter. Similar to `pretty`, but allows slashes.
  46586. *
  46587. * @param {string}
  46588. * @return {string}
  46589. */
  46590. function encodeAsterisk (str) {
  46591. return encodeURI(str).replace(/[?#]/g, function (c) {
  46592. return '%' + c.charCodeAt(0).toString(16).toUpperCase()
  46593. })
  46594. }
  46595. /**
  46596. * Expose a method for transforming tokens into the path function.
  46597. */
  46598. function tokensToFunction (tokens) {
  46599. // Compile all the tokens into regexps.
  46600. var matches = new Array(tokens.length);
  46601. // Compile all the patterns before compilation.
  46602. for (var i = 0; i < tokens.length; i++) {
  46603. if (typeof tokens[i] === 'object') {
  46604. matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');
  46605. }
  46606. }
  46607. return function (obj, opts) {
  46608. var path = '';
  46609. var data = obj || {};
  46610. var options = opts || {};
  46611. var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;
  46612. for (var i = 0; i < tokens.length; i++) {
  46613. var token = tokens[i];
  46614. if (typeof token === 'string') {
  46615. path += token;
  46616. continue
  46617. }
  46618. var value = data[token.name];
  46619. var segment;
  46620. if (value == null) {
  46621. if (token.optional) {
  46622. // Prepend partial segment prefixes.
  46623. if (token.partial) {
  46624. path += token.prefix;
  46625. }
  46626. continue
  46627. } else {
  46628. throw new TypeError('Expected "' + token.name + '" to be defined')
  46629. }
  46630. }
  46631. if (isarray(value)) {
  46632. if (!token.repeat) {
  46633. throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`')
  46634. }
  46635. if (value.length === 0) {
  46636. if (token.optional) {
  46637. continue
  46638. } else {
  46639. throw new TypeError('Expected "' + token.name + '" to not be empty')
  46640. }
  46641. }
  46642. for (var j = 0; j < value.length; j++) {
  46643. segment = encode(value[j]);
  46644. if (!matches[i].test(segment)) {
  46645. throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`')
  46646. }
  46647. path += (j === 0 ? token.prefix : token.delimiter) + segment;
  46648. }
  46649. continue
  46650. }
  46651. segment = token.asterisk ? encodeAsterisk(value) : encode(value);
  46652. if (!matches[i].test(segment)) {
  46653. throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"')
  46654. }
  46655. path += token.prefix + segment;
  46656. }
  46657. return path
  46658. }
  46659. }
  46660. /**
  46661. * Escape a regular expression string.
  46662. *
  46663. * @param {string} str
  46664. * @return {string}
  46665. */
  46666. function escapeString (str) {
  46667. return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1')
  46668. }
  46669. /**
  46670. * Escape the capturing group by escaping special characters and meaning.
  46671. *
  46672. * @param {string} group
  46673. * @return {string}
  46674. */
  46675. function escapeGroup (group) {
  46676. return group.replace(/([=!:$\/()])/g, '\\$1')
  46677. }
  46678. /**
  46679. * Attach the keys as a property of the regexp.
  46680. *
  46681. * @param {!RegExp} re
  46682. * @param {Array} keys
  46683. * @return {!RegExp}
  46684. */
  46685. function attachKeys (re, keys) {
  46686. re.keys = keys;
  46687. return re
  46688. }
  46689. /**
  46690. * Get the flags for a regexp from the options.
  46691. *
  46692. * @param {Object} options
  46693. * @return {string}
  46694. */
  46695. function flags (options) {
  46696. return options.sensitive ? '' : 'i'
  46697. }
  46698. /**
  46699. * Pull out keys from a regexp.
  46700. *
  46701. * @param {!RegExp} path
  46702. * @param {!Array} keys
  46703. * @return {!RegExp}
  46704. */
  46705. function regexpToRegexp (path, keys) {
  46706. // Use a negative lookahead to match only capturing groups.
  46707. var groups = path.source.match(/\((?!\?)/g);
  46708. if (groups) {
  46709. for (var i = 0; i < groups.length; i++) {
  46710. keys.push({
  46711. name: i,
  46712. prefix: null,
  46713. delimiter: null,
  46714. optional: false,
  46715. repeat: false,
  46716. partial: false,
  46717. asterisk: false,
  46718. pattern: null
  46719. });
  46720. }
  46721. }
  46722. return attachKeys(path, keys)
  46723. }
  46724. /**
  46725. * Transform an array into a regexp.
  46726. *
  46727. * @param {!Array} path
  46728. * @param {Array} keys
  46729. * @param {!Object} options
  46730. * @return {!RegExp}
  46731. */
  46732. function arrayToRegexp (path, keys, options) {
  46733. var parts = [];
  46734. for (var i = 0; i < path.length; i++) {
  46735. parts.push(pathToRegexp(path[i], keys, options).source);
  46736. }
  46737. var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options));
  46738. return attachKeys(regexp, keys)
  46739. }
  46740. /**
  46741. * Create a path regexp from string input.
  46742. *
  46743. * @param {string} path
  46744. * @param {!Array} keys
  46745. * @param {!Object} options
  46746. * @return {!RegExp}
  46747. */
  46748. function stringToRegexp (path, keys, options) {
  46749. return tokensToRegExp(parse(path, options), keys, options)
  46750. }
  46751. /**
  46752. * Expose a function for taking tokens and returning a RegExp.
  46753. *
  46754. * @param {!Array} tokens
  46755. * @param {(Array|Object)=} keys
  46756. * @param {Object=} options
  46757. * @return {!RegExp}
  46758. */
  46759. function tokensToRegExp (tokens, keys, options) {
  46760. if (!isarray(keys)) {
  46761. options = /** @type {!Object} */ (keys || options);
  46762. keys = [];
  46763. }
  46764. options = options || {};
  46765. var strict = options.strict;
  46766. var end = options.end !== false;
  46767. var route = '';
  46768. // Iterate over the tokens and create our regexp string.
  46769. for (var i = 0; i < tokens.length; i++) {
  46770. var token = tokens[i];
  46771. if (typeof token === 'string') {
  46772. route += escapeString(token);
  46773. } else {
  46774. var prefix = escapeString(token.prefix);
  46775. var capture = '(?:' + token.pattern + ')';
  46776. keys.push(token);
  46777. if (token.repeat) {
  46778. capture += '(?:' + prefix + capture + ')*';
  46779. }
  46780. if (token.optional) {
  46781. if (!token.partial) {
  46782. capture = '(?:' + prefix + '(' + capture + '))?';
  46783. } else {
  46784. capture = prefix + '(' + capture + ')?';
  46785. }
  46786. } else {
  46787. capture = prefix + '(' + capture + ')';
  46788. }
  46789. route += capture;
  46790. }
  46791. }
  46792. var delimiter = escapeString(options.delimiter || '/');
  46793. var endsWithDelimiter = route.slice(-delimiter.length) === delimiter;
  46794. // In non-strict mode we allow a slash at the end of match. If the path to
  46795. // match already ends with a slash, we remove it for consistency. The slash
  46796. // is valid at the end of a path match, not in the middle. This is important
  46797. // in non-ending mode, where "/test/" shouldn't match "/test//route".
  46798. if (!strict) {
  46799. route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?';
  46800. }
  46801. if (end) {
  46802. route += '$';
  46803. } else {
  46804. // In non-ending mode, we need the capturing groups to match as much as
  46805. // possible by using a positive lookahead to the end or next path segment.
  46806. route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)';
  46807. }
  46808. return attachKeys(new RegExp('^' + route, flags(options)), keys)
  46809. }
  46810. /**
  46811. * Normalize the given path string, returning a regular expression.
  46812. *
  46813. * An empty array can be passed in for the keys, which will hold the
  46814. * placeholder key descriptions. For example, using `/user/:id`, `keys` will
  46815. * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.
  46816. *
  46817. * @param {(string|RegExp|Array)} path
  46818. * @param {(Array|Object)=} keys
  46819. * @param {Object=} options
  46820. * @return {!RegExp}
  46821. */
  46822. function pathToRegexp (path, keys, options) {
  46823. if (!isarray(keys)) {
  46824. options = /** @type {!Object} */ (keys || options);
  46825. keys = [];
  46826. }
  46827. options = options || {};
  46828. if (path instanceof RegExp) {
  46829. return regexpToRegexp(path, /** @type {!Array} */ (keys))
  46830. }
  46831. if (isarray(path)) {
  46832. return arrayToRegexp(/** @type {!Array} */ (path), /** @type {!Array} */ (keys), options)
  46833. }
  46834. return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options)
  46835. }
  46836. pathToRegexp_1.parse = parse_1;
  46837. pathToRegexp_1.compile = compile_1;
  46838. pathToRegexp_1.tokensToFunction = tokensToFunction_1;
  46839. pathToRegexp_1.tokensToRegExp = tokensToRegExp_1;
  46840. /* */
  46841. // $flow-disable-line
  46842. var regexpCompileCache = Object.create(null);
  46843. function fillParams (
  46844. path,
  46845. params,
  46846. routeMsg
  46847. ) {
  46848. params = params || {};
  46849. try {
  46850. var filler =
  46851. regexpCompileCache[path] ||
  46852. (regexpCompileCache[path] = pathToRegexp_1.compile(path));
  46853. // Fix #2505 resolving asterisk routes { name: 'not-found', params: { pathMatch: '/not-found' }}
  46854. // and fix #3106 so that you can work with location descriptor object having params.pathMatch equal to empty string
  46855. if (typeof params.pathMatch === 'string') { params[0] = params.pathMatch; }
  46856. return filler(params, { pretty: true })
  46857. } catch (e) {
  46858. if (true) {
  46859. // Fix #3072 no warn if `pathMatch` is string
  46860. warn(typeof params.pathMatch === 'string', ("missing param for " + routeMsg + ": " + (e.message)));
  46861. }
  46862. return ''
  46863. } finally {
  46864. // delete the 0 if it was added
  46865. delete params[0];
  46866. }
  46867. }
  46868. /* */
  46869. function normalizeLocation (
  46870. raw,
  46871. current,
  46872. append,
  46873. router
  46874. ) {
  46875. var next = typeof raw === 'string' ? { path: raw } : raw;
  46876. // named target
  46877. if (next._normalized) {
  46878. return next
  46879. } else if (next.name) {
  46880. next = extend({}, raw);
  46881. var params = next.params;
  46882. if (params && typeof params === 'object') {
  46883. next.params = extend({}, params);
  46884. }
  46885. return next
  46886. }
  46887. // relative params
  46888. if (!next.path && next.params && current) {
  46889. next = extend({}, next);
  46890. next._normalized = true;
  46891. var params$1 = extend(extend({}, current.params), next.params);
  46892. if (current.name) {
  46893. next.name = current.name;
  46894. next.params = params$1;
  46895. } else if (current.matched.length) {
  46896. var rawPath = current.matched[current.matched.length - 1].path;
  46897. next.path = fillParams(rawPath, params$1, ("path " + (current.path)));
  46898. } else if (true) {
  46899. warn(false, "relative params navigation requires a current route.");
  46900. }
  46901. return next
  46902. }
  46903. var parsedPath = parsePath(next.path || '');
  46904. var basePath = (current && current.path) || '/';
  46905. var path = parsedPath.path
  46906. ? resolvePath(parsedPath.path, basePath, append || next.append)
  46907. : basePath;
  46908. var query = resolveQuery(
  46909. parsedPath.query,
  46910. next.query,
  46911. router && router.options.parseQuery
  46912. );
  46913. var hash = next.hash || parsedPath.hash;
  46914. if (hash && hash.charAt(0) !== '#') {
  46915. hash = "#" + hash;
  46916. }
  46917. return {
  46918. _normalized: true,
  46919. path: path,
  46920. query: query,
  46921. hash: hash
  46922. }
  46923. }
  46924. /* */
  46925. // work around weird flow bug
  46926. var toTypes = [String, Object];
  46927. var eventTypes = [String, Array];
  46928. var noop = function () {};
  46929. var Link = {
  46930. name: 'RouterLink',
  46931. props: {
  46932. to: {
  46933. type: toTypes,
  46934. required: true
  46935. },
  46936. tag: {
  46937. type: String,
  46938. default: 'a'
  46939. },
  46940. exact: Boolean,
  46941. append: Boolean,
  46942. replace: Boolean,
  46943. activeClass: String,
  46944. exactActiveClass: String,
  46945. event: {
  46946. type: eventTypes,
  46947. default: 'click'
  46948. }
  46949. },
  46950. render: function render (h) {
  46951. var this$1 = this;
  46952. var router = this.$router;
  46953. var current = this.$route;
  46954. var ref = router.resolve(
  46955. this.to,
  46956. current,
  46957. this.append
  46958. );
  46959. var location = ref.location;
  46960. var route = ref.route;
  46961. var href = ref.href;
  46962. var classes = {};
  46963. var globalActiveClass = router.options.linkActiveClass;
  46964. var globalExactActiveClass = router.options.linkExactActiveClass;
  46965. // Support global empty active class
  46966. var activeClassFallback =
  46967. globalActiveClass == null ? 'router-link-active' : globalActiveClass;
  46968. var exactActiveClassFallback =
  46969. globalExactActiveClass == null
  46970. ? 'router-link-exact-active'
  46971. : globalExactActiveClass;
  46972. var activeClass =
  46973. this.activeClass == null ? activeClassFallback : this.activeClass;
  46974. var exactActiveClass =
  46975. this.exactActiveClass == null
  46976. ? exactActiveClassFallback
  46977. : this.exactActiveClass;
  46978. var compareTarget = route.redirectedFrom
  46979. ? createRoute(null, normalizeLocation(route.redirectedFrom), null, router)
  46980. : route;
  46981. classes[exactActiveClass] = isSameRoute(current, compareTarget);
  46982. classes[activeClass] = this.exact
  46983. ? classes[exactActiveClass]
  46984. : isIncludedRoute(current, compareTarget);
  46985. var handler = function (e) {
  46986. if (guardEvent(e)) {
  46987. if (this$1.replace) {
  46988. router.replace(location, noop);
  46989. } else {
  46990. router.push(location, noop);
  46991. }
  46992. }
  46993. };
  46994. var on = { click: guardEvent };
  46995. if (Array.isArray(this.event)) {
  46996. this.event.forEach(function (e) {
  46997. on[e] = handler;
  46998. });
  46999. } else {
  47000. on[this.event] = handler;
  47001. }
  47002. var data = { class: classes };
  47003. var scopedSlot =
  47004. !this.$scopedSlots.$hasNormal &&
  47005. this.$scopedSlots.default &&
  47006. this.$scopedSlots.default({
  47007. href: href,
  47008. route: route,
  47009. navigate: handler,
  47010. isActive: classes[activeClass],
  47011. isExactActive: classes[exactActiveClass]
  47012. });
  47013. if (scopedSlot) {
  47014. if (scopedSlot.length === 1) {
  47015. return scopedSlot[0]
  47016. } else if (scopedSlot.length > 1 || !scopedSlot.length) {
  47017. if (true) {
  47018. warn(
  47019. false,
  47020. ("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.")
  47021. );
  47022. }
  47023. return scopedSlot.length === 0 ? h() : h('span', {}, scopedSlot)
  47024. }
  47025. }
  47026. if (this.tag === 'a') {
  47027. data.on = on;
  47028. data.attrs = { href: href };
  47029. } else {
  47030. // find the first <a> child and apply listener and href
  47031. var a = findAnchor(this.$slots.default);
  47032. if (a) {
  47033. // in case the <a> is a static node
  47034. a.isStatic = false;
  47035. var aData = (a.data = extend({}, a.data));
  47036. aData.on = aData.on || {};
  47037. // transform existing events in both objects into arrays so we can push later
  47038. for (var event in aData.on) {
  47039. var handler$1 = aData.on[event];
  47040. if (event in on) {
  47041. aData.on[event] = Array.isArray(handler$1) ? handler$1 : [handler$1];
  47042. }
  47043. }
  47044. // append new listeners for router-link
  47045. for (var event$1 in on) {
  47046. if (event$1 in aData.on) {
  47047. // on[event] is always a function
  47048. aData.on[event$1].push(on[event$1]);
  47049. } else {
  47050. aData.on[event$1] = handler;
  47051. }
  47052. }
  47053. var aAttrs = (a.data.attrs = extend({}, a.data.attrs));
  47054. aAttrs.href = href;
  47055. } else {
  47056. // doesn't have <a> child, apply listener to self
  47057. data.on = on;
  47058. }
  47059. }
  47060. return h(this.tag, data, this.$slots.default)
  47061. }
  47062. };
  47063. function guardEvent (e) {
  47064. // don't redirect with control keys
  47065. if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) { return }
  47066. // don't redirect when preventDefault called
  47067. if (e.defaultPrevented) { return }
  47068. // don't redirect on right click
  47069. if (e.button !== undefined && e.button !== 0) { return }
  47070. // don't redirect if `target="_blank"`
  47071. if (e.currentTarget && e.currentTarget.getAttribute) {
  47072. var target = e.currentTarget.getAttribute('target');
  47073. if (/\b_blank\b/i.test(target)) { return }
  47074. }
  47075. // this may be a Weex event which doesn't have this method
  47076. if (e.preventDefault) {
  47077. e.preventDefault();
  47078. }
  47079. return true
  47080. }
  47081. function findAnchor (children) {
  47082. if (children) {
  47083. var child;
  47084. for (var i = 0; i < children.length; i++) {
  47085. child = children[i];
  47086. if (child.tag === 'a') {
  47087. return child
  47088. }
  47089. if (child.children && (child = findAnchor(child.children))) {
  47090. return child
  47091. }
  47092. }
  47093. }
  47094. }
  47095. var _Vue;
  47096. function install (Vue) {
  47097. if (install.installed && _Vue === Vue) { return }
  47098. install.installed = true;
  47099. _Vue = Vue;
  47100. var isDef = function (v) { return v !== undefined; };
  47101. var registerInstance = function (vm, callVal) {
  47102. var i = vm.$options._parentVnode;
  47103. if (isDef(i) && isDef(i = i.data) && isDef(i = i.registerRouteInstance)) {
  47104. i(vm, callVal);
  47105. }
  47106. };
  47107. Vue.mixin({
  47108. beforeCreate: function beforeCreate () {
  47109. if (isDef(this.$options.router)) {
  47110. this._routerRoot = this;
  47111. this._router = this.$options.router;
  47112. this._router.init(this);
  47113. Vue.util.defineReactive(this, '_route', this._router.history.current);
  47114. } else {
  47115. this._routerRoot = (this.$parent && this.$parent._routerRoot) || this;
  47116. }
  47117. registerInstance(this, this);
  47118. },
  47119. destroyed: function destroyed () {
  47120. registerInstance(this);
  47121. }
  47122. });
  47123. Object.defineProperty(Vue.prototype, '$router', {
  47124. get: function get () { return this._routerRoot._router }
  47125. });
  47126. Object.defineProperty(Vue.prototype, '$route', {
  47127. get: function get () { return this._routerRoot._route }
  47128. });
  47129. Vue.component('RouterView', View);
  47130. Vue.component('RouterLink', Link);
  47131. var strats = Vue.config.optionMergeStrategies;
  47132. // use the same hook merging strategy for route hooks
  47133. strats.beforeRouteEnter = strats.beforeRouteLeave = strats.beforeRouteUpdate = strats.created;
  47134. }
  47135. /* */
  47136. var inBrowser = typeof window !== 'undefined';
  47137. /* */
  47138. function createRouteMap (
  47139. routes,
  47140. oldPathList,
  47141. oldPathMap,
  47142. oldNameMap
  47143. ) {
  47144. // the path list is used to control path matching priority
  47145. var pathList = oldPathList || [];
  47146. // $flow-disable-line
  47147. var pathMap = oldPathMap || Object.create(null);
  47148. // $flow-disable-line
  47149. var nameMap = oldNameMap || Object.create(null);
  47150. routes.forEach(function (route) {
  47151. addRouteRecord(pathList, pathMap, nameMap, route);
  47152. });
  47153. // ensure wildcard routes are always at the end
  47154. for (var i = 0, l = pathList.length; i < l; i++) {
  47155. if (pathList[i] === '*') {
  47156. pathList.push(pathList.splice(i, 1)[0]);
  47157. l--;
  47158. i--;
  47159. }
  47160. }
  47161. if (true) {
  47162. // warn if routes do not include leading slashes
  47163. var found = pathList
  47164. // check for missing leading slash
  47165. .filter(function (path) { return path && path.charAt(0) !== '*' && path.charAt(0) !== '/'; });
  47166. if (found.length > 0) {
  47167. var pathNames = found.map(function (path) { return ("- " + path); }).join('\n');
  47168. warn(false, ("Non-nested routes must include a leading slash character. Fix the following routes: \n" + pathNames));
  47169. }
  47170. }
  47171. return {
  47172. pathList: pathList,
  47173. pathMap: pathMap,
  47174. nameMap: nameMap
  47175. }
  47176. }
  47177. function addRouteRecord (
  47178. pathList,
  47179. pathMap,
  47180. nameMap,
  47181. route,
  47182. parent,
  47183. matchAs
  47184. ) {
  47185. var path = route.path;
  47186. var name = route.name;
  47187. if (true) {
  47188. assert(path != null, "\"path\" is required in a route configuration.");
  47189. assert(
  47190. typeof route.component !== 'string',
  47191. "route config \"component\" for path: " + (String(
  47192. path || name
  47193. )) + " cannot be a " + "string id. Use an actual component instead."
  47194. );
  47195. }
  47196. var pathToRegexpOptions =
  47197. route.pathToRegexpOptions || {};
  47198. var normalizedPath = normalizePath(path, parent, pathToRegexpOptions.strict);
  47199. if (typeof route.caseSensitive === 'boolean') {
  47200. pathToRegexpOptions.sensitive = route.caseSensitive;
  47201. }
  47202. var record = {
  47203. path: normalizedPath,
  47204. regex: compileRouteRegex(normalizedPath, pathToRegexpOptions),
  47205. components: route.components || { default: route.component },
  47206. instances: {},
  47207. name: name,
  47208. parent: parent,
  47209. matchAs: matchAs,
  47210. redirect: route.redirect,
  47211. beforeEnter: route.beforeEnter,
  47212. meta: route.meta || {},
  47213. props:
  47214. route.props == null
  47215. ? {}
  47216. : route.components
  47217. ? route.props
  47218. : { default: route.props }
  47219. };
  47220. if (route.children) {
  47221. // Warn if route is named, does not redirect and has a default child route.
  47222. // If users navigate to this route by name, the default child will
  47223. // not be rendered (GH Issue #629)
  47224. if (true) {
  47225. if (
  47226. route.name &&
  47227. !route.redirect &&
  47228. route.children.some(function (child) { return /^\/?$/.test(child.path); })
  47229. ) {
  47230. warn(
  47231. false,
  47232. "Named Route '" + (route.name) + "' has a default child route. " +
  47233. "When navigating to this named route (:to=\"{name: '" + (route.name) + "'\"), " +
  47234. "the default child route will not be rendered. Remove the name from " +
  47235. "this route and use the name of the default child route for named " +
  47236. "links instead."
  47237. );
  47238. }
  47239. }
  47240. route.children.forEach(function (child) {
  47241. var childMatchAs = matchAs
  47242. ? cleanPath((matchAs + "/" + (child.path)))
  47243. : undefined;
  47244. addRouteRecord(pathList, pathMap, nameMap, child, record, childMatchAs);
  47245. });
  47246. }
  47247. if (!pathMap[record.path]) {
  47248. pathList.push(record.path);
  47249. pathMap[record.path] = record;
  47250. }
  47251. if (route.alias !== undefined) {
  47252. var aliases = Array.isArray(route.alias) ? route.alias : [route.alias];
  47253. for (var i = 0; i < aliases.length; ++i) {
  47254. var alias = aliases[i];
  47255. if ( true && alias === path) {
  47256. warn(
  47257. false,
  47258. ("Found an alias with the same value as the path: \"" + path + "\". You have to remove that alias. It will be ignored in development.")
  47259. );
  47260. // skip in dev to make it work
  47261. continue
  47262. }
  47263. var aliasRoute = {
  47264. path: alias,
  47265. children: route.children
  47266. };
  47267. addRouteRecord(
  47268. pathList,
  47269. pathMap,
  47270. nameMap,
  47271. aliasRoute,
  47272. parent,
  47273. record.path || '/' // matchAs
  47274. );
  47275. }
  47276. }
  47277. if (name) {
  47278. if (!nameMap[name]) {
  47279. nameMap[name] = record;
  47280. } else if ( true && !matchAs) {
  47281. warn(
  47282. false,
  47283. "Duplicate named routes definition: " +
  47284. "{ name: \"" + name + "\", path: \"" + (record.path) + "\" }"
  47285. );
  47286. }
  47287. }
  47288. }
  47289. function compileRouteRegex (
  47290. path,
  47291. pathToRegexpOptions
  47292. ) {
  47293. var regex = pathToRegexp_1(path, [], pathToRegexpOptions);
  47294. if (true) {
  47295. var keys = Object.create(null);
  47296. regex.keys.forEach(function (key) {
  47297. warn(
  47298. !keys[key.name],
  47299. ("Duplicate param keys in route with path: \"" + path + "\"")
  47300. );
  47301. keys[key.name] = true;
  47302. });
  47303. }
  47304. return regex
  47305. }
  47306. function normalizePath (
  47307. path,
  47308. parent,
  47309. strict
  47310. ) {
  47311. if (!strict) { path = path.replace(/\/$/, ''); }
  47312. if (path[0] === '/') { return path }
  47313. if (parent == null) { return path }
  47314. return cleanPath(((parent.path) + "/" + path))
  47315. }
  47316. /* */
  47317. function createMatcher (
  47318. routes,
  47319. router
  47320. ) {
  47321. var ref = createRouteMap(routes);
  47322. var pathList = ref.pathList;
  47323. var pathMap = ref.pathMap;
  47324. var nameMap = ref.nameMap;
  47325. function addRoutes (routes) {
  47326. createRouteMap(routes, pathList, pathMap, nameMap);
  47327. }
  47328. function match (
  47329. raw,
  47330. currentRoute,
  47331. redirectedFrom
  47332. ) {
  47333. var location = normalizeLocation(raw, currentRoute, false, router);
  47334. var name = location.name;
  47335. if (name) {
  47336. var record = nameMap[name];
  47337. if (true) {
  47338. warn(record, ("Route with name '" + name + "' does not exist"));
  47339. }
  47340. if (!record) { return _createRoute(null, location) }
  47341. var paramNames = record.regex.keys
  47342. .filter(function (key) { return !key.optional; })
  47343. .map(function (key) { return key.name; });
  47344. if (typeof location.params !== 'object') {
  47345. location.params = {};
  47346. }
  47347. if (currentRoute && typeof currentRoute.params === 'object') {
  47348. for (var key in currentRoute.params) {
  47349. if (!(key in location.params) && paramNames.indexOf(key) > -1) {
  47350. location.params[key] = currentRoute.params[key];
  47351. }
  47352. }
  47353. }
  47354. location.path = fillParams(record.path, location.params, ("named route \"" + name + "\""));
  47355. return _createRoute(record, location, redirectedFrom)
  47356. } else if (location.path) {
  47357. location.params = {};
  47358. for (var i = 0; i < pathList.length; i++) {
  47359. var path = pathList[i];
  47360. var record$1 = pathMap[path];
  47361. if (matchRoute(record$1.regex, location.path, location.params)) {
  47362. return _createRoute(record$1, location, redirectedFrom)
  47363. }
  47364. }
  47365. }
  47366. // no match
  47367. return _createRoute(null, location)
  47368. }
  47369. function redirect (
  47370. record,
  47371. location
  47372. ) {
  47373. var originalRedirect = record.redirect;
  47374. var redirect = typeof originalRedirect === 'function'
  47375. ? originalRedirect(createRoute(record, location, null, router))
  47376. : originalRedirect;
  47377. if (typeof redirect === 'string') {
  47378. redirect = { path: redirect };
  47379. }
  47380. if (!redirect || typeof redirect !== 'object') {
  47381. if (true) {
  47382. warn(
  47383. false, ("invalid redirect option: " + (JSON.stringify(redirect)))
  47384. );
  47385. }
  47386. return _createRoute(null, location)
  47387. }
  47388. var re = redirect;
  47389. var name = re.name;
  47390. var path = re.path;
  47391. var query = location.query;
  47392. var hash = location.hash;
  47393. var params = location.params;
  47394. query = re.hasOwnProperty('query') ? re.query : query;
  47395. hash = re.hasOwnProperty('hash') ? re.hash : hash;
  47396. params = re.hasOwnProperty('params') ? re.params : params;
  47397. if (name) {
  47398. // resolved named direct
  47399. var targetRecord = nameMap[name];
  47400. if (true) {
  47401. assert(targetRecord, ("redirect failed: named route \"" + name + "\" not found."));
  47402. }
  47403. return match({
  47404. _normalized: true,
  47405. name: name,
  47406. query: query,
  47407. hash: hash,
  47408. params: params
  47409. }, undefined, location)
  47410. } else if (path) {
  47411. // 1. resolve relative redirect
  47412. var rawPath = resolveRecordPath(path, record);
  47413. // 2. resolve params
  47414. var resolvedPath = fillParams(rawPath, params, ("redirect route with path \"" + rawPath + "\""));
  47415. // 3. rematch with existing query and hash
  47416. return match({
  47417. _normalized: true,
  47418. path: resolvedPath,
  47419. query: query,
  47420. hash: hash
  47421. }, undefined, location)
  47422. } else {
  47423. if (true) {
  47424. warn(false, ("invalid redirect option: " + (JSON.stringify(redirect))));
  47425. }
  47426. return _createRoute(null, location)
  47427. }
  47428. }
  47429. function alias (
  47430. record,
  47431. location,
  47432. matchAs
  47433. ) {
  47434. var aliasedPath = fillParams(matchAs, location.params, ("aliased route with path \"" + matchAs + "\""));
  47435. var aliasedMatch = match({
  47436. _normalized: true,
  47437. path: aliasedPath
  47438. });
  47439. if (aliasedMatch) {
  47440. var matched = aliasedMatch.matched;
  47441. var aliasedRecord = matched[matched.length - 1];
  47442. location.params = aliasedMatch.params;
  47443. return _createRoute(aliasedRecord, location)
  47444. }
  47445. return _createRoute(null, location)
  47446. }
  47447. function _createRoute (
  47448. record,
  47449. location,
  47450. redirectedFrom
  47451. ) {
  47452. if (record && record.redirect) {
  47453. return redirect(record, redirectedFrom || location)
  47454. }
  47455. if (record && record.matchAs) {
  47456. return alias(record, location, record.matchAs)
  47457. }
  47458. return createRoute(record, location, redirectedFrom, router)
  47459. }
  47460. return {
  47461. match: match,
  47462. addRoutes: addRoutes
  47463. }
  47464. }
  47465. function matchRoute (
  47466. regex,
  47467. path,
  47468. params
  47469. ) {
  47470. var m = path.match(regex);
  47471. if (!m) {
  47472. return false
  47473. } else if (!params) {
  47474. return true
  47475. }
  47476. for (var i = 1, len = m.length; i < len; ++i) {
  47477. var key = regex.keys[i - 1];
  47478. var val = typeof m[i] === 'string' ? decodeURIComponent(m[i]) : m[i];
  47479. if (key) {
  47480. // Fix #1994: using * with props: true generates a param named 0
  47481. params[key.name || 'pathMatch'] = val;
  47482. }
  47483. }
  47484. return true
  47485. }
  47486. function resolveRecordPath (path, record) {
  47487. return resolvePath(path, record.parent ? record.parent.path : '/', true)
  47488. }
  47489. /* */
  47490. // use User Timing api (if present) for more accurate key precision
  47491. var Time =
  47492. inBrowser && window.performance && window.performance.now
  47493. ? window.performance
  47494. : Date;
  47495. function genStateKey () {
  47496. return Time.now().toFixed(3)
  47497. }
  47498. var _key = genStateKey();
  47499. function getStateKey () {
  47500. return _key
  47501. }
  47502. function setStateKey (key) {
  47503. return (_key = key)
  47504. }
  47505. /* */
  47506. var positionStore = Object.create(null);
  47507. function setupScroll () {
  47508. // Fix for #1585 for Firefox
  47509. // Fix for #2195 Add optional third attribute to workaround a bug in safari https://bugs.webkit.org/show_bug.cgi?id=182678
  47510. // Fix for #2774 Support for apps loaded from Windows file shares not mapped to network drives: replaced location.origin with
  47511. // window.location.protocol + '//' + window.location.host
  47512. // location.host contains the port and location.hostname doesn't
  47513. var protocolAndPath = window.location.protocol + '//' + window.location.host;
  47514. var absolutePath = window.location.href.replace(protocolAndPath, '');
  47515. // preserve existing history state as it could be overriden by the user
  47516. var stateCopy = extend({}, window.history.state);
  47517. stateCopy.key = getStateKey();
  47518. window.history.replaceState(stateCopy, '', absolutePath);
  47519. window.addEventListener('popstate', function (e) {
  47520. saveScrollPosition();
  47521. if (e.state && e.state.key) {
  47522. setStateKey(e.state.key);
  47523. }
  47524. });
  47525. }
  47526. function handleScroll (
  47527. router,
  47528. to,
  47529. from,
  47530. isPop
  47531. ) {
  47532. if (!router.app) {
  47533. return
  47534. }
  47535. var behavior = router.options.scrollBehavior;
  47536. if (!behavior) {
  47537. return
  47538. }
  47539. if (true) {
  47540. assert(typeof behavior === 'function', "scrollBehavior must be a function");
  47541. }
  47542. // wait until re-render finishes before scrolling
  47543. router.app.$nextTick(function () {
  47544. var position = getScrollPosition();
  47545. var shouldScroll = behavior.call(
  47546. router,
  47547. to,
  47548. from,
  47549. isPop ? position : null
  47550. );
  47551. if (!shouldScroll) {
  47552. return
  47553. }
  47554. if (typeof shouldScroll.then === 'function') {
  47555. shouldScroll
  47556. .then(function (shouldScroll) {
  47557. scrollToPosition((shouldScroll), position);
  47558. })
  47559. .catch(function (err) {
  47560. if (true) {
  47561. assert(false, err.toString());
  47562. }
  47563. });
  47564. } else {
  47565. scrollToPosition(shouldScroll, position);
  47566. }
  47567. });
  47568. }
  47569. function saveScrollPosition () {
  47570. var key = getStateKey();
  47571. if (key) {
  47572. positionStore[key] = {
  47573. x: window.pageXOffset,
  47574. y: window.pageYOffset
  47575. };
  47576. }
  47577. }
  47578. function getScrollPosition () {
  47579. var key = getStateKey();
  47580. if (key) {
  47581. return positionStore[key]
  47582. }
  47583. }
  47584. function getElementPosition (el, offset) {
  47585. var docEl = document.documentElement;
  47586. var docRect = docEl.getBoundingClientRect();
  47587. var elRect = el.getBoundingClientRect();
  47588. return {
  47589. x: elRect.left - docRect.left - offset.x,
  47590. y: elRect.top - docRect.top - offset.y
  47591. }
  47592. }
  47593. function isValidPosition (obj) {
  47594. return isNumber(obj.x) || isNumber(obj.y)
  47595. }
  47596. function normalizePosition (obj) {
  47597. return {
  47598. x: isNumber(obj.x) ? obj.x : window.pageXOffset,
  47599. y: isNumber(obj.y) ? obj.y : window.pageYOffset
  47600. }
  47601. }
  47602. function normalizeOffset (obj) {
  47603. return {
  47604. x: isNumber(obj.x) ? obj.x : 0,
  47605. y: isNumber(obj.y) ? obj.y : 0
  47606. }
  47607. }
  47608. function isNumber (v) {
  47609. return typeof v === 'number'
  47610. }
  47611. var hashStartsWithNumberRE = /^#\d/;
  47612. function scrollToPosition (shouldScroll, position) {
  47613. var isObject = typeof shouldScroll === 'object';
  47614. if (isObject && typeof shouldScroll.selector === 'string') {
  47615. // getElementById would still fail if the selector contains a more complicated query like #main[data-attr]
  47616. // but at the same time, it doesn't make much sense to select an element with an id and an extra selector
  47617. var el = hashStartsWithNumberRE.test(shouldScroll.selector) // $flow-disable-line
  47618. ? document.getElementById(shouldScroll.selector.slice(1)) // $flow-disable-line
  47619. : document.querySelector(shouldScroll.selector);
  47620. if (el) {
  47621. var offset =
  47622. shouldScroll.offset && typeof shouldScroll.offset === 'object'
  47623. ? shouldScroll.offset
  47624. : {};
  47625. offset = normalizeOffset(offset);
  47626. position = getElementPosition(el, offset);
  47627. } else if (isValidPosition(shouldScroll)) {
  47628. position = normalizePosition(shouldScroll);
  47629. }
  47630. } else if (isObject && isValidPosition(shouldScroll)) {
  47631. position = normalizePosition(shouldScroll);
  47632. }
  47633. if (position) {
  47634. window.scrollTo(position.x, position.y);
  47635. }
  47636. }
  47637. /* */
  47638. var supportsPushState =
  47639. inBrowser &&
  47640. (function () {
  47641. var ua = window.navigator.userAgent;
  47642. if (
  47643. (ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) &&
  47644. ua.indexOf('Mobile Safari') !== -1 &&
  47645. ua.indexOf('Chrome') === -1 &&
  47646. ua.indexOf('Windows Phone') === -1
  47647. ) {
  47648. return false
  47649. }
  47650. return window.history && 'pushState' in window.history
  47651. })();
  47652. function pushState (url, replace) {
  47653. saveScrollPosition();
  47654. // try...catch the pushState call to get around Safari
  47655. // DOM Exception 18 where it limits to 100 pushState calls
  47656. var history = window.history;
  47657. try {
  47658. if (replace) {
  47659. // preserve existing history state as it could be overriden by the user
  47660. var stateCopy = extend({}, history.state);
  47661. stateCopy.key = getStateKey();
  47662. history.replaceState(stateCopy, '', url);
  47663. } else {
  47664. history.pushState({ key: setStateKey(genStateKey()) }, '', url);
  47665. }
  47666. } catch (e) {
  47667. window.location[replace ? 'replace' : 'assign'](url);
  47668. }
  47669. }
  47670. function replaceState (url) {
  47671. pushState(url, true);
  47672. }
  47673. /* */
  47674. function runQueue (queue, fn, cb) {
  47675. var step = function (index) {
  47676. if (index >= queue.length) {
  47677. cb();
  47678. } else {
  47679. if (queue[index]) {
  47680. fn(queue[index], function () {
  47681. step(index + 1);
  47682. });
  47683. } else {
  47684. step(index + 1);
  47685. }
  47686. }
  47687. };
  47688. step(0);
  47689. }
  47690. /* */
  47691. function resolveAsyncComponents (matched) {
  47692. return function (to, from, next) {
  47693. var hasAsync = false;
  47694. var pending = 0;
  47695. var error = null;
  47696. flatMapComponents(matched, function (def, _, match, key) {
  47697. // if it's a function and doesn't have cid attached,
  47698. // assume it's an async component resolve function.
  47699. // we are not using Vue's default async resolving mechanism because
  47700. // we want to halt the navigation until the incoming component has been
  47701. // resolved.
  47702. if (typeof def === 'function' && def.cid === undefined) {
  47703. hasAsync = true;
  47704. pending++;
  47705. var resolve = once(function (resolvedDef) {
  47706. if (isESModule(resolvedDef)) {
  47707. resolvedDef = resolvedDef.default;
  47708. }
  47709. // save resolved on async factory in case it's used elsewhere
  47710. def.resolved = typeof resolvedDef === 'function'
  47711. ? resolvedDef
  47712. : _Vue.extend(resolvedDef);
  47713. match.components[key] = resolvedDef;
  47714. pending--;
  47715. if (pending <= 0) {
  47716. next();
  47717. }
  47718. });
  47719. var reject = once(function (reason) {
  47720. var msg = "Failed to resolve async component " + key + ": " + reason;
  47721. true && warn(false, msg);
  47722. if (!error) {
  47723. error = isError(reason)
  47724. ? reason
  47725. : new Error(msg);
  47726. next(error);
  47727. }
  47728. });
  47729. var res;
  47730. try {
  47731. res = def(resolve, reject);
  47732. } catch (e) {
  47733. reject(e);
  47734. }
  47735. if (res) {
  47736. if (typeof res.then === 'function') {
  47737. res.then(resolve, reject);
  47738. } else {
  47739. // new syntax in Vue 2.3
  47740. var comp = res.component;
  47741. if (comp && typeof comp.then === 'function') {
  47742. comp.then(resolve, reject);
  47743. }
  47744. }
  47745. }
  47746. }
  47747. });
  47748. if (!hasAsync) { next(); }
  47749. }
  47750. }
  47751. function flatMapComponents (
  47752. matched,
  47753. fn
  47754. ) {
  47755. return flatten(matched.map(function (m) {
  47756. return Object.keys(m.components).map(function (key) { return fn(
  47757. m.components[key],
  47758. m.instances[key],
  47759. m, key
  47760. ); })
  47761. }))
  47762. }
  47763. function flatten (arr) {
  47764. return Array.prototype.concat.apply([], arr)
  47765. }
  47766. var hasSymbol =
  47767. typeof Symbol === 'function' &&
  47768. typeof Symbol.toStringTag === 'symbol';
  47769. function isESModule (obj) {
  47770. return obj.__esModule || (hasSymbol && obj[Symbol.toStringTag] === 'Module')
  47771. }
  47772. // in Webpack 2, require.ensure now also returns a Promise
  47773. // so the resolve/reject functions may get called an extra time
  47774. // if the user uses an arrow function shorthand that happens to
  47775. // return that Promise.
  47776. function once (fn) {
  47777. var called = false;
  47778. return function () {
  47779. var args = [], len = arguments.length;
  47780. while ( len-- ) args[ len ] = arguments[ len ];
  47781. if (called) { return }
  47782. called = true;
  47783. return fn.apply(this, args)
  47784. }
  47785. }
  47786. var NavigationDuplicated = /*@__PURE__*/(function (Error) {
  47787. function NavigationDuplicated (normalizedLocation) {
  47788. Error.call(this);
  47789. this.name = this._name = 'NavigationDuplicated';
  47790. // passing the message to super() doesn't seem to work in the transpiled version
  47791. this.message = "Navigating to current location (\"" + (normalizedLocation.fullPath) + "\") is not allowed";
  47792. // add a stack property so services like Sentry can correctly display it
  47793. Object.defineProperty(this, 'stack', {
  47794. value: new Error().stack,
  47795. writable: true,
  47796. configurable: true
  47797. });
  47798. // we could also have used
  47799. // Error.captureStackTrace(this, this.constructor)
  47800. // but it only exists on node and chrome
  47801. }
  47802. if ( Error ) NavigationDuplicated.__proto__ = Error;
  47803. NavigationDuplicated.prototype = Object.create( Error && Error.prototype );
  47804. NavigationDuplicated.prototype.constructor = NavigationDuplicated;
  47805. return NavigationDuplicated;
  47806. }(Error));
  47807. // support IE9
  47808. NavigationDuplicated._name = 'NavigationDuplicated';
  47809. /* */
  47810. var History = function History (router, base) {
  47811. this.router = router;
  47812. this.base = normalizeBase(base);
  47813. // start with a route object that stands for "nowhere"
  47814. this.current = START;
  47815. this.pending = null;
  47816. this.ready = false;
  47817. this.readyCbs = [];
  47818. this.readyErrorCbs = [];
  47819. this.errorCbs = [];
  47820. };
  47821. History.prototype.listen = function listen (cb) {
  47822. this.cb = cb;
  47823. };
  47824. History.prototype.onReady = function onReady (cb, errorCb) {
  47825. if (this.ready) {
  47826. cb();
  47827. } else {
  47828. this.readyCbs.push(cb);
  47829. if (errorCb) {
  47830. this.readyErrorCbs.push(errorCb);
  47831. }
  47832. }
  47833. };
  47834. History.prototype.onError = function onError (errorCb) {
  47835. this.errorCbs.push(errorCb);
  47836. };
  47837. History.prototype.transitionTo = function transitionTo (
  47838. location,
  47839. onComplete,
  47840. onAbort
  47841. ) {
  47842. var this$1 = this;
  47843. var route = this.router.match(location, this.current);
  47844. this.confirmTransition(
  47845. route,
  47846. function () {
  47847. this$1.updateRoute(route);
  47848. onComplete && onComplete(route);
  47849. this$1.ensureURL();
  47850. // fire ready cbs once
  47851. if (!this$1.ready) {
  47852. this$1.ready = true;
  47853. this$1.readyCbs.forEach(function (cb) {
  47854. cb(route);
  47855. });
  47856. }
  47857. },
  47858. function (err) {
  47859. if (onAbort) {
  47860. onAbort(err);
  47861. }
  47862. if (err && !this$1.ready) {
  47863. this$1.ready = true;
  47864. this$1.readyErrorCbs.forEach(function (cb) {
  47865. cb(err);
  47866. });
  47867. }
  47868. }
  47869. );
  47870. };
  47871. History.prototype.confirmTransition = function confirmTransition (route, onComplete, onAbort) {
  47872. var this$1 = this;
  47873. var current = this.current;
  47874. var abort = function (err) {
  47875. // after merging https://github.com/vuejs/vue-router/pull/2771 we
  47876. // When the user navigates through history through back/forward buttons
  47877. // we do not want to throw the error. We only throw it if directly calling
  47878. // push/replace. That's why it's not included in isError
  47879. if (!isExtendedError(NavigationDuplicated, err) && isError(err)) {
  47880. if (this$1.errorCbs.length) {
  47881. this$1.errorCbs.forEach(function (cb) {
  47882. cb(err);
  47883. });
  47884. } else {
  47885. warn(false, 'uncaught error during route navigation:');
  47886. console.error(err);
  47887. }
  47888. }
  47889. onAbort && onAbort(err);
  47890. };
  47891. if (
  47892. isSameRoute(route, current) &&
  47893. // in the case the route map has been dynamically appended to
  47894. route.matched.length === current.matched.length
  47895. ) {
  47896. this.ensureURL();
  47897. return abort(new NavigationDuplicated(route))
  47898. }
  47899. var ref = resolveQueue(
  47900. this.current.matched,
  47901. route.matched
  47902. );
  47903. var updated = ref.updated;
  47904. var deactivated = ref.deactivated;
  47905. var activated = ref.activated;
  47906. var queue = [].concat(
  47907. // in-component leave guards
  47908. extractLeaveGuards(deactivated),
  47909. // global before hooks
  47910. this.router.beforeHooks,
  47911. // in-component update hooks
  47912. extractUpdateHooks(updated),
  47913. // in-config enter guards
  47914. activated.map(function (m) { return m.beforeEnter; }),
  47915. // async components
  47916. resolveAsyncComponents(activated)
  47917. );
  47918. this.pending = route;
  47919. var iterator = function (hook, next) {
  47920. if (this$1.pending !== route) {
  47921. return abort()
  47922. }
  47923. try {
  47924. hook(route, current, function (to) {
  47925. if (to === false || isError(to)) {
  47926. // next(false) -> abort navigation, ensure current URL
  47927. this$1.ensureURL(true);
  47928. abort(to);
  47929. } else if (
  47930. typeof to === 'string' ||
  47931. (typeof to === 'object' &&
  47932. (typeof to.path === 'string' || typeof to.name === 'string'))
  47933. ) {
  47934. // next('/') or next({ path: '/' }) -> redirect
  47935. abort();
  47936. if (typeof to === 'object' && to.replace) {
  47937. this$1.replace(to);
  47938. } else {
  47939. this$1.push(to);
  47940. }
  47941. } else {
  47942. // confirm transition and pass on the value
  47943. next(to);
  47944. }
  47945. });
  47946. } catch (e) {
  47947. abort(e);
  47948. }
  47949. };
  47950. runQueue(queue, iterator, function () {
  47951. var postEnterCbs = [];
  47952. var isValid = function () { return this$1.current === route; };
  47953. // wait until async components are resolved before
  47954. // extracting in-component enter guards
  47955. var enterGuards = extractEnterGuards(activated, postEnterCbs, isValid);
  47956. var queue = enterGuards.concat(this$1.router.resolveHooks);
  47957. runQueue(queue, iterator, function () {
  47958. if (this$1.pending !== route) {
  47959. return abort()
  47960. }
  47961. this$1.pending = null;
  47962. onComplete(route);
  47963. if (this$1.router.app) {
  47964. this$1.router.app.$nextTick(function () {
  47965. postEnterCbs.forEach(function (cb) {
  47966. cb();
  47967. });
  47968. });
  47969. }
  47970. });
  47971. });
  47972. };
  47973. History.prototype.updateRoute = function updateRoute (route) {
  47974. var prev = this.current;
  47975. this.current = route;
  47976. this.cb && this.cb(route);
  47977. this.router.afterHooks.forEach(function (hook) {
  47978. hook && hook(route, prev);
  47979. });
  47980. };
  47981. function normalizeBase (base) {
  47982. if (!base) {
  47983. if (inBrowser) {
  47984. // respect <base> tag
  47985. var baseEl = document.querySelector('base');
  47986. base = (baseEl && baseEl.getAttribute('href')) || '/';
  47987. // strip full URL origin
  47988. base = base.replace(/^https?:\/\/[^\/]+/, '');
  47989. } else {
  47990. base = '/';
  47991. }
  47992. }
  47993. // make sure there's the starting slash
  47994. if (base.charAt(0) !== '/') {
  47995. base = '/' + base;
  47996. }
  47997. // remove trailing slash
  47998. return base.replace(/\/$/, '')
  47999. }
  48000. function resolveQueue (
  48001. current,
  48002. next
  48003. ) {
  48004. var i;
  48005. var max = Math.max(current.length, next.length);
  48006. for (i = 0; i < max; i++) {
  48007. if (current[i] !== next[i]) {
  48008. break
  48009. }
  48010. }
  48011. return {
  48012. updated: next.slice(0, i),
  48013. activated: next.slice(i),
  48014. deactivated: current.slice(i)
  48015. }
  48016. }
  48017. function extractGuards (
  48018. records,
  48019. name,
  48020. bind,
  48021. reverse
  48022. ) {
  48023. var guards = flatMapComponents(records, function (def, instance, match, key) {
  48024. var guard = extractGuard(def, name);
  48025. if (guard) {
  48026. return Array.isArray(guard)
  48027. ? guard.map(function (guard) { return bind(guard, instance, match, key); })
  48028. : bind(guard, instance, match, key)
  48029. }
  48030. });
  48031. return flatten(reverse ? guards.reverse() : guards)
  48032. }
  48033. function extractGuard (
  48034. def,
  48035. key
  48036. ) {
  48037. if (typeof def !== 'function') {
  48038. // extend now so that global mixins are applied.
  48039. def = _Vue.extend(def);
  48040. }
  48041. return def.options[key]
  48042. }
  48043. function extractLeaveGuards (deactivated) {
  48044. return extractGuards(deactivated, 'beforeRouteLeave', bindGuard, true)
  48045. }
  48046. function extractUpdateHooks (updated) {
  48047. return extractGuards(updated, 'beforeRouteUpdate', bindGuard)
  48048. }
  48049. function bindGuard (guard, instance) {
  48050. if (instance) {
  48051. return function boundRouteGuard () {
  48052. return guard.apply(instance, arguments)
  48053. }
  48054. }
  48055. }
  48056. function extractEnterGuards (
  48057. activated,
  48058. cbs,
  48059. isValid
  48060. ) {
  48061. return extractGuards(
  48062. activated,
  48063. 'beforeRouteEnter',
  48064. function (guard, _, match, key) {
  48065. return bindEnterGuard(guard, match, key, cbs, isValid)
  48066. }
  48067. )
  48068. }
  48069. function bindEnterGuard (
  48070. guard,
  48071. match,
  48072. key,
  48073. cbs,
  48074. isValid
  48075. ) {
  48076. return function routeEnterGuard (to, from, next) {
  48077. return guard(to, from, function (cb) {
  48078. if (typeof cb === 'function') {
  48079. cbs.push(function () {
  48080. // #750
  48081. // if a router-view is wrapped with an out-in transition,
  48082. // the instance may not have been registered at this time.
  48083. // we will need to poll for registration until current route
  48084. // is no longer valid.
  48085. poll(cb, match.instances, key, isValid);
  48086. });
  48087. }
  48088. next(cb);
  48089. })
  48090. }
  48091. }
  48092. function poll (
  48093. cb, // somehow flow cannot infer this is a function
  48094. instances,
  48095. key,
  48096. isValid
  48097. ) {
  48098. if (
  48099. instances[key] &&
  48100. !instances[key]._isBeingDestroyed // do not reuse being destroyed instance
  48101. ) {
  48102. cb(instances[key]);
  48103. } else if (isValid()) {
  48104. setTimeout(function () {
  48105. poll(cb, instances, key, isValid);
  48106. }, 16);
  48107. }
  48108. }
  48109. /* */
  48110. var HTML5History = /*@__PURE__*/(function (History) {
  48111. function HTML5History (router, base) {
  48112. var this$1 = this;
  48113. History.call(this, router, base);
  48114. var expectScroll = router.options.scrollBehavior;
  48115. var supportsScroll = supportsPushState && expectScroll;
  48116. if (supportsScroll) {
  48117. setupScroll();
  48118. }
  48119. var initLocation = getLocation(this.base);
  48120. window.addEventListener('popstate', function (e) {
  48121. var current = this$1.current;
  48122. // Avoiding first `popstate` event dispatched in some browsers but first
  48123. // history route not updated since async guard at the same time.
  48124. var location = getLocation(this$1.base);
  48125. if (this$1.current === START && location === initLocation) {
  48126. return
  48127. }
  48128. this$1.transitionTo(location, function (route) {
  48129. if (supportsScroll) {
  48130. handleScroll(router, route, current, true);
  48131. }
  48132. });
  48133. });
  48134. }
  48135. if ( History ) HTML5History.__proto__ = History;
  48136. HTML5History.prototype = Object.create( History && History.prototype );
  48137. HTML5History.prototype.constructor = HTML5History;
  48138. HTML5History.prototype.go = function go (n) {
  48139. window.history.go(n);
  48140. };
  48141. HTML5History.prototype.push = function push (location, onComplete, onAbort) {
  48142. var this$1 = this;
  48143. var ref = this;
  48144. var fromRoute = ref.current;
  48145. this.transitionTo(location, function (route) {
  48146. pushState(cleanPath(this$1.base + route.fullPath));
  48147. handleScroll(this$1.router, route, fromRoute, false);
  48148. onComplete && onComplete(route);
  48149. }, onAbort);
  48150. };
  48151. HTML5History.prototype.replace = function replace (location, onComplete, onAbort) {
  48152. var this$1 = this;
  48153. var ref = this;
  48154. var fromRoute = ref.current;
  48155. this.transitionTo(location, function (route) {
  48156. replaceState(cleanPath(this$1.base + route.fullPath));
  48157. handleScroll(this$1.router, route, fromRoute, false);
  48158. onComplete && onComplete(route);
  48159. }, onAbort);
  48160. };
  48161. HTML5History.prototype.ensureURL = function ensureURL (push) {
  48162. if (getLocation(this.base) !== this.current.fullPath) {
  48163. var current = cleanPath(this.base + this.current.fullPath);
  48164. push ? pushState(current) : replaceState(current);
  48165. }
  48166. };
  48167. HTML5History.prototype.getCurrentLocation = function getCurrentLocation () {
  48168. return getLocation(this.base)
  48169. };
  48170. return HTML5History;
  48171. }(History));
  48172. function getLocation (base) {
  48173. var path = decodeURI(window.location.pathname);
  48174. if (base && path.indexOf(base) === 0) {
  48175. path = path.slice(base.length);
  48176. }
  48177. return (path || '/') + window.location.search + window.location.hash
  48178. }
  48179. /* */
  48180. var HashHistory = /*@__PURE__*/(function (History) {
  48181. function HashHistory (router, base, fallback) {
  48182. History.call(this, router, base);
  48183. // check history fallback deeplinking
  48184. if (fallback && checkFallback(this.base)) {
  48185. return
  48186. }
  48187. ensureSlash();
  48188. }
  48189. if ( History ) HashHistory.__proto__ = History;
  48190. HashHistory.prototype = Object.create( History && History.prototype );
  48191. HashHistory.prototype.constructor = HashHistory;
  48192. // this is delayed until the app mounts
  48193. // to avoid the hashchange listener being fired too early
  48194. HashHistory.prototype.setupListeners = function setupListeners () {
  48195. var this$1 = this;
  48196. var router = this.router;
  48197. var expectScroll = router.options.scrollBehavior;
  48198. var supportsScroll = supportsPushState && expectScroll;
  48199. if (supportsScroll) {
  48200. setupScroll();
  48201. }
  48202. window.addEventListener(
  48203. supportsPushState ? 'popstate' : 'hashchange',
  48204. function () {
  48205. var current = this$1.current;
  48206. if (!ensureSlash()) {
  48207. return
  48208. }
  48209. this$1.transitionTo(getHash(), function (route) {
  48210. if (supportsScroll) {
  48211. handleScroll(this$1.router, route, current, true);
  48212. }
  48213. if (!supportsPushState) {
  48214. replaceHash(route.fullPath);
  48215. }
  48216. });
  48217. }
  48218. );
  48219. };
  48220. HashHistory.prototype.push = function push (location, onComplete, onAbort) {
  48221. var this$1 = this;
  48222. var ref = this;
  48223. var fromRoute = ref.current;
  48224. this.transitionTo(
  48225. location,
  48226. function (route) {
  48227. pushHash(route.fullPath);
  48228. handleScroll(this$1.router, route, fromRoute, false);
  48229. onComplete && onComplete(route);
  48230. },
  48231. onAbort
  48232. );
  48233. };
  48234. HashHistory.prototype.replace = function replace (location, onComplete, onAbort) {
  48235. var this$1 = this;
  48236. var ref = this;
  48237. var fromRoute = ref.current;
  48238. this.transitionTo(
  48239. location,
  48240. function (route) {
  48241. replaceHash(route.fullPath);
  48242. handleScroll(this$1.router, route, fromRoute, false);
  48243. onComplete && onComplete(route);
  48244. },
  48245. onAbort
  48246. );
  48247. };
  48248. HashHistory.prototype.go = function go (n) {
  48249. window.history.go(n);
  48250. };
  48251. HashHistory.prototype.ensureURL = function ensureURL (push) {
  48252. var current = this.current.fullPath;
  48253. if (getHash() !== current) {
  48254. push ? pushHash(current) : replaceHash(current);
  48255. }
  48256. };
  48257. HashHistory.prototype.getCurrentLocation = function getCurrentLocation () {
  48258. return getHash()
  48259. };
  48260. return HashHistory;
  48261. }(History));
  48262. function checkFallback (base) {
  48263. var location = getLocation(base);
  48264. if (!/^\/#/.test(location)) {
  48265. window.location.replace(cleanPath(base + '/#' + location));
  48266. return true
  48267. }
  48268. }
  48269. function ensureSlash () {
  48270. var path = getHash();
  48271. if (path.charAt(0) === '/') {
  48272. return true
  48273. }
  48274. replaceHash('/' + path);
  48275. return false
  48276. }
  48277. function getHash () {
  48278. // We can't use window.location.hash here because it's not
  48279. // consistent across browsers - Firefox will pre-decode it!
  48280. var href = window.location.href;
  48281. var index = href.indexOf('#');
  48282. // empty path
  48283. if (index < 0) { return '' }
  48284. href = href.slice(index + 1);
  48285. // decode the hash but not the search or hash
  48286. // as search(query) is already decoded
  48287. // https://github.com/vuejs/vue-router/issues/2708
  48288. var searchIndex = href.indexOf('?');
  48289. if (searchIndex < 0) {
  48290. var hashIndex = href.indexOf('#');
  48291. if (hashIndex > -1) {
  48292. href = decodeURI(href.slice(0, hashIndex)) + href.slice(hashIndex);
  48293. } else { href = decodeURI(href); }
  48294. } else {
  48295. href = decodeURI(href.slice(0, searchIndex)) + href.slice(searchIndex);
  48296. }
  48297. return href
  48298. }
  48299. function getUrl (path) {
  48300. var href = window.location.href;
  48301. var i = href.indexOf('#');
  48302. var base = i >= 0 ? href.slice(0, i) : href;
  48303. return (base + "#" + path)
  48304. }
  48305. function pushHash (path) {
  48306. if (supportsPushState) {
  48307. pushState(getUrl(path));
  48308. } else {
  48309. window.location.hash = path;
  48310. }
  48311. }
  48312. function replaceHash (path) {
  48313. if (supportsPushState) {
  48314. replaceState(getUrl(path));
  48315. } else {
  48316. window.location.replace(getUrl(path));
  48317. }
  48318. }
  48319. /* */
  48320. var AbstractHistory = /*@__PURE__*/(function (History) {
  48321. function AbstractHistory (router, base) {
  48322. History.call(this, router, base);
  48323. this.stack = [];
  48324. this.index = -1;
  48325. }
  48326. if ( History ) AbstractHistory.__proto__ = History;
  48327. AbstractHistory.prototype = Object.create( History && History.prototype );
  48328. AbstractHistory.prototype.constructor = AbstractHistory;
  48329. AbstractHistory.prototype.push = function push (location, onComplete, onAbort) {
  48330. var this$1 = this;
  48331. this.transitionTo(
  48332. location,
  48333. function (route) {
  48334. this$1.stack = this$1.stack.slice(0, this$1.index + 1).concat(route);
  48335. this$1.index++;
  48336. onComplete && onComplete(route);
  48337. },
  48338. onAbort
  48339. );
  48340. };
  48341. AbstractHistory.prototype.replace = function replace (location, onComplete, onAbort) {
  48342. var this$1 = this;
  48343. this.transitionTo(
  48344. location,
  48345. function (route) {
  48346. this$1.stack = this$1.stack.slice(0, this$1.index).concat(route);
  48347. onComplete && onComplete(route);
  48348. },
  48349. onAbort
  48350. );
  48351. };
  48352. AbstractHistory.prototype.go = function go (n) {
  48353. var this$1 = this;
  48354. var targetIndex = this.index + n;
  48355. if (targetIndex < 0 || targetIndex >= this.stack.length) {
  48356. return
  48357. }
  48358. var route = this.stack[targetIndex];
  48359. this.confirmTransition(
  48360. route,
  48361. function () {
  48362. this$1.index = targetIndex;
  48363. this$1.updateRoute(route);
  48364. },
  48365. function (err) {
  48366. if (isExtendedError(NavigationDuplicated, err)) {
  48367. this$1.index = targetIndex;
  48368. }
  48369. }
  48370. );
  48371. };
  48372. AbstractHistory.prototype.getCurrentLocation = function getCurrentLocation () {
  48373. var current = this.stack[this.stack.length - 1];
  48374. return current ? current.fullPath : '/'
  48375. };
  48376. AbstractHistory.prototype.ensureURL = function ensureURL () {
  48377. // noop
  48378. };
  48379. return AbstractHistory;
  48380. }(History));
  48381. /* */
  48382. var VueRouter = function VueRouter (options) {
  48383. if ( options === void 0 ) options = {};
  48384. this.app = null;
  48385. this.apps = [];
  48386. this.options = options;
  48387. this.beforeHooks = [];
  48388. this.resolveHooks = [];
  48389. this.afterHooks = [];
  48390. this.matcher = createMatcher(options.routes || [], this);
  48391. var mode = options.mode || 'hash';
  48392. this.fallback = mode === 'history' && !supportsPushState && options.fallback !== false;
  48393. if (this.fallback) {
  48394. mode = 'hash';
  48395. }
  48396. if (!inBrowser) {
  48397. mode = 'abstract';
  48398. }
  48399. this.mode = mode;
  48400. switch (mode) {
  48401. case 'history':
  48402. this.history = new HTML5History(this, options.base);
  48403. break
  48404. case 'hash':
  48405. this.history = new HashHistory(this, options.base, this.fallback);
  48406. break
  48407. case 'abstract':
  48408. this.history = new AbstractHistory(this, options.base);
  48409. break
  48410. default:
  48411. if (true) {
  48412. assert(false, ("invalid mode: " + mode));
  48413. }
  48414. }
  48415. };
  48416. var prototypeAccessors = { currentRoute: { configurable: true } };
  48417. VueRouter.prototype.match = function match (
  48418. raw,
  48419. current,
  48420. redirectedFrom
  48421. ) {
  48422. return this.matcher.match(raw, current, redirectedFrom)
  48423. };
  48424. prototypeAccessors.currentRoute.get = function () {
  48425. return this.history && this.history.current
  48426. };
  48427. VueRouter.prototype.init = function init (app /* Vue component instance */) {
  48428. var this$1 = this;
  48429. true && assert(
  48430. install.installed,
  48431. "not installed. Make sure to call `Vue.use(VueRouter)` " +
  48432. "before creating root instance."
  48433. );
  48434. this.apps.push(app);
  48435. // set up app destroyed handler
  48436. // https://github.com/vuejs/vue-router/issues/2639
  48437. app.$once('hook:destroyed', function () {
  48438. // clean out app from this.apps array once destroyed
  48439. var index = this$1.apps.indexOf(app);
  48440. if (index > -1) { this$1.apps.splice(index, 1); }
  48441. // ensure we still have a main app or null if no apps
  48442. // we do not release the router so it can be reused
  48443. if (this$1.app === app) { this$1.app = this$1.apps[0] || null; }
  48444. });
  48445. // main app previously initialized
  48446. // return as we don't need to set up new history listener
  48447. if (this.app) {
  48448. return
  48449. }
  48450. this.app = app;
  48451. var history = this.history;
  48452. if (history instanceof HTML5History) {
  48453. history.transitionTo(history.getCurrentLocation());
  48454. } else if (history instanceof HashHistory) {
  48455. var setupHashListener = function () {
  48456. history.setupListeners();
  48457. };
  48458. history.transitionTo(
  48459. history.getCurrentLocation(),
  48460. setupHashListener,
  48461. setupHashListener
  48462. );
  48463. }
  48464. history.listen(function (route) {
  48465. this$1.apps.forEach(function (app) {
  48466. app._route = route;
  48467. });
  48468. });
  48469. };
  48470. VueRouter.prototype.beforeEach = function beforeEach (fn) {
  48471. return registerHook(this.beforeHooks, fn)
  48472. };
  48473. VueRouter.prototype.beforeResolve = function beforeResolve (fn) {
  48474. return registerHook(this.resolveHooks, fn)
  48475. };
  48476. VueRouter.prototype.afterEach = function afterEach (fn) {
  48477. return registerHook(this.afterHooks, fn)
  48478. };
  48479. VueRouter.prototype.onReady = function onReady (cb, errorCb) {
  48480. this.history.onReady(cb, errorCb);
  48481. };
  48482. VueRouter.prototype.onError = function onError (errorCb) {
  48483. this.history.onError(errorCb);
  48484. };
  48485. VueRouter.prototype.push = function push (location, onComplete, onAbort) {
  48486. var this$1 = this;
  48487. // $flow-disable-line
  48488. if (!onComplete && !onAbort && typeof Promise !== 'undefined') {
  48489. return new Promise(function (resolve, reject) {
  48490. this$1.history.push(location, resolve, reject);
  48491. })
  48492. } else {
  48493. this.history.push(location, onComplete, onAbort);
  48494. }
  48495. };
  48496. VueRouter.prototype.replace = function replace (location, onComplete, onAbort) {
  48497. var this$1 = this;
  48498. // $flow-disable-line
  48499. if (!onComplete && !onAbort && typeof Promise !== 'undefined') {
  48500. return new Promise(function (resolve, reject) {
  48501. this$1.history.replace(location, resolve, reject);
  48502. })
  48503. } else {
  48504. this.history.replace(location, onComplete, onAbort);
  48505. }
  48506. };
  48507. VueRouter.prototype.go = function go (n) {
  48508. this.history.go(n);
  48509. };
  48510. VueRouter.prototype.back = function back () {
  48511. this.go(-1);
  48512. };
  48513. VueRouter.prototype.forward = function forward () {
  48514. this.go(1);
  48515. };
  48516. VueRouter.prototype.getMatchedComponents = function getMatchedComponents (to) {
  48517. var route = to
  48518. ? to.matched
  48519. ? to
  48520. : this.resolve(to).route
  48521. : this.currentRoute;
  48522. if (!route) {
  48523. return []
  48524. }
  48525. return [].concat.apply([], route.matched.map(function (m) {
  48526. return Object.keys(m.components).map(function (key) {
  48527. return m.components[key]
  48528. })
  48529. }))
  48530. };
  48531. VueRouter.prototype.resolve = function resolve (
  48532. to,
  48533. current,
  48534. append
  48535. ) {
  48536. current = current || this.history.current;
  48537. var location = normalizeLocation(
  48538. to,
  48539. current,
  48540. append,
  48541. this
  48542. );
  48543. var route = this.match(location, current);
  48544. var fullPath = route.redirectedFrom || route.fullPath;
  48545. var base = this.history.base;
  48546. var href = createHref(base, fullPath, this.mode);
  48547. return {
  48548. location: location,
  48549. route: route,
  48550. href: href,
  48551. // for backwards compat
  48552. normalizedTo: location,
  48553. resolved: route
  48554. }
  48555. };
  48556. VueRouter.prototype.addRoutes = function addRoutes (routes) {
  48557. this.matcher.addRoutes(routes);
  48558. if (this.history.current !== START) {
  48559. this.history.transitionTo(this.history.getCurrentLocation());
  48560. }
  48561. };
  48562. Object.defineProperties( VueRouter.prototype, prototypeAccessors );
  48563. function registerHook (list, fn) {
  48564. list.push(fn);
  48565. return function () {
  48566. var i = list.indexOf(fn);
  48567. if (i > -1) { list.splice(i, 1); }
  48568. }
  48569. }
  48570. function createHref (base, fullPath, mode) {
  48571. var path = mode === 'hash' ? '#' + fullPath : fullPath;
  48572. return base ? cleanPath(base + '/' + path) : path
  48573. }
  48574. VueRouter.install = install;
  48575. VueRouter.version = '3.1.6';
  48576. if (inBrowser && window.Vue) {
  48577. window.Vue.use(VueRouter);
  48578. }
  48579. /* harmony default export */ __webpack_exports__["default"] = (VueRouter);
  48580. /***/ }),
  48581. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  48582. /*!*************************************************!*\
  48583. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  48584. \*************************************************/
  48585. /*! no static exports found */
  48586. /***/ (function(module, exports, __webpack_require__) {
  48587. "use strict";
  48588. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  48589. * Vue.js v2.6.11
  48590. * (c) 2014-2019 Evan You
  48591. * Released under the MIT License.
  48592. */
  48593. /* */
  48594. var emptyObject = Object.freeze({});
  48595. // These helpers produce better VM code in JS engines due to their
  48596. // explicitness and function inlining.
  48597. function isUndef (v) {
  48598. return v === undefined || v === null
  48599. }
  48600. function isDef (v) {
  48601. return v !== undefined && v !== null
  48602. }
  48603. function isTrue (v) {
  48604. return v === true
  48605. }
  48606. function isFalse (v) {
  48607. return v === false
  48608. }
  48609. /**
  48610. * Check if value is primitive.
  48611. */
  48612. function isPrimitive (value) {
  48613. return (
  48614. typeof value === 'string' ||
  48615. typeof value === 'number' ||
  48616. // $flow-disable-line
  48617. typeof value === 'symbol' ||
  48618. typeof value === 'boolean'
  48619. )
  48620. }
  48621. /**
  48622. * Quick object check - this is primarily used to tell
  48623. * Objects from primitive values when we know the value
  48624. * is a JSON-compliant type.
  48625. */
  48626. function isObject (obj) {
  48627. return obj !== null && typeof obj === 'object'
  48628. }
  48629. /**
  48630. * Get the raw type string of a value, e.g., [object Object].
  48631. */
  48632. var _toString = Object.prototype.toString;
  48633. function toRawType (value) {
  48634. return _toString.call(value).slice(8, -1)
  48635. }
  48636. /**
  48637. * Strict object type check. Only returns true
  48638. * for plain JavaScript objects.
  48639. */
  48640. function isPlainObject (obj) {
  48641. return _toString.call(obj) === '[object Object]'
  48642. }
  48643. function isRegExp (v) {
  48644. return _toString.call(v) === '[object RegExp]'
  48645. }
  48646. /**
  48647. * Check if val is a valid array index.
  48648. */
  48649. function isValidArrayIndex (val) {
  48650. var n = parseFloat(String(val));
  48651. return n >= 0 && Math.floor(n) === n && isFinite(val)
  48652. }
  48653. function isPromise (val) {
  48654. return (
  48655. isDef(val) &&
  48656. typeof val.then === 'function' &&
  48657. typeof val.catch === 'function'
  48658. )
  48659. }
  48660. /**
  48661. * Convert a value to a string that is actually rendered.
  48662. */
  48663. function toString (val) {
  48664. return val == null
  48665. ? ''
  48666. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  48667. ? JSON.stringify(val, null, 2)
  48668. : String(val)
  48669. }
  48670. /**
  48671. * Convert an input value to a number for persistence.
  48672. * If the conversion fails, return original string.
  48673. */
  48674. function toNumber (val) {
  48675. var n = parseFloat(val);
  48676. return isNaN(n) ? val : n
  48677. }
  48678. /**
  48679. * Make a map and return a function for checking if a key
  48680. * is in that map.
  48681. */
  48682. function makeMap (
  48683. str,
  48684. expectsLowerCase
  48685. ) {
  48686. var map = Object.create(null);
  48687. var list = str.split(',');
  48688. for (var i = 0; i < list.length; i++) {
  48689. map[list[i]] = true;
  48690. }
  48691. return expectsLowerCase
  48692. ? function (val) { return map[val.toLowerCase()]; }
  48693. : function (val) { return map[val]; }
  48694. }
  48695. /**
  48696. * Check if a tag is a built-in tag.
  48697. */
  48698. var isBuiltInTag = makeMap('slot,component', true);
  48699. /**
  48700. * Check if an attribute is a reserved attribute.
  48701. */
  48702. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  48703. /**
  48704. * Remove an item from an array.
  48705. */
  48706. function remove (arr, item) {
  48707. if (arr.length) {
  48708. var index = arr.indexOf(item);
  48709. if (index > -1) {
  48710. return arr.splice(index, 1)
  48711. }
  48712. }
  48713. }
  48714. /**
  48715. * Check whether an object has the property.
  48716. */
  48717. var hasOwnProperty = Object.prototype.hasOwnProperty;
  48718. function hasOwn (obj, key) {
  48719. return hasOwnProperty.call(obj, key)
  48720. }
  48721. /**
  48722. * Create a cached version of a pure function.
  48723. */
  48724. function cached (fn) {
  48725. var cache = Object.create(null);
  48726. return (function cachedFn (str) {
  48727. var hit = cache[str];
  48728. return hit || (cache[str] = fn(str))
  48729. })
  48730. }
  48731. /**
  48732. * Camelize a hyphen-delimited string.
  48733. */
  48734. var camelizeRE = /-(\w)/g;
  48735. var camelize = cached(function (str) {
  48736. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  48737. });
  48738. /**
  48739. * Capitalize a string.
  48740. */
  48741. var capitalize = cached(function (str) {
  48742. return str.charAt(0).toUpperCase() + str.slice(1)
  48743. });
  48744. /**
  48745. * Hyphenate a camelCase string.
  48746. */
  48747. var hyphenateRE = /\B([A-Z])/g;
  48748. var hyphenate = cached(function (str) {
  48749. return str.replace(hyphenateRE, '-$1').toLowerCase()
  48750. });
  48751. /**
  48752. * Simple bind polyfill for environments that do not support it,
  48753. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  48754. * since native bind is now performant enough in most browsers.
  48755. * But removing it would mean breaking code that was able to run in
  48756. * PhantomJS 1.x, so this must be kept for backward compatibility.
  48757. */
  48758. /* istanbul ignore next */
  48759. function polyfillBind (fn, ctx) {
  48760. function boundFn (a) {
  48761. var l = arguments.length;
  48762. return l
  48763. ? l > 1
  48764. ? fn.apply(ctx, arguments)
  48765. : fn.call(ctx, a)
  48766. : fn.call(ctx)
  48767. }
  48768. boundFn._length = fn.length;
  48769. return boundFn
  48770. }
  48771. function nativeBind (fn, ctx) {
  48772. return fn.bind(ctx)
  48773. }
  48774. var bind = Function.prototype.bind
  48775. ? nativeBind
  48776. : polyfillBind;
  48777. /**
  48778. * Convert an Array-like object to a real Array.
  48779. */
  48780. function toArray (list, start) {
  48781. start = start || 0;
  48782. var i = list.length - start;
  48783. var ret = new Array(i);
  48784. while (i--) {
  48785. ret[i] = list[i + start];
  48786. }
  48787. return ret
  48788. }
  48789. /**
  48790. * Mix properties into target object.
  48791. */
  48792. function extend (to, _from) {
  48793. for (var key in _from) {
  48794. to[key] = _from[key];
  48795. }
  48796. return to
  48797. }
  48798. /**
  48799. * Merge an Array of Objects into a single Object.
  48800. */
  48801. function toObject (arr) {
  48802. var res = {};
  48803. for (var i = 0; i < arr.length; i++) {
  48804. if (arr[i]) {
  48805. extend(res, arr[i]);
  48806. }
  48807. }
  48808. return res
  48809. }
  48810. /* eslint-disable no-unused-vars */
  48811. /**
  48812. * Perform no operation.
  48813. * Stubbing args to make Flow happy without leaving useless transpiled code
  48814. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  48815. */
  48816. function noop (a, b, c) {}
  48817. /**
  48818. * Always return false.
  48819. */
  48820. var no = function (a, b, c) { return false; };
  48821. /* eslint-enable no-unused-vars */
  48822. /**
  48823. * Return the same value.
  48824. */
  48825. var identity = function (_) { return _; };
  48826. /**
  48827. * Generate a string containing static keys from compiler modules.
  48828. */
  48829. function genStaticKeys (modules) {
  48830. return modules.reduce(function (keys, m) {
  48831. return keys.concat(m.staticKeys || [])
  48832. }, []).join(',')
  48833. }
  48834. /**
  48835. * Check if two values are loosely equal - that is,
  48836. * if they are plain objects, do they have the same shape?
  48837. */
  48838. function looseEqual (a, b) {
  48839. if (a === b) { return true }
  48840. var isObjectA = isObject(a);
  48841. var isObjectB = isObject(b);
  48842. if (isObjectA && isObjectB) {
  48843. try {
  48844. var isArrayA = Array.isArray(a);
  48845. var isArrayB = Array.isArray(b);
  48846. if (isArrayA && isArrayB) {
  48847. return a.length === b.length && a.every(function (e, i) {
  48848. return looseEqual(e, b[i])
  48849. })
  48850. } else if (a instanceof Date && b instanceof Date) {
  48851. return a.getTime() === b.getTime()
  48852. } else if (!isArrayA && !isArrayB) {
  48853. var keysA = Object.keys(a);
  48854. var keysB = Object.keys(b);
  48855. return keysA.length === keysB.length && keysA.every(function (key) {
  48856. return looseEqual(a[key], b[key])
  48857. })
  48858. } else {
  48859. /* istanbul ignore next */
  48860. return false
  48861. }
  48862. } catch (e) {
  48863. /* istanbul ignore next */
  48864. return false
  48865. }
  48866. } else if (!isObjectA && !isObjectB) {
  48867. return String(a) === String(b)
  48868. } else {
  48869. return false
  48870. }
  48871. }
  48872. /**
  48873. * Return the first index at which a loosely equal value can be
  48874. * found in the array (if value is a plain object, the array must
  48875. * contain an object of the same shape), or -1 if it is not present.
  48876. */
  48877. function looseIndexOf (arr, val) {
  48878. for (var i = 0; i < arr.length; i++) {
  48879. if (looseEqual(arr[i], val)) { return i }
  48880. }
  48881. return -1
  48882. }
  48883. /**
  48884. * Ensure a function is called only once.
  48885. */
  48886. function once (fn) {
  48887. var called = false;
  48888. return function () {
  48889. if (!called) {
  48890. called = true;
  48891. fn.apply(this, arguments);
  48892. }
  48893. }
  48894. }
  48895. var SSR_ATTR = 'data-server-rendered';
  48896. var ASSET_TYPES = [
  48897. 'component',
  48898. 'directive',
  48899. 'filter'
  48900. ];
  48901. var LIFECYCLE_HOOKS = [
  48902. 'beforeCreate',
  48903. 'created',
  48904. 'beforeMount',
  48905. 'mounted',
  48906. 'beforeUpdate',
  48907. 'updated',
  48908. 'beforeDestroy',
  48909. 'destroyed',
  48910. 'activated',
  48911. 'deactivated',
  48912. 'errorCaptured',
  48913. 'serverPrefetch'
  48914. ];
  48915. /* */
  48916. var config = ({
  48917. /**
  48918. * Option merge strategies (used in core/util/options)
  48919. */
  48920. // $flow-disable-line
  48921. optionMergeStrategies: Object.create(null),
  48922. /**
  48923. * Whether to suppress warnings.
  48924. */
  48925. silent: false,
  48926. /**
  48927. * Show production mode tip message on boot?
  48928. */
  48929. productionTip: "development" !== 'production',
  48930. /**
  48931. * Whether to enable devtools
  48932. */
  48933. devtools: "development" !== 'production',
  48934. /**
  48935. * Whether to record perf
  48936. */
  48937. performance: false,
  48938. /**
  48939. * Error handler for watcher errors
  48940. */
  48941. errorHandler: null,
  48942. /**
  48943. * Warn handler for watcher warns
  48944. */
  48945. warnHandler: null,
  48946. /**
  48947. * Ignore certain custom elements
  48948. */
  48949. ignoredElements: [],
  48950. /**
  48951. * Custom user key aliases for v-on
  48952. */
  48953. // $flow-disable-line
  48954. keyCodes: Object.create(null),
  48955. /**
  48956. * Check if a tag is reserved so that it cannot be registered as a
  48957. * component. This is platform-dependent and may be overwritten.
  48958. */
  48959. isReservedTag: no,
  48960. /**
  48961. * Check if an attribute is reserved so that it cannot be used as a component
  48962. * prop. This is platform-dependent and may be overwritten.
  48963. */
  48964. isReservedAttr: no,
  48965. /**
  48966. * Check if a tag is an unknown element.
  48967. * Platform-dependent.
  48968. */
  48969. isUnknownElement: no,
  48970. /**
  48971. * Get the namespace of an element
  48972. */
  48973. getTagNamespace: noop,
  48974. /**
  48975. * Parse the real tag name for the specific platform.
  48976. */
  48977. parsePlatformTagName: identity,
  48978. /**
  48979. * Check if an attribute must be bound using property, e.g. value
  48980. * Platform-dependent.
  48981. */
  48982. mustUseProp: no,
  48983. /**
  48984. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  48985. * This will significantly reduce performance if set to false.
  48986. */
  48987. async: true,
  48988. /**
  48989. * Exposed for legacy reasons
  48990. */
  48991. _lifecycleHooks: LIFECYCLE_HOOKS
  48992. });
  48993. /* */
  48994. /**
  48995. * unicode letters used for parsing html tags, component names and property paths.
  48996. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  48997. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  48998. */
  48999. 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/;
  49000. /**
  49001. * Check if a string starts with $ or _
  49002. */
  49003. function isReserved (str) {
  49004. var c = (str + '').charCodeAt(0);
  49005. return c === 0x24 || c === 0x5F
  49006. }
  49007. /**
  49008. * Define a property.
  49009. */
  49010. function def (obj, key, val, enumerable) {
  49011. Object.defineProperty(obj, key, {
  49012. value: val,
  49013. enumerable: !!enumerable,
  49014. writable: true,
  49015. configurable: true
  49016. });
  49017. }
  49018. /**
  49019. * Parse simple path.
  49020. */
  49021. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  49022. function parsePath (path) {
  49023. if (bailRE.test(path)) {
  49024. return
  49025. }
  49026. var segments = path.split('.');
  49027. return function (obj) {
  49028. for (var i = 0; i < segments.length; i++) {
  49029. if (!obj) { return }
  49030. obj = obj[segments[i]];
  49031. }
  49032. return obj
  49033. }
  49034. }
  49035. /* */
  49036. // can we use __proto__?
  49037. var hasProto = '__proto__' in {};
  49038. // Browser environment sniffing
  49039. var inBrowser = typeof window !== 'undefined';
  49040. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  49041. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  49042. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  49043. var isIE = UA && /msie|trident/.test(UA);
  49044. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  49045. var isEdge = UA && UA.indexOf('edge/') > 0;
  49046. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  49047. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  49048. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  49049. var isPhantomJS = UA && /phantomjs/.test(UA);
  49050. var isFF = UA && UA.match(/firefox\/(\d+)/);
  49051. // Firefox has a "watch" function on Object.prototype...
  49052. var nativeWatch = ({}).watch;
  49053. var supportsPassive = false;
  49054. if (inBrowser) {
  49055. try {
  49056. var opts = {};
  49057. Object.defineProperty(opts, 'passive', ({
  49058. get: function get () {
  49059. /* istanbul ignore next */
  49060. supportsPassive = true;
  49061. }
  49062. })); // https://github.com/facebook/flow/issues/285
  49063. window.addEventListener('test-passive', null, opts);
  49064. } catch (e) {}
  49065. }
  49066. // this needs to be lazy-evaled because vue may be required before
  49067. // vue-server-renderer can set VUE_ENV
  49068. var _isServer;
  49069. var isServerRendering = function () {
  49070. if (_isServer === undefined) {
  49071. /* istanbul ignore if */
  49072. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  49073. // detect presence of vue-server-renderer and avoid
  49074. // Webpack shimming the process
  49075. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  49076. } else {
  49077. _isServer = false;
  49078. }
  49079. }
  49080. return _isServer
  49081. };
  49082. // detect devtools
  49083. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  49084. /* istanbul ignore next */
  49085. function isNative (Ctor) {
  49086. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  49087. }
  49088. var hasSymbol =
  49089. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  49090. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  49091. var _Set;
  49092. /* istanbul ignore if */ // $flow-disable-line
  49093. if (typeof Set !== 'undefined' && isNative(Set)) {
  49094. // use native Set when available.
  49095. _Set = Set;
  49096. } else {
  49097. // a non-standard Set polyfill that only works with primitive keys.
  49098. _Set = /*@__PURE__*/(function () {
  49099. function Set () {
  49100. this.set = Object.create(null);
  49101. }
  49102. Set.prototype.has = function has (key) {
  49103. return this.set[key] === true
  49104. };
  49105. Set.prototype.add = function add (key) {
  49106. this.set[key] = true;
  49107. };
  49108. Set.prototype.clear = function clear () {
  49109. this.set = Object.create(null);
  49110. };
  49111. return Set;
  49112. }());
  49113. }
  49114. /* */
  49115. var warn = noop;
  49116. var tip = noop;
  49117. var generateComponentTrace = (noop); // work around flow check
  49118. var formatComponentName = (noop);
  49119. {
  49120. var hasConsole = typeof console !== 'undefined';
  49121. var classifyRE = /(?:^|[-_])(\w)/g;
  49122. var classify = function (str) { return str
  49123. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  49124. .replace(/[-_]/g, ''); };
  49125. warn = function (msg, vm) {
  49126. var trace = vm ? generateComponentTrace(vm) : '';
  49127. if (config.warnHandler) {
  49128. config.warnHandler.call(null, msg, vm, trace);
  49129. } else if (hasConsole && (!config.silent)) {
  49130. console.error(("[Vue warn]: " + msg + trace));
  49131. }
  49132. };
  49133. tip = function (msg, vm) {
  49134. if (hasConsole && (!config.silent)) {
  49135. console.warn("[Vue tip]: " + msg + (
  49136. vm ? generateComponentTrace(vm) : ''
  49137. ));
  49138. }
  49139. };
  49140. formatComponentName = function (vm, includeFile) {
  49141. if (vm.$root === vm) {
  49142. return '<Root>'
  49143. }
  49144. var options = typeof vm === 'function' && vm.cid != null
  49145. ? vm.options
  49146. : vm._isVue
  49147. ? vm.$options || vm.constructor.options
  49148. : vm;
  49149. var name = options.name || options._componentTag;
  49150. var file = options.__file;
  49151. if (!name && file) {
  49152. var match = file.match(/([^/\\]+)\.vue$/);
  49153. name = match && match[1];
  49154. }
  49155. return (
  49156. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  49157. (file && includeFile !== false ? (" at " + file) : '')
  49158. )
  49159. };
  49160. var repeat = function (str, n) {
  49161. var res = '';
  49162. while (n) {
  49163. if (n % 2 === 1) { res += str; }
  49164. if (n > 1) { str += str; }
  49165. n >>= 1;
  49166. }
  49167. return res
  49168. };
  49169. generateComponentTrace = function (vm) {
  49170. if (vm._isVue && vm.$parent) {
  49171. var tree = [];
  49172. var currentRecursiveSequence = 0;
  49173. while (vm) {
  49174. if (tree.length > 0) {
  49175. var last = tree[tree.length - 1];
  49176. if (last.constructor === vm.constructor) {
  49177. currentRecursiveSequence++;
  49178. vm = vm.$parent;
  49179. continue
  49180. } else if (currentRecursiveSequence > 0) {
  49181. tree[tree.length - 1] = [last, currentRecursiveSequence];
  49182. currentRecursiveSequence = 0;
  49183. }
  49184. }
  49185. tree.push(vm);
  49186. vm = vm.$parent;
  49187. }
  49188. return '\n\nfound in\n\n' + tree
  49189. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  49190. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  49191. : formatComponentName(vm))); })
  49192. .join('\n')
  49193. } else {
  49194. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  49195. }
  49196. };
  49197. }
  49198. /* */
  49199. var uid = 0;
  49200. /**
  49201. * A dep is an observable that can have multiple
  49202. * directives subscribing to it.
  49203. */
  49204. var Dep = function Dep () {
  49205. this.id = uid++;
  49206. this.subs = [];
  49207. };
  49208. Dep.prototype.addSub = function addSub (sub) {
  49209. this.subs.push(sub);
  49210. };
  49211. Dep.prototype.removeSub = function removeSub (sub) {
  49212. remove(this.subs, sub);
  49213. };
  49214. Dep.prototype.depend = function depend () {
  49215. if (Dep.target) {
  49216. Dep.target.addDep(this);
  49217. }
  49218. };
  49219. Dep.prototype.notify = function notify () {
  49220. // stabilize the subscriber list first
  49221. var subs = this.subs.slice();
  49222. if (!config.async) {
  49223. // subs aren't sorted in scheduler if not running async
  49224. // we need to sort them now to make sure they fire in correct
  49225. // order
  49226. subs.sort(function (a, b) { return a.id - b.id; });
  49227. }
  49228. for (var i = 0, l = subs.length; i < l; i++) {
  49229. subs[i].update();
  49230. }
  49231. };
  49232. // The current target watcher being evaluated.
  49233. // This is globally unique because only one watcher
  49234. // can be evaluated at a time.
  49235. Dep.target = null;
  49236. var targetStack = [];
  49237. function pushTarget (target) {
  49238. targetStack.push(target);
  49239. Dep.target = target;
  49240. }
  49241. function popTarget () {
  49242. targetStack.pop();
  49243. Dep.target = targetStack[targetStack.length - 1];
  49244. }
  49245. /* */
  49246. var VNode = function VNode (
  49247. tag,
  49248. data,
  49249. children,
  49250. text,
  49251. elm,
  49252. context,
  49253. componentOptions,
  49254. asyncFactory
  49255. ) {
  49256. this.tag = tag;
  49257. this.data = data;
  49258. this.children = children;
  49259. this.text = text;
  49260. this.elm = elm;
  49261. this.ns = undefined;
  49262. this.context = context;
  49263. this.fnContext = undefined;
  49264. this.fnOptions = undefined;
  49265. this.fnScopeId = undefined;
  49266. this.key = data && data.key;
  49267. this.componentOptions = componentOptions;
  49268. this.componentInstance = undefined;
  49269. this.parent = undefined;
  49270. this.raw = false;
  49271. this.isStatic = false;
  49272. this.isRootInsert = true;
  49273. this.isComment = false;
  49274. this.isCloned = false;
  49275. this.isOnce = false;
  49276. this.asyncFactory = asyncFactory;
  49277. this.asyncMeta = undefined;
  49278. this.isAsyncPlaceholder = false;
  49279. };
  49280. var prototypeAccessors = { child: { configurable: true } };
  49281. // DEPRECATED: alias for componentInstance for backwards compat.
  49282. /* istanbul ignore next */
  49283. prototypeAccessors.child.get = function () {
  49284. return this.componentInstance
  49285. };
  49286. Object.defineProperties( VNode.prototype, prototypeAccessors );
  49287. var createEmptyVNode = function (text) {
  49288. if ( text === void 0 ) text = '';
  49289. var node = new VNode();
  49290. node.text = text;
  49291. node.isComment = true;
  49292. return node
  49293. };
  49294. function createTextVNode (val) {
  49295. return new VNode(undefined, undefined, undefined, String(val))
  49296. }
  49297. // optimized shallow clone
  49298. // used for static nodes and slot nodes because they may be reused across
  49299. // multiple renders, cloning them avoids errors when DOM manipulations rely
  49300. // on their elm reference.
  49301. function cloneVNode (vnode) {
  49302. var cloned = new VNode(
  49303. vnode.tag,
  49304. vnode.data,
  49305. // #7975
  49306. // clone children array to avoid mutating original in case of cloning
  49307. // a child.
  49308. vnode.children && vnode.children.slice(),
  49309. vnode.text,
  49310. vnode.elm,
  49311. vnode.context,
  49312. vnode.componentOptions,
  49313. vnode.asyncFactory
  49314. );
  49315. cloned.ns = vnode.ns;
  49316. cloned.isStatic = vnode.isStatic;
  49317. cloned.key = vnode.key;
  49318. cloned.isComment = vnode.isComment;
  49319. cloned.fnContext = vnode.fnContext;
  49320. cloned.fnOptions = vnode.fnOptions;
  49321. cloned.fnScopeId = vnode.fnScopeId;
  49322. cloned.asyncMeta = vnode.asyncMeta;
  49323. cloned.isCloned = true;
  49324. return cloned
  49325. }
  49326. /*
  49327. * not type checking this file because flow doesn't play well with
  49328. * dynamically accessing methods on Array prototype
  49329. */
  49330. var arrayProto = Array.prototype;
  49331. var arrayMethods = Object.create(arrayProto);
  49332. var methodsToPatch = [
  49333. 'push',
  49334. 'pop',
  49335. 'shift',
  49336. 'unshift',
  49337. 'splice',
  49338. 'sort',
  49339. 'reverse'
  49340. ];
  49341. /**
  49342. * Intercept mutating methods and emit events
  49343. */
  49344. methodsToPatch.forEach(function (method) {
  49345. // cache original method
  49346. var original = arrayProto[method];
  49347. def(arrayMethods, method, function mutator () {
  49348. var args = [], len = arguments.length;
  49349. while ( len-- ) args[ len ] = arguments[ len ];
  49350. var result = original.apply(this, args);
  49351. var ob = this.__ob__;
  49352. var inserted;
  49353. switch (method) {
  49354. case 'push':
  49355. case 'unshift':
  49356. inserted = args;
  49357. break
  49358. case 'splice':
  49359. inserted = args.slice(2);
  49360. break
  49361. }
  49362. if (inserted) { ob.observeArray(inserted); }
  49363. // notify change
  49364. ob.dep.notify();
  49365. return result
  49366. });
  49367. });
  49368. /* */
  49369. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  49370. /**
  49371. * In some cases we may want to disable observation inside a component's
  49372. * update computation.
  49373. */
  49374. var shouldObserve = true;
  49375. function toggleObserving (value) {
  49376. shouldObserve = value;
  49377. }
  49378. /**
  49379. * Observer class that is attached to each observed
  49380. * object. Once attached, the observer converts the target
  49381. * object's property keys into getter/setters that
  49382. * collect dependencies and dispatch updates.
  49383. */
  49384. var Observer = function Observer (value) {
  49385. this.value = value;
  49386. this.dep = new Dep();
  49387. this.vmCount = 0;
  49388. def(value, '__ob__', this);
  49389. if (Array.isArray(value)) {
  49390. if (hasProto) {
  49391. protoAugment(value, arrayMethods);
  49392. } else {
  49393. copyAugment(value, arrayMethods, arrayKeys);
  49394. }
  49395. this.observeArray(value);
  49396. } else {
  49397. this.walk(value);
  49398. }
  49399. };
  49400. /**
  49401. * Walk through all properties and convert them into
  49402. * getter/setters. This method should only be called when
  49403. * value type is Object.
  49404. */
  49405. Observer.prototype.walk = function walk (obj) {
  49406. var keys = Object.keys(obj);
  49407. for (var i = 0; i < keys.length; i++) {
  49408. defineReactive$$1(obj, keys[i]);
  49409. }
  49410. };
  49411. /**
  49412. * Observe a list of Array items.
  49413. */
  49414. Observer.prototype.observeArray = function observeArray (items) {
  49415. for (var i = 0, l = items.length; i < l; i++) {
  49416. observe(items[i]);
  49417. }
  49418. };
  49419. // helpers
  49420. /**
  49421. * Augment a target Object or Array by intercepting
  49422. * the prototype chain using __proto__
  49423. */
  49424. function protoAugment (target, src) {
  49425. /* eslint-disable no-proto */
  49426. target.__proto__ = src;
  49427. /* eslint-enable no-proto */
  49428. }
  49429. /**
  49430. * Augment a target Object or Array by defining
  49431. * hidden properties.
  49432. */
  49433. /* istanbul ignore next */
  49434. function copyAugment (target, src, keys) {
  49435. for (var i = 0, l = keys.length; i < l; i++) {
  49436. var key = keys[i];
  49437. def(target, key, src[key]);
  49438. }
  49439. }
  49440. /**
  49441. * Attempt to create an observer instance for a value,
  49442. * returns the new observer if successfully observed,
  49443. * or the existing observer if the value already has one.
  49444. */
  49445. function observe (value, asRootData) {
  49446. if (!isObject(value) || value instanceof VNode) {
  49447. return
  49448. }
  49449. var ob;
  49450. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  49451. ob = value.__ob__;
  49452. } else if (
  49453. shouldObserve &&
  49454. !isServerRendering() &&
  49455. (Array.isArray(value) || isPlainObject(value)) &&
  49456. Object.isExtensible(value) &&
  49457. !value._isVue
  49458. ) {
  49459. ob = new Observer(value);
  49460. }
  49461. if (asRootData && ob) {
  49462. ob.vmCount++;
  49463. }
  49464. return ob
  49465. }
  49466. /**
  49467. * Define a reactive property on an Object.
  49468. */
  49469. function defineReactive$$1 (
  49470. obj,
  49471. key,
  49472. val,
  49473. customSetter,
  49474. shallow
  49475. ) {
  49476. var dep = new Dep();
  49477. var property = Object.getOwnPropertyDescriptor(obj, key);
  49478. if (property && property.configurable === false) {
  49479. return
  49480. }
  49481. // cater for pre-defined getter/setters
  49482. var getter = property && property.get;
  49483. var setter = property && property.set;
  49484. if ((!getter || setter) && arguments.length === 2) {
  49485. val = obj[key];
  49486. }
  49487. var childOb = !shallow && observe(val);
  49488. Object.defineProperty(obj, key, {
  49489. enumerable: true,
  49490. configurable: true,
  49491. get: function reactiveGetter () {
  49492. var value = getter ? getter.call(obj) : val;
  49493. if (Dep.target) {
  49494. dep.depend();
  49495. if (childOb) {
  49496. childOb.dep.depend();
  49497. if (Array.isArray(value)) {
  49498. dependArray(value);
  49499. }
  49500. }
  49501. }
  49502. return value
  49503. },
  49504. set: function reactiveSetter (newVal) {
  49505. var value = getter ? getter.call(obj) : val;
  49506. /* eslint-disable no-self-compare */
  49507. if (newVal === value || (newVal !== newVal && value !== value)) {
  49508. return
  49509. }
  49510. /* eslint-enable no-self-compare */
  49511. if (customSetter) {
  49512. customSetter();
  49513. }
  49514. // #7981: for accessor properties without setter
  49515. if (getter && !setter) { return }
  49516. if (setter) {
  49517. setter.call(obj, newVal);
  49518. } else {
  49519. val = newVal;
  49520. }
  49521. childOb = !shallow && observe(newVal);
  49522. dep.notify();
  49523. }
  49524. });
  49525. }
  49526. /**
  49527. * Set a property on an object. Adds the new property and
  49528. * triggers change notification if the property doesn't
  49529. * already exist.
  49530. */
  49531. function set (target, key, val) {
  49532. if (isUndef(target) || isPrimitive(target)
  49533. ) {
  49534. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  49535. }
  49536. if (Array.isArray(target) && isValidArrayIndex(key)) {
  49537. target.length = Math.max(target.length, key);
  49538. target.splice(key, 1, val);
  49539. return val
  49540. }
  49541. if (key in target && !(key in Object.prototype)) {
  49542. target[key] = val;
  49543. return val
  49544. }
  49545. var ob = (target).__ob__;
  49546. if (target._isVue || (ob && ob.vmCount)) {
  49547. warn(
  49548. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  49549. 'at runtime - declare it upfront in the data option.'
  49550. );
  49551. return val
  49552. }
  49553. if (!ob) {
  49554. target[key] = val;
  49555. return val
  49556. }
  49557. defineReactive$$1(ob.value, key, val);
  49558. ob.dep.notify();
  49559. return val
  49560. }
  49561. /**
  49562. * Delete a property and trigger change if necessary.
  49563. */
  49564. function del (target, key) {
  49565. if (isUndef(target) || isPrimitive(target)
  49566. ) {
  49567. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  49568. }
  49569. if (Array.isArray(target) && isValidArrayIndex(key)) {
  49570. target.splice(key, 1);
  49571. return
  49572. }
  49573. var ob = (target).__ob__;
  49574. if (target._isVue || (ob && ob.vmCount)) {
  49575. warn(
  49576. 'Avoid deleting properties on a Vue instance or its root $data ' +
  49577. '- just set it to null.'
  49578. );
  49579. return
  49580. }
  49581. if (!hasOwn(target, key)) {
  49582. return
  49583. }
  49584. delete target[key];
  49585. if (!ob) {
  49586. return
  49587. }
  49588. ob.dep.notify();
  49589. }
  49590. /**
  49591. * Collect dependencies on array elements when the array is touched, since
  49592. * we cannot intercept array element access like property getters.
  49593. */
  49594. function dependArray (value) {
  49595. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  49596. e = value[i];
  49597. e && e.__ob__ && e.__ob__.dep.depend();
  49598. if (Array.isArray(e)) {
  49599. dependArray(e);
  49600. }
  49601. }
  49602. }
  49603. /* */
  49604. /**
  49605. * Option overwriting strategies are functions that handle
  49606. * how to merge a parent option value and a child option
  49607. * value into the final value.
  49608. */
  49609. var strats = config.optionMergeStrategies;
  49610. /**
  49611. * Options with restrictions
  49612. */
  49613. {
  49614. strats.el = strats.propsData = function (parent, child, vm, key) {
  49615. if (!vm) {
  49616. warn(
  49617. "option \"" + key + "\" can only be used during instance " +
  49618. 'creation with the `new` keyword.'
  49619. );
  49620. }
  49621. return defaultStrat(parent, child)
  49622. };
  49623. }
  49624. /**
  49625. * Helper that recursively merges two data objects together.
  49626. */
  49627. function mergeData (to, from) {
  49628. if (!from) { return to }
  49629. var key, toVal, fromVal;
  49630. var keys = hasSymbol
  49631. ? Reflect.ownKeys(from)
  49632. : Object.keys(from);
  49633. for (var i = 0; i < keys.length; i++) {
  49634. key = keys[i];
  49635. // in case the object is already observed...
  49636. if (key === '__ob__') { continue }
  49637. toVal = to[key];
  49638. fromVal = from[key];
  49639. if (!hasOwn(to, key)) {
  49640. set(to, key, fromVal);
  49641. } else if (
  49642. toVal !== fromVal &&
  49643. isPlainObject(toVal) &&
  49644. isPlainObject(fromVal)
  49645. ) {
  49646. mergeData(toVal, fromVal);
  49647. }
  49648. }
  49649. return to
  49650. }
  49651. /**
  49652. * Data
  49653. */
  49654. function mergeDataOrFn (
  49655. parentVal,
  49656. childVal,
  49657. vm
  49658. ) {
  49659. if (!vm) {
  49660. // in a Vue.extend merge, both should be functions
  49661. if (!childVal) {
  49662. return parentVal
  49663. }
  49664. if (!parentVal) {
  49665. return childVal
  49666. }
  49667. // when parentVal & childVal are both present,
  49668. // we need to return a function that returns the
  49669. // merged result of both functions... no need to
  49670. // check if parentVal is a function here because
  49671. // it has to be a function to pass previous merges.
  49672. return function mergedDataFn () {
  49673. return mergeData(
  49674. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  49675. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  49676. )
  49677. }
  49678. } else {
  49679. return function mergedInstanceDataFn () {
  49680. // instance merge
  49681. var instanceData = typeof childVal === 'function'
  49682. ? childVal.call(vm, vm)
  49683. : childVal;
  49684. var defaultData = typeof parentVal === 'function'
  49685. ? parentVal.call(vm, vm)
  49686. : parentVal;
  49687. if (instanceData) {
  49688. return mergeData(instanceData, defaultData)
  49689. } else {
  49690. return defaultData
  49691. }
  49692. }
  49693. }
  49694. }
  49695. strats.data = function (
  49696. parentVal,
  49697. childVal,
  49698. vm
  49699. ) {
  49700. if (!vm) {
  49701. if (childVal && typeof childVal !== 'function') {
  49702. warn(
  49703. 'The "data" option should be a function ' +
  49704. 'that returns a per-instance value in component ' +
  49705. 'definitions.',
  49706. vm
  49707. );
  49708. return parentVal
  49709. }
  49710. return mergeDataOrFn(parentVal, childVal)
  49711. }
  49712. return mergeDataOrFn(parentVal, childVal, vm)
  49713. };
  49714. /**
  49715. * Hooks and props are merged as arrays.
  49716. */
  49717. function mergeHook (
  49718. parentVal,
  49719. childVal
  49720. ) {
  49721. var res = childVal
  49722. ? parentVal
  49723. ? parentVal.concat(childVal)
  49724. : Array.isArray(childVal)
  49725. ? childVal
  49726. : [childVal]
  49727. : parentVal;
  49728. return res
  49729. ? dedupeHooks(res)
  49730. : res
  49731. }
  49732. function dedupeHooks (hooks) {
  49733. var res = [];
  49734. for (var i = 0; i < hooks.length; i++) {
  49735. if (res.indexOf(hooks[i]) === -1) {
  49736. res.push(hooks[i]);
  49737. }
  49738. }
  49739. return res
  49740. }
  49741. LIFECYCLE_HOOKS.forEach(function (hook) {
  49742. strats[hook] = mergeHook;
  49743. });
  49744. /**
  49745. * Assets
  49746. *
  49747. * When a vm is present (instance creation), we need to do
  49748. * a three-way merge between constructor options, instance
  49749. * options and parent options.
  49750. */
  49751. function mergeAssets (
  49752. parentVal,
  49753. childVal,
  49754. vm,
  49755. key
  49756. ) {
  49757. var res = Object.create(parentVal || null);
  49758. if (childVal) {
  49759. assertObjectType(key, childVal, vm);
  49760. return extend(res, childVal)
  49761. } else {
  49762. return res
  49763. }
  49764. }
  49765. ASSET_TYPES.forEach(function (type) {
  49766. strats[type + 's'] = mergeAssets;
  49767. });
  49768. /**
  49769. * Watchers.
  49770. *
  49771. * Watchers hashes should not overwrite one
  49772. * another, so we merge them as arrays.
  49773. */
  49774. strats.watch = function (
  49775. parentVal,
  49776. childVal,
  49777. vm,
  49778. key
  49779. ) {
  49780. // work around Firefox's Object.prototype.watch...
  49781. if (parentVal === nativeWatch) { parentVal = undefined; }
  49782. if (childVal === nativeWatch) { childVal = undefined; }
  49783. /* istanbul ignore if */
  49784. if (!childVal) { return Object.create(parentVal || null) }
  49785. {
  49786. assertObjectType(key, childVal, vm);
  49787. }
  49788. if (!parentVal) { return childVal }
  49789. var ret = {};
  49790. extend(ret, parentVal);
  49791. for (var key$1 in childVal) {
  49792. var parent = ret[key$1];
  49793. var child = childVal[key$1];
  49794. if (parent && !Array.isArray(parent)) {
  49795. parent = [parent];
  49796. }
  49797. ret[key$1] = parent
  49798. ? parent.concat(child)
  49799. : Array.isArray(child) ? child : [child];
  49800. }
  49801. return ret
  49802. };
  49803. /**
  49804. * Other object hashes.
  49805. */
  49806. strats.props =
  49807. strats.methods =
  49808. strats.inject =
  49809. strats.computed = function (
  49810. parentVal,
  49811. childVal,
  49812. vm,
  49813. key
  49814. ) {
  49815. if (childVal && "development" !== 'production') {
  49816. assertObjectType(key, childVal, vm);
  49817. }
  49818. if (!parentVal) { return childVal }
  49819. var ret = Object.create(null);
  49820. extend(ret, parentVal);
  49821. if (childVal) { extend(ret, childVal); }
  49822. return ret
  49823. };
  49824. strats.provide = mergeDataOrFn;
  49825. /**
  49826. * Default strategy.
  49827. */
  49828. var defaultStrat = function (parentVal, childVal) {
  49829. return childVal === undefined
  49830. ? parentVal
  49831. : childVal
  49832. };
  49833. /**
  49834. * Validate component names
  49835. */
  49836. function checkComponents (options) {
  49837. for (var key in options.components) {
  49838. validateComponentName(key);
  49839. }
  49840. }
  49841. function validateComponentName (name) {
  49842. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  49843. warn(
  49844. 'Invalid component name: "' + name + '". Component names ' +
  49845. 'should conform to valid custom element name in html5 specification.'
  49846. );
  49847. }
  49848. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  49849. warn(
  49850. 'Do not use built-in or reserved HTML elements as component ' +
  49851. 'id: ' + name
  49852. );
  49853. }
  49854. }
  49855. /**
  49856. * Ensure all props option syntax are normalized into the
  49857. * Object-based format.
  49858. */
  49859. function normalizeProps (options, vm) {
  49860. var props = options.props;
  49861. if (!props) { return }
  49862. var res = {};
  49863. var i, val, name;
  49864. if (Array.isArray(props)) {
  49865. i = props.length;
  49866. while (i--) {
  49867. val = props[i];
  49868. if (typeof val === 'string') {
  49869. name = camelize(val);
  49870. res[name] = { type: null };
  49871. } else {
  49872. warn('props must be strings when using array syntax.');
  49873. }
  49874. }
  49875. } else if (isPlainObject(props)) {
  49876. for (var key in props) {
  49877. val = props[key];
  49878. name = camelize(key);
  49879. res[name] = isPlainObject(val)
  49880. ? val
  49881. : { type: val };
  49882. }
  49883. } else {
  49884. warn(
  49885. "Invalid value for option \"props\": expected an Array or an Object, " +
  49886. "but got " + (toRawType(props)) + ".",
  49887. vm
  49888. );
  49889. }
  49890. options.props = res;
  49891. }
  49892. /**
  49893. * Normalize all injections into Object-based format
  49894. */
  49895. function normalizeInject (options, vm) {
  49896. var inject = options.inject;
  49897. if (!inject) { return }
  49898. var normalized = options.inject = {};
  49899. if (Array.isArray(inject)) {
  49900. for (var i = 0; i < inject.length; i++) {
  49901. normalized[inject[i]] = { from: inject[i] };
  49902. }
  49903. } else if (isPlainObject(inject)) {
  49904. for (var key in inject) {
  49905. var val = inject[key];
  49906. normalized[key] = isPlainObject(val)
  49907. ? extend({ from: key }, val)
  49908. : { from: val };
  49909. }
  49910. } else {
  49911. warn(
  49912. "Invalid value for option \"inject\": expected an Array or an Object, " +
  49913. "but got " + (toRawType(inject)) + ".",
  49914. vm
  49915. );
  49916. }
  49917. }
  49918. /**
  49919. * Normalize raw function directives into object format.
  49920. */
  49921. function normalizeDirectives (options) {
  49922. var dirs = options.directives;
  49923. if (dirs) {
  49924. for (var key in dirs) {
  49925. var def$$1 = dirs[key];
  49926. if (typeof def$$1 === 'function') {
  49927. dirs[key] = { bind: def$$1, update: def$$1 };
  49928. }
  49929. }
  49930. }
  49931. }
  49932. function assertObjectType (name, value, vm) {
  49933. if (!isPlainObject(value)) {
  49934. warn(
  49935. "Invalid value for option \"" + name + "\": expected an Object, " +
  49936. "but got " + (toRawType(value)) + ".",
  49937. vm
  49938. );
  49939. }
  49940. }
  49941. /**
  49942. * Merge two option objects into a new one.
  49943. * Core utility used in both instantiation and inheritance.
  49944. */
  49945. function mergeOptions (
  49946. parent,
  49947. child,
  49948. vm
  49949. ) {
  49950. {
  49951. checkComponents(child);
  49952. }
  49953. if (typeof child === 'function') {
  49954. child = child.options;
  49955. }
  49956. normalizeProps(child, vm);
  49957. normalizeInject(child, vm);
  49958. normalizeDirectives(child);
  49959. // Apply extends and mixins on the child options,
  49960. // but only if it is a raw options object that isn't
  49961. // the result of another mergeOptions call.
  49962. // Only merged options has the _base property.
  49963. if (!child._base) {
  49964. if (child.extends) {
  49965. parent = mergeOptions(parent, child.extends, vm);
  49966. }
  49967. if (child.mixins) {
  49968. for (var i = 0, l = child.mixins.length; i < l; i++) {
  49969. parent = mergeOptions(parent, child.mixins[i], vm);
  49970. }
  49971. }
  49972. }
  49973. var options = {};
  49974. var key;
  49975. for (key in parent) {
  49976. mergeField(key);
  49977. }
  49978. for (key in child) {
  49979. if (!hasOwn(parent, key)) {
  49980. mergeField(key);
  49981. }
  49982. }
  49983. function mergeField (key) {
  49984. var strat = strats[key] || defaultStrat;
  49985. options[key] = strat(parent[key], child[key], vm, key);
  49986. }
  49987. return options
  49988. }
  49989. /**
  49990. * Resolve an asset.
  49991. * This function is used because child instances need access
  49992. * to assets defined in its ancestor chain.
  49993. */
  49994. function resolveAsset (
  49995. options,
  49996. type,
  49997. id,
  49998. warnMissing
  49999. ) {
  50000. /* istanbul ignore if */
  50001. if (typeof id !== 'string') {
  50002. return
  50003. }
  50004. var assets = options[type];
  50005. // check local registration variations first
  50006. if (hasOwn(assets, id)) { return assets[id] }
  50007. var camelizedId = camelize(id);
  50008. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  50009. var PascalCaseId = capitalize(camelizedId);
  50010. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  50011. // fallback to prototype chain
  50012. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  50013. if (warnMissing && !res) {
  50014. warn(
  50015. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  50016. options
  50017. );
  50018. }
  50019. return res
  50020. }
  50021. /* */
  50022. function validateProp (
  50023. key,
  50024. propOptions,
  50025. propsData,
  50026. vm
  50027. ) {
  50028. var prop = propOptions[key];
  50029. var absent = !hasOwn(propsData, key);
  50030. var value = propsData[key];
  50031. // boolean casting
  50032. var booleanIndex = getTypeIndex(Boolean, prop.type);
  50033. if (booleanIndex > -1) {
  50034. if (absent && !hasOwn(prop, 'default')) {
  50035. value = false;
  50036. } else if (value === '' || value === hyphenate(key)) {
  50037. // only cast empty string / same name to boolean if
  50038. // boolean has higher priority
  50039. var stringIndex = getTypeIndex(String, prop.type);
  50040. if (stringIndex < 0 || booleanIndex < stringIndex) {
  50041. value = true;
  50042. }
  50043. }
  50044. }
  50045. // check default value
  50046. if (value === undefined) {
  50047. value = getPropDefaultValue(vm, prop, key);
  50048. // since the default value is a fresh copy,
  50049. // make sure to observe it.
  50050. var prevShouldObserve = shouldObserve;
  50051. toggleObserving(true);
  50052. observe(value);
  50053. toggleObserving(prevShouldObserve);
  50054. }
  50055. {
  50056. assertProp(prop, key, value, vm, absent);
  50057. }
  50058. return value
  50059. }
  50060. /**
  50061. * Get the default value of a prop.
  50062. */
  50063. function getPropDefaultValue (vm, prop, key) {
  50064. // no default, return undefined
  50065. if (!hasOwn(prop, 'default')) {
  50066. return undefined
  50067. }
  50068. var def = prop.default;
  50069. // warn against non-factory defaults for Object & Array
  50070. if (isObject(def)) {
  50071. warn(
  50072. 'Invalid default value for prop "' + key + '": ' +
  50073. 'Props with type Object/Array must use a factory function ' +
  50074. 'to return the default value.',
  50075. vm
  50076. );
  50077. }
  50078. // the raw prop value was also undefined from previous render,
  50079. // return previous default value to avoid unnecessary watcher trigger
  50080. if (vm && vm.$options.propsData &&
  50081. vm.$options.propsData[key] === undefined &&
  50082. vm._props[key] !== undefined
  50083. ) {
  50084. return vm._props[key]
  50085. }
  50086. // call factory function for non-Function types
  50087. // a value is Function if its prototype is function even across different execution context
  50088. return typeof def === 'function' && getType(prop.type) !== 'Function'
  50089. ? def.call(vm)
  50090. : def
  50091. }
  50092. /**
  50093. * Assert whether a prop is valid.
  50094. */
  50095. function assertProp (
  50096. prop,
  50097. name,
  50098. value,
  50099. vm,
  50100. absent
  50101. ) {
  50102. if (prop.required && absent) {
  50103. warn(
  50104. 'Missing required prop: "' + name + '"',
  50105. vm
  50106. );
  50107. return
  50108. }
  50109. if (value == null && !prop.required) {
  50110. return
  50111. }
  50112. var type = prop.type;
  50113. var valid = !type || type === true;
  50114. var expectedTypes = [];
  50115. if (type) {
  50116. if (!Array.isArray(type)) {
  50117. type = [type];
  50118. }
  50119. for (var i = 0; i < type.length && !valid; i++) {
  50120. var assertedType = assertType(value, type[i]);
  50121. expectedTypes.push(assertedType.expectedType || '');
  50122. valid = assertedType.valid;
  50123. }
  50124. }
  50125. if (!valid) {
  50126. warn(
  50127. getInvalidTypeMessage(name, value, expectedTypes),
  50128. vm
  50129. );
  50130. return
  50131. }
  50132. var validator = prop.validator;
  50133. if (validator) {
  50134. if (!validator(value)) {
  50135. warn(
  50136. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  50137. vm
  50138. );
  50139. }
  50140. }
  50141. }
  50142. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  50143. function assertType (value, type) {
  50144. var valid;
  50145. var expectedType = getType(type);
  50146. if (simpleCheckRE.test(expectedType)) {
  50147. var t = typeof value;
  50148. valid = t === expectedType.toLowerCase();
  50149. // for primitive wrapper objects
  50150. if (!valid && t === 'object') {
  50151. valid = value instanceof type;
  50152. }
  50153. } else if (expectedType === 'Object') {
  50154. valid = isPlainObject(value);
  50155. } else if (expectedType === 'Array') {
  50156. valid = Array.isArray(value);
  50157. } else {
  50158. valid = value instanceof type;
  50159. }
  50160. return {
  50161. valid: valid,
  50162. expectedType: expectedType
  50163. }
  50164. }
  50165. /**
  50166. * Use function string name to check built-in types,
  50167. * because a simple equality check will fail when running
  50168. * across different vms / iframes.
  50169. */
  50170. function getType (fn) {
  50171. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  50172. return match ? match[1] : ''
  50173. }
  50174. function isSameType (a, b) {
  50175. return getType(a) === getType(b)
  50176. }
  50177. function getTypeIndex (type, expectedTypes) {
  50178. if (!Array.isArray(expectedTypes)) {
  50179. return isSameType(expectedTypes, type) ? 0 : -1
  50180. }
  50181. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  50182. if (isSameType(expectedTypes[i], type)) {
  50183. return i
  50184. }
  50185. }
  50186. return -1
  50187. }
  50188. function getInvalidTypeMessage (name, value, expectedTypes) {
  50189. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  50190. " Expected " + (expectedTypes.map(capitalize).join(', '));
  50191. var expectedType = expectedTypes[0];
  50192. var receivedType = toRawType(value);
  50193. var expectedValue = styleValue(value, expectedType);
  50194. var receivedValue = styleValue(value, receivedType);
  50195. // check if we need to specify expected value
  50196. if (expectedTypes.length === 1 &&
  50197. isExplicable(expectedType) &&
  50198. !isBoolean(expectedType, receivedType)) {
  50199. message += " with value " + expectedValue;
  50200. }
  50201. message += ", got " + receivedType + " ";
  50202. // check if we need to specify received value
  50203. if (isExplicable(receivedType)) {
  50204. message += "with value " + receivedValue + ".";
  50205. }
  50206. return message
  50207. }
  50208. function styleValue (value, type) {
  50209. if (type === 'String') {
  50210. return ("\"" + value + "\"")
  50211. } else if (type === 'Number') {
  50212. return ("" + (Number(value)))
  50213. } else {
  50214. return ("" + value)
  50215. }
  50216. }
  50217. function isExplicable (value) {
  50218. var explicitTypes = ['string', 'number', 'boolean'];
  50219. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  50220. }
  50221. function isBoolean () {
  50222. var args = [], len = arguments.length;
  50223. while ( len-- ) args[ len ] = arguments[ len ];
  50224. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  50225. }
  50226. /* */
  50227. function handleError (err, vm, info) {
  50228. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  50229. // See: https://github.com/vuejs/vuex/issues/1505
  50230. pushTarget();
  50231. try {
  50232. if (vm) {
  50233. var cur = vm;
  50234. while ((cur = cur.$parent)) {
  50235. var hooks = cur.$options.errorCaptured;
  50236. if (hooks) {
  50237. for (var i = 0; i < hooks.length; i++) {
  50238. try {
  50239. var capture = hooks[i].call(cur, err, vm, info) === false;
  50240. if (capture) { return }
  50241. } catch (e) {
  50242. globalHandleError(e, cur, 'errorCaptured hook');
  50243. }
  50244. }
  50245. }
  50246. }
  50247. }
  50248. globalHandleError(err, vm, info);
  50249. } finally {
  50250. popTarget();
  50251. }
  50252. }
  50253. function invokeWithErrorHandling (
  50254. handler,
  50255. context,
  50256. args,
  50257. vm,
  50258. info
  50259. ) {
  50260. var res;
  50261. try {
  50262. res = args ? handler.apply(context, args) : handler.call(context);
  50263. if (res && !res._isVue && isPromise(res) && !res._handled) {
  50264. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  50265. // issue #9511
  50266. // avoid catch triggering multiple times when nested calls
  50267. res._handled = true;
  50268. }
  50269. } catch (e) {
  50270. handleError(e, vm, info);
  50271. }
  50272. return res
  50273. }
  50274. function globalHandleError (err, vm, info) {
  50275. if (config.errorHandler) {
  50276. try {
  50277. return config.errorHandler.call(null, err, vm, info)
  50278. } catch (e) {
  50279. // if the user intentionally throws the original error in the handler,
  50280. // do not log it twice
  50281. if (e !== err) {
  50282. logError(e, null, 'config.errorHandler');
  50283. }
  50284. }
  50285. }
  50286. logError(err, vm, info);
  50287. }
  50288. function logError (err, vm, info) {
  50289. {
  50290. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  50291. }
  50292. /* istanbul ignore else */
  50293. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  50294. console.error(err);
  50295. } else {
  50296. throw err
  50297. }
  50298. }
  50299. /* */
  50300. var isUsingMicroTask = false;
  50301. var callbacks = [];
  50302. var pending = false;
  50303. function flushCallbacks () {
  50304. pending = false;
  50305. var copies = callbacks.slice(0);
  50306. callbacks.length = 0;
  50307. for (var i = 0; i < copies.length; i++) {
  50308. copies[i]();
  50309. }
  50310. }
  50311. // Here we have async deferring wrappers using microtasks.
  50312. // In 2.5 we used (macro) tasks (in combination with microtasks).
  50313. // However, it has subtle problems when state is changed right before repaint
  50314. // (e.g. #6813, out-in transitions).
  50315. // Also, using (macro) tasks in event handler would cause some weird behaviors
  50316. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  50317. // So we now use microtasks everywhere, again.
  50318. // A major drawback of this tradeoff is that there are some scenarios
  50319. // where microtasks have too high a priority and fire in between supposedly
  50320. // sequential events (e.g. #4521, #6690, which have workarounds)
  50321. // or even between bubbling of the same event (#6566).
  50322. var timerFunc;
  50323. // The nextTick behavior leverages the microtask queue, which can be accessed
  50324. // via either native Promise.then or MutationObserver.
  50325. // MutationObserver has wider support, however it is seriously bugged in
  50326. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  50327. // completely stops working after triggering a few times... so, if native
  50328. // Promise is available, we will use it:
  50329. /* istanbul ignore next, $flow-disable-line */
  50330. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  50331. var p = Promise.resolve();
  50332. timerFunc = function () {
  50333. p.then(flushCallbacks);
  50334. // In problematic UIWebViews, Promise.then doesn't completely break, but
  50335. // it can get stuck in a weird state where callbacks are pushed into the
  50336. // microtask queue but the queue isn't being flushed, until the browser
  50337. // needs to do some other work, e.g. handle a timer. Therefore we can
  50338. // "force" the microtask queue to be flushed by adding an empty timer.
  50339. if (isIOS) { setTimeout(noop); }
  50340. };
  50341. isUsingMicroTask = true;
  50342. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  50343. isNative(MutationObserver) ||
  50344. // PhantomJS and iOS 7.x
  50345. MutationObserver.toString() === '[object MutationObserverConstructor]'
  50346. )) {
  50347. // Use MutationObserver where native Promise is not available,
  50348. // e.g. PhantomJS, iOS7, Android 4.4
  50349. // (#6466 MutationObserver is unreliable in IE11)
  50350. var counter = 1;
  50351. var observer = new MutationObserver(flushCallbacks);
  50352. var textNode = document.createTextNode(String(counter));
  50353. observer.observe(textNode, {
  50354. characterData: true
  50355. });
  50356. timerFunc = function () {
  50357. counter = (counter + 1) % 2;
  50358. textNode.data = String(counter);
  50359. };
  50360. isUsingMicroTask = true;
  50361. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  50362. // Fallback to setImmediate.
  50363. // Technically it leverages the (macro) task queue,
  50364. // but it is still a better choice than setTimeout.
  50365. timerFunc = function () {
  50366. setImmediate(flushCallbacks);
  50367. };
  50368. } else {
  50369. // Fallback to setTimeout.
  50370. timerFunc = function () {
  50371. setTimeout(flushCallbacks, 0);
  50372. };
  50373. }
  50374. function nextTick (cb, ctx) {
  50375. var _resolve;
  50376. callbacks.push(function () {
  50377. if (cb) {
  50378. try {
  50379. cb.call(ctx);
  50380. } catch (e) {
  50381. handleError(e, ctx, 'nextTick');
  50382. }
  50383. } else if (_resolve) {
  50384. _resolve(ctx);
  50385. }
  50386. });
  50387. if (!pending) {
  50388. pending = true;
  50389. timerFunc();
  50390. }
  50391. // $flow-disable-line
  50392. if (!cb && typeof Promise !== 'undefined') {
  50393. return new Promise(function (resolve) {
  50394. _resolve = resolve;
  50395. })
  50396. }
  50397. }
  50398. /* */
  50399. var mark;
  50400. var measure;
  50401. {
  50402. var perf = inBrowser && window.performance;
  50403. /* istanbul ignore if */
  50404. if (
  50405. perf &&
  50406. perf.mark &&
  50407. perf.measure &&
  50408. perf.clearMarks &&
  50409. perf.clearMeasures
  50410. ) {
  50411. mark = function (tag) { return perf.mark(tag); };
  50412. measure = function (name, startTag, endTag) {
  50413. perf.measure(name, startTag, endTag);
  50414. perf.clearMarks(startTag);
  50415. perf.clearMarks(endTag);
  50416. // perf.clearMeasures(name)
  50417. };
  50418. }
  50419. }
  50420. /* not type checking this file because flow doesn't play well with Proxy */
  50421. var initProxy;
  50422. {
  50423. var allowedGlobals = makeMap(
  50424. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  50425. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  50426. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  50427. 'require' // for Webpack/Browserify
  50428. );
  50429. var warnNonPresent = function (target, key) {
  50430. warn(
  50431. "Property or method \"" + key + "\" is not defined on the instance but " +
  50432. 'referenced during render. Make sure that this property is reactive, ' +
  50433. 'either in the data option, or for class-based components, by ' +
  50434. 'initializing the property. ' +
  50435. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  50436. target
  50437. );
  50438. };
  50439. var warnReservedPrefix = function (target, key) {
  50440. warn(
  50441. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  50442. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  50443. 'prevent conflicts with Vue internals. ' +
  50444. 'See: https://vuejs.org/v2/api/#data',
  50445. target
  50446. );
  50447. };
  50448. var hasProxy =
  50449. typeof Proxy !== 'undefined' && isNative(Proxy);
  50450. if (hasProxy) {
  50451. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  50452. config.keyCodes = new Proxy(config.keyCodes, {
  50453. set: function set (target, key, value) {
  50454. if (isBuiltInModifier(key)) {
  50455. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  50456. return false
  50457. } else {
  50458. target[key] = value;
  50459. return true
  50460. }
  50461. }
  50462. });
  50463. }
  50464. var hasHandler = {
  50465. has: function has (target, key) {
  50466. var has = key in target;
  50467. var isAllowed = allowedGlobals(key) ||
  50468. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  50469. if (!has && !isAllowed) {
  50470. if (key in target.$data) { warnReservedPrefix(target, key); }
  50471. else { warnNonPresent(target, key); }
  50472. }
  50473. return has || !isAllowed
  50474. }
  50475. };
  50476. var getHandler = {
  50477. get: function get (target, key) {
  50478. if (typeof key === 'string' && !(key in target)) {
  50479. if (key in target.$data) { warnReservedPrefix(target, key); }
  50480. else { warnNonPresent(target, key); }
  50481. }
  50482. return target[key]
  50483. }
  50484. };
  50485. initProxy = function initProxy (vm) {
  50486. if (hasProxy) {
  50487. // determine which proxy handler to use
  50488. var options = vm.$options;
  50489. var handlers = options.render && options.render._withStripped
  50490. ? getHandler
  50491. : hasHandler;
  50492. vm._renderProxy = new Proxy(vm, handlers);
  50493. } else {
  50494. vm._renderProxy = vm;
  50495. }
  50496. };
  50497. }
  50498. /* */
  50499. var seenObjects = new _Set();
  50500. /**
  50501. * Recursively traverse an object to evoke all converted
  50502. * getters, so that every nested property inside the object
  50503. * is collected as a "deep" dependency.
  50504. */
  50505. function traverse (val) {
  50506. _traverse(val, seenObjects);
  50507. seenObjects.clear();
  50508. }
  50509. function _traverse (val, seen) {
  50510. var i, keys;
  50511. var isA = Array.isArray(val);
  50512. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  50513. return
  50514. }
  50515. if (val.__ob__) {
  50516. var depId = val.__ob__.dep.id;
  50517. if (seen.has(depId)) {
  50518. return
  50519. }
  50520. seen.add(depId);
  50521. }
  50522. if (isA) {
  50523. i = val.length;
  50524. while (i--) { _traverse(val[i], seen); }
  50525. } else {
  50526. keys = Object.keys(val);
  50527. i = keys.length;
  50528. while (i--) { _traverse(val[keys[i]], seen); }
  50529. }
  50530. }
  50531. /* */
  50532. var normalizeEvent = cached(function (name) {
  50533. var passive = name.charAt(0) === '&';
  50534. name = passive ? name.slice(1) : name;
  50535. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  50536. name = once$$1 ? name.slice(1) : name;
  50537. var capture = name.charAt(0) === '!';
  50538. name = capture ? name.slice(1) : name;
  50539. return {
  50540. name: name,
  50541. once: once$$1,
  50542. capture: capture,
  50543. passive: passive
  50544. }
  50545. });
  50546. function createFnInvoker (fns, vm) {
  50547. function invoker () {
  50548. var arguments$1 = arguments;
  50549. var fns = invoker.fns;
  50550. if (Array.isArray(fns)) {
  50551. var cloned = fns.slice();
  50552. for (var i = 0; i < cloned.length; i++) {
  50553. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  50554. }
  50555. } else {
  50556. // return handler return value for single handlers
  50557. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  50558. }
  50559. }
  50560. invoker.fns = fns;
  50561. return invoker
  50562. }
  50563. function updateListeners (
  50564. on,
  50565. oldOn,
  50566. add,
  50567. remove$$1,
  50568. createOnceHandler,
  50569. vm
  50570. ) {
  50571. var name, def$$1, cur, old, event;
  50572. for (name in on) {
  50573. def$$1 = cur = on[name];
  50574. old = oldOn[name];
  50575. event = normalizeEvent(name);
  50576. if (isUndef(cur)) {
  50577. warn(
  50578. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  50579. vm
  50580. );
  50581. } else if (isUndef(old)) {
  50582. if (isUndef(cur.fns)) {
  50583. cur = on[name] = createFnInvoker(cur, vm);
  50584. }
  50585. if (isTrue(event.once)) {
  50586. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  50587. }
  50588. add(event.name, cur, event.capture, event.passive, event.params);
  50589. } else if (cur !== old) {
  50590. old.fns = cur;
  50591. on[name] = old;
  50592. }
  50593. }
  50594. for (name in oldOn) {
  50595. if (isUndef(on[name])) {
  50596. event = normalizeEvent(name);
  50597. remove$$1(event.name, oldOn[name], event.capture);
  50598. }
  50599. }
  50600. }
  50601. /* */
  50602. function mergeVNodeHook (def, hookKey, hook) {
  50603. if (def instanceof VNode) {
  50604. def = def.data.hook || (def.data.hook = {});
  50605. }
  50606. var invoker;
  50607. var oldHook = def[hookKey];
  50608. function wrappedHook () {
  50609. hook.apply(this, arguments);
  50610. // important: remove merged hook to ensure it's called only once
  50611. // and prevent memory leak
  50612. remove(invoker.fns, wrappedHook);
  50613. }
  50614. if (isUndef(oldHook)) {
  50615. // no existing hook
  50616. invoker = createFnInvoker([wrappedHook]);
  50617. } else {
  50618. /* istanbul ignore if */
  50619. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  50620. // already a merged invoker
  50621. invoker = oldHook;
  50622. invoker.fns.push(wrappedHook);
  50623. } else {
  50624. // existing plain hook
  50625. invoker = createFnInvoker([oldHook, wrappedHook]);
  50626. }
  50627. }
  50628. invoker.merged = true;
  50629. def[hookKey] = invoker;
  50630. }
  50631. /* */
  50632. function extractPropsFromVNodeData (
  50633. data,
  50634. Ctor,
  50635. tag
  50636. ) {
  50637. // we are only extracting raw values here.
  50638. // validation and default values are handled in the child
  50639. // component itself.
  50640. var propOptions = Ctor.options.props;
  50641. if (isUndef(propOptions)) {
  50642. return
  50643. }
  50644. var res = {};
  50645. var attrs = data.attrs;
  50646. var props = data.props;
  50647. if (isDef(attrs) || isDef(props)) {
  50648. for (var key in propOptions) {
  50649. var altKey = hyphenate(key);
  50650. {
  50651. var keyInLowerCase = key.toLowerCase();
  50652. if (
  50653. key !== keyInLowerCase &&
  50654. attrs && hasOwn(attrs, keyInLowerCase)
  50655. ) {
  50656. tip(
  50657. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  50658. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  50659. " \"" + key + "\". " +
  50660. "Note that HTML attributes are case-insensitive and camelCased " +
  50661. "props need to use their kebab-case equivalents when using in-DOM " +
  50662. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  50663. );
  50664. }
  50665. }
  50666. checkProp(res, props, key, altKey, true) ||
  50667. checkProp(res, attrs, key, altKey, false);
  50668. }
  50669. }
  50670. return res
  50671. }
  50672. function checkProp (
  50673. res,
  50674. hash,
  50675. key,
  50676. altKey,
  50677. preserve
  50678. ) {
  50679. if (isDef(hash)) {
  50680. if (hasOwn(hash, key)) {
  50681. res[key] = hash[key];
  50682. if (!preserve) {
  50683. delete hash[key];
  50684. }
  50685. return true
  50686. } else if (hasOwn(hash, altKey)) {
  50687. res[key] = hash[altKey];
  50688. if (!preserve) {
  50689. delete hash[altKey];
  50690. }
  50691. return true
  50692. }
  50693. }
  50694. return false
  50695. }
  50696. /* */
  50697. // The template compiler attempts to minimize the need for normalization by
  50698. // statically analyzing the template at compile time.
  50699. //
  50700. // For plain HTML markup, normalization can be completely skipped because the
  50701. // generated render function is guaranteed to return Array<VNode>. There are
  50702. // two cases where extra normalization is needed:
  50703. // 1. When the children contains components - because a functional component
  50704. // may return an Array instead of a single root. In this case, just a simple
  50705. // normalization is needed - if any child is an Array, we flatten the whole
  50706. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  50707. // because functional components already normalize their own children.
  50708. function simpleNormalizeChildren (children) {
  50709. for (var i = 0; i < children.length; i++) {
  50710. if (Array.isArray(children[i])) {
  50711. return Array.prototype.concat.apply([], children)
  50712. }
  50713. }
  50714. return children
  50715. }
  50716. // 2. When the children contains constructs that always generated nested Arrays,
  50717. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  50718. // with hand-written render functions / JSX. In such cases a full normalization
  50719. // is needed to cater to all possible types of children values.
  50720. function normalizeChildren (children) {
  50721. return isPrimitive(children)
  50722. ? [createTextVNode(children)]
  50723. : Array.isArray(children)
  50724. ? normalizeArrayChildren(children)
  50725. : undefined
  50726. }
  50727. function isTextNode (node) {
  50728. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  50729. }
  50730. function normalizeArrayChildren (children, nestedIndex) {
  50731. var res = [];
  50732. var i, c, lastIndex, last;
  50733. for (i = 0; i < children.length; i++) {
  50734. c = children[i];
  50735. if (isUndef(c) || typeof c === 'boolean') { continue }
  50736. lastIndex = res.length - 1;
  50737. last = res[lastIndex];
  50738. // nested
  50739. if (Array.isArray(c)) {
  50740. if (c.length > 0) {
  50741. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  50742. // merge adjacent text nodes
  50743. if (isTextNode(c[0]) && isTextNode(last)) {
  50744. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  50745. c.shift();
  50746. }
  50747. res.push.apply(res, c);
  50748. }
  50749. } else if (isPrimitive(c)) {
  50750. if (isTextNode(last)) {
  50751. // merge adjacent text nodes
  50752. // this is necessary for SSR hydration because text nodes are
  50753. // essentially merged when rendered to HTML strings
  50754. res[lastIndex] = createTextVNode(last.text + c);
  50755. } else if (c !== '') {
  50756. // convert primitive to vnode
  50757. res.push(createTextVNode(c));
  50758. }
  50759. } else {
  50760. if (isTextNode(c) && isTextNode(last)) {
  50761. // merge adjacent text nodes
  50762. res[lastIndex] = createTextVNode(last.text + c.text);
  50763. } else {
  50764. // default key for nested array children (likely generated by v-for)
  50765. if (isTrue(children._isVList) &&
  50766. isDef(c.tag) &&
  50767. isUndef(c.key) &&
  50768. isDef(nestedIndex)) {
  50769. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  50770. }
  50771. res.push(c);
  50772. }
  50773. }
  50774. }
  50775. return res
  50776. }
  50777. /* */
  50778. function initProvide (vm) {
  50779. var provide = vm.$options.provide;
  50780. if (provide) {
  50781. vm._provided = typeof provide === 'function'
  50782. ? provide.call(vm)
  50783. : provide;
  50784. }
  50785. }
  50786. function initInjections (vm) {
  50787. var result = resolveInject(vm.$options.inject, vm);
  50788. if (result) {
  50789. toggleObserving(false);
  50790. Object.keys(result).forEach(function (key) {
  50791. /* istanbul ignore else */
  50792. {
  50793. defineReactive$$1(vm, key, result[key], function () {
  50794. warn(
  50795. "Avoid mutating an injected value directly since the changes will be " +
  50796. "overwritten whenever the provided component re-renders. " +
  50797. "injection being mutated: \"" + key + "\"",
  50798. vm
  50799. );
  50800. });
  50801. }
  50802. });
  50803. toggleObserving(true);
  50804. }
  50805. }
  50806. function resolveInject (inject, vm) {
  50807. if (inject) {
  50808. // inject is :any because flow is not smart enough to figure out cached
  50809. var result = Object.create(null);
  50810. var keys = hasSymbol
  50811. ? Reflect.ownKeys(inject)
  50812. : Object.keys(inject);
  50813. for (var i = 0; i < keys.length; i++) {
  50814. var key = keys[i];
  50815. // #6574 in case the inject object is observed...
  50816. if (key === '__ob__') { continue }
  50817. var provideKey = inject[key].from;
  50818. var source = vm;
  50819. while (source) {
  50820. if (source._provided && hasOwn(source._provided, provideKey)) {
  50821. result[key] = source._provided[provideKey];
  50822. break
  50823. }
  50824. source = source.$parent;
  50825. }
  50826. if (!source) {
  50827. if ('default' in inject[key]) {
  50828. var provideDefault = inject[key].default;
  50829. result[key] = typeof provideDefault === 'function'
  50830. ? provideDefault.call(vm)
  50831. : provideDefault;
  50832. } else {
  50833. warn(("Injection \"" + key + "\" not found"), vm);
  50834. }
  50835. }
  50836. }
  50837. return result
  50838. }
  50839. }
  50840. /* */
  50841. /**
  50842. * Runtime helper for resolving raw children VNodes into a slot object.
  50843. */
  50844. function resolveSlots (
  50845. children,
  50846. context
  50847. ) {
  50848. if (!children || !children.length) {
  50849. return {}
  50850. }
  50851. var slots = {};
  50852. for (var i = 0, l = children.length; i < l; i++) {
  50853. var child = children[i];
  50854. var data = child.data;
  50855. // remove slot attribute if the node is resolved as a Vue slot node
  50856. if (data && data.attrs && data.attrs.slot) {
  50857. delete data.attrs.slot;
  50858. }
  50859. // named slots should only be respected if the vnode was rendered in the
  50860. // same context.
  50861. if ((child.context === context || child.fnContext === context) &&
  50862. data && data.slot != null
  50863. ) {
  50864. var name = data.slot;
  50865. var slot = (slots[name] || (slots[name] = []));
  50866. if (child.tag === 'template') {
  50867. slot.push.apply(slot, child.children || []);
  50868. } else {
  50869. slot.push(child);
  50870. }
  50871. } else {
  50872. (slots.default || (slots.default = [])).push(child);
  50873. }
  50874. }
  50875. // ignore slots that contains only whitespace
  50876. for (var name$1 in slots) {
  50877. if (slots[name$1].every(isWhitespace)) {
  50878. delete slots[name$1];
  50879. }
  50880. }
  50881. return slots
  50882. }
  50883. function isWhitespace (node) {
  50884. return (node.isComment && !node.asyncFactory) || node.text === ' '
  50885. }
  50886. /* */
  50887. function normalizeScopedSlots (
  50888. slots,
  50889. normalSlots,
  50890. prevSlots
  50891. ) {
  50892. var res;
  50893. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  50894. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  50895. var key = slots && slots.$key;
  50896. if (!slots) {
  50897. res = {};
  50898. } else if (slots._normalized) {
  50899. // fast path 1: child component re-render only, parent did not change
  50900. return slots._normalized
  50901. } else if (
  50902. isStable &&
  50903. prevSlots &&
  50904. prevSlots !== emptyObject &&
  50905. key === prevSlots.$key &&
  50906. !hasNormalSlots &&
  50907. !prevSlots.$hasNormal
  50908. ) {
  50909. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  50910. // only need to normalize once
  50911. return prevSlots
  50912. } else {
  50913. res = {};
  50914. for (var key$1 in slots) {
  50915. if (slots[key$1] && key$1[0] !== '$') {
  50916. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  50917. }
  50918. }
  50919. }
  50920. // expose normal slots on scopedSlots
  50921. for (var key$2 in normalSlots) {
  50922. if (!(key$2 in res)) {
  50923. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  50924. }
  50925. }
  50926. // avoriaz seems to mock a non-extensible $scopedSlots object
  50927. // and when that is passed down this would cause an error
  50928. if (slots && Object.isExtensible(slots)) {
  50929. (slots)._normalized = res;
  50930. }
  50931. def(res, '$stable', isStable);
  50932. def(res, '$key', key);
  50933. def(res, '$hasNormal', hasNormalSlots);
  50934. return res
  50935. }
  50936. function normalizeScopedSlot(normalSlots, key, fn) {
  50937. var normalized = function () {
  50938. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  50939. res = res && typeof res === 'object' && !Array.isArray(res)
  50940. ? [res] // single vnode
  50941. : normalizeChildren(res);
  50942. return res && (
  50943. res.length === 0 ||
  50944. (res.length === 1 && res[0].isComment) // #9658
  50945. ) ? undefined
  50946. : res
  50947. };
  50948. // this is a slot using the new v-slot syntax without scope. although it is
  50949. // compiled as a scoped slot, render fn users would expect it to be present
  50950. // on this.$slots because the usage is semantically a normal slot.
  50951. if (fn.proxy) {
  50952. Object.defineProperty(normalSlots, key, {
  50953. get: normalized,
  50954. enumerable: true,
  50955. configurable: true
  50956. });
  50957. }
  50958. return normalized
  50959. }
  50960. function proxyNormalSlot(slots, key) {
  50961. return function () { return slots[key]; }
  50962. }
  50963. /* */
  50964. /**
  50965. * Runtime helper for rendering v-for lists.
  50966. */
  50967. function renderList (
  50968. val,
  50969. render
  50970. ) {
  50971. var ret, i, l, keys, key;
  50972. if (Array.isArray(val) || typeof val === 'string') {
  50973. ret = new Array(val.length);
  50974. for (i = 0, l = val.length; i < l; i++) {
  50975. ret[i] = render(val[i], i);
  50976. }
  50977. } else if (typeof val === 'number') {
  50978. ret = new Array(val);
  50979. for (i = 0; i < val; i++) {
  50980. ret[i] = render(i + 1, i);
  50981. }
  50982. } else if (isObject(val)) {
  50983. if (hasSymbol && val[Symbol.iterator]) {
  50984. ret = [];
  50985. var iterator = val[Symbol.iterator]();
  50986. var result = iterator.next();
  50987. while (!result.done) {
  50988. ret.push(render(result.value, ret.length));
  50989. result = iterator.next();
  50990. }
  50991. } else {
  50992. keys = Object.keys(val);
  50993. ret = new Array(keys.length);
  50994. for (i = 0, l = keys.length; i < l; i++) {
  50995. key = keys[i];
  50996. ret[i] = render(val[key], key, i);
  50997. }
  50998. }
  50999. }
  51000. if (!isDef(ret)) {
  51001. ret = [];
  51002. }
  51003. (ret)._isVList = true;
  51004. return ret
  51005. }
  51006. /* */
  51007. /**
  51008. * Runtime helper for rendering <slot>
  51009. */
  51010. function renderSlot (
  51011. name,
  51012. fallback,
  51013. props,
  51014. bindObject
  51015. ) {
  51016. var scopedSlotFn = this.$scopedSlots[name];
  51017. var nodes;
  51018. if (scopedSlotFn) { // scoped slot
  51019. props = props || {};
  51020. if (bindObject) {
  51021. if (!isObject(bindObject)) {
  51022. warn(
  51023. 'slot v-bind without argument expects an Object',
  51024. this
  51025. );
  51026. }
  51027. props = extend(extend({}, bindObject), props);
  51028. }
  51029. nodes = scopedSlotFn(props) || fallback;
  51030. } else {
  51031. nodes = this.$slots[name] || fallback;
  51032. }
  51033. var target = props && props.slot;
  51034. if (target) {
  51035. return this.$createElement('template', { slot: target }, nodes)
  51036. } else {
  51037. return nodes
  51038. }
  51039. }
  51040. /* */
  51041. /**
  51042. * Runtime helper for resolving filters
  51043. */
  51044. function resolveFilter (id) {
  51045. return resolveAsset(this.$options, 'filters', id, true) || identity
  51046. }
  51047. /* */
  51048. function isKeyNotMatch (expect, actual) {
  51049. if (Array.isArray(expect)) {
  51050. return expect.indexOf(actual) === -1
  51051. } else {
  51052. return expect !== actual
  51053. }
  51054. }
  51055. /**
  51056. * Runtime helper for checking keyCodes from config.
  51057. * exposed as Vue.prototype._k
  51058. * passing in eventKeyName as last argument separately for backwards compat
  51059. */
  51060. function checkKeyCodes (
  51061. eventKeyCode,
  51062. key,
  51063. builtInKeyCode,
  51064. eventKeyName,
  51065. builtInKeyName
  51066. ) {
  51067. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  51068. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  51069. return isKeyNotMatch(builtInKeyName, eventKeyName)
  51070. } else if (mappedKeyCode) {
  51071. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  51072. } else if (eventKeyName) {
  51073. return hyphenate(eventKeyName) !== key
  51074. }
  51075. }
  51076. /* */
  51077. /**
  51078. * Runtime helper for merging v-bind="object" into a VNode's data.
  51079. */
  51080. function bindObjectProps (
  51081. data,
  51082. tag,
  51083. value,
  51084. asProp,
  51085. isSync
  51086. ) {
  51087. if (value) {
  51088. if (!isObject(value)) {
  51089. warn(
  51090. 'v-bind without argument expects an Object or Array value',
  51091. this
  51092. );
  51093. } else {
  51094. if (Array.isArray(value)) {
  51095. value = toObject(value);
  51096. }
  51097. var hash;
  51098. var loop = function ( key ) {
  51099. if (
  51100. key === 'class' ||
  51101. key === 'style' ||
  51102. isReservedAttribute(key)
  51103. ) {
  51104. hash = data;
  51105. } else {
  51106. var type = data.attrs && data.attrs.type;
  51107. hash = asProp || config.mustUseProp(tag, type, key)
  51108. ? data.domProps || (data.domProps = {})
  51109. : data.attrs || (data.attrs = {});
  51110. }
  51111. var camelizedKey = camelize(key);
  51112. var hyphenatedKey = hyphenate(key);
  51113. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  51114. hash[key] = value[key];
  51115. if (isSync) {
  51116. var on = data.on || (data.on = {});
  51117. on[("update:" + key)] = function ($event) {
  51118. value[key] = $event;
  51119. };
  51120. }
  51121. }
  51122. };
  51123. for (var key in value) loop( key );
  51124. }
  51125. }
  51126. return data
  51127. }
  51128. /* */
  51129. /**
  51130. * Runtime helper for rendering static trees.
  51131. */
  51132. function renderStatic (
  51133. index,
  51134. isInFor
  51135. ) {
  51136. var cached = this._staticTrees || (this._staticTrees = []);
  51137. var tree = cached[index];
  51138. // if has already-rendered static tree and not inside v-for,
  51139. // we can reuse the same tree.
  51140. if (tree && !isInFor) {
  51141. return tree
  51142. }
  51143. // otherwise, render a fresh tree.
  51144. tree = cached[index] = this.$options.staticRenderFns[index].call(
  51145. this._renderProxy,
  51146. null,
  51147. this // for render fns generated for functional component templates
  51148. );
  51149. markStatic(tree, ("__static__" + index), false);
  51150. return tree
  51151. }
  51152. /**
  51153. * Runtime helper for v-once.
  51154. * Effectively it means marking the node as static with a unique key.
  51155. */
  51156. function markOnce (
  51157. tree,
  51158. index,
  51159. key
  51160. ) {
  51161. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  51162. return tree
  51163. }
  51164. function markStatic (
  51165. tree,
  51166. key,
  51167. isOnce
  51168. ) {
  51169. if (Array.isArray(tree)) {
  51170. for (var i = 0; i < tree.length; i++) {
  51171. if (tree[i] && typeof tree[i] !== 'string') {
  51172. markStaticNode(tree[i], (key + "_" + i), isOnce);
  51173. }
  51174. }
  51175. } else {
  51176. markStaticNode(tree, key, isOnce);
  51177. }
  51178. }
  51179. function markStaticNode (node, key, isOnce) {
  51180. node.isStatic = true;
  51181. node.key = key;
  51182. node.isOnce = isOnce;
  51183. }
  51184. /* */
  51185. function bindObjectListeners (data, value) {
  51186. if (value) {
  51187. if (!isPlainObject(value)) {
  51188. warn(
  51189. 'v-on without argument expects an Object value',
  51190. this
  51191. );
  51192. } else {
  51193. var on = data.on = data.on ? extend({}, data.on) : {};
  51194. for (var key in value) {
  51195. var existing = on[key];
  51196. var ours = value[key];
  51197. on[key] = existing ? [].concat(existing, ours) : ours;
  51198. }
  51199. }
  51200. }
  51201. return data
  51202. }
  51203. /* */
  51204. function resolveScopedSlots (
  51205. fns, // see flow/vnode
  51206. res,
  51207. // the following are added in 2.6
  51208. hasDynamicKeys,
  51209. contentHashKey
  51210. ) {
  51211. res = res || { $stable: !hasDynamicKeys };
  51212. for (var i = 0; i < fns.length; i++) {
  51213. var slot = fns[i];
  51214. if (Array.isArray(slot)) {
  51215. resolveScopedSlots(slot, res, hasDynamicKeys);
  51216. } else if (slot) {
  51217. // marker for reverse proxying v-slot without scope on this.$slots
  51218. if (slot.proxy) {
  51219. slot.fn.proxy = true;
  51220. }
  51221. res[slot.key] = slot.fn;
  51222. }
  51223. }
  51224. if (contentHashKey) {
  51225. (res).$key = contentHashKey;
  51226. }
  51227. return res
  51228. }
  51229. /* */
  51230. function bindDynamicKeys (baseObj, values) {
  51231. for (var i = 0; i < values.length; i += 2) {
  51232. var key = values[i];
  51233. if (typeof key === 'string' && key) {
  51234. baseObj[values[i]] = values[i + 1];
  51235. } else if (key !== '' && key !== null) {
  51236. // null is a special value for explicitly removing a binding
  51237. warn(
  51238. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  51239. this
  51240. );
  51241. }
  51242. }
  51243. return baseObj
  51244. }
  51245. // helper to dynamically append modifier runtime markers to event names.
  51246. // ensure only append when value is already string, otherwise it will be cast
  51247. // to string and cause the type check to miss.
  51248. function prependModifier (value, symbol) {
  51249. return typeof value === 'string' ? symbol + value : value
  51250. }
  51251. /* */
  51252. function installRenderHelpers (target) {
  51253. target._o = markOnce;
  51254. target._n = toNumber;
  51255. target._s = toString;
  51256. target._l = renderList;
  51257. target._t = renderSlot;
  51258. target._q = looseEqual;
  51259. target._i = looseIndexOf;
  51260. target._m = renderStatic;
  51261. target._f = resolveFilter;
  51262. target._k = checkKeyCodes;
  51263. target._b = bindObjectProps;
  51264. target._v = createTextVNode;
  51265. target._e = createEmptyVNode;
  51266. target._u = resolveScopedSlots;
  51267. target._g = bindObjectListeners;
  51268. target._d = bindDynamicKeys;
  51269. target._p = prependModifier;
  51270. }
  51271. /* */
  51272. function FunctionalRenderContext (
  51273. data,
  51274. props,
  51275. children,
  51276. parent,
  51277. Ctor
  51278. ) {
  51279. var this$1 = this;
  51280. var options = Ctor.options;
  51281. // ensure the createElement function in functional components
  51282. // gets a unique context - this is necessary for correct named slot check
  51283. var contextVm;
  51284. if (hasOwn(parent, '_uid')) {
  51285. contextVm = Object.create(parent);
  51286. // $flow-disable-line
  51287. contextVm._original = parent;
  51288. } else {
  51289. // the context vm passed in is a functional context as well.
  51290. // in this case we want to make sure we are able to get a hold to the
  51291. // real context instance.
  51292. contextVm = parent;
  51293. // $flow-disable-line
  51294. parent = parent._original;
  51295. }
  51296. var isCompiled = isTrue(options._compiled);
  51297. var needNormalization = !isCompiled;
  51298. this.data = data;
  51299. this.props = props;
  51300. this.children = children;
  51301. this.parent = parent;
  51302. this.listeners = data.on || emptyObject;
  51303. this.injections = resolveInject(options.inject, parent);
  51304. this.slots = function () {
  51305. if (!this$1.$slots) {
  51306. normalizeScopedSlots(
  51307. data.scopedSlots,
  51308. this$1.$slots = resolveSlots(children, parent)
  51309. );
  51310. }
  51311. return this$1.$slots
  51312. };
  51313. Object.defineProperty(this, 'scopedSlots', ({
  51314. enumerable: true,
  51315. get: function get () {
  51316. return normalizeScopedSlots(data.scopedSlots, this.slots())
  51317. }
  51318. }));
  51319. // support for compiled functional template
  51320. if (isCompiled) {
  51321. // exposing $options for renderStatic()
  51322. this.$options = options;
  51323. // pre-resolve slots for renderSlot()
  51324. this.$slots = this.slots();
  51325. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  51326. }
  51327. if (options._scopeId) {
  51328. this._c = function (a, b, c, d) {
  51329. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  51330. if (vnode && !Array.isArray(vnode)) {
  51331. vnode.fnScopeId = options._scopeId;
  51332. vnode.fnContext = parent;
  51333. }
  51334. return vnode
  51335. };
  51336. } else {
  51337. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  51338. }
  51339. }
  51340. installRenderHelpers(FunctionalRenderContext.prototype);
  51341. function createFunctionalComponent (
  51342. Ctor,
  51343. propsData,
  51344. data,
  51345. contextVm,
  51346. children
  51347. ) {
  51348. var options = Ctor.options;
  51349. var props = {};
  51350. var propOptions = options.props;
  51351. if (isDef(propOptions)) {
  51352. for (var key in propOptions) {
  51353. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  51354. }
  51355. } else {
  51356. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  51357. if (isDef(data.props)) { mergeProps(props, data.props); }
  51358. }
  51359. var renderContext = new FunctionalRenderContext(
  51360. data,
  51361. props,
  51362. children,
  51363. contextVm,
  51364. Ctor
  51365. );
  51366. var vnode = options.render.call(null, renderContext._c, renderContext);
  51367. if (vnode instanceof VNode) {
  51368. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  51369. } else if (Array.isArray(vnode)) {
  51370. var vnodes = normalizeChildren(vnode) || [];
  51371. var res = new Array(vnodes.length);
  51372. for (var i = 0; i < vnodes.length; i++) {
  51373. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  51374. }
  51375. return res
  51376. }
  51377. }
  51378. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  51379. // #7817 clone node before setting fnContext, otherwise if the node is reused
  51380. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  51381. // that should not be matched to match.
  51382. var clone = cloneVNode(vnode);
  51383. clone.fnContext = contextVm;
  51384. clone.fnOptions = options;
  51385. {
  51386. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  51387. }
  51388. if (data.slot) {
  51389. (clone.data || (clone.data = {})).slot = data.slot;
  51390. }
  51391. return clone
  51392. }
  51393. function mergeProps (to, from) {
  51394. for (var key in from) {
  51395. to[camelize(key)] = from[key];
  51396. }
  51397. }
  51398. /* */
  51399. /* */
  51400. /* */
  51401. /* */
  51402. // inline hooks to be invoked on component VNodes during patch
  51403. var componentVNodeHooks = {
  51404. init: function init (vnode, hydrating) {
  51405. if (
  51406. vnode.componentInstance &&
  51407. !vnode.componentInstance._isDestroyed &&
  51408. vnode.data.keepAlive
  51409. ) {
  51410. // kept-alive components, treat as a patch
  51411. var mountedNode = vnode; // work around flow
  51412. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  51413. } else {
  51414. var child = vnode.componentInstance = createComponentInstanceForVnode(
  51415. vnode,
  51416. activeInstance
  51417. );
  51418. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  51419. }
  51420. },
  51421. prepatch: function prepatch (oldVnode, vnode) {
  51422. var options = vnode.componentOptions;
  51423. var child = vnode.componentInstance = oldVnode.componentInstance;
  51424. updateChildComponent(
  51425. child,
  51426. options.propsData, // updated props
  51427. options.listeners, // updated listeners
  51428. vnode, // new parent vnode
  51429. options.children // new children
  51430. );
  51431. },
  51432. insert: function insert (vnode) {
  51433. var context = vnode.context;
  51434. var componentInstance = vnode.componentInstance;
  51435. if (!componentInstance._isMounted) {
  51436. componentInstance._isMounted = true;
  51437. callHook(componentInstance, 'mounted');
  51438. }
  51439. if (vnode.data.keepAlive) {
  51440. if (context._isMounted) {
  51441. // vue-router#1212
  51442. // During updates, a kept-alive component's child components may
  51443. // change, so directly walking the tree here may call activated hooks
  51444. // on incorrect children. Instead we push them into a queue which will
  51445. // be processed after the whole patch process ended.
  51446. queueActivatedComponent(componentInstance);
  51447. } else {
  51448. activateChildComponent(componentInstance, true /* direct */);
  51449. }
  51450. }
  51451. },
  51452. destroy: function destroy (vnode) {
  51453. var componentInstance = vnode.componentInstance;
  51454. if (!componentInstance._isDestroyed) {
  51455. if (!vnode.data.keepAlive) {
  51456. componentInstance.$destroy();
  51457. } else {
  51458. deactivateChildComponent(componentInstance, true /* direct */);
  51459. }
  51460. }
  51461. }
  51462. };
  51463. var hooksToMerge = Object.keys(componentVNodeHooks);
  51464. function createComponent (
  51465. Ctor,
  51466. data,
  51467. context,
  51468. children,
  51469. tag
  51470. ) {
  51471. if (isUndef(Ctor)) {
  51472. return
  51473. }
  51474. var baseCtor = context.$options._base;
  51475. // plain options object: turn it into a constructor
  51476. if (isObject(Ctor)) {
  51477. Ctor = baseCtor.extend(Ctor);
  51478. }
  51479. // if at this stage it's not a constructor or an async component factory,
  51480. // reject.
  51481. if (typeof Ctor !== 'function') {
  51482. {
  51483. warn(("Invalid Component definition: " + (String(Ctor))), context);
  51484. }
  51485. return
  51486. }
  51487. // async component
  51488. var asyncFactory;
  51489. if (isUndef(Ctor.cid)) {
  51490. asyncFactory = Ctor;
  51491. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  51492. if (Ctor === undefined) {
  51493. // return a placeholder node for async component, which is rendered
  51494. // as a comment node but preserves all the raw information for the node.
  51495. // the information will be used for async server-rendering and hydration.
  51496. return createAsyncPlaceholder(
  51497. asyncFactory,
  51498. data,
  51499. context,
  51500. children,
  51501. tag
  51502. )
  51503. }
  51504. }
  51505. data = data || {};
  51506. // resolve constructor options in case global mixins are applied after
  51507. // component constructor creation
  51508. resolveConstructorOptions(Ctor);
  51509. // transform component v-model data into props & events
  51510. if (isDef(data.model)) {
  51511. transformModel(Ctor.options, data);
  51512. }
  51513. // extract props
  51514. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  51515. // functional component
  51516. if (isTrue(Ctor.options.functional)) {
  51517. return createFunctionalComponent(Ctor, propsData, data, context, children)
  51518. }
  51519. // extract listeners, since these needs to be treated as
  51520. // child component listeners instead of DOM listeners
  51521. var listeners = data.on;
  51522. // replace with listeners with .native modifier
  51523. // so it gets processed during parent component patch.
  51524. data.on = data.nativeOn;
  51525. if (isTrue(Ctor.options.abstract)) {
  51526. // abstract components do not keep anything
  51527. // other than props & listeners & slot
  51528. // work around flow
  51529. var slot = data.slot;
  51530. data = {};
  51531. if (slot) {
  51532. data.slot = slot;
  51533. }
  51534. }
  51535. // install component management hooks onto the placeholder node
  51536. installComponentHooks(data);
  51537. // return a placeholder vnode
  51538. var name = Ctor.options.name || tag;
  51539. var vnode = new VNode(
  51540. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  51541. data, undefined, undefined, undefined, context,
  51542. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  51543. asyncFactory
  51544. );
  51545. return vnode
  51546. }
  51547. function createComponentInstanceForVnode (
  51548. vnode, // we know it's MountedComponentVNode but flow doesn't
  51549. parent // activeInstance in lifecycle state
  51550. ) {
  51551. var options = {
  51552. _isComponent: true,
  51553. _parentVnode: vnode,
  51554. parent: parent
  51555. };
  51556. // check inline-template render functions
  51557. var inlineTemplate = vnode.data.inlineTemplate;
  51558. if (isDef(inlineTemplate)) {
  51559. options.render = inlineTemplate.render;
  51560. options.staticRenderFns = inlineTemplate.staticRenderFns;
  51561. }
  51562. return new vnode.componentOptions.Ctor(options)
  51563. }
  51564. function installComponentHooks (data) {
  51565. var hooks = data.hook || (data.hook = {});
  51566. for (var i = 0; i < hooksToMerge.length; i++) {
  51567. var key = hooksToMerge[i];
  51568. var existing = hooks[key];
  51569. var toMerge = componentVNodeHooks[key];
  51570. if (existing !== toMerge && !(existing && existing._merged)) {
  51571. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  51572. }
  51573. }
  51574. }
  51575. function mergeHook$1 (f1, f2) {
  51576. var merged = function (a, b) {
  51577. // flow complains about extra args which is why we use any
  51578. f1(a, b);
  51579. f2(a, b);
  51580. };
  51581. merged._merged = true;
  51582. return merged
  51583. }
  51584. // transform component v-model info (value and callback) into
  51585. // prop and event handler respectively.
  51586. function transformModel (options, data) {
  51587. var prop = (options.model && options.model.prop) || 'value';
  51588. var event = (options.model && options.model.event) || 'input'
  51589. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  51590. var on = data.on || (data.on = {});
  51591. var existing = on[event];
  51592. var callback = data.model.callback;
  51593. if (isDef(existing)) {
  51594. if (
  51595. Array.isArray(existing)
  51596. ? existing.indexOf(callback) === -1
  51597. : existing !== callback
  51598. ) {
  51599. on[event] = [callback].concat(existing);
  51600. }
  51601. } else {
  51602. on[event] = callback;
  51603. }
  51604. }
  51605. /* */
  51606. var SIMPLE_NORMALIZE = 1;
  51607. var ALWAYS_NORMALIZE = 2;
  51608. // wrapper function for providing a more flexible interface
  51609. // without getting yelled at by flow
  51610. function createElement (
  51611. context,
  51612. tag,
  51613. data,
  51614. children,
  51615. normalizationType,
  51616. alwaysNormalize
  51617. ) {
  51618. if (Array.isArray(data) || isPrimitive(data)) {
  51619. normalizationType = children;
  51620. children = data;
  51621. data = undefined;
  51622. }
  51623. if (isTrue(alwaysNormalize)) {
  51624. normalizationType = ALWAYS_NORMALIZE;
  51625. }
  51626. return _createElement(context, tag, data, children, normalizationType)
  51627. }
  51628. function _createElement (
  51629. context,
  51630. tag,
  51631. data,
  51632. children,
  51633. normalizationType
  51634. ) {
  51635. if (isDef(data) && isDef((data).__ob__)) {
  51636. warn(
  51637. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  51638. 'Always create fresh vnode data objects in each render!',
  51639. context
  51640. );
  51641. return createEmptyVNode()
  51642. }
  51643. // object syntax in v-bind
  51644. if (isDef(data) && isDef(data.is)) {
  51645. tag = data.is;
  51646. }
  51647. if (!tag) {
  51648. // in case of component :is set to falsy value
  51649. return createEmptyVNode()
  51650. }
  51651. // warn against non-primitive key
  51652. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  51653. ) {
  51654. {
  51655. warn(
  51656. 'Avoid using non-primitive value as key, ' +
  51657. 'use string/number value instead.',
  51658. context
  51659. );
  51660. }
  51661. }
  51662. // support single function children as default scoped slot
  51663. if (Array.isArray(children) &&
  51664. typeof children[0] === 'function'
  51665. ) {
  51666. data = data || {};
  51667. data.scopedSlots = { default: children[0] };
  51668. children.length = 0;
  51669. }
  51670. if (normalizationType === ALWAYS_NORMALIZE) {
  51671. children = normalizeChildren(children);
  51672. } else if (normalizationType === SIMPLE_NORMALIZE) {
  51673. children = simpleNormalizeChildren(children);
  51674. }
  51675. var vnode, ns;
  51676. if (typeof tag === 'string') {
  51677. var Ctor;
  51678. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  51679. if (config.isReservedTag(tag)) {
  51680. // platform built-in elements
  51681. if (isDef(data) && isDef(data.nativeOn)) {
  51682. warn(
  51683. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  51684. context
  51685. );
  51686. }
  51687. vnode = new VNode(
  51688. config.parsePlatformTagName(tag), data, children,
  51689. undefined, undefined, context
  51690. );
  51691. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  51692. // component
  51693. vnode = createComponent(Ctor, data, context, children, tag);
  51694. } else {
  51695. // unknown or unlisted namespaced elements
  51696. // check at runtime because it may get assigned a namespace when its
  51697. // parent normalizes children
  51698. vnode = new VNode(
  51699. tag, data, children,
  51700. undefined, undefined, context
  51701. );
  51702. }
  51703. } else {
  51704. // direct component options / constructor
  51705. vnode = createComponent(tag, data, context, children);
  51706. }
  51707. if (Array.isArray(vnode)) {
  51708. return vnode
  51709. } else if (isDef(vnode)) {
  51710. if (isDef(ns)) { applyNS(vnode, ns); }
  51711. if (isDef(data)) { registerDeepBindings(data); }
  51712. return vnode
  51713. } else {
  51714. return createEmptyVNode()
  51715. }
  51716. }
  51717. function applyNS (vnode, ns, force) {
  51718. vnode.ns = ns;
  51719. if (vnode.tag === 'foreignObject') {
  51720. // use default namespace inside foreignObject
  51721. ns = undefined;
  51722. force = true;
  51723. }
  51724. if (isDef(vnode.children)) {
  51725. for (var i = 0, l = vnode.children.length; i < l; i++) {
  51726. var child = vnode.children[i];
  51727. if (isDef(child.tag) && (
  51728. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  51729. applyNS(child, ns, force);
  51730. }
  51731. }
  51732. }
  51733. }
  51734. // ref #5318
  51735. // necessary to ensure parent re-render when deep bindings like :style and
  51736. // :class are used on slot nodes
  51737. function registerDeepBindings (data) {
  51738. if (isObject(data.style)) {
  51739. traverse(data.style);
  51740. }
  51741. if (isObject(data.class)) {
  51742. traverse(data.class);
  51743. }
  51744. }
  51745. /* */
  51746. function initRender (vm) {
  51747. vm._vnode = null; // the root of the child tree
  51748. vm._staticTrees = null; // v-once cached trees
  51749. var options = vm.$options;
  51750. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  51751. var renderContext = parentVnode && parentVnode.context;
  51752. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  51753. vm.$scopedSlots = emptyObject;
  51754. // bind the createElement fn to this instance
  51755. // so that we get proper render context inside it.
  51756. // args order: tag, data, children, normalizationType, alwaysNormalize
  51757. // internal version is used by render functions compiled from templates
  51758. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  51759. // normalization is always applied for the public version, used in
  51760. // user-written render functions.
  51761. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  51762. // $attrs & $listeners are exposed for easier HOC creation.
  51763. // they need to be reactive so that HOCs using them are always updated
  51764. var parentData = parentVnode && parentVnode.data;
  51765. /* istanbul ignore else */
  51766. {
  51767. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  51768. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  51769. }, true);
  51770. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  51771. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  51772. }, true);
  51773. }
  51774. }
  51775. var currentRenderingInstance = null;
  51776. function renderMixin (Vue) {
  51777. // install runtime convenience helpers
  51778. installRenderHelpers(Vue.prototype);
  51779. Vue.prototype.$nextTick = function (fn) {
  51780. return nextTick(fn, this)
  51781. };
  51782. Vue.prototype._render = function () {
  51783. var vm = this;
  51784. var ref = vm.$options;
  51785. var render = ref.render;
  51786. var _parentVnode = ref._parentVnode;
  51787. if (_parentVnode) {
  51788. vm.$scopedSlots = normalizeScopedSlots(
  51789. _parentVnode.data.scopedSlots,
  51790. vm.$slots,
  51791. vm.$scopedSlots
  51792. );
  51793. }
  51794. // set parent vnode. this allows render functions to have access
  51795. // to the data on the placeholder node.
  51796. vm.$vnode = _parentVnode;
  51797. // render self
  51798. var vnode;
  51799. try {
  51800. // There's no need to maintain a stack because all render fns are called
  51801. // separately from one another. Nested component's render fns are called
  51802. // when parent component is patched.
  51803. currentRenderingInstance = vm;
  51804. vnode = render.call(vm._renderProxy, vm.$createElement);
  51805. } catch (e) {
  51806. handleError(e, vm, "render");
  51807. // return error render result,
  51808. // or previous vnode to prevent render error causing blank component
  51809. /* istanbul ignore else */
  51810. if (vm.$options.renderError) {
  51811. try {
  51812. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  51813. } catch (e) {
  51814. handleError(e, vm, "renderError");
  51815. vnode = vm._vnode;
  51816. }
  51817. } else {
  51818. vnode = vm._vnode;
  51819. }
  51820. } finally {
  51821. currentRenderingInstance = null;
  51822. }
  51823. // if the returned array contains only a single node, allow it
  51824. if (Array.isArray(vnode) && vnode.length === 1) {
  51825. vnode = vnode[0];
  51826. }
  51827. // return empty vnode in case the render function errored out
  51828. if (!(vnode instanceof VNode)) {
  51829. if (Array.isArray(vnode)) {
  51830. warn(
  51831. 'Multiple root nodes returned from render function. Render function ' +
  51832. 'should return a single root node.',
  51833. vm
  51834. );
  51835. }
  51836. vnode = createEmptyVNode();
  51837. }
  51838. // set parent
  51839. vnode.parent = _parentVnode;
  51840. return vnode
  51841. };
  51842. }
  51843. /* */
  51844. function ensureCtor (comp, base) {
  51845. if (
  51846. comp.__esModule ||
  51847. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  51848. ) {
  51849. comp = comp.default;
  51850. }
  51851. return isObject(comp)
  51852. ? base.extend(comp)
  51853. : comp
  51854. }
  51855. function createAsyncPlaceholder (
  51856. factory,
  51857. data,
  51858. context,
  51859. children,
  51860. tag
  51861. ) {
  51862. var node = createEmptyVNode();
  51863. node.asyncFactory = factory;
  51864. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  51865. return node
  51866. }
  51867. function resolveAsyncComponent (
  51868. factory,
  51869. baseCtor
  51870. ) {
  51871. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  51872. return factory.errorComp
  51873. }
  51874. if (isDef(factory.resolved)) {
  51875. return factory.resolved
  51876. }
  51877. var owner = currentRenderingInstance;
  51878. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  51879. // already pending
  51880. factory.owners.push(owner);
  51881. }
  51882. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  51883. return factory.loadingComp
  51884. }
  51885. if (owner && !isDef(factory.owners)) {
  51886. var owners = factory.owners = [owner];
  51887. var sync = true;
  51888. var timerLoading = null;
  51889. var timerTimeout = null
  51890. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  51891. var forceRender = function (renderCompleted) {
  51892. for (var i = 0, l = owners.length; i < l; i++) {
  51893. (owners[i]).$forceUpdate();
  51894. }
  51895. if (renderCompleted) {
  51896. owners.length = 0;
  51897. if (timerLoading !== null) {
  51898. clearTimeout(timerLoading);
  51899. timerLoading = null;
  51900. }
  51901. if (timerTimeout !== null) {
  51902. clearTimeout(timerTimeout);
  51903. timerTimeout = null;
  51904. }
  51905. }
  51906. };
  51907. var resolve = once(function (res) {
  51908. // cache resolved
  51909. factory.resolved = ensureCtor(res, baseCtor);
  51910. // invoke callbacks only if this is not a synchronous resolve
  51911. // (async resolves are shimmed as synchronous during SSR)
  51912. if (!sync) {
  51913. forceRender(true);
  51914. } else {
  51915. owners.length = 0;
  51916. }
  51917. });
  51918. var reject = once(function (reason) {
  51919. warn(
  51920. "Failed to resolve async component: " + (String(factory)) +
  51921. (reason ? ("\nReason: " + reason) : '')
  51922. );
  51923. if (isDef(factory.errorComp)) {
  51924. factory.error = true;
  51925. forceRender(true);
  51926. }
  51927. });
  51928. var res = factory(resolve, reject);
  51929. if (isObject(res)) {
  51930. if (isPromise(res)) {
  51931. // () => Promise
  51932. if (isUndef(factory.resolved)) {
  51933. res.then(resolve, reject);
  51934. }
  51935. } else if (isPromise(res.component)) {
  51936. res.component.then(resolve, reject);
  51937. if (isDef(res.error)) {
  51938. factory.errorComp = ensureCtor(res.error, baseCtor);
  51939. }
  51940. if (isDef(res.loading)) {
  51941. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  51942. if (res.delay === 0) {
  51943. factory.loading = true;
  51944. } else {
  51945. timerLoading = setTimeout(function () {
  51946. timerLoading = null;
  51947. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  51948. factory.loading = true;
  51949. forceRender(false);
  51950. }
  51951. }, res.delay || 200);
  51952. }
  51953. }
  51954. if (isDef(res.timeout)) {
  51955. timerTimeout = setTimeout(function () {
  51956. timerTimeout = null;
  51957. if (isUndef(factory.resolved)) {
  51958. reject(
  51959. "timeout (" + (res.timeout) + "ms)"
  51960. );
  51961. }
  51962. }, res.timeout);
  51963. }
  51964. }
  51965. }
  51966. sync = false;
  51967. // return in case resolved synchronously
  51968. return factory.loading
  51969. ? factory.loadingComp
  51970. : factory.resolved
  51971. }
  51972. }
  51973. /* */
  51974. function isAsyncPlaceholder (node) {
  51975. return node.isComment && node.asyncFactory
  51976. }
  51977. /* */
  51978. function getFirstComponentChild (children) {
  51979. if (Array.isArray(children)) {
  51980. for (var i = 0; i < children.length; i++) {
  51981. var c = children[i];
  51982. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  51983. return c
  51984. }
  51985. }
  51986. }
  51987. }
  51988. /* */
  51989. /* */
  51990. function initEvents (vm) {
  51991. vm._events = Object.create(null);
  51992. vm._hasHookEvent = false;
  51993. // init parent attached events
  51994. var listeners = vm.$options._parentListeners;
  51995. if (listeners) {
  51996. updateComponentListeners(vm, listeners);
  51997. }
  51998. }
  51999. var target;
  52000. function add (event, fn) {
  52001. target.$on(event, fn);
  52002. }
  52003. function remove$1 (event, fn) {
  52004. target.$off(event, fn);
  52005. }
  52006. function createOnceHandler (event, fn) {
  52007. var _target = target;
  52008. return function onceHandler () {
  52009. var res = fn.apply(null, arguments);
  52010. if (res !== null) {
  52011. _target.$off(event, onceHandler);
  52012. }
  52013. }
  52014. }
  52015. function updateComponentListeners (
  52016. vm,
  52017. listeners,
  52018. oldListeners
  52019. ) {
  52020. target = vm;
  52021. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  52022. target = undefined;
  52023. }
  52024. function eventsMixin (Vue) {
  52025. var hookRE = /^hook:/;
  52026. Vue.prototype.$on = function (event, fn) {
  52027. var vm = this;
  52028. if (Array.isArray(event)) {
  52029. for (var i = 0, l = event.length; i < l; i++) {
  52030. vm.$on(event[i], fn);
  52031. }
  52032. } else {
  52033. (vm._events[event] || (vm._events[event] = [])).push(fn);
  52034. // optimize hook:event cost by using a boolean flag marked at registration
  52035. // instead of a hash lookup
  52036. if (hookRE.test(event)) {
  52037. vm._hasHookEvent = true;
  52038. }
  52039. }
  52040. return vm
  52041. };
  52042. Vue.prototype.$once = function (event, fn) {
  52043. var vm = this;
  52044. function on () {
  52045. vm.$off(event, on);
  52046. fn.apply(vm, arguments);
  52047. }
  52048. on.fn = fn;
  52049. vm.$on(event, on);
  52050. return vm
  52051. };
  52052. Vue.prototype.$off = function (event, fn) {
  52053. var vm = this;
  52054. // all
  52055. if (!arguments.length) {
  52056. vm._events = Object.create(null);
  52057. return vm
  52058. }
  52059. // array of events
  52060. if (Array.isArray(event)) {
  52061. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  52062. vm.$off(event[i$1], fn);
  52063. }
  52064. return vm
  52065. }
  52066. // specific event
  52067. var cbs = vm._events[event];
  52068. if (!cbs) {
  52069. return vm
  52070. }
  52071. if (!fn) {
  52072. vm._events[event] = null;
  52073. return vm
  52074. }
  52075. // specific handler
  52076. var cb;
  52077. var i = cbs.length;
  52078. while (i--) {
  52079. cb = cbs[i];
  52080. if (cb === fn || cb.fn === fn) {
  52081. cbs.splice(i, 1);
  52082. break
  52083. }
  52084. }
  52085. return vm
  52086. };
  52087. Vue.prototype.$emit = function (event) {
  52088. var vm = this;
  52089. {
  52090. var lowerCaseEvent = event.toLowerCase();
  52091. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  52092. tip(
  52093. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  52094. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  52095. "Note that HTML attributes are case-insensitive and you cannot use " +
  52096. "v-on to listen to camelCase events when using in-DOM templates. " +
  52097. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  52098. );
  52099. }
  52100. }
  52101. var cbs = vm._events[event];
  52102. if (cbs) {
  52103. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  52104. var args = toArray(arguments, 1);
  52105. var info = "event handler for \"" + event + "\"";
  52106. for (var i = 0, l = cbs.length; i < l; i++) {
  52107. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  52108. }
  52109. }
  52110. return vm
  52111. };
  52112. }
  52113. /* */
  52114. var activeInstance = null;
  52115. var isUpdatingChildComponent = false;
  52116. function setActiveInstance(vm) {
  52117. var prevActiveInstance = activeInstance;
  52118. activeInstance = vm;
  52119. return function () {
  52120. activeInstance = prevActiveInstance;
  52121. }
  52122. }
  52123. function initLifecycle (vm) {
  52124. var options = vm.$options;
  52125. // locate first non-abstract parent
  52126. var parent = options.parent;
  52127. if (parent && !options.abstract) {
  52128. while (parent.$options.abstract && parent.$parent) {
  52129. parent = parent.$parent;
  52130. }
  52131. parent.$children.push(vm);
  52132. }
  52133. vm.$parent = parent;
  52134. vm.$root = parent ? parent.$root : vm;
  52135. vm.$children = [];
  52136. vm.$refs = {};
  52137. vm._watcher = null;
  52138. vm._inactive = null;
  52139. vm._directInactive = false;
  52140. vm._isMounted = false;
  52141. vm._isDestroyed = false;
  52142. vm._isBeingDestroyed = false;
  52143. }
  52144. function lifecycleMixin (Vue) {
  52145. Vue.prototype._update = function (vnode, hydrating) {
  52146. var vm = this;
  52147. var prevEl = vm.$el;
  52148. var prevVnode = vm._vnode;
  52149. var restoreActiveInstance = setActiveInstance(vm);
  52150. vm._vnode = vnode;
  52151. // Vue.prototype.__patch__ is injected in entry points
  52152. // based on the rendering backend used.
  52153. if (!prevVnode) {
  52154. // initial render
  52155. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  52156. } else {
  52157. // updates
  52158. vm.$el = vm.__patch__(prevVnode, vnode);
  52159. }
  52160. restoreActiveInstance();
  52161. // update __vue__ reference
  52162. if (prevEl) {
  52163. prevEl.__vue__ = null;
  52164. }
  52165. if (vm.$el) {
  52166. vm.$el.__vue__ = vm;
  52167. }
  52168. // if parent is an HOC, update its $el as well
  52169. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  52170. vm.$parent.$el = vm.$el;
  52171. }
  52172. // updated hook is called by the scheduler to ensure that children are
  52173. // updated in a parent's updated hook.
  52174. };
  52175. Vue.prototype.$forceUpdate = function () {
  52176. var vm = this;
  52177. if (vm._watcher) {
  52178. vm._watcher.update();
  52179. }
  52180. };
  52181. Vue.prototype.$destroy = function () {
  52182. var vm = this;
  52183. if (vm._isBeingDestroyed) {
  52184. return
  52185. }
  52186. callHook(vm, 'beforeDestroy');
  52187. vm._isBeingDestroyed = true;
  52188. // remove self from parent
  52189. var parent = vm.$parent;
  52190. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  52191. remove(parent.$children, vm);
  52192. }
  52193. // teardown watchers
  52194. if (vm._watcher) {
  52195. vm._watcher.teardown();
  52196. }
  52197. var i = vm._watchers.length;
  52198. while (i--) {
  52199. vm._watchers[i].teardown();
  52200. }
  52201. // remove reference from data ob
  52202. // frozen object may not have observer.
  52203. if (vm._data.__ob__) {
  52204. vm._data.__ob__.vmCount--;
  52205. }
  52206. // call the last hook...
  52207. vm._isDestroyed = true;
  52208. // invoke destroy hooks on current rendered tree
  52209. vm.__patch__(vm._vnode, null);
  52210. // fire destroyed hook
  52211. callHook(vm, 'destroyed');
  52212. // turn off all instance listeners.
  52213. vm.$off();
  52214. // remove __vue__ reference
  52215. if (vm.$el) {
  52216. vm.$el.__vue__ = null;
  52217. }
  52218. // release circular reference (#6759)
  52219. if (vm.$vnode) {
  52220. vm.$vnode.parent = null;
  52221. }
  52222. };
  52223. }
  52224. function mountComponent (
  52225. vm,
  52226. el,
  52227. hydrating
  52228. ) {
  52229. vm.$el = el;
  52230. if (!vm.$options.render) {
  52231. vm.$options.render = createEmptyVNode;
  52232. {
  52233. /* istanbul ignore if */
  52234. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  52235. vm.$options.el || el) {
  52236. warn(
  52237. 'You are using the runtime-only build of Vue where the template ' +
  52238. 'compiler is not available. Either pre-compile the templates into ' +
  52239. 'render functions, or use the compiler-included build.',
  52240. vm
  52241. );
  52242. } else {
  52243. warn(
  52244. 'Failed to mount component: template or render function not defined.',
  52245. vm
  52246. );
  52247. }
  52248. }
  52249. }
  52250. callHook(vm, 'beforeMount');
  52251. var updateComponent;
  52252. /* istanbul ignore if */
  52253. if (config.performance && mark) {
  52254. updateComponent = function () {
  52255. var name = vm._name;
  52256. var id = vm._uid;
  52257. var startTag = "vue-perf-start:" + id;
  52258. var endTag = "vue-perf-end:" + id;
  52259. mark(startTag);
  52260. var vnode = vm._render();
  52261. mark(endTag);
  52262. measure(("vue " + name + " render"), startTag, endTag);
  52263. mark(startTag);
  52264. vm._update(vnode, hydrating);
  52265. mark(endTag);
  52266. measure(("vue " + name + " patch"), startTag, endTag);
  52267. };
  52268. } else {
  52269. updateComponent = function () {
  52270. vm._update(vm._render(), hydrating);
  52271. };
  52272. }
  52273. // we set this to vm._watcher inside the watcher's constructor
  52274. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  52275. // component's mounted hook), which relies on vm._watcher being already defined
  52276. new Watcher(vm, updateComponent, noop, {
  52277. before: function before () {
  52278. if (vm._isMounted && !vm._isDestroyed) {
  52279. callHook(vm, 'beforeUpdate');
  52280. }
  52281. }
  52282. }, true /* isRenderWatcher */);
  52283. hydrating = false;
  52284. // manually mounted instance, call mounted on self
  52285. // mounted is called for render-created child components in its inserted hook
  52286. if (vm.$vnode == null) {
  52287. vm._isMounted = true;
  52288. callHook(vm, 'mounted');
  52289. }
  52290. return vm
  52291. }
  52292. function updateChildComponent (
  52293. vm,
  52294. propsData,
  52295. listeners,
  52296. parentVnode,
  52297. renderChildren
  52298. ) {
  52299. {
  52300. isUpdatingChildComponent = true;
  52301. }
  52302. // determine whether component has slot children
  52303. // we need to do this before overwriting $options._renderChildren.
  52304. // check if there are dynamic scopedSlots (hand-written or compiled but with
  52305. // dynamic slot names). Static scoped slots compiled from template has the
  52306. // "$stable" marker.
  52307. var newScopedSlots = parentVnode.data.scopedSlots;
  52308. var oldScopedSlots = vm.$scopedSlots;
  52309. var hasDynamicScopedSlot = !!(
  52310. (newScopedSlots && !newScopedSlots.$stable) ||
  52311. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  52312. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  52313. );
  52314. // Any static slot children from the parent may have changed during parent's
  52315. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  52316. // update is necessary to ensure correctness.
  52317. var needsForceUpdate = !!(
  52318. renderChildren || // has new static slots
  52319. vm.$options._renderChildren || // has old static slots
  52320. hasDynamicScopedSlot
  52321. );
  52322. vm.$options._parentVnode = parentVnode;
  52323. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  52324. if (vm._vnode) { // update child tree's parent
  52325. vm._vnode.parent = parentVnode;
  52326. }
  52327. vm.$options._renderChildren = renderChildren;
  52328. // update $attrs and $listeners hash
  52329. // these are also reactive so they may trigger child update if the child
  52330. // used them during render
  52331. vm.$attrs = parentVnode.data.attrs || emptyObject;
  52332. vm.$listeners = listeners || emptyObject;
  52333. // update props
  52334. if (propsData && vm.$options.props) {
  52335. toggleObserving(false);
  52336. var props = vm._props;
  52337. var propKeys = vm.$options._propKeys || [];
  52338. for (var i = 0; i < propKeys.length; i++) {
  52339. var key = propKeys[i];
  52340. var propOptions = vm.$options.props; // wtf flow?
  52341. props[key] = validateProp(key, propOptions, propsData, vm);
  52342. }
  52343. toggleObserving(true);
  52344. // keep a copy of raw propsData
  52345. vm.$options.propsData = propsData;
  52346. }
  52347. // update listeners
  52348. listeners = listeners || emptyObject;
  52349. var oldListeners = vm.$options._parentListeners;
  52350. vm.$options._parentListeners = listeners;
  52351. updateComponentListeners(vm, listeners, oldListeners);
  52352. // resolve slots + force update if has children
  52353. if (needsForceUpdate) {
  52354. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  52355. vm.$forceUpdate();
  52356. }
  52357. {
  52358. isUpdatingChildComponent = false;
  52359. }
  52360. }
  52361. function isInInactiveTree (vm) {
  52362. while (vm && (vm = vm.$parent)) {
  52363. if (vm._inactive) { return true }
  52364. }
  52365. return false
  52366. }
  52367. function activateChildComponent (vm, direct) {
  52368. if (direct) {
  52369. vm._directInactive = false;
  52370. if (isInInactiveTree(vm)) {
  52371. return
  52372. }
  52373. } else if (vm._directInactive) {
  52374. return
  52375. }
  52376. if (vm._inactive || vm._inactive === null) {
  52377. vm._inactive = false;
  52378. for (var i = 0; i < vm.$children.length; i++) {
  52379. activateChildComponent(vm.$children[i]);
  52380. }
  52381. callHook(vm, 'activated');
  52382. }
  52383. }
  52384. function deactivateChildComponent (vm, direct) {
  52385. if (direct) {
  52386. vm._directInactive = true;
  52387. if (isInInactiveTree(vm)) {
  52388. return
  52389. }
  52390. }
  52391. if (!vm._inactive) {
  52392. vm._inactive = true;
  52393. for (var i = 0; i < vm.$children.length; i++) {
  52394. deactivateChildComponent(vm.$children[i]);
  52395. }
  52396. callHook(vm, 'deactivated');
  52397. }
  52398. }
  52399. function callHook (vm, hook) {
  52400. // #7573 disable dep collection when invoking lifecycle hooks
  52401. pushTarget();
  52402. var handlers = vm.$options[hook];
  52403. var info = hook + " hook";
  52404. if (handlers) {
  52405. for (var i = 0, j = handlers.length; i < j; i++) {
  52406. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  52407. }
  52408. }
  52409. if (vm._hasHookEvent) {
  52410. vm.$emit('hook:' + hook);
  52411. }
  52412. popTarget();
  52413. }
  52414. /* */
  52415. var MAX_UPDATE_COUNT = 100;
  52416. var queue = [];
  52417. var activatedChildren = [];
  52418. var has = {};
  52419. var circular = {};
  52420. var waiting = false;
  52421. var flushing = false;
  52422. var index = 0;
  52423. /**
  52424. * Reset the scheduler's state.
  52425. */
  52426. function resetSchedulerState () {
  52427. index = queue.length = activatedChildren.length = 0;
  52428. has = {};
  52429. {
  52430. circular = {};
  52431. }
  52432. waiting = flushing = false;
  52433. }
  52434. // Async edge case #6566 requires saving the timestamp when event listeners are
  52435. // attached. However, calling performance.now() has a perf overhead especially
  52436. // if the page has thousands of event listeners. Instead, we take a timestamp
  52437. // every time the scheduler flushes and use that for all event listeners
  52438. // attached during that flush.
  52439. var currentFlushTimestamp = 0;
  52440. // Async edge case fix requires storing an event listener's attach timestamp.
  52441. var getNow = Date.now;
  52442. // Determine what event timestamp the browser is using. Annoyingly, the
  52443. // timestamp can either be hi-res (relative to page load) or low-res
  52444. // (relative to UNIX epoch), so in order to compare time we have to use the
  52445. // same timestamp type when saving the flush timestamp.
  52446. // All IE versions use low-res event timestamps, and have problematic clock
  52447. // implementations (#9632)
  52448. if (inBrowser && !isIE) {
  52449. var performance = window.performance;
  52450. if (
  52451. performance &&
  52452. typeof performance.now === 'function' &&
  52453. getNow() > document.createEvent('Event').timeStamp
  52454. ) {
  52455. // if the event timestamp, although evaluated AFTER the Date.now(), is
  52456. // smaller than it, it means the event is using a hi-res timestamp,
  52457. // and we need to use the hi-res version for event listener timestamps as
  52458. // well.
  52459. getNow = function () { return performance.now(); };
  52460. }
  52461. }
  52462. /**
  52463. * Flush both queues and run the watchers.
  52464. */
  52465. function flushSchedulerQueue () {
  52466. currentFlushTimestamp = getNow();
  52467. flushing = true;
  52468. var watcher, id;
  52469. // Sort queue before flush.
  52470. // This ensures that:
  52471. // 1. Components are updated from parent to child. (because parent is always
  52472. // created before the child)
  52473. // 2. A component's user watchers are run before its render watcher (because
  52474. // user watchers are created before the render watcher)
  52475. // 3. If a component is destroyed during a parent component's watcher run,
  52476. // its watchers can be skipped.
  52477. queue.sort(function (a, b) { return a.id - b.id; });
  52478. // do not cache length because more watchers might be pushed
  52479. // as we run existing watchers
  52480. for (index = 0; index < queue.length; index++) {
  52481. watcher = queue[index];
  52482. if (watcher.before) {
  52483. watcher.before();
  52484. }
  52485. id = watcher.id;
  52486. has[id] = null;
  52487. watcher.run();
  52488. // in dev build, check and stop circular updates.
  52489. if (has[id] != null) {
  52490. circular[id] = (circular[id] || 0) + 1;
  52491. if (circular[id] > MAX_UPDATE_COUNT) {
  52492. warn(
  52493. 'You may have an infinite update loop ' + (
  52494. watcher.user
  52495. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  52496. : "in a component render function."
  52497. ),
  52498. watcher.vm
  52499. );
  52500. break
  52501. }
  52502. }
  52503. }
  52504. // keep copies of post queues before resetting state
  52505. var activatedQueue = activatedChildren.slice();
  52506. var updatedQueue = queue.slice();
  52507. resetSchedulerState();
  52508. // call component updated and activated hooks
  52509. callActivatedHooks(activatedQueue);
  52510. callUpdatedHooks(updatedQueue);
  52511. // devtool hook
  52512. /* istanbul ignore if */
  52513. if (devtools && config.devtools) {
  52514. devtools.emit('flush');
  52515. }
  52516. }
  52517. function callUpdatedHooks (queue) {
  52518. var i = queue.length;
  52519. while (i--) {
  52520. var watcher = queue[i];
  52521. var vm = watcher.vm;
  52522. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  52523. callHook(vm, 'updated');
  52524. }
  52525. }
  52526. }
  52527. /**
  52528. * Queue a kept-alive component that was activated during patch.
  52529. * The queue will be processed after the entire tree has been patched.
  52530. */
  52531. function queueActivatedComponent (vm) {
  52532. // setting _inactive to false here so that a render function can
  52533. // rely on checking whether it's in an inactive tree (e.g. router-view)
  52534. vm._inactive = false;
  52535. activatedChildren.push(vm);
  52536. }
  52537. function callActivatedHooks (queue) {
  52538. for (var i = 0; i < queue.length; i++) {
  52539. queue[i]._inactive = true;
  52540. activateChildComponent(queue[i], true /* true */);
  52541. }
  52542. }
  52543. /**
  52544. * Push a watcher into the watcher queue.
  52545. * Jobs with duplicate IDs will be skipped unless it's
  52546. * pushed when the queue is being flushed.
  52547. */
  52548. function queueWatcher (watcher) {
  52549. var id = watcher.id;
  52550. if (has[id] == null) {
  52551. has[id] = true;
  52552. if (!flushing) {
  52553. queue.push(watcher);
  52554. } else {
  52555. // if already flushing, splice the watcher based on its id
  52556. // if already past its id, it will be run next immediately.
  52557. var i = queue.length - 1;
  52558. while (i > index && queue[i].id > watcher.id) {
  52559. i--;
  52560. }
  52561. queue.splice(i + 1, 0, watcher);
  52562. }
  52563. // queue the flush
  52564. if (!waiting) {
  52565. waiting = true;
  52566. if (!config.async) {
  52567. flushSchedulerQueue();
  52568. return
  52569. }
  52570. nextTick(flushSchedulerQueue);
  52571. }
  52572. }
  52573. }
  52574. /* */
  52575. var uid$2 = 0;
  52576. /**
  52577. * A watcher parses an expression, collects dependencies,
  52578. * and fires callback when the expression value changes.
  52579. * This is used for both the $watch() api and directives.
  52580. */
  52581. var Watcher = function Watcher (
  52582. vm,
  52583. expOrFn,
  52584. cb,
  52585. options,
  52586. isRenderWatcher
  52587. ) {
  52588. this.vm = vm;
  52589. if (isRenderWatcher) {
  52590. vm._watcher = this;
  52591. }
  52592. vm._watchers.push(this);
  52593. // options
  52594. if (options) {
  52595. this.deep = !!options.deep;
  52596. this.user = !!options.user;
  52597. this.lazy = !!options.lazy;
  52598. this.sync = !!options.sync;
  52599. this.before = options.before;
  52600. } else {
  52601. this.deep = this.user = this.lazy = this.sync = false;
  52602. }
  52603. this.cb = cb;
  52604. this.id = ++uid$2; // uid for batching
  52605. this.active = true;
  52606. this.dirty = this.lazy; // for lazy watchers
  52607. this.deps = [];
  52608. this.newDeps = [];
  52609. this.depIds = new _Set();
  52610. this.newDepIds = new _Set();
  52611. this.expression = expOrFn.toString();
  52612. // parse expression for getter
  52613. if (typeof expOrFn === 'function') {
  52614. this.getter = expOrFn;
  52615. } else {
  52616. this.getter = parsePath(expOrFn);
  52617. if (!this.getter) {
  52618. this.getter = noop;
  52619. warn(
  52620. "Failed watching path: \"" + expOrFn + "\" " +
  52621. 'Watcher only accepts simple dot-delimited paths. ' +
  52622. 'For full control, use a function instead.',
  52623. vm
  52624. );
  52625. }
  52626. }
  52627. this.value = this.lazy
  52628. ? undefined
  52629. : this.get();
  52630. };
  52631. /**
  52632. * Evaluate the getter, and re-collect dependencies.
  52633. */
  52634. Watcher.prototype.get = function get () {
  52635. pushTarget(this);
  52636. var value;
  52637. var vm = this.vm;
  52638. try {
  52639. value = this.getter.call(vm, vm);
  52640. } catch (e) {
  52641. if (this.user) {
  52642. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  52643. } else {
  52644. throw e
  52645. }
  52646. } finally {
  52647. // "touch" every property so they are all tracked as
  52648. // dependencies for deep watching
  52649. if (this.deep) {
  52650. traverse(value);
  52651. }
  52652. popTarget();
  52653. this.cleanupDeps();
  52654. }
  52655. return value
  52656. };
  52657. /**
  52658. * Add a dependency to this directive.
  52659. */
  52660. Watcher.prototype.addDep = function addDep (dep) {
  52661. var id = dep.id;
  52662. if (!this.newDepIds.has(id)) {
  52663. this.newDepIds.add(id);
  52664. this.newDeps.push(dep);
  52665. if (!this.depIds.has(id)) {
  52666. dep.addSub(this);
  52667. }
  52668. }
  52669. };
  52670. /**
  52671. * Clean up for dependency collection.
  52672. */
  52673. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  52674. var i = this.deps.length;
  52675. while (i--) {
  52676. var dep = this.deps[i];
  52677. if (!this.newDepIds.has(dep.id)) {
  52678. dep.removeSub(this);
  52679. }
  52680. }
  52681. var tmp = this.depIds;
  52682. this.depIds = this.newDepIds;
  52683. this.newDepIds = tmp;
  52684. this.newDepIds.clear();
  52685. tmp = this.deps;
  52686. this.deps = this.newDeps;
  52687. this.newDeps = tmp;
  52688. this.newDeps.length = 0;
  52689. };
  52690. /**
  52691. * Subscriber interface.
  52692. * Will be called when a dependency changes.
  52693. */
  52694. Watcher.prototype.update = function update () {
  52695. /* istanbul ignore else */
  52696. if (this.lazy) {
  52697. this.dirty = true;
  52698. } else if (this.sync) {
  52699. this.run();
  52700. } else {
  52701. queueWatcher(this);
  52702. }
  52703. };
  52704. /**
  52705. * Scheduler job interface.
  52706. * Will be called by the scheduler.
  52707. */
  52708. Watcher.prototype.run = function run () {
  52709. if (this.active) {
  52710. var value = this.get();
  52711. if (
  52712. value !== this.value ||
  52713. // Deep watchers and watchers on Object/Arrays should fire even
  52714. // when the value is the same, because the value may
  52715. // have mutated.
  52716. isObject(value) ||
  52717. this.deep
  52718. ) {
  52719. // set new value
  52720. var oldValue = this.value;
  52721. this.value = value;
  52722. if (this.user) {
  52723. try {
  52724. this.cb.call(this.vm, value, oldValue);
  52725. } catch (e) {
  52726. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  52727. }
  52728. } else {
  52729. this.cb.call(this.vm, value, oldValue);
  52730. }
  52731. }
  52732. }
  52733. };
  52734. /**
  52735. * Evaluate the value of the watcher.
  52736. * This only gets called for lazy watchers.
  52737. */
  52738. Watcher.prototype.evaluate = function evaluate () {
  52739. this.value = this.get();
  52740. this.dirty = false;
  52741. };
  52742. /**
  52743. * Depend on all deps collected by this watcher.
  52744. */
  52745. Watcher.prototype.depend = function depend () {
  52746. var i = this.deps.length;
  52747. while (i--) {
  52748. this.deps[i].depend();
  52749. }
  52750. };
  52751. /**
  52752. * Remove self from all dependencies' subscriber list.
  52753. */
  52754. Watcher.prototype.teardown = function teardown () {
  52755. if (this.active) {
  52756. // remove self from vm's watcher list
  52757. // this is a somewhat expensive operation so we skip it
  52758. // if the vm is being destroyed.
  52759. if (!this.vm._isBeingDestroyed) {
  52760. remove(this.vm._watchers, this);
  52761. }
  52762. var i = this.deps.length;
  52763. while (i--) {
  52764. this.deps[i].removeSub(this);
  52765. }
  52766. this.active = false;
  52767. }
  52768. };
  52769. /* */
  52770. var sharedPropertyDefinition = {
  52771. enumerable: true,
  52772. configurable: true,
  52773. get: noop,
  52774. set: noop
  52775. };
  52776. function proxy (target, sourceKey, key) {
  52777. sharedPropertyDefinition.get = function proxyGetter () {
  52778. return this[sourceKey][key]
  52779. };
  52780. sharedPropertyDefinition.set = function proxySetter (val) {
  52781. this[sourceKey][key] = val;
  52782. };
  52783. Object.defineProperty(target, key, sharedPropertyDefinition);
  52784. }
  52785. function initState (vm) {
  52786. vm._watchers = [];
  52787. var opts = vm.$options;
  52788. if (opts.props) { initProps(vm, opts.props); }
  52789. if (opts.methods) { initMethods(vm, opts.methods); }
  52790. if (opts.data) {
  52791. initData(vm);
  52792. } else {
  52793. observe(vm._data = {}, true /* asRootData */);
  52794. }
  52795. if (opts.computed) { initComputed(vm, opts.computed); }
  52796. if (opts.watch && opts.watch !== nativeWatch) {
  52797. initWatch(vm, opts.watch);
  52798. }
  52799. }
  52800. function initProps (vm, propsOptions) {
  52801. var propsData = vm.$options.propsData || {};
  52802. var props = vm._props = {};
  52803. // cache prop keys so that future props updates can iterate using Array
  52804. // instead of dynamic object key enumeration.
  52805. var keys = vm.$options._propKeys = [];
  52806. var isRoot = !vm.$parent;
  52807. // root instance props should be converted
  52808. if (!isRoot) {
  52809. toggleObserving(false);
  52810. }
  52811. var loop = function ( key ) {
  52812. keys.push(key);
  52813. var value = validateProp(key, propsOptions, propsData, vm);
  52814. /* istanbul ignore else */
  52815. {
  52816. var hyphenatedKey = hyphenate(key);
  52817. if (isReservedAttribute(hyphenatedKey) ||
  52818. config.isReservedAttr(hyphenatedKey)) {
  52819. warn(
  52820. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  52821. vm
  52822. );
  52823. }
  52824. defineReactive$$1(props, key, value, function () {
  52825. if (!isRoot && !isUpdatingChildComponent) {
  52826. warn(
  52827. "Avoid mutating a prop directly since the value will be " +
  52828. "overwritten whenever the parent component re-renders. " +
  52829. "Instead, use a data or computed property based on the prop's " +
  52830. "value. Prop being mutated: \"" + key + "\"",
  52831. vm
  52832. );
  52833. }
  52834. });
  52835. }
  52836. // static props are already proxied on the component's prototype
  52837. // during Vue.extend(). We only need to proxy props defined at
  52838. // instantiation here.
  52839. if (!(key in vm)) {
  52840. proxy(vm, "_props", key);
  52841. }
  52842. };
  52843. for (var key in propsOptions) loop( key );
  52844. toggleObserving(true);
  52845. }
  52846. function initData (vm) {
  52847. var data = vm.$options.data;
  52848. data = vm._data = typeof data === 'function'
  52849. ? getData(data, vm)
  52850. : data || {};
  52851. if (!isPlainObject(data)) {
  52852. data = {};
  52853. warn(
  52854. 'data functions should return an object:\n' +
  52855. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  52856. vm
  52857. );
  52858. }
  52859. // proxy data on instance
  52860. var keys = Object.keys(data);
  52861. var props = vm.$options.props;
  52862. var methods = vm.$options.methods;
  52863. var i = keys.length;
  52864. while (i--) {
  52865. var key = keys[i];
  52866. {
  52867. if (methods && hasOwn(methods, key)) {
  52868. warn(
  52869. ("Method \"" + key + "\" has already been defined as a data property."),
  52870. vm
  52871. );
  52872. }
  52873. }
  52874. if (props && hasOwn(props, key)) {
  52875. warn(
  52876. "The data property \"" + key + "\" is already declared as a prop. " +
  52877. "Use prop default value instead.",
  52878. vm
  52879. );
  52880. } else if (!isReserved(key)) {
  52881. proxy(vm, "_data", key);
  52882. }
  52883. }
  52884. // observe data
  52885. observe(data, true /* asRootData */);
  52886. }
  52887. function getData (data, vm) {
  52888. // #7573 disable dep collection when invoking data getters
  52889. pushTarget();
  52890. try {
  52891. return data.call(vm, vm)
  52892. } catch (e) {
  52893. handleError(e, vm, "data()");
  52894. return {}
  52895. } finally {
  52896. popTarget();
  52897. }
  52898. }
  52899. var computedWatcherOptions = { lazy: true };
  52900. function initComputed (vm, computed) {
  52901. // $flow-disable-line
  52902. var watchers = vm._computedWatchers = Object.create(null);
  52903. // computed properties are just getters during SSR
  52904. var isSSR = isServerRendering();
  52905. for (var key in computed) {
  52906. var userDef = computed[key];
  52907. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  52908. if (getter == null) {
  52909. warn(
  52910. ("Getter is missing for computed property \"" + key + "\"."),
  52911. vm
  52912. );
  52913. }
  52914. if (!isSSR) {
  52915. // create internal watcher for the computed property.
  52916. watchers[key] = new Watcher(
  52917. vm,
  52918. getter || noop,
  52919. noop,
  52920. computedWatcherOptions
  52921. );
  52922. }
  52923. // component-defined computed properties are already defined on the
  52924. // component prototype. We only need to define computed properties defined
  52925. // at instantiation here.
  52926. if (!(key in vm)) {
  52927. defineComputed(vm, key, userDef);
  52928. } else {
  52929. if (key in vm.$data) {
  52930. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  52931. } else if (vm.$options.props && key in vm.$options.props) {
  52932. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  52933. }
  52934. }
  52935. }
  52936. }
  52937. function defineComputed (
  52938. target,
  52939. key,
  52940. userDef
  52941. ) {
  52942. var shouldCache = !isServerRendering();
  52943. if (typeof userDef === 'function') {
  52944. sharedPropertyDefinition.get = shouldCache
  52945. ? createComputedGetter(key)
  52946. : createGetterInvoker(userDef);
  52947. sharedPropertyDefinition.set = noop;
  52948. } else {
  52949. sharedPropertyDefinition.get = userDef.get
  52950. ? shouldCache && userDef.cache !== false
  52951. ? createComputedGetter(key)
  52952. : createGetterInvoker(userDef.get)
  52953. : noop;
  52954. sharedPropertyDefinition.set = userDef.set || noop;
  52955. }
  52956. if (sharedPropertyDefinition.set === noop) {
  52957. sharedPropertyDefinition.set = function () {
  52958. warn(
  52959. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  52960. this
  52961. );
  52962. };
  52963. }
  52964. Object.defineProperty(target, key, sharedPropertyDefinition);
  52965. }
  52966. function createComputedGetter (key) {
  52967. return function computedGetter () {
  52968. var watcher = this._computedWatchers && this._computedWatchers[key];
  52969. if (watcher) {
  52970. if (watcher.dirty) {
  52971. watcher.evaluate();
  52972. }
  52973. if (Dep.target) {
  52974. watcher.depend();
  52975. }
  52976. return watcher.value
  52977. }
  52978. }
  52979. }
  52980. function createGetterInvoker(fn) {
  52981. return function computedGetter () {
  52982. return fn.call(this, this)
  52983. }
  52984. }
  52985. function initMethods (vm, methods) {
  52986. var props = vm.$options.props;
  52987. for (var key in methods) {
  52988. {
  52989. if (typeof methods[key] !== 'function') {
  52990. warn(
  52991. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  52992. "Did you reference the function correctly?",
  52993. vm
  52994. );
  52995. }
  52996. if (props && hasOwn(props, key)) {
  52997. warn(
  52998. ("Method \"" + key + "\" has already been defined as a prop."),
  52999. vm
  53000. );
  53001. }
  53002. if ((key in vm) && isReserved(key)) {
  53003. warn(
  53004. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  53005. "Avoid defining component methods that start with _ or $."
  53006. );
  53007. }
  53008. }
  53009. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  53010. }
  53011. }
  53012. function initWatch (vm, watch) {
  53013. for (var key in watch) {
  53014. var handler = watch[key];
  53015. if (Array.isArray(handler)) {
  53016. for (var i = 0; i < handler.length; i++) {
  53017. createWatcher(vm, key, handler[i]);
  53018. }
  53019. } else {
  53020. createWatcher(vm, key, handler);
  53021. }
  53022. }
  53023. }
  53024. function createWatcher (
  53025. vm,
  53026. expOrFn,
  53027. handler,
  53028. options
  53029. ) {
  53030. if (isPlainObject(handler)) {
  53031. options = handler;
  53032. handler = handler.handler;
  53033. }
  53034. if (typeof handler === 'string') {
  53035. handler = vm[handler];
  53036. }
  53037. return vm.$watch(expOrFn, handler, options)
  53038. }
  53039. function stateMixin (Vue) {
  53040. // flow somehow has problems with directly declared definition object
  53041. // when using Object.defineProperty, so we have to procedurally build up
  53042. // the object here.
  53043. var dataDef = {};
  53044. dataDef.get = function () { return this._data };
  53045. var propsDef = {};
  53046. propsDef.get = function () { return this._props };
  53047. {
  53048. dataDef.set = function () {
  53049. warn(
  53050. 'Avoid replacing instance root $data. ' +
  53051. 'Use nested data properties instead.',
  53052. this
  53053. );
  53054. };
  53055. propsDef.set = function () {
  53056. warn("$props is readonly.", this);
  53057. };
  53058. }
  53059. Object.defineProperty(Vue.prototype, '$data', dataDef);
  53060. Object.defineProperty(Vue.prototype, '$props', propsDef);
  53061. Vue.prototype.$set = set;
  53062. Vue.prototype.$delete = del;
  53063. Vue.prototype.$watch = function (
  53064. expOrFn,
  53065. cb,
  53066. options
  53067. ) {
  53068. var vm = this;
  53069. if (isPlainObject(cb)) {
  53070. return createWatcher(vm, expOrFn, cb, options)
  53071. }
  53072. options = options || {};
  53073. options.user = true;
  53074. var watcher = new Watcher(vm, expOrFn, cb, options);
  53075. if (options.immediate) {
  53076. try {
  53077. cb.call(vm, watcher.value);
  53078. } catch (error) {
  53079. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  53080. }
  53081. }
  53082. return function unwatchFn () {
  53083. watcher.teardown();
  53084. }
  53085. };
  53086. }
  53087. /* */
  53088. var uid$3 = 0;
  53089. function initMixin (Vue) {
  53090. Vue.prototype._init = function (options) {
  53091. var vm = this;
  53092. // a uid
  53093. vm._uid = uid$3++;
  53094. var startTag, endTag;
  53095. /* istanbul ignore if */
  53096. if (config.performance && mark) {
  53097. startTag = "vue-perf-start:" + (vm._uid);
  53098. endTag = "vue-perf-end:" + (vm._uid);
  53099. mark(startTag);
  53100. }
  53101. // a flag to avoid this being observed
  53102. vm._isVue = true;
  53103. // merge options
  53104. if (options && options._isComponent) {
  53105. // optimize internal component instantiation
  53106. // since dynamic options merging is pretty slow, and none of the
  53107. // internal component options needs special treatment.
  53108. initInternalComponent(vm, options);
  53109. } else {
  53110. vm.$options = mergeOptions(
  53111. resolveConstructorOptions(vm.constructor),
  53112. options || {},
  53113. vm
  53114. );
  53115. }
  53116. /* istanbul ignore else */
  53117. {
  53118. initProxy(vm);
  53119. }
  53120. // expose real self
  53121. vm._self = vm;
  53122. initLifecycle(vm);
  53123. initEvents(vm);
  53124. initRender(vm);
  53125. callHook(vm, 'beforeCreate');
  53126. initInjections(vm); // resolve injections before data/props
  53127. initState(vm);
  53128. initProvide(vm); // resolve provide after data/props
  53129. callHook(vm, 'created');
  53130. /* istanbul ignore if */
  53131. if (config.performance && mark) {
  53132. vm._name = formatComponentName(vm, false);
  53133. mark(endTag);
  53134. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  53135. }
  53136. if (vm.$options.el) {
  53137. vm.$mount(vm.$options.el);
  53138. }
  53139. };
  53140. }
  53141. function initInternalComponent (vm, options) {
  53142. var opts = vm.$options = Object.create(vm.constructor.options);
  53143. // doing this because it's faster than dynamic enumeration.
  53144. var parentVnode = options._parentVnode;
  53145. opts.parent = options.parent;
  53146. opts._parentVnode = parentVnode;
  53147. var vnodeComponentOptions = parentVnode.componentOptions;
  53148. opts.propsData = vnodeComponentOptions.propsData;
  53149. opts._parentListeners = vnodeComponentOptions.listeners;
  53150. opts._renderChildren = vnodeComponentOptions.children;
  53151. opts._componentTag = vnodeComponentOptions.tag;
  53152. if (options.render) {
  53153. opts.render = options.render;
  53154. opts.staticRenderFns = options.staticRenderFns;
  53155. }
  53156. }
  53157. function resolveConstructorOptions (Ctor) {
  53158. var options = Ctor.options;
  53159. if (Ctor.super) {
  53160. var superOptions = resolveConstructorOptions(Ctor.super);
  53161. var cachedSuperOptions = Ctor.superOptions;
  53162. if (superOptions !== cachedSuperOptions) {
  53163. // super option changed,
  53164. // need to resolve new options.
  53165. Ctor.superOptions = superOptions;
  53166. // check if there are any late-modified/attached options (#4976)
  53167. var modifiedOptions = resolveModifiedOptions(Ctor);
  53168. // update base extend options
  53169. if (modifiedOptions) {
  53170. extend(Ctor.extendOptions, modifiedOptions);
  53171. }
  53172. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  53173. if (options.name) {
  53174. options.components[options.name] = Ctor;
  53175. }
  53176. }
  53177. }
  53178. return options
  53179. }
  53180. function resolveModifiedOptions (Ctor) {
  53181. var modified;
  53182. var latest = Ctor.options;
  53183. var sealed = Ctor.sealedOptions;
  53184. for (var key in latest) {
  53185. if (latest[key] !== sealed[key]) {
  53186. if (!modified) { modified = {}; }
  53187. modified[key] = latest[key];
  53188. }
  53189. }
  53190. return modified
  53191. }
  53192. function Vue (options) {
  53193. if (!(this instanceof Vue)
  53194. ) {
  53195. warn('Vue is a constructor and should be called with the `new` keyword');
  53196. }
  53197. this._init(options);
  53198. }
  53199. initMixin(Vue);
  53200. stateMixin(Vue);
  53201. eventsMixin(Vue);
  53202. lifecycleMixin(Vue);
  53203. renderMixin(Vue);
  53204. /* */
  53205. function initUse (Vue) {
  53206. Vue.use = function (plugin) {
  53207. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  53208. if (installedPlugins.indexOf(plugin) > -1) {
  53209. return this
  53210. }
  53211. // additional parameters
  53212. var args = toArray(arguments, 1);
  53213. args.unshift(this);
  53214. if (typeof plugin.install === 'function') {
  53215. plugin.install.apply(plugin, args);
  53216. } else if (typeof plugin === 'function') {
  53217. plugin.apply(null, args);
  53218. }
  53219. installedPlugins.push(plugin);
  53220. return this
  53221. };
  53222. }
  53223. /* */
  53224. function initMixin$1 (Vue) {
  53225. Vue.mixin = function (mixin) {
  53226. this.options = mergeOptions(this.options, mixin);
  53227. return this
  53228. };
  53229. }
  53230. /* */
  53231. function initExtend (Vue) {
  53232. /**
  53233. * Each instance constructor, including Vue, has a unique
  53234. * cid. This enables us to create wrapped "child
  53235. * constructors" for prototypal inheritance and cache them.
  53236. */
  53237. Vue.cid = 0;
  53238. var cid = 1;
  53239. /**
  53240. * Class inheritance
  53241. */
  53242. Vue.extend = function (extendOptions) {
  53243. extendOptions = extendOptions || {};
  53244. var Super = this;
  53245. var SuperId = Super.cid;
  53246. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  53247. if (cachedCtors[SuperId]) {
  53248. return cachedCtors[SuperId]
  53249. }
  53250. var name = extendOptions.name || Super.options.name;
  53251. if (name) {
  53252. validateComponentName(name);
  53253. }
  53254. var Sub = function VueComponent (options) {
  53255. this._init(options);
  53256. };
  53257. Sub.prototype = Object.create(Super.prototype);
  53258. Sub.prototype.constructor = Sub;
  53259. Sub.cid = cid++;
  53260. Sub.options = mergeOptions(
  53261. Super.options,
  53262. extendOptions
  53263. );
  53264. Sub['super'] = Super;
  53265. // For props and computed properties, we define the proxy getters on
  53266. // the Vue instances at extension time, on the extended prototype. This
  53267. // avoids Object.defineProperty calls for each instance created.
  53268. if (Sub.options.props) {
  53269. initProps$1(Sub);
  53270. }
  53271. if (Sub.options.computed) {
  53272. initComputed$1(Sub);
  53273. }
  53274. // allow further extension/mixin/plugin usage
  53275. Sub.extend = Super.extend;
  53276. Sub.mixin = Super.mixin;
  53277. Sub.use = Super.use;
  53278. // create asset registers, so extended classes
  53279. // can have their private assets too.
  53280. ASSET_TYPES.forEach(function (type) {
  53281. Sub[type] = Super[type];
  53282. });
  53283. // enable recursive self-lookup
  53284. if (name) {
  53285. Sub.options.components[name] = Sub;
  53286. }
  53287. // keep a reference to the super options at extension time.
  53288. // later at instantiation we can check if Super's options have
  53289. // been updated.
  53290. Sub.superOptions = Super.options;
  53291. Sub.extendOptions = extendOptions;
  53292. Sub.sealedOptions = extend({}, Sub.options);
  53293. // cache constructor
  53294. cachedCtors[SuperId] = Sub;
  53295. return Sub
  53296. };
  53297. }
  53298. function initProps$1 (Comp) {
  53299. var props = Comp.options.props;
  53300. for (var key in props) {
  53301. proxy(Comp.prototype, "_props", key);
  53302. }
  53303. }
  53304. function initComputed$1 (Comp) {
  53305. var computed = Comp.options.computed;
  53306. for (var key in computed) {
  53307. defineComputed(Comp.prototype, key, computed[key]);
  53308. }
  53309. }
  53310. /* */
  53311. function initAssetRegisters (Vue) {
  53312. /**
  53313. * Create asset registration methods.
  53314. */
  53315. ASSET_TYPES.forEach(function (type) {
  53316. Vue[type] = function (
  53317. id,
  53318. definition
  53319. ) {
  53320. if (!definition) {
  53321. return this.options[type + 's'][id]
  53322. } else {
  53323. /* istanbul ignore if */
  53324. if (type === 'component') {
  53325. validateComponentName(id);
  53326. }
  53327. if (type === 'component' && isPlainObject(definition)) {
  53328. definition.name = definition.name || id;
  53329. definition = this.options._base.extend(definition);
  53330. }
  53331. if (type === 'directive' && typeof definition === 'function') {
  53332. definition = { bind: definition, update: definition };
  53333. }
  53334. this.options[type + 's'][id] = definition;
  53335. return definition
  53336. }
  53337. };
  53338. });
  53339. }
  53340. /* */
  53341. function getComponentName (opts) {
  53342. return opts && (opts.Ctor.options.name || opts.tag)
  53343. }
  53344. function matches (pattern, name) {
  53345. if (Array.isArray(pattern)) {
  53346. return pattern.indexOf(name) > -1
  53347. } else if (typeof pattern === 'string') {
  53348. return pattern.split(',').indexOf(name) > -1
  53349. } else if (isRegExp(pattern)) {
  53350. return pattern.test(name)
  53351. }
  53352. /* istanbul ignore next */
  53353. return false
  53354. }
  53355. function pruneCache (keepAliveInstance, filter) {
  53356. var cache = keepAliveInstance.cache;
  53357. var keys = keepAliveInstance.keys;
  53358. var _vnode = keepAliveInstance._vnode;
  53359. for (var key in cache) {
  53360. var cachedNode = cache[key];
  53361. if (cachedNode) {
  53362. var name = getComponentName(cachedNode.componentOptions);
  53363. if (name && !filter(name)) {
  53364. pruneCacheEntry(cache, key, keys, _vnode);
  53365. }
  53366. }
  53367. }
  53368. }
  53369. function pruneCacheEntry (
  53370. cache,
  53371. key,
  53372. keys,
  53373. current
  53374. ) {
  53375. var cached$$1 = cache[key];
  53376. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  53377. cached$$1.componentInstance.$destroy();
  53378. }
  53379. cache[key] = null;
  53380. remove(keys, key);
  53381. }
  53382. var patternTypes = [String, RegExp, Array];
  53383. var KeepAlive = {
  53384. name: 'keep-alive',
  53385. abstract: true,
  53386. props: {
  53387. include: patternTypes,
  53388. exclude: patternTypes,
  53389. max: [String, Number]
  53390. },
  53391. created: function created () {
  53392. this.cache = Object.create(null);
  53393. this.keys = [];
  53394. },
  53395. destroyed: function destroyed () {
  53396. for (var key in this.cache) {
  53397. pruneCacheEntry(this.cache, key, this.keys);
  53398. }
  53399. },
  53400. mounted: function mounted () {
  53401. var this$1 = this;
  53402. this.$watch('include', function (val) {
  53403. pruneCache(this$1, function (name) { return matches(val, name); });
  53404. });
  53405. this.$watch('exclude', function (val) {
  53406. pruneCache(this$1, function (name) { return !matches(val, name); });
  53407. });
  53408. },
  53409. render: function render () {
  53410. var slot = this.$slots.default;
  53411. var vnode = getFirstComponentChild(slot);
  53412. var componentOptions = vnode && vnode.componentOptions;
  53413. if (componentOptions) {
  53414. // check pattern
  53415. var name = getComponentName(componentOptions);
  53416. var ref = this;
  53417. var include = ref.include;
  53418. var exclude = ref.exclude;
  53419. if (
  53420. // not included
  53421. (include && (!name || !matches(include, name))) ||
  53422. // excluded
  53423. (exclude && name && matches(exclude, name))
  53424. ) {
  53425. return vnode
  53426. }
  53427. var ref$1 = this;
  53428. var cache = ref$1.cache;
  53429. var keys = ref$1.keys;
  53430. var key = vnode.key == null
  53431. // same constructor may get registered as different local components
  53432. // so cid alone is not enough (#3269)
  53433. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  53434. : vnode.key;
  53435. if (cache[key]) {
  53436. vnode.componentInstance = cache[key].componentInstance;
  53437. // make current key freshest
  53438. remove(keys, key);
  53439. keys.push(key);
  53440. } else {
  53441. cache[key] = vnode;
  53442. keys.push(key);
  53443. // prune oldest entry
  53444. if (this.max && keys.length > parseInt(this.max)) {
  53445. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  53446. }
  53447. }
  53448. vnode.data.keepAlive = true;
  53449. }
  53450. return vnode || (slot && slot[0])
  53451. }
  53452. };
  53453. var builtInComponents = {
  53454. KeepAlive: KeepAlive
  53455. };
  53456. /* */
  53457. function initGlobalAPI (Vue) {
  53458. // config
  53459. var configDef = {};
  53460. configDef.get = function () { return config; };
  53461. {
  53462. configDef.set = function () {
  53463. warn(
  53464. 'Do not replace the Vue.config object, set individual fields instead.'
  53465. );
  53466. };
  53467. }
  53468. Object.defineProperty(Vue, 'config', configDef);
  53469. // exposed util methods.
  53470. // NOTE: these are not considered part of the public API - avoid relying on
  53471. // them unless you are aware of the risk.
  53472. Vue.util = {
  53473. warn: warn,
  53474. extend: extend,
  53475. mergeOptions: mergeOptions,
  53476. defineReactive: defineReactive$$1
  53477. };
  53478. Vue.set = set;
  53479. Vue.delete = del;
  53480. Vue.nextTick = nextTick;
  53481. // 2.6 explicit observable API
  53482. Vue.observable = function (obj) {
  53483. observe(obj);
  53484. return obj
  53485. };
  53486. Vue.options = Object.create(null);
  53487. ASSET_TYPES.forEach(function (type) {
  53488. Vue.options[type + 's'] = Object.create(null);
  53489. });
  53490. // this is used to identify the "base" constructor to extend all plain-object
  53491. // components with in Weex's multi-instance scenarios.
  53492. Vue.options._base = Vue;
  53493. extend(Vue.options.components, builtInComponents);
  53494. initUse(Vue);
  53495. initMixin$1(Vue);
  53496. initExtend(Vue);
  53497. initAssetRegisters(Vue);
  53498. }
  53499. initGlobalAPI(Vue);
  53500. Object.defineProperty(Vue.prototype, '$isServer', {
  53501. get: isServerRendering
  53502. });
  53503. Object.defineProperty(Vue.prototype, '$ssrContext', {
  53504. get: function get () {
  53505. /* istanbul ignore next */
  53506. return this.$vnode && this.$vnode.ssrContext
  53507. }
  53508. });
  53509. // expose FunctionalRenderContext for ssr runtime helper installation
  53510. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  53511. value: FunctionalRenderContext
  53512. });
  53513. Vue.version = '2.6.11';
  53514. /* */
  53515. // these are reserved for web because they are directly compiled away
  53516. // during template compilation
  53517. var isReservedAttr = makeMap('style,class');
  53518. // attributes that should be using props for binding
  53519. var acceptValue = makeMap('input,textarea,option,select,progress');
  53520. var mustUseProp = function (tag, type, attr) {
  53521. return (
  53522. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  53523. (attr === 'selected' && tag === 'option') ||
  53524. (attr === 'checked' && tag === 'input') ||
  53525. (attr === 'muted' && tag === 'video')
  53526. )
  53527. };
  53528. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  53529. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  53530. var convertEnumeratedValue = function (key, value) {
  53531. return isFalsyAttrValue(value) || value === 'false'
  53532. ? 'false'
  53533. // allow arbitrary string value for contenteditable
  53534. : key === 'contenteditable' && isValidContentEditableValue(value)
  53535. ? value
  53536. : 'true'
  53537. };
  53538. var isBooleanAttr = makeMap(
  53539. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  53540. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  53541. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  53542. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  53543. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  53544. 'truespeed,typemustmatch,visible'
  53545. );
  53546. var xlinkNS = 'http://www.w3.org/1999/xlink';
  53547. var isXlink = function (name) {
  53548. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  53549. };
  53550. var getXlinkProp = function (name) {
  53551. return isXlink(name) ? name.slice(6, name.length) : ''
  53552. };
  53553. var isFalsyAttrValue = function (val) {
  53554. return val == null || val === false
  53555. };
  53556. /* */
  53557. function genClassForVnode (vnode) {
  53558. var data = vnode.data;
  53559. var parentNode = vnode;
  53560. var childNode = vnode;
  53561. while (isDef(childNode.componentInstance)) {
  53562. childNode = childNode.componentInstance._vnode;
  53563. if (childNode && childNode.data) {
  53564. data = mergeClassData(childNode.data, data);
  53565. }
  53566. }
  53567. while (isDef(parentNode = parentNode.parent)) {
  53568. if (parentNode && parentNode.data) {
  53569. data = mergeClassData(data, parentNode.data);
  53570. }
  53571. }
  53572. return renderClass(data.staticClass, data.class)
  53573. }
  53574. function mergeClassData (child, parent) {
  53575. return {
  53576. staticClass: concat(child.staticClass, parent.staticClass),
  53577. class: isDef(child.class)
  53578. ? [child.class, parent.class]
  53579. : parent.class
  53580. }
  53581. }
  53582. function renderClass (
  53583. staticClass,
  53584. dynamicClass
  53585. ) {
  53586. if (isDef(staticClass) || isDef(dynamicClass)) {
  53587. return concat(staticClass, stringifyClass(dynamicClass))
  53588. }
  53589. /* istanbul ignore next */
  53590. return ''
  53591. }
  53592. function concat (a, b) {
  53593. return a ? b ? (a + ' ' + b) : a : (b || '')
  53594. }
  53595. function stringifyClass (value) {
  53596. if (Array.isArray(value)) {
  53597. return stringifyArray(value)
  53598. }
  53599. if (isObject(value)) {
  53600. return stringifyObject(value)
  53601. }
  53602. if (typeof value === 'string') {
  53603. return value
  53604. }
  53605. /* istanbul ignore next */
  53606. return ''
  53607. }
  53608. function stringifyArray (value) {
  53609. var res = '';
  53610. var stringified;
  53611. for (var i = 0, l = value.length; i < l; i++) {
  53612. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  53613. if (res) { res += ' '; }
  53614. res += stringified;
  53615. }
  53616. }
  53617. return res
  53618. }
  53619. function stringifyObject (value) {
  53620. var res = '';
  53621. for (var key in value) {
  53622. if (value[key]) {
  53623. if (res) { res += ' '; }
  53624. res += key;
  53625. }
  53626. }
  53627. return res
  53628. }
  53629. /* */
  53630. var namespaceMap = {
  53631. svg: 'http://www.w3.org/2000/svg',
  53632. math: 'http://www.w3.org/1998/Math/MathML'
  53633. };
  53634. var isHTMLTag = makeMap(
  53635. 'html,body,base,head,link,meta,style,title,' +
  53636. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  53637. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  53638. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  53639. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  53640. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  53641. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  53642. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  53643. 'output,progress,select,textarea,' +
  53644. 'details,dialog,menu,menuitem,summary,' +
  53645. 'content,element,shadow,template,blockquote,iframe,tfoot'
  53646. );
  53647. // this map is intentionally selective, only covering SVG elements that may
  53648. // contain child elements.
  53649. var isSVG = makeMap(
  53650. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  53651. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  53652. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  53653. true
  53654. );
  53655. var isPreTag = function (tag) { return tag === 'pre'; };
  53656. var isReservedTag = function (tag) {
  53657. return isHTMLTag(tag) || isSVG(tag)
  53658. };
  53659. function getTagNamespace (tag) {
  53660. if (isSVG(tag)) {
  53661. return 'svg'
  53662. }
  53663. // basic support for MathML
  53664. // note it doesn't support other MathML elements being component roots
  53665. if (tag === 'math') {
  53666. return 'math'
  53667. }
  53668. }
  53669. var unknownElementCache = Object.create(null);
  53670. function isUnknownElement (tag) {
  53671. /* istanbul ignore if */
  53672. if (!inBrowser) {
  53673. return true
  53674. }
  53675. if (isReservedTag(tag)) {
  53676. return false
  53677. }
  53678. tag = tag.toLowerCase();
  53679. /* istanbul ignore if */
  53680. if (unknownElementCache[tag] != null) {
  53681. return unknownElementCache[tag]
  53682. }
  53683. var el = document.createElement(tag);
  53684. if (tag.indexOf('-') > -1) {
  53685. // http://stackoverflow.com/a/28210364/1070244
  53686. return (unknownElementCache[tag] = (
  53687. el.constructor === window.HTMLUnknownElement ||
  53688. el.constructor === window.HTMLElement
  53689. ))
  53690. } else {
  53691. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  53692. }
  53693. }
  53694. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  53695. /* */
  53696. /**
  53697. * Query an element selector if it's not an element already.
  53698. */
  53699. function query (el) {
  53700. if (typeof el === 'string') {
  53701. var selected = document.querySelector(el);
  53702. if (!selected) {
  53703. warn(
  53704. 'Cannot find element: ' + el
  53705. );
  53706. return document.createElement('div')
  53707. }
  53708. return selected
  53709. } else {
  53710. return el
  53711. }
  53712. }
  53713. /* */
  53714. function createElement$1 (tagName, vnode) {
  53715. var elm = document.createElement(tagName);
  53716. if (tagName !== 'select') {
  53717. return elm
  53718. }
  53719. // false or null will remove the attribute but undefined will not
  53720. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  53721. elm.setAttribute('multiple', 'multiple');
  53722. }
  53723. return elm
  53724. }
  53725. function createElementNS (namespace, tagName) {
  53726. return document.createElementNS(namespaceMap[namespace], tagName)
  53727. }
  53728. function createTextNode (text) {
  53729. return document.createTextNode(text)
  53730. }
  53731. function createComment (text) {
  53732. return document.createComment(text)
  53733. }
  53734. function insertBefore (parentNode, newNode, referenceNode) {
  53735. parentNode.insertBefore(newNode, referenceNode);
  53736. }
  53737. function removeChild (node, child) {
  53738. node.removeChild(child);
  53739. }
  53740. function appendChild (node, child) {
  53741. node.appendChild(child);
  53742. }
  53743. function parentNode (node) {
  53744. return node.parentNode
  53745. }
  53746. function nextSibling (node) {
  53747. return node.nextSibling
  53748. }
  53749. function tagName (node) {
  53750. return node.tagName
  53751. }
  53752. function setTextContent (node, text) {
  53753. node.textContent = text;
  53754. }
  53755. function setStyleScope (node, scopeId) {
  53756. node.setAttribute(scopeId, '');
  53757. }
  53758. var nodeOps = /*#__PURE__*/Object.freeze({
  53759. createElement: createElement$1,
  53760. createElementNS: createElementNS,
  53761. createTextNode: createTextNode,
  53762. createComment: createComment,
  53763. insertBefore: insertBefore,
  53764. removeChild: removeChild,
  53765. appendChild: appendChild,
  53766. parentNode: parentNode,
  53767. nextSibling: nextSibling,
  53768. tagName: tagName,
  53769. setTextContent: setTextContent,
  53770. setStyleScope: setStyleScope
  53771. });
  53772. /* */
  53773. var ref = {
  53774. create: function create (_, vnode) {
  53775. registerRef(vnode);
  53776. },
  53777. update: function update (oldVnode, vnode) {
  53778. if (oldVnode.data.ref !== vnode.data.ref) {
  53779. registerRef(oldVnode, true);
  53780. registerRef(vnode);
  53781. }
  53782. },
  53783. destroy: function destroy (vnode) {
  53784. registerRef(vnode, true);
  53785. }
  53786. };
  53787. function registerRef (vnode, isRemoval) {
  53788. var key = vnode.data.ref;
  53789. if (!isDef(key)) { return }
  53790. var vm = vnode.context;
  53791. var ref = vnode.componentInstance || vnode.elm;
  53792. var refs = vm.$refs;
  53793. if (isRemoval) {
  53794. if (Array.isArray(refs[key])) {
  53795. remove(refs[key], ref);
  53796. } else if (refs[key] === ref) {
  53797. refs[key] = undefined;
  53798. }
  53799. } else {
  53800. if (vnode.data.refInFor) {
  53801. if (!Array.isArray(refs[key])) {
  53802. refs[key] = [ref];
  53803. } else if (refs[key].indexOf(ref) < 0) {
  53804. // $flow-disable-line
  53805. refs[key].push(ref);
  53806. }
  53807. } else {
  53808. refs[key] = ref;
  53809. }
  53810. }
  53811. }
  53812. /**
  53813. * Virtual DOM patching algorithm based on Snabbdom by
  53814. * Simon Friis Vindum (@paldepind)
  53815. * Licensed under the MIT License
  53816. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  53817. *
  53818. * modified by Evan You (@yyx990803)
  53819. *
  53820. * Not type-checking this because this file is perf-critical and the cost
  53821. * of making flow understand it is not worth it.
  53822. */
  53823. var emptyNode = new VNode('', {}, []);
  53824. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  53825. function sameVnode (a, b) {
  53826. return (
  53827. a.key === b.key && (
  53828. (
  53829. a.tag === b.tag &&
  53830. a.isComment === b.isComment &&
  53831. isDef(a.data) === isDef(b.data) &&
  53832. sameInputType(a, b)
  53833. ) || (
  53834. isTrue(a.isAsyncPlaceholder) &&
  53835. a.asyncFactory === b.asyncFactory &&
  53836. isUndef(b.asyncFactory.error)
  53837. )
  53838. )
  53839. )
  53840. }
  53841. function sameInputType (a, b) {
  53842. if (a.tag !== 'input') { return true }
  53843. var i;
  53844. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  53845. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  53846. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  53847. }
  53848. function createKeyToOldIdx (children, beginIdx, endIdx) {
  53849. var i, key;
  53850. var map = {};
  53851. for (i = beginIdx; i <= endIdx; ++i) {
  53852. key = children[i].key;
  53853. if (isDef(key)) { map[key] = i; }
  53854. }
  53855. return map
  53856. }
  53857. function createPatchFunction (backend) {
  53858. var i, j;
  53859. var cbs = {};
  53860. var modules = backend.modules;
  53861. var nodeOps = backend.nodeOps;
  53862. for (i = 0; i < hooks.length; ++i) {
  53863. cbs[hooks[i]] = [];
  53864. for (j = 0; j < modules.length; ++j) {
  53865. if (isDef(modules[j][hooks[i]])) {
  53866. cbs[hooks[i]].push(modules[j][hooks[i]]);
  53867. }
  53868. }
  53869. }
  53870. function emptyNodeAt (elm) {
  53871. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  53872. }
  53873. function createRmCb (childElm, listeners) {
  53874. function remove$$1 () {
  53875. if (--remove$$1.listeners === 0) {
  53876. removeNode(childElm);
  53877. }
  53878. }
  53879. remove$$1.listeners = listeners;
  53880. return remove$$1
  53881. }
  53882. function removeNode (el) {
  53883. var parent = nodeOps.parentNode(el);
  53884. // element may have already been removed due to v-html / v-text
  53885. if (isDef(parent)) {
  53886. nodeOps.removeChild(parent, el);
  53887. }
  53888. }
  53889. function isUnknownElement$$1 (vnode, inVPre) {
  53890. return (
  53891. !inVPre &&
  53892. !vnode.ns &&
  53893. !(
  53894. config.ignoredElements.length &&
  53895. config.ignoredElements.some(function (ignore) {
  53896. return isRegExp(ignore)
  53897. ? ignore.test(vnode.tag)
  53898. : ignore === vnode.tag
  53899. })
  53900. ) &&
  53901. config.isUnknownElement(vnode.tag)
  53902. )
  53903. }
  53904. var creatingElmInVPre = 0;
  53905. function createElm (
  53906. vnode,
  53907. insertedVnodeQueue,
  53908. parentElm,
  53909. refElm,
  53910. nested,
  53911. ownerArray,
  53912. index
  53913. ) {
  53914. if (isDef(vnode.elm) && isDef(ownerArray)) {
  53915. // This vnode was used in a previous render!
  53916. // now it's used as a new node, overwriting its elm would cause
  53917. // potential patch errors down the road when it's used as an insertion
  53918. // reference node. Instead, we clone the node on-demand before creating
  53919. // associated DOM element for it.
  53920. vnode = ownerArray[index] = cloneVNode(vnode);
  53921. }
  53922. vnode.isRootInsert = !nested; // for transition enter check
  53923. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  53924. return
  53925. }
  53926. var data = vnode.data;
  53927. var children = vnode.children;
  53928. var tag = vnode.tag;
  53929. if (isDef(tag)) {
  53930. {
  53931. if (data && data.pre) {
  53932. creatingElmInVPre++;
  53933. }
  53934. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  53935. warn(
  53936. 'Unknown custom element: <' + tag + '> - did you ' +
  53937. 'register the component correctly? For recursive components, ' +
  53938. 'make sure to provide the "name" option.',
  53939. vnode.context
  53940. );
  53941. }
  53942. }
  53943. vnode.elm = vnode.ns
  53944. ? nodeOps.createElementNS(vnode.ns, tag)
  53945. : nodeOps.createElement(tag, vnode);
  53946. setScope(vnode);
  53947. /* istanbul ignore if */
  53948. {
  53949. createChildren(vnode, children, insertedVnodeQueue);
  53950. if (isDef(data)) {
  53951. invokeCreateHooks(vnode, insertedVnodeQueue);
  53952. }
  53953. insert(parentElm, vnode.elm, refElm);
  53954. }
  53955. if (data && data.pre) {
  53956. creatingElmInVPre--;
  53957. }
  53958. } else if (isTrue(vnode.isComment)) {
  53959. vnode.elm = nodeOps.createComment(vnode.text);
  53960. insert(parentElm, vnode.elm, refElm);
  53961. } else {
  53962. vnode.elm = nodeOps.createTextNode(vnode.text);
  53963. insert(parentElm, vnode.elm, refElm);
  53964. }
  53965. }
  53966. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  53967. var i = vnode.data;
  53968. if (isDef(i)) {
  53969. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  53970. if (isDef(i = i.hook) && isDef(i = i.init)) {
  53971. i(vnode, false /* hydrating */);
  53972. }
  53973. // after calling the init hook, if the vnode is a child component
  53974. // it should've created a child instance and mounted it. the child
  53975. // component also has set the placeholder vnode's elm.
  53976. // in that case we can just return the element and be done.
  53977. if (isDef(vnode.componentInstance)) {
  53978. initComponent(vnode, insertedVnodeQueue);
  53979. insert(parentElm, vnode.elm, refElm);
  53980. if (isTrue(isReactivated)) {
  53981. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  53982. }
  53983. return true
  53984. }
  53985. }
  53986. }
  53987. function initComponent (vnode, insertedVnodeQueue) {
  53988. if (isDef(vnode.data.pendingInsert)) {
  53989. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  53990. vnode.data.pendingInsert = null;
  53991. }
  53992. vnode.elm = vnode.componentInstance.$el;
  53993. if (isPatchable(vnode)) {
  53994. invokeCreateHooks(vnode, insertedVnodeQueue);
  53995. setScope(vnode);
  53996. } else {
  53997. // empty component root.
  53998. // skip all element-related modules except for ref (#3455)
  53999. registerRef(vnode);
  54000. // make sure to invoke the insert hook
  54001. insertedVnodeQueue.push(vnode);
  54002. }
  54003. }
  54004. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  54005. var i;
  54006. // hack for #4339: a reactivated component with inner transition
  54007. // does not trigger because the inner node's created hooks are not called
  54008. // again. It's not ideal to involve module-specific logic in here but
  54009. // there doesn't seem to be a better way to do it.
  54010. var innerNode = vnode;
  54011. while (innerNode.componentInstance) {
  54012. innerNode = innerNode.componentInstance._vnode;
  54013. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  54014. for (i = 0; i < cbs.activate.length; ++i) {
  54015. cbs.activate[i](emptyNode, innerNode);
  54016. }
  54017. insertedVnodeQueue.push(innerNode);
  54018. break
  54019. }
  54020. }
  54021. // unlike a newly created component,
  54022. // a reactivated keep-alive component doesn't insert itself
  54023. insert(parentElm, vnode.elm, refElm);
  54024. }
  54025. function insert (parent, elm, ref$$1) {
  54026. if (isDef(parent)) {
  54027. if (isDef(ref$$1)) {
  54028. if (nodeOps.parentNode(ref$$1) === parent) {
  54029. nodeOps.insertBefore(parent, elm, ref$$1);
  54030. }
  54031. } else {
  54032. nodeOps.appendChild(parent, elm);
  54033. }
  54034. }
  54035. }
  54036. function createChildren (vnode, children, insertedVnodeQueue) {
  54037. if (Array.isArray(children)) {
  54038. {
  54039. checkDuplicateKeys(children);
  54040. }
  54041. for (var i = 0; i < children.length; ++i) {
  54042. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  54043. }
  54044. } else if (isPrimitive(vnode.text)) {
  54045. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  54046. }
  54047. }
  54048. function isPatchable (vnode) {
  54049. while (vnode.componentInstance) {
  54050. vnode = vnode.componentInstance._vnode;
  54051. }
  54052. return isDef(vnode.tag)
  54053. }
  54054. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  54055. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  54056. cbs.create[i$1](emptyNode, vnode);
  54057. }
  54058. i = vnode.data.hook; // Reuse variable
  54059. if (isDef(i)) {
  54060. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  54061. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  54062. }
  54063. }
  54064. // set scope id attribute for scoped CSS.
  54065. // this is implemented as a special case to avoid the overhead
  54066. // of going through the normal attribute patching process.
  54067. function setScope (vnode) {
  54068. var i;
  54069. if (isDef(i = vnode.fnScopeId)) {
  54070. nodeOps.setStyleScope(vnode.elm, i);
  54071. } else {
  54072. var ancestor = vnode;
  54073. while (ancestor) {
  54074. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  54075. nodeOps.setStyleScope(vnode.elm, i);
  54076. }
  54077. ancestor = ancestor.parent;
  54078. }
  54079. }
  54080. // for slot content they should also get the scopeId from the host instance.
  54081. if (isDef(i = activeInstance) &&
  54082. i !== vnode.context &&
  54083. i !== vnode.fnContext &&
  54084. isDef(i = i.$options._scopeId)
  54085. ) {
  54086. nodeOps.setStyleScope(vnode.elm, i);
  54087. }
  54088. }
  54089. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  54090. for (; startIdx <= endIdx; ++startIdx) {
  54091. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  54092. }
  54093. }
  54094. function invokeDestroyHook (vnode) {
  54095. var i, j;
  54096. var data = vnode.data;
  54097. if (isDef(data)) {
  54098. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  54099. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  54100. }
  54101. if (isDef(i = vnode.children)) {
  54102. for (j = 0; j < vnode.children.length; ++j) {
  54103. invokeDestroyHook(vnode.children[j]);
  54104. }
  54105. }
  54106. }
  54107. function removeVnodes (vnodes, startIdx, endIdx) {
  54108. for (; startIdx <= endIdx; ++startIdx) {
  54109. var ch = vnodes[startIdx];
  54110. if (isDef(ch)) {
  54111. if (isDef(ch.tag)) {
  54112. removeAndInvokeRemoveHook(ch);
  54113. invokeDestroyHook(ch);
  54114. } else { // Text node
  54115. removeNode(ch.elm);
  54116. }
  54117. }
  54118. }
  54119. }
  54120. function removeAndInvokeRemoveHook (vnode, rm) {
  54121. if (isDef(rm) || isDef(vnode.data)) {
  54122. var i;
  54123. var listeners = cbs.remove.length + 1;
  54124. if (isDef(rm)) {
  54125. // we have a recursively passed down rm callback
  54126. // increase the listeners count
  54127. rm.listeners += listeners;
  54128. } else {
  54129. // directly removing
  54130. rm = createRmCb(vnode.elm, listeners);
  54131. }
  54132. // recursively invoke hooks on child component root node
  54133. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  54134. removeAndInvokeRemoveHook(i, rm);
  54135. }
  54136. for (i = 0; i < cbs.remove.length; ++i) {
  54137. cbs.remove[i](vnode, rm);
  54138. }
  54139. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  54140. i(vnode, rm);
  54141. } else {
  54142. rm();
  54143. }
  54144. } else {
  54145. removeNode(vnode.elm);
  54146. }
  54147. }
  54148. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  54149. var oldStartIdx = 0;
  54150. var newStartIdx = 0;
  54151. var oldEndIdx = oldCh.length - 1;
  54152. var oldStartVnode = oldCh[0];
  54153. var oldEndVnode = oldCh[oldEndIdx];
  54154. var newEndIdx = newCh.length - 1;
  54155. var newStartVnode = newCh[0];
  54156. var newEndVnode = newCh[newEndIdx];
  54157. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  54158. // removeOnly is a special flag used only by <transition-group>
  54159. // to ensure removed elements stay in correct relative positions
  54160. // during leaving transitions
  54161. var canMove = !removeOnly;
  54162. {
  54163. checkDuplicateKeys(newCh);
  54164. }
  54165. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  54166. if (isUndef(oldStartVnode)) {
  54167. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  54168. } else if (isUndef(oldEndVnode)) {
  54169. oldEndVnode = oldCh[--oldEndIdx];
  54170. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  54171. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  54172. oldStartVnode = oldCh[++oldStartIdx];
  54173. newStartVnode = newCh[++newStartIdx];
  54174. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  54175. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  54176. oldEndVnode = oldCh[--oldEndIdx];
  54177. newEndVnode = newCh[--newEndIdx];
  54178. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  54179. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  54180. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  54181. oldStartVnode = oldCh[++oldStartIdx];
  54182. newEndVnode = newCh[--newEndIdx];
  54183. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  54184. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  54185. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  54186. oldEndVnode = oldCh[--oldEndIdx];
  54187. newStartVnode = newCh[++newStartIdx];
  54188. } else {
  54189. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  54190. idxInOld = isDef(newStartVnode.key)
  54191. ? oldKeyToIdx[newStartVnode.key]
  54192. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  54193. if (isUndef(idxInOld)) { // New element
  54194. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  54195. } else {
  54196. vnodeToMove = oldCh[idxInOld];
  54197. if (sameVnode(vnodeToMove, newStartVnode)) {
  54198. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  54199. oldCh[idxInOld] = undefined;
  54200. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  54201. } else {
  54202. // same key but different element. treat as new element
  54203. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  54204. }
  54205. }
  54206. newStartVnode = newCh[++newStartIdx];
  54207. }
  54208. }
  54209. if (oldStartIdx > oldEndIdx) {
  54210. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  54211. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  54212. } else if (newStartIdx > newEndIdx) {
  54213. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  54214. }
  54215. }
  54216. function checkDuplicateKeys (children) {
  54217. var seenKeys = {};
  54218. for (var i = 0; i < children.length; i++) {
  54219. var vnode = children[i];
  54220. var key = vnode.key;
  54221. if (isDef(key)) {
  54222. if (seenKeys[key]) {
  54223. warn(
  54224. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  54225. vnode.context
  54226. );
  54227. } else {
  54228. seenKeys[key] = true;
  54229. }
  54230. }
  54231. }
  54232. }
  54233. function findIdxInOld (node, oldCh, start, end) {
  54234. for (var i = start; i < end; i++) {
  54235. var c = oldCh[i];
  54236. if (isDef(c) && sameVnode(node, c)) { return i }
  54237. }
  54238. }
  54239. function patchVnode (
  54240. oldVnode,
  54241. vnode,
  54242. insertedVnodeQueue,
  54243. ownerArray,
  54244. index,
  54245. removeOnly
  54246. ) {
  54247. if (oldVnode === vnode) {
  54248. return
  54249. }
  54250. if (isDef(vnode.elm) && isDef(ownerArray)) {
  54251. // clone reused vnode
  54252. vnode = ownerArray[index] = cloneVNode(vnode);
  54253. }
  54254. var elm = vnode.elm = oldVnode.elm;
  54255. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  54256. if (isDef(vnode.asyncFactory.resolved)) {
  54257. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  54258. } else {
  54259. vnode.isAsyncPlaceholder = true;
  54260. }
  54261. return
  54262. }
  54263. // reuse element for static trees.
  54264. // note we only do this if the vnode is cloned -
  54265. // if the new node is not cloned it means the render functions have been
  54266. // reset by the hot-reload-api and we need to do a proper re-render.
  54267. if (isTrue(vnode.isStatic) &&
  54268. isTrue(oldVnode.isStatic) &&
  54269. vnode.key === oldVnode.key &&
  54270. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  54271. ) {
  54272. vnode.componentInstance = oldVnode.componentInstance;
  54273. return
  54274. }
  54275. var i;
  54276. var data = vnode.data;
  54277. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  54278. i(oldVnode, vnode);
  54279. }
  54280. var oldCh = oldVnode.children;
  54281. var ch = vnode.children;
  54282. if (isDef(data) && isPatchable(vnode)) {
  54283. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  54284. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  54285. }
  54286. if (isUndef(vnode.text)) {
  54287. if (isDef(oldCh) && isDef(ch)) {
  54288. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  54289. } else if (isDef(ch)) {
  54290. {
  54291. checkDuplicateKeys(ch);
  54292. }
  54293. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  54294. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  54295. } else if (isDef(oldCh)) {
  54296. removeVnodes(oldCh, 0, oldCh.length - 1);
  54297. } else if (isDef(oldVnode.text)) {
  54298. nodeOps.setTextContent(elm, '');
  54299. }
  54300. } else if (oldVnode.text !== vnode.text) {
  54301. nodeOps.setTextContent(elm, vnode.text);
  54302. }
  54303. if (isDef(data)) {
  54304. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  54305. }
  54306. }
  54307. function invokeInsertHook (vnode, queue, initial) {
  54308. // delay insert hooks for component root nodes, invoke them after the
  54309. // element is really inserted
  54310. if (isTrue(initial) && isDef(vnode.parent)) {
  54311. vnode.parent.data.pendingInsert = queue;
  54312. } else {
  54313. for (var i = 0; i < queue.length; ++i) {
  54314. queue[i].data.hook.insert(queue[i]);
  54315. }
  54316. }
  54317. }
  54318. var hydrationBailed = false;
  54319. // list of modules that can skip create hook during hydration because they
  54320. // are already rendered on the client or has no need for initialization
  54321. // Note: style is excluded because it relies on initial clone for future
  54322. // deep updates (#7063).
  54323. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  54324. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  54325. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  54326. var i;
  54327. var tag = vnode.tag;
  54328. var data = vnode.data;
  54329. var children = vnode.children;
  54330. inVPre = inVPre || (data && data.pre);
  54331. vnode.elm = elm;
  54332. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  54333. vnode.isAsyncPlaceholder = true;
  54334. return true
  54335. }
  54336. // assert node match
  54337. {
  54338. if (!assertNodeMatch(elm, vnode, inVPre)) {
  54339. return false
  54340. }
  54341. }
  54342. if (isDef(data)) {
  54343. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  54344. if (isDef(i = vnode.componentInstance)) {
  54345. // child component. it should have hydrated its own tree.
  54346. initComponent(vnode, insertedVnodeQueue);
  54347. return true
  54348. }
  54349. }
  54350. if (isDef(tag)) {
  54351. if (isDef(children)) {
  54352. // empty element, allow client to pick up and populate children
  54353. if (!elm.hasChildNodes()) {
  54354. createChildren(vnode, children, insertedVnodeQueue);
  54355. } else {
  54356. // v-html and domProps: innerHTML
  54357. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  54358. if (i !== elm.innerHTML) {
  54359. /* istanbul ignore if */
  54360. if (typeof console !== 'undefined' &&
  54361. !hydrationBailed
  54362. ) {
  54363. hydrationBailed = true;
  54364. console.warn('Parent: ', elm);
  54365. console.warn('server innerHTML: ', i);
  54366. console.warn('client innerHTML: ', elm.innerHTML);
  54367. }
  54368. return false
  54369. }
  54370. } else {
  54371. // iterate and compare children lists
  54372. var childrenMatch = true;
  54373. var childNode = elm.firstChild;
  54374. for (var i$1 = 0; i$1 < children.length; i$1++) {
  54375. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  54376. childrenMatch = false;
  54377. break
  54378. }
  54379. childNode = childNode.nextSibling;
  54380. }
  54381. // if childNode is not null, it means the actual childNodes list is
  54382. // longer than the virtual children list.
  54383. if (!childrenMatch || childNode) {
  54384. /* istanbul ignore if */
  54385. if (typeof console !== 'undefined' &&
  54386. !hydrationBailed
  54387. ) {
  54388. hydrationBailed = true;
  54389. console.warn('Parent: ', elm);
  54390. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  54391. }
  54392. return false
  54393. }
  54394. }
  54395. }
  54396. }
  54397. if (isDef(data)) {
  54398. var fullInvoke = false;
  54399. for (var key in data) {
  54400. if (!isRenderedModule(key)) {
  54401. fullInvoke = true;
  54402. invokeCreateHooks(vnode, insertedVnodeQueue);
  54403. break
  54404. }
  54405. }
  54406. if (!fullInvoke && data['class']) {
  54407. // ensure collecting deps for deep class bindings for future updates
  54408. traverse(data['class']);
  54409. }
  54410. }
  54411. } else if (elm.data !== vnode.text) {
  54412. elm.data = vnode.text;
  54413. }
  54414. return true
  54415. }
  54416. function assertNodeMatch (node, vnode, inVPre) {
  54417. if (isDef(vnode.tag)) {
  54418. return vnode.tag.indexOf('vue-component') === 0 || (
  54419. !isUnknownElement$$1(vnode, inVPre) &&
  54420. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  54421. )
  54422. } else {
  54423. return node.nodeType === (vnode.isComment ? 8 : 3)
  54424. }
  54425. }
  54426. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  54427. if (isUndef(vnode)) {
  54428. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  54429. return
  54430. }
  54431. var isInitialPatch = false;
  54432. var insertedVnodeQueue = [];
  54433. if (isUndef(oldVnode)) {
  54434. // empty mount (likely as component), create new root element
  54435. isInitialPatch = true;
  54436. createElm(vnode, insertedVnodeQueue);
  54437. } else {
  54438. var isRealElement = isDef(oldVnode.nodeType);
  54439. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  54440. // patch existing root node
  54441. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  54442. } else {
  54443. if (isRealElement) {
  54444. // mounting to a real element
  54445. // check if this is server-rendered content and if we can perform
  54446. // a successful hydration.
  54447. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  54448. oldVnode.removeAttribute(SSR_ATTR);
  54449. hydrating = true;
  54450. }
  54451. if (isTrue(hydrating)) {
  54452. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  54453. invokeInsertHook(vnode, insertedVnodeQueue, true);
  54454. return oldVnode
  54455. } else {
  54456. warn(
  54457. 'The client-side rendered virtual DOM tree is not matching ' +
  54458. 'server-rendered content. This is likely caused by incorrect ' +
  54459. 'HTML markup, for example nesting block-level elements inside ' +
  54460. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  54461. 'full client-side render.'
  54462. );
  54463. }
  54464. }
  54465. // either not server-rendered, or hydration failed.
  54466. // create an empty node and replace it
  54467. oldVnode = emptyNodeAt(oldVnode);
  54468. }
  54469. // replacing existing element
  54470. var oldElm = oldVnode.elm;
  54471. var parentElm = nodeOps.parentNode(oldElm);
  54472. // create new node
  54473. createElm(
  54474. vnode,
  54475. insertedVnodeQueue,
  54476. // extremely rare edge case: do not insert if old element is in a
  54477. // leaving transition. Only happens when combining transition +
  54478. // keep-alive + HOCs. (#4590)
  54479. oldElm._leaveCb ? null : parentElm,
  54480. nodeOps.nextSibling(oldElm)
  54481. );
  54482. // update parent placeholder node element, recursively
  54483. if (isDef(vnode.parent)) {
  54484. var ancestor = vnode.parent;
  54485. var patchable = isPatchable(vnode);
  54486. while (ancestor) {
  54487. for (var i = 0; i < cbs.destroy.length; ++i) {
  54488. cbs.destroy[i](ancestor);
  54489. }
  54490. ancestor.elm = vnode.elm;
  54491. if (patchable) {
  54492. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  54493. cbs.create[i$1](emptyNode, ancestor);
  54494. }
  54495. // #6513
  54496. // invoke insert hooks that may have been merged by create hooks.
  54497. // e.g. for directives that uses the "inserted" hook.
  54498. var insert = ancestor.data.hook.insert;
  54499. if (insert.merged) {
  54500. // start at index 1 to avoid re-invoking component mounted hook
  54501. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  54502. insert.fns[i$2]();
  54503. }
  54504. }
  54505. } else {
  54506. registerRef(ancestor);
  54507. }
  54508. ancestor = ancestor.parent;
  54509. }
  54510. }
  54511. // destroy old node
  54512. if (isDef(parentElm)) {
  54513. removeVnodes([oldVnode], 0, 0);
  54514. } else if (isDef(oldVnode.tag)) {
  54515. invokeDestroyHook(oldVnode);
  54516. }
  54517. }
  54518. }
  54519. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  54520. return vnode.elm
  54521. }
  54522. }
  54523. /* */
  54524. var directives = {
  54525. create: updateDirectives,
  54526. update: updateDirectives,
  54527. destroy: function unbindDirectives (vnode) {
  54528. updateDirectives(vnode, emptyNode);
  54529. }
  54530. };
  54531. function updateDirectives (oldVnode, vnode) {
  54532. if (oldVnode.data.directives || vnode.data.directives) {
  54533. _update(oldVnode, vnode);
  54534. }
  54535. }
  54536. function _update (oldVnode, vnode) {
  54537. var isCreate = oldVnode === emptyNode;
  54538. var isDestroy = vnode === emptyNode;
  54539. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  54540. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  54541. var dirsWithInsert = [];
  54542. var dirsWithPostpatch = [];
  54543. var key, oldDir, dir;
  54544. for (key in newDirs) {
  54545. oldDir = oldDirs[key];
  54546. dir = newDirs[key];
  54547. if (!oldDir) {
  54548. // new directive, bind
  54549. callHook$1(dir, 'bind', vnode, oldVnode);
  54550. if (dir.def && dir.def.inserted) {
  54551. dirsWithInsert.push(dir);
  54552. }
  54553. } else {
  54554. // existing directive, update
  54555. dir.oldValue = oldDir.value;
  54556. dir.oldArg = oldDir.arg;
  54557. callHook$1(dir, 'update', vnode, oldVnode);
  54558. if (dir.def && dir.def.componentUpdated) {
  54559. dirsWithPostpatch.push(dir);
  54560. }
  54561. }
  54562. }
  54563. if (dirsWithInsert.length) {
  54564. var callInsert = function () {
  54565. for (var i = 0; i < dirsWithInsert.length; i++) {
  54566. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  54567. }
  54568. };
  54569. if (isCreate) {
  54570. mergeVNodeHook(vnode, 'insert', callInsert);
  54571. } else {
  54572. callInsert();
  54573. }
  54574. }
  54575. if (dirsWithPostpatch.length) {
  54576. mergeVNodeHook(vnode, 'postpatch', function () {
  54577. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  54578. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  54579. }
  54580. });
  54581. }
  54582. if (!isCreate) {
  54583. for (key in oldDirs) {
  54584. if (!newDirs[key]) {
  54585. // no longer present, unbind
  54586. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  54587. }
  54588. }
  54589. }
  54590. }
  54591. var emptyModifiers = Object.create(null);
  54592. function normalizeDirectives$1 (
  54593. dirs,
  54594. vm
  54595. ) {
  54596. var res = Object.create(null);
  54597. if (!dirs) {
  54598. // $flow-disable-line
  54599. return res
  54600. }
  54601. var i, dir;
  54602. for (i = 0; i < dirs.length; i++) {
  54603. dir = dirs[i];
  54604. if (!dir.modifiers) {
  54605. // $flow-disable-line
  54606. dir.modifiers = emptyModifiers;
  54607. }
  54608. res[getRawDirName(dir)] = dir;
  54609. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  54610. }
  54611. // $flow-disable-line
  54612. return res
  54613. }
  54614. function getRawDirName (dir) {
  54615. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  54616. }
  54617. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  54618. var fn = dir.def && dir.def[hook];
  54619. if (fn) {
  54620. try {
  54621. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  54622. } catch (e) {
  54623. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  54624. }
  54625. }
  54626. }
  54627. var baseModules = [
  54628. ref,
  54629. directives
  54630. ];
  54631. /* */
  54632. function updateAttrs (oldVnode, vnode) {
  54633. var opts = vnode.componentOptions;
  54634. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  54635. return
  54636. }
  54637. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  54638. return
  54639. }
  54640. var key, cur, old;
  54641. var elm = vnode.elm;
  54642. var oldAttrs = oldVnode.data.attrs || {};
  54643. var attrs = vnode.data.attrs || {};
  54644. // clone observed objects, as the user probably wants to mutate it
  54645. if (isDef(attrs.__ob__)) {
  54646. attrs = vnode.data.attrs = extend({}, attrs);
  54647. }
  54648. for (key in attrs) {
  54649. cur = attrs[key];
  54650. old = oldAttrs[key];
  54651. if (old !== cur) {
  54652. setAttr(elm, key, cur);
  54653. }
  54654. }
  54655. // #4391: in IE9, setting type can reset value for input[type=radio]
  54656. // #6666: IE/Edge forces progress value down to 1 before setting a max
  54657. /* istanbul ignore if */
  54658. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  54659. setAttr(elm, 'value', attrs.value);
  54660. }
  54661. for (key in oldAttrs) {
  54662. if (isUndef(attrs[key])) {
  54663. if (isXlink(key)) {
  54664. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  54665. } else if (!isEnumeratedAttr(key)) {
  54666. elm.removeAttribute(key);
  54667. }
  54668. }
  54669. }
  54670. }
  54671. function setAttr (el, key, value) {
  54672. if (el.tagName.indexOf('-') > -1) {
  54673. baseSetAttr(el, key, value);
  54674. } else if (isBooleanAttr(key)) {
  54675. // set attribute for blank value
  54676. // e.g. <option disabled>Select one</option>
  54677. if (isFalsyAttrValue(value)) {
  54678. el.removeAttribute(key);
  54679. } else {
  54680. // technically allowfullscreen is a boolean attribute for <iframe>,
  54681. // but Flash expects a value of "true" when used on <embed> tag
  54682. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  54683. ? 'true'
  54684. : key;
  54685. el.setAttribute(key, value);
  54686. }
  54687. } else if (isEnumeratedAttr(key)) {
  54688. el.setAttribute(key, convertEnumeratedValue(key, value));
  54689. } else if (isXlink(key)) {
  54690. if (isFalsyAttrValue(value)) {
  54691. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  54692. } else {
  54693. el.setAttributeNS(xlinkNS, key, value);
  54694. }
  54695. } else {
  54696. baseSetAttr(el, key, value);
  54697. }
  54698. }
  54699. function baseSetAttr (el, key, value) {
  54700. if (isFalsyAttrValue(value)) {
  54701. el.removeAttribute(key);
  54702. } else {
  54703. // #7138: IE10 & 11 fires input event when setting placeholder on
  54704. // <textarea>... block the first input event and remove the blocker
  54705. // immediately.
  54706. /* istanbul ignore if */
  54707. if (
  54708. isIE && !isIE9 &&
  54709. el.tagName === 'TEXTAREA' &&
  54710. key === 'placeholder' && value !== '' && !el.__ieph
  54711. ) {
  54712. var blocker = function (e) {
  54713. e.stopImmediatePropagation();
  54714. el.removeEventListener('input', blocker);
  54715. };
  54716. el.addEventListener('input', blocker);
  54717. // $flow-disable-line
  54718. el.__ieph = true; /* IE placeholder patched */
  54719. }
  54720. el.setAttribute(key, value);
  54721. }
  54722. }
  54723. var attrs = {
  54724. create: updateAttrs,
  54725. update: updateAttrs
  54726. };
  54727. /* */
  54728. function updateClass (oldVnode, vnode) {
  54729. var el = vnode.elm;
  54730. var data = vnode.data;
  54731. var oldData = oldVnode.data;
  54732. if (
  54733. isUndef(data.staticClass) &&
  54734. isUndef(data.class) && (
  54735. isUndef(oldData) || (
  54736. isUndef(oldData.staticClass) &&
  54737. isUndef(oldData.class)
  54738. )
  54739. )
  54740. ) {
  54741. return
  54742. }
  54743. var cls = genClassForVnode(vnode);
  54744. // handle transition classes
  54745. var transitionClass = el._transitionClasses;
  54746. if (isDef(transitionClass)) {
  54747. cls = concat(cls, stringifyClass(transitionClass));
  54748. }
  54749. // set the class
  54750. if (cls !== el._prevClass) {
  54751. el.setAttribute('class', cls);
  54752. el._prevClass = cls;
  54753. }
  54754. }
  54755. var klass = {
  54756. create: updateClass,
  54757. update: updateClass
  54758. };
  54759. /* */
  54760. var validDivisionCharRE = /[\w).+\-_$\]]/;
  54761. function parseFilters (exp) {
  54762. var inSingle = false;
  54763. var inDouble = false;
  54764. var inTemplateString = false;
  54765. var inRegex = false;
  54766. var curly = 0;
  54767. var square = 0;
  54768. var paren = 0;
  54769. var lastFilterIndex = 0;
  54770. var c, prev, i, expression, filters;
  54771. for (i = 0; i < exp.length; i++) {
  54772. prev = c;
  54773. c = exp.charCodeAt(i);
  54774. if (inSingle) {
  54775. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  54776. } else if (inDouble) {
  54777. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  54778. } else if (inTemplateString) {
  54779. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  54780. } else if (inRegex) {
  54781. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  54782. } else if (
  54783. c === 0x7C && // pipe
  54784. exp.charCodeAt(i + 1) !== 0x7C &&
  54785. exp.charCodeAt(i - 1) !== 0x7C &&
  54786. !curly && !square && !paren
  54787. ) {
  54788. if (expression === undefined) {
  54789. // first filter, end of expression
  54790. lastFilterIndex = i + 1;
  54791. expression = exp.slice(0, i).trim();
  54792. } else {
  54793. pushFilter();
  54794. }
  54795. } else {
  54796. switch (c) {
  54797. case 0x22: inDouble = true; break // "
  54798. case 0x27: inSingle = true; break // '
  54799. case 0x60: inTemplateString = true; break // `
  54800. case 0x28: paren++; break // (
  54801. case 0x29: paren--; break // )
  54802. case 0x5B: square++; break // [
  54803. case 0x5D: square--; break // ]
  54804. case 0x7B: curly++; break // {
  54805. case 0x7D: curly--; break // }
  54806. }
  54807. if (c === 0x2f) { // /
  54808. var j = i - 1;
  54809. var p = (void 0);
  54810. // find first non-whitespace prev char
  54811. for (; j >= 0; j--) {
  54812. p = exp.charAt(j);
  54813. if (p !== ' ') { break }
  54814. }
  54815. if (!p || !validDivisionCharRE.test(p)) {
  54816. inRegex = true;
  54817. }
  54818. }
  54819. }
  54820. }
  54821. if (expression === undefined) {
  54822. expression = exp.slice(0, i).trim();
  54823. } else if (lastFilterIndex !== 0) {
  54824. pushFilter();
  54825. }
  54826. function pushFilter () {
  54827. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  54828. lastFilterIndex = i + 1;
  54829. }
  54830. if (filters) {
  54831. for (i = 0; i < filters.length; i++) {
  54832. expression = wrapFilter(expression, filters[i]);
  54833. }
  54834. }
  54835. return expression
  54836. }
  54837. function wrapFilter (exp, filter) {
  54838. var i = filter.indexOf('(');
  54839. if (i < 0) {
  54840. // _f: resolveFilter
  54841. return ("_f(\"" + filter + "\")(" + exp + ")")
  54842. } else {
  54843. var name = filter.slice(0, i);
  54844. var args = filter.slice(i + 1);
  54845. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  54846. }
  54847. }
  54848. /* */
  54849. /* eslint-disable no-unused-vars */
  54850. function baseWarn (msg, range) {
  54851. console.error(("[Vue compiler]: " + msg));
  54852. }
  54853. /* eslint-enable no-unused-vars */
  54854. function pluckModuleFunction (
  54855. modules,
  54856. key
  54857. ) {
  54858. return modules
  54859. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  54860. : []
  54861. }
  54862. function addProp (el, name, value, range, dynamic) {
  54863. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  54864. el.plain = false;
  54865. }
  54866. function addAttr (el, name, value, range, dynamic) {
  54867. var attrs = dynamic
  54868. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  54869. : (el.attrs || (el.attrs = []));
  54870. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  54871. el.plain = false;
  54872. }
  54873. // add a raw attr (use this in preTransforms)
  54874. function addRawAttr (el, name, value, range) {
  54875. el.attrsMap[name] = value;
  54876. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  54877. }
  54878. function addDirective (
  54879. el,
  54880. name,
  54881. rawName,
  54882. value,
  54883. arg,
  54884. isDynamicArg,
  54885. modifiers,
  54886. range
  54887. ) {
  54888. (el.directives || (el.directives = [])).push(rangeSetItem({
  54889. name: name,
  54890. rawName: rawName,
  54891. value: value,
  54892. arg: arg,
  54893. isDynamicArg: isDynamicArg,
  54894. modifiers: modifiers
  54895. }, range));
  54896. el.plain = false;
  54897. }
  54898. function prependModifierMarker (symbol, name, dynamic) {
  54899. return dynamic
  54900. ? ("_p(" + name + ",\"" + symbol + "\")")
  54901. : symbol + name // mark the event as captured
  54902. }
  54903. function addHandler (
  54904. el,
  54905. name,
  54906. value,
  54907. modifiers,
  54908. important,
  54909. warn,
  54910. range,
  54911. dynamic
  54912. ) {
  54913. modifiers = modifiers || emptyObject;
  54914. // warn prevent and passive modifier
  54915. /* istanbul ignore if */
  54916. if (
  54917. warn &&
  54918. modifiers.prevent && modifiers.passive
  54919. ) {
  54920. warn(
  54921. 'passive and prevent can\'t be used together. ' +
  54922. 'Passive handler can\'t prevent default event.',
  54923. range
  54924. );
  54925. }
  54926. // normalize click.right and click.middle since they don't actually fire
  54927. // this is technically browser-specific, but at least for now browsers are
  54928. // the only target envs that have right/middle clicks.
  54929. if (modifiers.right) {
  54930. if (dynamic) {
  54931. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  54932. } else if (name === 'click') {
  54933. name = 'contextmenu';
  54934. delete modifiers.right;
  54935. }
  54936. } else if (modifiers.middle) {
  54937. if (dynamic) {
  54938. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  54939. } else if (name === 'click') {
  54940. name = 'mouseup';
  54941. }
  54942. }
  54943. // check capture modifier
  54944. if (modifiers.capture) {
  54945. delete modifiers.capture;
  54946. name = prependModifierMarker('!', name, dynamic);
  54947. }
  54948. if (modifiers.once) {
  54949. delete modifiers.once;
  54950. name = prependModifierMarker('~', name, dynamic);
  54951. }
  54952. /* istanbul ignore if */
  54953. if (modifiers.passive) {
  54954. delete modifiers.passive;
  54955. name = prependModifierMarker('&', name, dynamic);
  54956. }
  54957. var events;
  54958. if (modifiers.native) {
  54959. delete modifiers.native;
  54960. events = el.nativeEvents || (el.nativeEvents = {});
  54961. } else {
  54962. events = el.events || (el.events = {});
  54963. }
  54964. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  54965. if (modifiers !== emptyObject) {
  54966. newHandler.modifiers = modifiers;
  54967. }
  54968. var handlers = events[name];
  54969. /* istanbul ignore if */
  54970. if (Array.isArray(handlers)) {
  54971. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  54972. } else if (handlers) {
  54973. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  54974. } else {
  54975. events[name] = newHandler;
  54976. }
  54977. el.plain = false;
  54978. }
  54979. function getRawBindingAttr (
  54980. el,
  54981. name
  54982. ) {
  54983. return el.rawAttrsMap[':' + name] ||
  54984. el.rawAttrsMap['v-bind:' + name] ||
  54985. el.rawAttrsMap[name]
  54986. }
  54987. function getBindingAttr (
  54988. el,
  54989. name,
  54990. getStatic
  54991. ) {
  54992. var dynamicValue =
  54993. getAndRemoveAttr(el, ':' + name) ||
  54994. getAndRemoveAttr(el, 'v-bind:' + name);
  54995. if (dynamicValue != null) {
  54996. return parseFilters(dynamicValue)
  54997. } else if (getStatic !== false) {
  54998. var staticValue = getAndRemoveAttr(el, name);
  54999. if (staticValue != null) {
  55000. return JSON.stringify(staticValue)
  55001. }
  55002. }
  55003. }
  55004. // note: this only removes the attr from the Array (attrsList) so that it
  55005. // doesn't get processed by processAttrs.
  55006. // By default it does NOT remove it from the map (attrsMap) because the map is
  55007. // needed during codegen.
  55008. function getAndRemoveAttr (
  55009. el,
  55010. name,
  55011. removeFromMap
  55012. ) {
  55013. var val;
  55014. if ((val = el.attrsMap[name]) != null) {
  55015. var list = el.attrsList;
  55016. for (var i = 0, l = list.length; i < l; i++) {
  55017. if (list[i].name === name) {
  55018. list.splice(i, 1);
  55019. break
  55020. }
  55021. }
  55022. }
  55023. if (removeFromMap) {
  55024. delete el.attrsMap[name];
  55025. }
  55026. return val
  55027. }
  55028. function getAndRemoveAttrByRegex (
  55029. el,
  55030. name
  55031. ) {
  55032. var list = el.attrsList;
  55033. for (var i = 0, l = list.length; i < l; i++) {
  55034. var attr = list[i];
  55035. if (name.test(attr.name)) {
  55036. list.splice(i, 1);
  55037. return attr
  55038. }
  55039. }
  55040. }
  55041. function rangeSetItem (
  55042. item,
  55043. range
  55044. ) {
  55045. if (range) {
  55046. if (range.start != null) {
  55047. item.start = range.start;
  55048. }
  55049. if (range.end != null) {
  55050. item.end = range.end;
  55051. }
  55052. }
  55053. return item
  55054. }
  55055. /* */
  55056. /**
  55057. * Cross-platform code generation for component v-model
  55058. */
  55059. function genComponentModel (
  55060. el,
  55061. value,
  55062. modifiers
  55063. ) {
  55064. var ref = modifiers || {};
  55065. var number = ref.number;
  55066. var trim = ref.trim;
  55067. var baseValueExpression = '$$v';
  55068. var valueExpression = baseValueExpression;
  55069. if (trim) {
  55070. valueExpression =
  55071. "(typeof " + baseValueExpression + " === 'string'" +
  55072. "? " + baseValueExpression + ".trim()" +
  55073. ": " + baseValueExpression + ")";
  55074. }
  55075. if (number) {
  55076. valueExpression = "_n(" + valueExpression + ")";
  55077. }
  55078. var assignment = genAssignmentCode(value, valueExpression);
  55079. el.model = {
  55080. value: ("(" + value + ")"),
  55081. expression: JSON.stringify(value),
  55082. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  55083. };
  55084. }
  55085. /**
  55086. * Cross-platform codegen helper for generating v-model value assignment code.
  55087. */
  55088. function genAssignmentCode (
  55089. value,
  55090. assignment
  55091. ) {
  55092. var res = parseModel(value);
  55093. if (res.key === null) {
  55094. return (value + "=" + assignment)
  55095. } else {
  55096. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  55097. }
  55098. }
  55099. /**
  55100. * Parse a v-model expression into a base path and a final key segment.
  55101. * Handles both dot-path and possible square brackets.
  55102. *
  55103. * Possible cases:
  55104. *
  55105. * - test
  55106. * - test[key]
  55107. * - test[test1[key]]
  55108. * - test["a"][key]
  55109. * - xxx.test[a[a].test1[key]]
  55110. * - test.xxx.a["asa"][test1[key]]
  55111. *
  55112. */
  55113. var len, str, chr, index$1, expressionPos, expressionEndPos;
  55114. function parseModel (val) {
  55115. // Fix https://github.com/vuejs/vue/pull/7730
  55116. // allow v-model="obj.val " (trailing whitespace)
  55117. val = val.trim();
  55118. len = val.length;
  55119. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  55120. index$1 = val.lastIndexOf('.');
  55121. if (index$1 > -1) {
  55122. return {
  55123. exp: val.slice(0, index$1),
  55124. key: '"' + val.slice(index$1 + 1) + '"'
  55125. }
  55126. } else {
  55127. return {
  55128. exp: val,
  55129. key: null
  55130. }
  55131. }
  55132. }
  55133. str = val;
  55134. index$1 = expressionPos = expressionEndPos = 0;
  55135. while (!eof()) {
  55136. chr = next();
  55137. /* istanbul ignore if */
  55138. if (isStringStart(chr)) {
  55139. parseString(chr);
  55140. } else if (chr === 0x5B) {
  55141. parseBracket(chr);
  55142. }
  55143. }
  55144. return {
  55145. exp: val.slice(0, expressionPos),
  55146. key: val.slice(expressionPos + 1, expressionEndPos)
  55147. }
  55148. }
  55149. function next () {
  55150. return str.charCodeAt(++index$1)
  55151. }
  55152. function eof () {
  55153. return index$1 >= len
  55154. }
  55155. function isStringStart (chr) {
  55156. return chr === 0x22 || chr === 0x27
  55157. }
  55158. function parseBracket (chr) {
  55159. var inBracket = 1;
  55160. expressionPos = index$1;
  55161. while (!eof()) {
  55162. chr = next();
  55163. if (isStringStart(chr)) {
  55164. parseString(chr);
  55165. continue
  55166. }
  55167. if (chr === 0x5B) { inBracket++; }
  55168. if (chr === 0x5D) { inBracket--; }
  55169. if (inBracket === 0) {
  55170. expressionEndPos = index$1;
  55171. break
  55172. }
  55173. }
  55174. }
  55175. function parseString (chr) {
  55176. var stringQuote = chr;
  55177. while (!eof()) {
  55178. chr = next();
  55179. if (chr === stringQuote) {
  55180. break
  55181. }
  55182. }
  55183. }
  55184. /* */
  55185. var warn$1;
  55186. // in some cases, the event used has to be determined at runtime
  55187. // so we used some reserved tokens during compile.
  55188. var RANGE_TOKEN = '__r';
  55189. var CHECKBOX_RADIO_TOKEN = '__c';
  55190. function model (
  55191. el,
  55192. dir,
  55193. _warn
  55194. ) {
  55195. warn$1 = _warn;
  55196. var value = dir.value;
  55197. var modifiers = dir.modifiers;
  55198. var tag = el.tag;
  55199. var type = el.attrsMap.type;
  55200. {
  55201. // inputs with type="file" are read only and setting the input's
  55202. // value will throw an error.
  55203. if (tag === 'input' && type === 'file') {
  55204. warn$1(
  55205. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  55206. "File inputs are read only. Use a v-on:change listener instead.",
  55207. el.rawAttrsMap['v-model']
  55208. );
  55209. }
  55210. }
  55211. if (el.component) {
  55212. genComponentModel(el, value, modifiers);
  55213. // component v-model doesn't need extra runtime
  55214. return false
  55215. } else if (tag === 'select') {
  55216. genSelect(el, value, modifiers);
  55217. } else if (tag === 'input' && type === 'checkbox') {
  55218. genCheckboxModel(el, value, modifiers);
  55219. } else if (tag === 'input' && type === 'radio') {
  55220. genRadioModel(el, value, modifiers);
  55221. } else if (tag === 'input' || tag === 'textarea') {
  55222. genDefaultModel(el, value, modifiers);
  55223. } else if (!config.isReservedTag(tag)) {
  55224. genComponentModel(el, value, modifiers);
  55225. // component v-model doesn't need extra runtime
  55226. return false
  55227. } else {
  55228. warn$1(
  55229. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  55230. "v-model is not supported on this element type. " +
  55231. 'If you are working with contenteditable, it\'s recommended to ' +
  55232. 'wrap a library dedicated for that purpose inside a custom component.',
  55233. el.rawAttrsMap['v-model']
  55234. );
  55235. }
  55236. // ensure runtime directive metadata
  55237. return true
  55238. }
  55239. function genCheckboxModel (
  55240. el,
  55241. value,
  55242. modifiers
  55243. ) {
  55244. var number = modifiers && modifiers.number;
  55245. var valueBinding = getBindingAttr(el, 'value') || 'null';
  55246. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  55247. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  55248. addProp(el, 'checked',
  55249. "Array.isArray(" + value + ")" +
  55250. "?_i(" + value + "," + valueBinding + ")>-1" + (
  55251. trueValueBinding === 'true'
  55252. ? (":(" + value + ")")
  55253. : (":_q(" + value + "," + trueValueBinding + ")")
  55254. )
  55255. );
  55256. addHandler(el, 'change',
  55257. "var $$a=" + value + "," +
  55258. '$$el=$event.target,' +
  55259. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  55260. 'if(Array.isArray($$a)){' +
  55261. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  55262. '$$i=_i($$a,$$v);' +
  55263. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  55264. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  55265. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  55266. null, true
  55267. );
  55268. }
  55269. function genRadioModel (
  55270. el,
  55271. value,
  55272. modifiers
  55273. ) {
  55274. var number = modifiers && modifiers.number;
  55275. var valueBinding = getBindingAttr(el, 'value') || 'null';
  55276. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  55277. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  55278. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  55279. }
  55280. function genSelect (
  55281. el,
  55282. value,
  55283. modifiers
  55284. ) {
  55285. var number = modifiers && modifiers.number;
  55286. var selectedVal = "Array.prototype.filter" +
  55287. ".call($event.target.options,function(o){return o.selected})" +
  55288. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  55289. "return " + (number ? '_n(val)' : 'val') + "})";
  55290. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  55291. var code = "var $$selectedVal = " + selectedVal + ";";
  55292. code = code + " " + (genAssignmentCode(value, assignment));
  55293. addHandler(el, 'change', code, null, true);
  55294. }
  55295. function genDefaultModel (
  55296. el,
  55297. value,
  55298. modifiers
  55299. ) {
  55300. var type = el.attrsMap.type;
  55301. // warn if v-bind:value conflicts with v-model
  55302. // except for inputs with v-bind:type
  55303. {
  55304. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  55305. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  55306. if (value$1 && !typeBinding) {
  55307. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  55308. warn$1(
  55309. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  55310. 'because the latter already expands to a value binding internally',
  55311. el.rawAttrsMap[binding]
  55312. );
  55313. }
  55314. }
  55315. var ref = modifiers || {};
  55316. var lazy = ref.lazy;
  55317. var number = ref.number;
  55318. var trim = ref.trim;
  55319. var needCompositionGuard = !lazy && type !== 'range';
  55320. var event = lazy
  55321. ? 'change'
  55322. : type === 'range'
  55323. ? RANGE_TOKEN
  55324. : 'input';
  55325. var valueExpression = '$event.target.value';
  55326. if (trim) {
  55327. valueExpression = "$event.target.value.trim()";
  55328. }
  55329. if (number) {
  55330. valueExpression = "_n(" + valueExpression + ")";
  55331. }
  55332. var code = genAssignmentCode(value, valueExpression);
  55333. if (needCompositionGuard) {
  55334. code = "if($event.target.composing)return;" + code;
  55335. }
  55336. addProp(el, 'value', ("(" + value + ")"));
  55337. addHandler(el, event, code, null, true);
  55338. if (trim || number) {
  55339. addHandler(el, 'blur', '$forceUpdate()');
  55340. }
  55341. }
  55342. /* */
  55343. // normalize v-model event tokens that can only be determined at runtime.
  55344. // it's important to place the event as the first in the array because
  55345. // the whole point is ensuring the v-model callback gets called before
  55346. // user-attached handlers.
  55347. function normalizeEvents (on) {
  55348. /* istanbul ignore if */
  55349. if (isDef(on[RANGE_TOKEN])) {
  55350. // IE input[type=range] only supports `change` event
  55351. var event = isIE ? 'change' : 'input';
  55352. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  55353. delete on[RANGE_TOKEN];
  55354. }
  55355. // This was originally intended to fix #4521 but no longer necessary
  55356. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  55357. /* istanbul ignore if */
  55358. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  55359. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  55360. delete on[CHECKBOX_RADIO_TOKEN];
  55361. }
  55362. }
  55363. var target$1;
  55364. function createOnceHandler$1 (event, handler, capture) {
  55365. var _target = target$1; // save current target element in closure
  55366. return function onceHandler () {
  55367. var res = handler.apply(null, arguments);
  55368. if (res !== null) {
  55369. remove$2(event, onceHandler, capture, _target);
  55370. }
  55371. }
  55372. }
  55373. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  55374. // implementation and does not fire microtasks in between event propagation, so
  55375. // safe to exclude.
  55376. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  55377. function add$1 (
  55378. name,
  55379. handler,
  55380. capture,
  55381. passive
  55382. ) {
  55383. // async edge case #6566: inner click event triggers patch, event handler
  55384. // attached to outer element during patch, and triggered again. This
  55385. // happens because browsers fire microtask ticks between event propagation.
  55386. // the solution is simple: we save the timestamp when a handler is attached,
  55387. // and the handler would only fire if the event passed to it was fired
  55388. // AFTER it was attached.
  55389. if (useMicrotaskFix) {
  55390. var attachedTimestamp = currentFlushTimestamp;
  55391. var original = handler;
  55392. handler = original._wrapper = function (e) {
  55393. if (
  55394. // no bubbling, should always fire.
  55395. // this is just a safety net in case event.timeStamp is unreliable in
  55396. // certain weird environments...
  55397. e.target === e.currentTarget ||
  55398. // event is fired after handler attachment
  55399. e.timeStamp >= attachedTimestamp ||
  55400. // bail for environments that have buggy event.timeStamp implementations
  55401. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  55402. // #9681 QtWebEngine event.timeStamp is negative value
  55403. e.timeStamp <= 0 ||
  55404. // #9448 bail if event is fired in another document in a multi-page
  55405. // electron/nw.js app, since event.timeStamp will be using a different
  55406. // starting reference
  55407. e.target.ownerDocument !== document
  55408. ) {
  55409. return original.apply(this, arguments)
  55410. }
  55411. };
  55412. }
  55413. target$1.addEventListener(
  55414. name,
  55415. handler,
  55416. supportsPassive
  55417. ? { capture: capture, passive: passive }
  55418. : capture
  55419. );
  55420. }
  55421. function remove$2 (
  55422. name,
  55423. handler,
  55424. capture,
  55425. _target
  55426. ) {
  55427. (_target || target$1).removeEventListener(
  55428. name,
  55429. handler._wrapper || handler,
  55430. capture
  55431. );
  55432. }
  55433. function updateDOMListeners (oldVnode, vnode) {
  55434. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  55435. return
  55436. }
  55437. var on = vnode.data.on || {};
  55438. var oldOn = oldVnode.data.on || {};
  55439. target$1 = vnode.elm;
  55440. normalizeEvents(on);
  55441. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  55442. target$1 = undefined;
  55443. }
  55444. var events = {
  55445. create: updateDOMListeners,
  55446. update: updateDOMListeners
  55447. };
  55448. /* */
  55449. var svgContainer;
  55450. function updateDOMProps (oldVnode, vnode) {
  55451. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  55452. return
  55453. }
  55454. var key, cur;
  55455. var elm = vnode.elm;
  55456. var oldProps = oldVnode.data.domProps || {};
  55457. var props = vnode.data.domProps || {};
  55458. // clone observed objects, as the user probably wants to mutate it
  55459. if (isDef(props.__ob__)) {
  55460. props = vnode.data.domProps = extend({}, props);
  55461. }
  55462. for (key in oldProps) {
  55463. if (!(key in props)) {
  55464. elm[key] = '';
  55465. }
  55466. }
  55467. for (key in props) {
  55468. cur = props[key];
  55469. // ignore children if the node has textContent or innerHTML,
  55470. // as these will throw away existing DOM nodes and cause removal errors
  55471. // on subsequent patches (#3360)
  55472. if (key === 'textContent' || key === 'innerHTML') {
  55473. if (vnode.children) { vnode.children.length = 0; }
  55474. if (cur === oldProps[key]) { continue }
  55475. // #6601 work around Chrome version <= 55 bug where single textNode
  55476. // replaced by innerHTML/textContent retains its parentNode property
  55477. if (elm.childNodes.length === 1) {
  55478. elm.removeChild(elm.childNodes[0]);
  55479. }
  55480. }
  55481. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  55482. // store value as _value as well since
  55483. // non-string values will be stringified
  55484. elm._value = cur;
  55485. // avoid resetting cursor position when value is the same
  55486. var strCur = isUndef(cur) ? '' : String(cur);
  55487. if (shouldUpdateValue(elm, strCur)) {
  55488. elm.value = strCur;
  55489. }
  55490. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  55491. // IE doesn't support innerHTML for SVG elements
  55492. svgContainer = svgContainer || document.createElement('div');
  55493. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  55494. var svg = svgContainer.firstChild;
  55495. while (elm.firstChild) {
  55496. elm.removeChild(elm.firstChild);
  55497. }
  55498. while (svg.firstChild) {
  55499. elm.appendChild(svg.firstChild);
  55500. }
  55501. } else if (
  55502. // skip the update if old and new VDOM state is the same.
  55503. // `value` is handled separately because the DOM value may be temporarily
  55504. // out of sync with VDOM state due to focus, composition and modifiers.
  55505. // This #4521 by skipping the unnecesarry `checked` update.
  55506. cur !== oldProps[key]
  55507. ) {
  55508. // some property updates can throw
  55509. // e.g. `value` on <progress> w/ non-finite value
  55510. try {
  55511. elm[key] = cur;
  55512. } catch (e) {}
  55513. }
  55514. }
  55515. }
  55516. // check platforms/web/util/attrs.js acceptValue
  55517. function shouldUpdateValue (elm, checkVal) {
  55518. return (!elm.composing && (
  55519. elm.tagName === 'OPTION' ||
  55520. isNotInFocusAndDirty(elm, checkVal) ||
  55521. isDirtyWithModifiers(elm, checkVal)
  55522. ))
  55523. }
  55524. function isNotInFocusAndDirty (elm, checkVal) {
  55525. // return true when textbox (.number and .trim) loses focus and its value is
  55526. // not equal to the updated value
  55527. var notInFocus = true;
  55528. // #6157
  55529. // work around IE bug when accessing document.activeElement in an iframe
  55530. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  55531. return notInFocus && elm.value !== checkVal
  55532. }
  55533. function isDirtyWithModifiers (elm, newVal) {
  55534. var value = elm.value;
  55535. var modifiers = elm._vModifiers; // injected by v-model runtime
  55536. if (isDef(modifiers)) {
  55537. if (modifiers.number) {
  55538. return toNumber(value) !== toNumber(newVal)
  55539. }
  55540. if (modifiers.trim) {
  55541. return value.trim() !== newVal.trim()
  55542. }
  55543. }
  55544. return value !== newVal
  55545. }
  55546. var domProps = {
  55547. create: updateDOMProps,
  55548. update: updateDOMProps
  55549. };
  55550. /* */
  55551. var parseStyleText = cached(function (cssText) {
  55552. var res = {};
  55553. var listDelimiter = /;(?![^(]*\))/g;
  55554. var propertyDelimiter = /:(.+)/;
  55555. cssText.split(listDelimiter).forEach(function (item) {
  55556. if (item) {
  55557. var tmp = item.split(propertyDelimiter);
  55558. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  55559. }
  55560. });
  55561. return res
  55562. });
  55563. // merge static and dynamic style data on the same vnode
  55564. function normalizeStyleData (data) {
  55565. var style = normalizeStyleBinding(data.style);
  55566. // static style is pre-processed into an object during compilation
  55567. // and is always a fresh object, so it's safe to merge into it
  55568. return data.staticStyle
  55569. ? extend(data.staticStyle, style)
  55570. : style
  55571. }
  55572. // normalize possible array / string values into Object
  55573. function normalizeStyleBinding (bindingStyle) {
  55574. if (Array.isArray(bindingStyle)) {
  55575. return toObject(bindingStyle)
  55576. }
  55577. if (typeof bindingStyle === 'string') {
  55578. return parseStyleText(bindingStyle)
  55579. }
  55580. return bindingStyle
  55581. }
  55582. /**
  55583. * parent component style should be after child's
  55584. * so that parent component's style could override it
  55585. */
  55586. function getStyle (vnode, checkChild) {
  55587. var res = {};
  55588. var styleData;
  55589. if (checkChild) {
  55590. var childNode = vnode;
  55591. while (childNode.componentInstance) {
  55592. childNode = childNode.componentInstance._vnode;
  55593. if (
  55594. childNode && childNode.data &&
  55595. (styleData = normalizeStyleData(childNode.data))
  55596. ) {
  55597. extend(res, styleData);
  55598. }
  55599. }
  55600. }
  55601. if ((styleData = normalizeStyleData(vnode.data))) {
  55602. extend(res, styleData);
  55603. }
  55604. var parentNode = vnode;
  55605. while ((parentNode = parentNode.parent)) {
  55606. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  55607. extend(res, styleData);
  55608. }
  55609. }
  55610. return res
  55611. }
  55612. /* */
  55613. var cssVarRE = /^--/;
  55614. var importantRE = /\s*!important$/;
  55615. var setProp = function (el, name, val) {
  55616. /* istanbul ignore if */
  55617. if (cssVarRE.test(name)) {
  55618. el.style.setProperty(name, val);
  55619. } else if (importantRE.test(val)) {
  55620. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  55621. } else {
  55622. var normalizedName = normalize(name);
  55623. if (Array.isArray(val)) {
  55624. // Support values array created by autoprefixer, e.g.
  55625. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  55626. // Set them one by one, and the browser will only set those it can recognize
  55627. for (var i = 0, len = val.length; i < len; i++) {
  55628. el.style[normalizedName] = val[i];
  55629. }
  55630. } else {
  55631. el.style[normalizedName] = val;
  55632. }
  55633. }
  55634. };
  55635. var vendorNames = ['Webkit', 'Moz', 'ms'];
  55636. var emptyStyle;
  55637. var normalize = cached(function (prop) {
  55638. emptyStyle = emptyStyle || document.createElement('div').style;
  55639. prop = camelize(prop);
  55640. if (prop !== 'filter' && (prop in emptyStyle)) {
  55641. return prop
  55642. }
  55643. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  55644. for (var i = 0; i < vendorNames.length; i++) {
  55645. var name = vendorNames[i] + capName;
  55646. if (name in emptyStyle) {
  55647. return name
  55648. }
  55649. }
  55650. });
  55651. function updateStyle (oldVnode, vnode) {
  55652. var data = vnode.data;
  55653. var oldData = oldVnode.data;
  55654. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  55655. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  55656. ) {
  55657. return
  55658. }
  55659. var cur, name;
  55660. var el = vnode.elm;
  55661. var oldStaticStyle = oldData.staticStyle;
  55662. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  55663. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  55664. var oldStyle = oldStaticStyle || oldStyleBinding;
  55665. var style = normalizeStyleBinding(vnode.data.style) || {};
  55666. // store normalized style under a different key for next diff
  55667. // make sure to clone it if it's reactive, since the user likely wants
  55668. // to mutate it.
  55669. vnode.data.normalizedStyle = isDef(style.__ob__)
  55670. ? extend({}, style)
  55671. : style;
  55672. var newStyle = getStyle(vnode, true);
  55673. for (name in oldStyle) {
  55674. if (isUndef(newStyle[name])) {
  55675. setProp(el, name, '');
  55676. }
  55677. }
  55678. for (name in newStyle) {
  55679. cur = newStyle[name];
  55680. if (cur !== oldStyle[name]) {
  55681. // ie9 setting to null has no effect, must use empty string
  55682. setProp(el, name, cur == null ? '' : cur);
  55683. }
  55684. }
  55685. }
  55686. var style = {
  55687. create: updateStyle,
  55688. update: updateStyle
  55689. };
  55690. /* */
  55691. var whitespaceRE = /\s+/;
  55692. /**
  55693. * Add class with compatibility for SVG since classList is not supported on
  55694. * SVG elements in IE
  55695. */
  55696. function addClass (el, cls) {
  55697. /* istanbul ignore if */
  55698. if (!cls || !(cls = cls.trim())) {
  55699. return
  55700. }
  55701. /* istanbul ignore else */
  55702. if (el.classList) {
  55703. if (cls.indexOf(' ') > -1) {
  55704. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  55705. } else {
  55706. el.classList.add(cls);
  55707. }
  55708. } else {
  55709. var cur = " " + (el.getAttribute('class') || '') + " ";
  55710. if (cur.indexOf(' ' + cls + ' ') < 0) {
  55711. el.setAttribute('class', (cur + cls).trim());
  55712. }
  55713. }
  55714. }
  55715. /**
  55716. * Remove class with compatibility for SVG since classList is not supported on
  55717. * SVG elements in IE
  55718. */
  55719. function removeClass (el, cls) {
  55720. /* istanbul ignore if */
  55721. if (!cls || !(cls = cls.trim())) {
  55722. return
  55723. }
  55724. /* istanbul ignore else */
  55725. if (el.classList) {
  55726. if (cls.indexOf(' ') > -1) {
  55727. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  55728. } else {
  55729. el.classList.remove(cls);
  55730. }
  55731. if (!el.classList.length) {
  55732. el.removeAttribute('class');
  55733. }
  55734. } else {
  55735. var cur = " " + (el.getAttribute('class') || '') + " ";
  55736. var tar = ' ' + cls + ' ';
  55737. while (cur.indexOf(tar) >= 0) {
  55738. cur = cur.replace(tar, ' ');
  55739. }
  55740. cur = cur.trim();
  55741. if (cur) {
  55742. el.setAttribute('class', cur);
  55743. } else {
  55744. el.removeAttribute('class');
  55745. }
  55746. }
  55747. }
  55748. /* */
  55749. function resolveTransition (def$$1) {
  55750. if (!def$$1) {
  55751. return
  55752. }
  55753. /* istanbul ignore else */
  55754. if (typeof def$$1 === 'object') {
  55755. var res = {};
  55756. if (def$$1.css !== false) {
  55757. extend(res, autoCssTransition(def$$1.name || 'v'));
  55758. }
  55759. extend(res, def$$1);
  55760. return res
  55761. } else if (typeof def$$1 === 'string') {
  55762. return autoCssTransition(def$$1)
  55763. }
  55764. }
  55765. var autoCssTransition = cached(function (name) {
  55766. return {
  55767. enterClass: (name + "-enter"),
  55768. enterToClass: (name + "-enter-to"),
  55769. enterActiveClass: (name + "-enter-active"),
  55770. leaveClass: (name + "-leave"),
  55771. leaveToClass: (name + "-leave-to"),
  55772. leaveActiveClass: (name + "-leave-active")
  55773. }
  55774. });
  55775. var hasTransition = inBrowser && !isIE9;
  55776. var TRANSITION = 'transition';
  55777. var ANIMATION = 'animation';
  55778. // Transition property/event sniffing
  55779. var transitionProp = 'transition';
  55780. var transitionEndEvent = 'transitionend';
  55781. var animationProp = 'animation';
  55782. var animationEndEvent = 'animationend';
  55783. if (hasTransition) {
  55784. /* istanbul ignore if */
  55785. if (window.ontransitionend === undefined &&
  55786. window.onwebkittransitionend !== undefined
  55787. ) {
  55788. transitionProp = 'WebkitTransition';
  55789. transitionEndEvent = 'webkitTransitionEnd';
  55790. }
  55791. if (window.onanimationend === undefined &&
  55792. window.onwebkitanimationend !== undefined
  55793. ) {
  55794. animationProp = 'WebkitAnimation';
  55795. animationEndEvent = 'webkitAnimationEnd';
  55796. }
  55797. }
  55798. // binding to window is necessary to make hot reload work in IE in strict mode
  55799. var raf = inBrowser
  55800. ? window.requestAnimationFrame
  55801. ? window.requestAnimationFrame.bind(window)
  55802. : setTimeout
  55803. : /* istanbul ignore next */ function (fn) { return fn(); };
  55804. function nextFrame (fn) {
  55805. raf(function () {
  55806. raf(fn);
  55807. });
  55808. }
  55809. function addTransitionClass (el, cls) {
  55810. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  55811. if (transitionClasses.indexOf(cls) < 0) {
  55812. transitionClasses.push(cls);
  55813. addClass(el, cls);
  55814. }
  55815. }
  55816. function removeTransitionClass (el, cls) {
  55817. if (el._transitionClasses) {
  55818. remove(el._transitionClasses, cls);
  55819. }
  55820. removeClass(el, cls);
  55821. }
  55822. function whenTransitionEnds (
  55823. el,
  55824. expectedType,
  55825. cb
  55826. ) {
  55827. var ref = getTransitionInfo(el, expectedType);
  55828. var type = ref.type;
  55829. var timeout = ref.timeout;
  55830. var propCount = ref.propCount;
  55831. if (!type) { return cb() }
  55832. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  55833. var ended = 0;
  55834. var end = function () {
  55835. el.removeEventListener(event, onEnd);
  55836. cb();
  55837. };
  55838. var onEnd = function (e) {
  55839. if (e.target === el) {
  55840. if (++ended >= propCount) {
  55841. end();
  55842. }
  55843. }
  55844. };
  55845. setTimeout(function () {
  55846. if (ended < propCount) {
  55847. end();
  55848. }
  55849. }, timeout + 1);
  55850. el.addEventListener(event, onEnd);
  55851. }
  55852. var transformRE = /\b(transform|all)(,|$)/;
  55853. function getTransitionInfo (el, expectedType) {
  55854. var styles = window.getComputedStyle(el);
  55855. // JSDOM may return undefined for transition properties
  55856. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  55857. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  55858. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  55859. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  55860. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  55861. var animationTimeout = getTimeout(animationDelays, animationDurations);
  55862. var type;
  55863. var timeout = 0;
  55864. var propCount = 0;
  55865. /* istanbul ignore if */
  55866. if (expectedType === TRANSITION) {
  55867. if (transitionTimeout > 0) {
  55868. type = TRANSITION;
  55869. timeout = transitionTimeout;
  55870. propCount = transitionDurations.length;
  55871. }
  55872. } else if (expectedType === ANIMATION) {
  55873. if (animationTimeout > 0) {
  55874. type = ANIMATION;
  55875. timeout = animationTimeout;
  55876. propCount = animationDurations.length;
  55877. }
  55878. } else {
  55879. timeout = Math.max(transitionTimeout, animationTimeout);
  55880. type = timeout > 0
  55881. ? transitionTimeout > animationTimeout
  55882. ? TRANSITION
  55883. : ANIMATION
  55884. : null;
  55885. propCount = type
  55886. ? type === TRANSITION
  55887. ? transitionDurations.length
  55888. : animationDurations.length
  55889. : 0;
  55890. }
  55891. var hasTransform =
  55892. type === TRANSITION &&
  55893. transformRE.test(styles[transitionProp + 'Property']);
  55894. return {
  55895. type: type,
  55896. timeout: timeout,
  55897. propCount: propCount,
  55898. hasTransform: hasTransform
  55899. }
  55900. }
  55901. function getTimeout (delays, durations) {
  55902. /* istanbul ignore next */
  55903. while (delays.length < durations.length) {
  55904. delays = delays.concat(delays);
  55905. }
  55906. return Math.max.apply(null, durations.map(function (d, i) {
  55907. return toMs(d) + toMs(delays[i])
  55908. }))
  55909. }
  55910. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  55911. // in a locale-dependent way, using a comma instead of a dot.
  55912. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  55913. // as a floor function) causing unexpected behaviors
  55914. function toMs (s) {
  55915. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  55916. }
  55917. /* */
  55918. function enter (vnode, toggleDisplay) {
  55919. var el = vnode.elm;
  55920. // call leave callback now
  55921. if (isDef(el._leaveCb)) {
  55922. el._leaveCb.cancelled = true;
  55923. el._leaveCb();
  55924. }
  55925. var data = resolveTransition(vnode.data.transition);
  55926. if (isUndef(data)) {
  55927. return
  55928. }
  55929. /* istanbul ignore if */
  55930. if (isDef(el._enterCb) || el.nodeType !== 1) {
  55931. return
  55932. }
  55933. var css = data.css;
  55934. var type = data.type;
  55935. var enterClass = data.enterClass;
  55936. var enterToClass = data.enterToClass;
  55937. var enterActiveClass = data.enterActiveClass;
  55938. var appearClass = data.appearClass;
  55939. var appearToClass = data.appearToClass;
  55940. var appearActiveClass = data.appearActiveClass;
  55941. var beforeEnter = data.beforeEnter;
  55942. var enter = data.enter;
  55943. var afterEnter = data.afterEnter;
  55944. var enterCancelled = data.enterCancelled;
  55945. var beforeAppear = data.beforeAppear;
  55946. var appear = data.appear;
  55947. var afterAppear = data.afterAppear;
  55948. var appearCancelled = data.appearCancelled;
  55949. var duration = data.duration;
  55950. // activeInstance will always be the <transition> component managing this
  55951. // transition. One edge case to check is when the <transition> is placed
  55952. // as the root node of a child component. In that case we need to check
  55953. // <transition>'s parent for appear check.
  55954. var context = activeInstance;
  55955. var transitionNode = activeInstance.$vnode;
  55956. while (transitionNode && transitionNode.parent) {
  55957. context = transitionNode.context;
  55958. transitionNode = transitionNode.parent;
  55959. }
  55960. var isAppear = !context._isMounted || !vnode.isRootInsert;
  55961. if (isAppear && !appear && appear !== '') {
  55962. return
  55963. }
  55964. var startClass = isAppear && appearClass
  55965. ? appearClass
  55966. : enterClass;
  55967. var activeClass = isAppear && appearActiveClass
  55968. ? appearActiveClass
  55969. : enterActiveClass;
  55970. var toClass = isAppear && appearToClass
  55971. ? appearToClass
  55972. : enterToClass;
  55973. var beforeEnterHook = isAppear
  55974. ? (beforeAppear || beforeEnter)
  55975. : beforeEnter;
  55976. var enterHook = isAppear
  55977. ? (typeof appear === 'function' ? appear : enter)
  55978. : enter;
  55979. var afterEnterHook = isAppear
  55980. ? (afterAppear || afterEnter)
  55981. : afterEnter;
  55982. var enterCancelledHook = isAppear
  55983. ? (appearCancelled || enterCancelled)
  55984. : enterCancelled;
  55985. var explicitEnterDuration = toNumber(
  55986. isObject(duration)
  55987. ? duration.enter
  55988. : duration
  55989. );
  55990. if (explicitEnterDuration != null) {
  55991. checkDuration(explicitEnterDuration, 'enter', vnode);
  55992. }
  55993. var expectsCSS = css !== false && !isIE9;
  55994. var userWantsControl = getHookArgumentsLength(enterHook);
  55995. var cb = el._enterCb = once(function () {
  55996. if (expectsCSS) {
  55997. removeTransitionClass(el, toClass);
  55998. removeTransitionClass(el, activeClass);
  55999. }
  56000. if (cb.cancelled) {
  56001. if (expectsCSS) {
  56002. removeTransitionClass(el, startClass);
  56003. }
  56004. enterCancelledHook && enterCancelledHook(el);
  56005. } else {
  56006. afterEnterHook && afterEnterHook(el);
  56007. }
  56008. el._enterCb = null;
  56009. });
  56010. if (!vnode.data.show) {
  56011. // remove pending leave element on enter by injecting an insert hook
  56012. mergeVNodeHook(vnode, 'insert', function () {
  56013. var parent = el.parentNode;
  56014. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  56015. if (pendingNode &&
  56016. pendingNode.tag === vnode.tag &&
  56017. pendingNode.elm._leaveCb
  56018. ) {
  56019. pendingNode.elm._leaveCb();
  56020. }
  56021. enterHook && enterHook(el, cb);
  56022. });
  56023. }
  56024. // start enter transition
  56025. beforeEnterHook && beforeEnterHook(el);
  56026. if (expectsCSS) {
  56027. addTransitionClass(el, startClass);
  56028. addTransitionClass(el, activeClass);
  56029. nextFrame(function () {
  56030. removeTransitionClass(el, startClass);
  56031. if (!cb.cancelled) {
  56032. addTransitionClass(el, toClass);
  56033. if (!userWantsControl) {
  56034. if (isValidDuration(explicitEnterDuration)) {
  56035. setTimeout(cb, explicitEnterDuration);
  56036. } else {
  56037. whenTransitionEnds(el, type, cb);
  56038. }
  56039. }
  56040. }
  56041. });
  56042. }
  56043. if (vnode.data.show) {
  56044. toggleDisplay && toggleDisplay();
  56045. enterHook && enterHook(el, cb);
  56046. }
  56047. if (!expectsCSS && !userWantsControl) {
  56048. cb();
  56049. }
  56050. }
  56051. function leave (vnode, rm) {
  56052. var el = vnode.elm;
  56053. // call enter callback now
  56054. if (isDef(el._enterCb)) {
  56055. el._enterCb.cancelled = true;
  56056. el._enterCb();
  56057. }
  56058. var data = resolveTransition(vnode.data.transition);
  56059. if (isUndef(data) || el.nodeType !== 1) {
  56060. return rm()
  56061. }
  56062. /* istanbul ignore if */
  56063. if (isDef(el._leaveCb)) {
  56064. return
  56065. }
  56066. var css = data.css;
  56067. var type = data.type;
  56068. var leaveClass = data.leaveClass;
  56069. var leaveToClass = data.leaveToClass;
  56070. var leaveActiveClass = data.leaveActiveClass;
  56071. var beforeLeave = data.beforeLeave;
  56072. var leave = data.leave;
  56073. var afterLeave = data.afterLeave;
  56074. var leaveCancelled = data.leaveCancelled;
  56075. var delayLeave = data.delayLeave;
  56076. var duration = data.duration;
  56077. var expectsCSS = css !== false && !isIE9;
  56078. var userWantsControl = getHookArgumentsLength(leave);
  56079. var explicitLeaveDuration = toNumber(
  56080. isObject(duration)
  56081. ? duration.leave
  56082. : duration
  56083. );
  56084. if (isDef(explicitLeaveDuration)) {
  56085. checkDuration(explicitLeaveDuration, 'leave', vnode);
  56086. }
  56087. var cb = el._leaveCb = once(function () {
  56088. if (el.parentNode && el.parentNode._pending) {
  56089. el.parentNode._pending[vnode.key] = null;
  56090. }
  56091. if (expectsCSS) {
  56092. removeTransitionClass(el, leaveToClass);
  56093. removeTransitionClass(el, leaveActiveClass);
  56094. }
  56095. if (cb.cancelled) {
  56096. if (expectsCSS) {
  56097. removeTransitionClass(el, leaveClass);
  56098. }
  56099. leaveCancelled && leaveCancelled(el);
  56100. } else {
  56101. rm();
  56102. afterLeave && afterLeave(el);
  56103. }
  56104. el._leaveCb = null;
  56105. });
  56106. if (delayLeave) {
  56107. delayLeave(performLeave);
  56108. } else {
  56109. performLeave();
  56110. }
  56111. function performLeave () {
  56112. // the delayed leave may have already been cancelled
  56113. if (cb.cancelled) {
  56114. return
  56115. }
  56116. // record leaving element
  56117. if (!vnode.data.show && el.parentNode) {
  56118. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  56119. }
  56120. beforeLeave && beforeLeave(el);
  56121. if (expectsCSS) {
  56122. addTransitionClass(el, leaveClass);
  56123. addTransitionClass(el, leaveActiveClass);
  56124. nextFrame(function () {
  56125. removeTransitionClass(el, leaveClass);
  56126. if (!cb.cancelled) {
  56127. addTransitionClass(el, leaveToClass);
  56128. if (!userWantsControl) {
  56129. if (isValidDuration(explicitLeaveDuration)) {
  56130. setTimeout(cb, explicitLeaveDuration);
  56131. } else {
  56132. whenTransitionEnds(el, type, cb);
  56133. }
  56134. }
  56135. }
  56136. });
  56137. }
  56138. leave && leave(el, cb);
  56139. if (!expectsCSS && !userWantsControl) {
  56140. cb();
  56141. }
  56142. }
  56143. }
  56144. // only used in dev mode
  56145. function checkDuration (val, name, vnode) {
  56146. if (typeof val !== 'number') {
  56147. warn(
  56148. "<transition> explicit " + name + " duration is not a valid number - " +
  56149. "got " + (JSON.stringify(val)) + ".",
  56150. vnode.context
  56151. );
  56152. } else if (isNaN(val)) {
  56153. warn(
  56154. "<transition> explicit " + name + " duration is NaN - " +
  56155. 'the duration expression might be incorrect.',
  56156. vnode.context
  56157. );
  56158. }
  56159. }
  56160. function isValidDuration (val) {
  56161. return typeof val === 'number' && !isNaN(val)
  56162. }
  56163. /**
  56164. * Normalize a transition hook's argument length. The hook may be:
  56165. * - a merged hook (invoker) with the original in .fns
  56166. * - a wrapped component method (check ._length)
  56167. * - a plain function (.length)
  56168. */
  56169. function getHookArgumentsLength (fn) {
  56170. if (isUndef(fn)) {
  56171. return false
  56172. }
  56173. var invokerFns = fn.fns;
  56174. if (isDef(invokerFns)) {
  56175. // invoker
  56176. return getHookArgumentsLength(
  56177. Array.isArray(invokerFns)
  56178. ? invokerFns[0]
  56179. : invokerFns
  56180. )
  56181. } else {
  56182. return (fn._length || fn.length) > 1
  56183. }
  56184. }
  56185. function _enter (_, vnode) {
  56186. if (vnode.data.show !== true) {
  56187. enter(vnode);
  56188. }
  56189. }
  56190. var transition = inBrowser ? {
  56191. create: _enter,
  56192. activate: _enter,
  56193. remove: function remove$$1 (vnode, rm) {
  56194. /* istanbul ignore else */
  56195. if (vnode.data.show !== true) {
  56196. leave(vnode, rm);
  56197. } else {
  56198. rm();
  56199. }
  56200. }
  56201. } : {};
  56202. var platformModules = [
  56203. attrs,
  56204. klass,
  56205. events,
  56206. domProps,
  56207. style,
  56208. transition
  56209. ];
  56210. /* */
  56211. // the directive module should be applied last, after all
  56212. // built-in modules have been applied.
  56213. var modules = platformModules.concat(baseModules);
  56214. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  56215. /**
  56216. * Not type checking this file because flow doesn't like attaching
  56217. * properties to Elements.
  56218. */
  56219. /* istanbul ignore if */
  56220. if (isIE9) {
  56221. // http://www.matts411.com/post/internet-explorer-9-oninput/
  56222. document.addEventListener('selectionchange', function () {
  56223. var el = document.activeElement;
  56224. if (el && el.vmodel) {
  56225. trigger(el, 'input');
  56226. }
  56227. });
  56228. }
  56229. var directive = {
  56230. inserted: function inserted (el, binding, vnode, oldVnode) {
  56231. if (vnode.tag === 'select') {
  56232. // #6903
  56233. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  56234. mergeVNodeHook(vnode, 'postpatch', function () {
  56235. directive.componentUpdated(el, binding, vnode);
  56236. });
  56237. } else {
  56238. setSelected(el, binding, vnode.context);
  56239. }
  56240. el._vOptions = [].map.call(el.options, getValue);
  56241. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  56242. el._vModifiers = binding.modifiers;
  56243. if (!binding.modifiers.lazy) {
  56244. el.addEventListener('compositionstart', onCompositionStart);
  56245. el.addEventListener('compositionend', onCompositionEnd);
  56246. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  56247. // switching focus before confirming composition choice
  56248. // this also fixes the issue where some browsers e.g. iOS Chrome
  56249. // fires "change" instead of "input" on autocomplete.
  56250. el.addEventListener('change', onCompositionEnd);
  56251. /* istanbul ignore if */
  56252. if (isIE9) {
  56253. el.vmodel = true;
  56254. }
  56255. }
  56256. }
  56257. },
  56258. componentUpdated: function componentUpdated (el, binding, vnode) {
  56259. if (vnode.tag === 'select') {
  56260. setSelected(el, binding, vnode.context);
  56261. // in case the options rendered by v-for have changed,
  56262. // it's possible that the value is out-of-sync with the rendered options.
  56263. // detect such cases and filter out values that no longer has a matching
  56264. // option in the DOM.
  56265. var prevOptions = el._vOptions;
  56266. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  56267. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  56268. // trigger change event if
  56269. // no matching option found for at least one value
  56270. var needReset = el.multiple
  56271. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  56272. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  56273. if (needReset) {
  56274. trigger(el, 'change');
  56275. }
  56276. }
  56277. }
  56278. }
  56279. };
  56280. function setSelected (el, binding, vm) {
  56281. actuallySetSelected(el, binding, vm);
  56282. /* istanbul ignore if */
  56283. if (isIE || isEdge) {
  56284. setTimeout(function () {
  56285. actuallySetSelected(el, binding, vm);
  56286. }, 0);
  56287. }
  56288. }
  56289. function actuallySetSelected (el, binding, vm) {
  56290. var value = binding.value;
  56291. var isMultiple = el.multiple;
  56292. if (isMultiple && !Array.isArray(value)) {
  56293. warn(
  56294. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  56295. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  56296. vm
  56297. );
  56298. return
  56299. }
  56300. var selected, option;
  56301. for (var i = 0, l = el.options.length; i < l; i++) {
  56302. option = el.options[i];
  56303. if (isMultiple) {
  56304. selected = looseIndexOf(value, getValue(option)) > -1;
  56305. if (option.selected !== selected) {
  56306. option.selected = selected;
  56307. }
  56308. } else {
  56309. if (looseEqual(getValue(option), value)) {
  56310. if (el.selectedIndex !== i) {
  56311. el.selectedIndex = i;
  56312. }
  56313. return
  56314. }
  56315. }
  56316. }
  56317. if (!isMultiple) {
  56318. el.selectedIndex = -1;
  56319. }
  56320. }
  56321. function hasNoMatchingOption (value, options) {
  56322. return options.every(function (o) { return !looseEqual(o, value); })
  56323. }
  56324. function getValue (option) {
  56325. return '_value' in option
  56326. ? option._value
  56327. : option.value
  56328. }
  56329. function onCompositionStart (e) {
  56330. e.target.composing = true;
  56331. }
  56332. function onCompositionEnd (e) {
  56333. // prevent triggering an input event for no reason
  56334. if (!e.target.composing) { return }
  56335. e.target.composing = false;
  56336. trigger(e.target, 'input');
  56337. }
  56338. function trigger (el, type) {
  56339. var e = document.createEvent('HTMLEvents');
  56340. e.initEvent(type, true, true);
  56341. el.dispatchEvent(e);
  56342. }
  56343. /* */
  56344. // recursively search for possible transition defined inside the component root
  56345. function locateNode (vnode) {
  56346. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  56347. ? locateNode(vnode.componentInstance._vnode)
  56348. : vnode
  56349. }
  56350. var show = {
  56351. bind: function bind (el, ref, vnode) {
  56352. var value = ref.value;
  56353. vnode = locateNode(vnode);
  56354. var transition$$1 = vnode.data && vnode.data.transition;
  56355. var originalDisplay = el.__vOriginalDisplay =
  56356. el.style.display === 'none' ? '' : el.style.display;
  56357. if (value && transition$$1) {
  56358. vnode.data.show = true;
  56359. enter(vnode, function () {
  56360. el.style.display = originalDisplay;
  56361. });
  56362. } else {
  56363. el.style.display = value ? originalDisplay : 'none';
  56364. }
  56365. },
  56366. update: function update (el, ref, vnode) {
  56367. var value = ref.value;
  56368. var oldValue = ref.oldValue;
  56369. /* istanbul ignore if */
  56370. if (!value === !oldValue) { return }
  56371. vnode = locateNode(vnode);
  56372. var transition$$1 = vnode.data && vnode.data.transition;
  56373. if (transition$$1) {
  56374. vnode.data.show = true;
  56375. if (value) {
  56376. enter(vnode, function () {
  56377. el.style.display = el.__vOriginalDisplay;
  56378. });
  56379. } else {
  56380. leave(vnode, function () {
  56381. el.style.display = 'none';
  56382. });
  56383. }
  56384. } else {
  56385. el.style.display = value ? el.__vOriginalDisplay : 'none';
  56386. }
  56387. },
  56388. unbind: function unbind (
  56389. el,
  56390. binding,
  56391. vnode,
  56392. oldVnode,
  56393. isDestroy
  56394. ) {
  56395. if (!isDestroy) {
  56396. el.style.display = el.__vOriginalDisplay;
  56397. }
  56398. }
  56399. };
  56400. var platformDirectives = {
  56401. model: directive,
  56402. show: show
  56403. };
  56404. /* */
  56405. var transitionProps = {
  56406. name: String,
  56407. appear: Boolean,
  56408. css: Boolean,
  56409. mode: String,
  56410. type: String,
  56411. enterClass: String,
  56412. leaveClass: String,
  56413. enterToClass: String,
  56414. leaveToClass: String,
  56415. enterActiveClass: String,
  56416. leaveActiveClass: String,
  56417. appearClass: String,
  56418. appearActiveClass: String,
  56419. appearToClass: String,
  56420. duration: [Number, String, Object]
  56421. };
  56422. // in case the child is also an abstract component, e.g. <keep-alive>
  56423. // we want to recursively retrieve the real component to be rendered
  56424. function getRealChild (vnode) {
  56425. var compOptions = vnode && vnode.componentOptions;
  56426. if (compOptions && compOptions.Ctor.options.abstract) {
  56427. return getRealChild(getFirstComponentChild(compOptions.children))
  56428. } else {
  56429. return vnode
  56430. }
  56431. }
  56432. function extractTransitionData (comp) {
  56433. var data = {};
  56434. var options = comp.$options;
  56435. // props
  56436. for (var key in options.propsData) {
  56437. data[key] = comp[key];
  56438. }
  56439. // events.
  56440. // extract listeners and pass them directly to the transition methods
  56441. var listeners = options._parentListeners;
  56442. for (var key$1 in listeners) {
  56443. data[camelize(key$1)] = listeners[key$1];
  56444. }
  56445. return data
  56446. }
  56447. function placeholder (h, rawChild) {
  56448. if (/\d-keep-alive$/.test(rawChild.tag)) {
  56449. return h('keep-alive', {
  56450. props: rawChild.componentOptions.propsData
  56451. })
  56452. }
  56453. }
  56454. function hasParentTransition (vnode) {
  56455. while ((vnode = vnode.parent)) {
  56456. if (vnode.data.transition) {
  56457. return true
  56458. }
  56459. }
  56460. }
  56461. function isSameChild (child, oldChild) {
  56462. return oldChild.key === child.key && oldChild.tag === child.tag
  56463. }
  56464. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  56465. var isVShowDirective = function (d) { return d.name === 'show'; };
  56466. var Transition = {
  56467. name: 'transition',
  56468. props: transitionProps,
  56469. abstract: true,
  56470. render: function render (h) {
  56471. var this$1 = this;
  56472. var children = this.$slots.default;
  56473. if (!children) {
  56474. return
  56475. }
  56476. // filter out text nodes (possible whitespaces)
  56477. children = children.filter(isNotTextNode);
  56478. /* istanbul ignore if */
  56479. if (!children.length) {
  56480. return
  56481. }
  56482. // warn multiple elements
  56483. if (children.length > 1) {
  56484. warn(
  56485. '<transition> can only be used on a single element. Use ' +
  56486. '<transition-group> for lists.',
  56487. this.$parent
  56488. );
  56489. }
  56490. var mode = this.mode;
  56491. // warn invalid mode
  56492. if (mode && mode !== 'in-out' && mode !== 'out-in'
  56493. ) {
  56494. warn(
  56495. 'invalid <transition> mode: ' + mode,
  56496. this.$parent
  56497. );
  56498. }
  56499. var rawChild = children[0];
  56500. // if this is a component root node and the component's
  56501. // parent container node also has transition, skip.
  56502. if (hasParentTransition(this.$vnode)) {
  56503. return rawChild
  56504. }
  56505. // apply transition data to child
  56506. // use getRealChild() to ignore abstract components e.g. keep-alive
  56507. var child = getRealChild(rawChild);
  56508. /* istanbul ignore if */
  56509. if (!child) {
  56510. return rawChild
  56511. }
  56512. if (this._leaving) {
  56513. return placeholder(h, rawChild)
  56514. }
  56515. // ensure a key that is unique to the vnode type and to this transition
  56516. // component instance. This key will be used to remove pending leaving nodes
  56517. // during entering.
  56518. var id = "__transition-" + (this._uid) + "-";
  56519. child.key = child.key == null
  56520. ? child.isComment
  56521. ? id + 'comment'
  56522. : id + child.tag
  56523. : isPrimitive(child.key)
  56524. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  56525. : child.key;
  56526. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  56527. var oldRawChild = this._vnode;
  56528. var oldChild = getRealChild(oldRawChild);
  56529. // mark v-show
  56530. // so that the transition module can hand over the control to the directive
  56531. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  56532. child.data.show = true;
  56533. }
  56534. if (
  56535. oldChild &&
  56536. oldChild.data &&
  56537. !isSameChild(child, oldChild) &&
  56538. !isAsyncPlaceholder(oldChild) &&
  56539. // #6687 component root is a comment node
  56540. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  56541. ) {
  56542. // replace old child transition data with fresh one
  56543. // important for dynamic transitions!
  56544. var oldData = oldChild.data.transition = extend({}, data);
  56545. // handle transition mode
  56546. if (mode === 'out-in') {
  56547. // return placeholder node and queue update when leave finishes
  56548. this._leaving = true;
  56549. mergeVNodeHook(oldData, 'afterLeave', function () {
  56550. this$1._leaving = false;
  56551. this$1.$forceUpdate();
  56552. });
  56553. return placeholder(h, rawChild)
  56554. } else if (mode === 'in-out') {
  56555. if (isAsyncPlaceholder(child)) {
  56556. return oldRawChild
  56557. }
  56558. var delayedLeave;
  56559. var performLeave = function () { delayedLeave(); };
  56560. mergeVNodeHook(data, 'afterEnter', performLeave);
  56561. mergeVNodeHook(data, 'enterCancelled', performLeave);
  56562. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  56563. }
  56564. }
  56565. return rawChild
  56566. }
  56567. };
  56568. /* */
  56569. var props = extend({
  56570. tag: String,
  56571. moveClass: String
  56572. }, transitionProps);
  56573. delete props.mode;
  56574. var TransitionGroup = {
  56575. props: props,
  56576. beforeMount: function beforeMount () {
  56577. var this$1 = this;
  56578. var update = this._update;
  56579. this._update = function (vnode, hydrating) {
  56580. var restoreActiveInstance = setActiveInstance(this$1);
  56581. // force removing pass
  56582. this$1.__patch__(
  56583. this$1._vnode,
  56584. this$1.kept,
  56585. false, // hydrating
  56586. true // removeOnly (!important, avoids unnecessary moves)
  56587. );
  56588. this$1._vnode = this$1.kept;
  56589. restoreActiveInstance();
  56590. update.call(this$1, vnode, hydrating);
  56591. };
  56592. },
  56593. render: function render (h) {
  56594. var tag = this.tag || this.$vnode.data.tag || 'span';
  56595. var map = Object.create(null);
  56596. var prevChildren = this.prevChildren = this.children;
  56597. var rawChildren = this.$slots.default || [];
  56598. var children = this.children = [];
  56599. var transitionData = extractTransitionData(this);
  56600. for (var i = 0; i < rawChildren.length; i++) {
  56601. var c = rawChildren[i];
  56602. if (c.tag) {
  56603. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  56604. children.push(c);
  56605. map[c.key] = c
  56606. ;(c.data || (c.data = {})).transition = transitionData;
  56607. } else {
  56608. var opts = c.componentOptions;
  56609. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  56610. warn(("<transition-group> children must be keyed: <" + name + ">"));
  56611. }
  56612. }
  56613. }
  56614. if (prevChildren) {
  56615. var kept = [];
  56616. var removed = [];
  56617. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  56618. var c$1 = prevChildren[i$1];
  56619. c$1.data.transition = transitionData;
  56620. c$1.data.pos = c$1.elm.getBoundingClientRect();
  56621. if (map[c$1.key]) {
  56622. kept.push(c$1);
  56623. } else {
  56624. removed.push(c$1);
  56625. }
  56626. }
  56627. this.kept = h(tag, null, kept);
  56628. this.removed = removed;
  56629. }
  56630. return h(tag, null, children)
  56631. },
  56632. updated: function updated () {
  56633. var children = this.prevChildren;
  56634. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  56635. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  56636. return
  56637. }
  56638. // we divide the work into three loops to avoid mixing DOM reads and writes
  56639. // in each iteration - which helps prevent layout thrashing.
  56640. children.forEach(callPendingCbs);
  56641. children.forEach(recordPosition);
  56642. children.forEach(applyTranslation);
  56643. // force reflow to put everything in position
  56644. // assign to this to avoid being removed in tree-shaking
  56645. // $flow-disable-line
  56646. this._reflow = document.body.offsetHeight;
  56647. children.forEach(function (c) {
  56648. if (c.data.moved) {
  56649. var el = c.elm;
  56650. var s = el.style;
  56651. addTransitionClass(el, moveClass);
  56652. s.transform = s.WebkitTransform = s.transitionDuration = '';
  56653. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  56654. if (e && e.target !== el) {
  56655. return
  56656. }
  56657. if (!e || /transform$/.test(e.propertyName)) {
  56658. el.removeEventListener(transitionEndEvent, cb);
  56659. el._moveCb = null;
  56660. removeTransitionClass(el, moveClass);
  56661. }
  56662. });
  56663. }
  56664. });
  56665. },
  56666. methods: {
  56667. hasMove: function hasMove (el, moveClass) {
  56668. /* istanbul ignore if */
  56669. if (!hasTransition) {
  56670. return false
  56671. }
  56672. /* istanbul ignore if */
  56673. if (this._hasMove) {
  56674. return this._hasMove
  56675. }
  56676. // Detect whether an element with the move class applied has
  56677. // CSS transitions. Since the element may be inside an entering
  56678. // transition at this very moment, we make a clone of it and remove
  56679. // all other transition classes applied to ensure only the move class
  56680. // is applied.
  56681. var clone = el.cloneNode();
  56682. if (el._transitionClasses) {
  56683. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  56684. }
  56685. addClass(clone, moveClass);
  56686. clone.style.display = 'none';
  56687. this.$el.appendChild(clone);
  56688. var info = getTransitionInfo(clone);
  56689. this.$el.removeChild(clone);
  56690. return (this._hasMove = info.hasTransform)
  56691. }
  56692. }
  56693. };
  56694. function callPendingCbs (c) {
  56695. /* istanbul ignore if */
  56696. if (c.elm._moveCb) {
  56697. c.elm._moveCb();
  56698. }
  56699. /* istanbul ignore if */
  56700. if (c.elm._enterCb) {
  56701. c.elm._enterCb();
  56702. }
  56703. }
  56704. function recordPosition (c) {
  56705. c.data.newPos = c.elm.getBoundingClientRect();
  56706. }
  56707. function applyTranslation (c) {
  56708. var oldPos = c.data.pos;
  56709. var newPos = c.data.newPos;
  56710. var dx = oldPos.left - newPos.left;
  56711. var dy = oldPos.top - newPos.top;
  56712. if (dx || dy) {
  56713. c.data.moved = true;
  56714. var s = c.elm.style;
  56715. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  56716. s.transitionDuration = '0s';
  56717. }
  56718. }
  56719. var platformComponents = {
  56720. Transition: Transition,
  56721. TransitionGroup: TransitionGroup
  56722. };
  56723. /* */
  56724. // install platform specific utils
  56725. Vue.config.mustUseProp = mustUseProp;
  56726. Vue.config.isReservedTag = isReservedTag;
  56727. Vue.config.isReservedAttr = isReservedAttr;
  56728. Vue.config.getTagNamespace = getTagNamespace;
  56729. Vue.config.isUnknownElement = isUnknownElement;
  56730. // install platform runtime directives & components
  56731. extend(Vue.options.directives, platformDirectives);
  56732. extend(Vue.options.components, platformComponents);
  56733. // install platform patch function
  56734. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  56735. // public mount method
  56736. Vue.prototype.$mount = function (
  56737. el,
  56738. hydrating
  56739. ) {
  56740. el = el && inBrowser ? query(el) : undefined;
  56741. return mountComponent(this, el, hydrating)
  56742. };
  56743. // devtools global hook
  56744. /* istanbul ignore next */
  56745. if (inBrowser) {
  56746. setTimeout(function () {
  56747. if (config.devtools) {
  56748. if (devtools) {
  56749. devtools.emit('init', Vue);
  56750. } else {
  56751. console[console.info ? 'info' : 'log'](
  56752. 'Download the Vue Devtools extension for a better development experience:\n' +
  56753. 'https://github.com/vuejs/vue-devtools'
  56754. );
  56755. }
  56756. }
  56757. if (config.productionTip !== false &&
  56758. typeof console !== 'undefined'
  56759. ) {
  56760. console[console.info ? 'info' : 'log'](
  56761. "You are running Vue in development mode.\n" +
  56762. "Make sure to turn on production mode when deploying for production.\n" +
  56763. "See more tips at https://vuejs.org/guide/deployment.html"
  56764. );
  56765. }
  56766. }, 0);
  56767. }
  56768. /* */
  56769. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  56770. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  56771. var buildRegex = cached(function (delimiters) {
  56772. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  56773. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  56774. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  56775. });
  56776. function parseText (
  56777. text,
  56778. delimiters
  56779. ) {
  56780. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  56781. if (!tagRE.test(text)) {
  56782. return
  56783. }
  56784. var tokens = [];
  56785. var rawTokens = [];
  56786. var lastIndex = tagRE.lastIndex = 0;
  56787. var match, index, tokenValue;
  56788. while ((match = tagRE.exec(text))) {
  56789. index = match.index;
  56790. // push text token
  56791. if (index > lastIndex) {
  56792. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  56793. tokens.push(JSON.stringify(tokenValue));
  56794. }
  56795. // tag token
  56796. var exp = parseFilters(match[1].trim());
  56797. tokens.push(("_s(" + exp + ")"));
  56798. rawTokens.push({ '@binding': exp });
  56799. lastIndex = index + match[0].length;
  56800. }
  56801. if (lastIndex < text.length) {
  56802. rawTokens.push(tokenValue = text.slice(lastIndex));
  56803. tokens.push(JSON.stringify(tokenValue));
  56804. }
  56805. return {
  56806. expression: tokens.join('+'),
  56807. tokens: rawTokens
  56808. }
  56809. }
  56810. /* */
  56811. function transformNode (el, options) {
  56812. var warn = options.warn || baseWarn;
  56813. var staticClass = getAndRemoveAttr(el, 'class');
  56814. if (staticClass) {
  56815. var res = parseText(staticClass, options.delimiters);
  56816. if (res) {
  56817. warn(
  56818. "class=\"" + staticClass + "\": " +
  56819. 'Interpolation inside attributes has been removed. ' +
  56820. 'Use v-bind or the colon shorthand instead. For example, ' +
  56821. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  56822. el.rawAttrsMap['class']
  56823. );
  56824. }
  56825. }
  56826. if (staticClass) {
  56827. el.staticClass = JSON.stringify(staticClass);
  56828. }
  56829. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  56830. if (classBinding) {
  56831. el.classBinding = classBinding;
  56832. }
  56833. }
  56834. function genData (el) {
  56835. var data = '';
  56836. if (el.staticClass) {
  56837. data += "staticClass:" + (el.staticClass) + ",";
  56838. }
  56839. if (el.classBinding) {
  56840. data += "class:" + (el.classBinding) + ",";
  56841. }
  56842. return data
  56843. }
  56844. var klass$1 = {
  56845. staticKeys: ['staticClass'],
  56846. transformNode: transformNode,
  56847. genData: genData
  56848. };
  56849. /* */
  56850. function transformNode$1 (el, options) {
  56851. var warn = options.warn || baseWarn;
  56852. var staticStyle = getAndRemoveAttr(el, 'style');
  56853. if (staticStyle) {
  56854. /* istanbul ignore if */
  56855. {
  56856. var res = parseText(staticStyle, options.delimiters);
  56857. if (res) {
  56858. warn(
  56859. "style=\"" + staticStyle + "\": " +
  56860. 'Interpolation inside attributes has been removed. ' +
  56861. 'Use v-bind or the colon shorthand instead. For example, ' +
  56862. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  56863. el.rawAttrsMap['style']
  56864. );
  56865. }
  56866. }
  56867. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  56868. }
  56869. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  56870. if (styleBinding) {
  56871. el.styleBinding = styleBinding;
  56872. }
  56873. }
  56874. function genData$1 (el) {
  56875. var data = '';
  56876. if (el.staticStyle) {
  56877. data += "staticStyle:" + (el.staticStyle) + ",";
  56878. }
  56879. if (el.styleBinding) {
  56880. data += "style:(" + (el.styleBinding) + "),";
  56881. }
  56882. return data
  56883. }
  56884. var style$1 = {
  56885. staticKeys: ['staticStyle'],
  56886. transformNode: transformNode$1,
  56887. genData: genData$1
  56888. };
  56889. /* */
  56890. var decoder;
  56891. var he = {
  56892. decode: function decode (html) {
  56893. decoder = decoder || document.createElement('div');
  56894. decoder.innerHTML = html;
  56895. return decoder.textContent
  56896. }
  56897. };
  56898. /* */
  56899. var isUnaryTag = makeMap(
  56900. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  56901. 'link,meta,param,source,track,wbr'
  56902. );
  56903. // Elements that you can, intentionally, leave open
  56904. // (and which close themselves)
  56905. var canBeLeftOpenTag = makeMap(
  56906. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  56907. );
  56908. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  56909. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  56910. var isNonPhrasingTag = makeMap(
  56911. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  56912. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  56913. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  56914. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  56915. 'title,tr,track'
  56916. );
  56917. /**
  56918. * Not type-checking this file because it's mostly vendor code.
  56919. */
  56920. // Regular Expressions for parsing tags and attributes
  56921. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  56922. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  56923. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  56924. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  56925. var startTagOpen = new RegExp(("^<" + qnameCapture));
  56926. var startTagClose = /^\s*(\/?)>/;
  56927. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  56928. var doctype = /^<!DOCTYPE [^>]+>/i;
  56929. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  56930. var comment = /^<!\--/;
  56931. var conditionalComment = /^<!\[/;
  56932. // Special Elements (can contain anything)
  56933. var isPlainTextElement = makeMap('script,style,textarea', true);
  56934. var reCache = {};
  56935. var decodingMap = {
  56936. '&lt;': '<',
  56937. '&gt;': '>',
  56938. '&quot;': '"',
  56939. '&amp;': '&',
  56940. '&#10;': '\n',
  56941. '&#9;': '\t',
  56942. '&#39;': "'"
  56943. };
  56944. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  56945. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  56946. // #5992
  56947. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  56948. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  56949. function decodeAttr (value, shouldDecodeNewlines) {
  56950. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  56951. return value.replace(re, function (match) { return decodingMap[match]; })
  56952. }
  56953. function parseHTML (html, options) {
  56954. var stack = [];
  56955. var expectHTML = options.expectHTML;
  56956. var isUnaryTag$$1 = options.isUnaryTag || no;
  56957. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  56958. var index = 0;
  56959. var last, lastTag;
  56960. while (html) {
  56961. last = html;
  56962. // Make sure we're not in a plaintext content element like script/style
  56963. if (!lastTag || !isPlainTextElement(lastTag)) {
  56964. var textEnd = html.indexOf('<');
  56965. if (textEnd === 0) {
  56966. // Comment:
  56967. if (comment.test(html)) {
  56968. var commentEnd = html.indexOf('-->');
  56969. if (commentEnd >= 0) {
  56970. if (options.shouldKeepComment) {
  56971. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  56972. }
  56973. advance(commentEnd + 3);
  56974. continue
  56975. }
  56976. }
  56977. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  56978. if (conditionalComment.test(html)) {
  56979. var conditionalEnd = html.indexOf(']>');
  56980. if (conditionalEnd >= 0) {
  56981. advance(conditionalEnd + 2);
  56982. continue
  56983. }
  56984. }
  56985. // Doctype:
  56986. var doctypeMatch = html.match(doctype);
  56987. if (doctypeMatch) {
  56988. advance(doctypeMatch[0].length);
  56989. continue
  56990. }
  56991. // End tag:
  56992. var endTagMatch = html.match(endTag);
  56993. if (endTagMatch) {
  56994. var curIndex = index;
  56995. advance(endTagMatch[0].length);
  56996. parseEndTag(endTagMatch[1], curIndex, index);
  56997. continue
  56998. }
  56999. // Start tag:
  57000. var startTagMatch = parseStartTag();
  57001. if (startTagMatch) {
  57002. handleStartTag(startTagMatch);
  57003. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  57004. advance(1);
  57005. }
  57006. continue
  57007. }
  57008. }
  57009. var text = (void 0), rest = (void 0), next = (void 0);
  57010. if (textEnd >= 0) {
  57011. rest = html.slice(textEnd);
  57012. while (
  57013. !endTag.test(rest) &&
  57014. !startTagOpen.test(rest) &&
  57015. !comment.test(rest) &&
  57016. !conditionalComment.test(rest)
  57017. ) {
  57018. // < in plain text, be forgiving and treat it as text
  57019. next = rest.indexOf('<', 1);
  57020. if (next < 0) { break }
  57021. textEnd += next;
  57022. rest = html.slice(textEnd);
  57023. }
  57024. text = html.substring(0, textEnd);
  57025. }
  57026. if (textEnd < 0) {
  57027. text = html;
  57028. }
  57029. if (text) {
  57030. advance(text.length);
  57031. }
  57032. if (options.chars && text) {
  57033. options.chars(text, index - text.length, index);
  57034. }
  57035. } else {
  57036. var endTagLength = 0;
  57037. var stackedTag = lastTag.toLowerCase();
  57038. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  57039. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  57040. endTagLength = endTag.length;
  57041. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  57042. text = text
  57043. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  57044. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  57045. }
  57046. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  57047. text = text.slice(1);
  57048. }
  57049. if (options.chars) {
  57050. options.chars(text);
  57051. }
  57052. return ''
  57053. });
  57054. index += html.length - rest$1.length;
  57055. html = rest$1;
  57056. parseEndTag(stackedTag, index - endTagLength, index);
  57057. }
  57058. if (html === last) {
  57059. options.chars && options.chars(html);
  57060. if (!stack.length && options.warn) {
  57061. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  57062. }
  57063. break
  57064. }
  57065. }
  57066. // Clean up any remaining tags
  57067. parseEndTag();
  57068. function advance (n) {
  57069. index += n;
  57070. html = html.substring(n);
  57071. }
  57072. function parseStartTag () {
  57073. var start = html.match(startTagOpen);
  57074. if (start) {
  57075. var match = {
  57076. tagName: start[1],
  57077. attrs: [],
  57078. start: index
  57079. };
  57080. advance(start[0].length);
  57081. var end, attr;
  57082. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  57083. attr.start = index;
  57084. advance(attr[0].length);
  57085. attr.end = index;
  57086. match.attrs.push(attr);
  57087. }
  57088. if (end) {
  57089. match.unarySlash = end[1];
  57090. advance(end[0].length);
  57091. match.end = index;
  57092. return match
  57093. }
  57094. }
  57095. }
  57096. function handleStartTag (match) {
  57097. var tagName = match.tagName;
  57098. var unarySlash = match.unarySlash;
  57099. if (expectHTML) {
  57100. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  57101. parseEndTag(lastTag);
  57102. }
  57103. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  57104. parseEndTag(tagName);
  57105. }
  57106. }
  57107. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  57108. var l = match.attrs.length;
  57109. var attrs = new Array(l);
  57110. for (var i = 0; i < l; i++) {
  57111. var args = match.attrs[i];
  57112. var value = args[3] || args[4] || args[5] || '';
  57113. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  57114. ? options.shouldDecodeNewlinesForHref
  57115. : options.shouldDecodeNewlines;
  57116. attrs[i] = {
  57117. name: args[1],
  57118. value: decodeAttr(value, shouldDecodeNewlines)
  57119. };
  57120. if (options.outputSourceRange) {
  57121. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  57122. attrs[i].end = args.end;
  57123. }
  57124. }
  57125. if (!unary) {
  57126. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  57127. lastTag = tagName;
  57128. }
  57129. if (options.start) {
  57130. options.start(tagName, attrs, unary, match.start, match.end);
  57131. }
  57132. }
  57133. function parseEndTag (tagName, start, end) {
  57134. var pos, lowerCasedTagName;
  57135. if (start == null) { start = index; }
  57136. if (end == null) { end = index; }
  57137. // Find the closest opened tag of the same type
  57138. if (tagName) {
  57139. lowerCasedTagName = tagName.toLowerCase();
  57140. for (pos = stack.length - 1; pos >= 0; pos--) {
  57141. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  57142. break
  57143. }
  57144. }
  57145. } else {
  57146. // If no tag name is provided, clean shop
  57147. pos = 0;
  57148. }
  57149. if (pos >= 0) {
  57150. // Close all the open elements, up the stack
  57151. for (var i = stack.length - 1; i >= pos; i--) {
  57152. if (i > pos || !tagName &&
  57153. options.warn
  57154. ) {
  57155. options.warn(
  57156. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  57157. { start: stack[i].start, end: stack[i].end }
  57158. );
  57159. }
  57160. if (options.end) {
  57161. options.end(stack[i].tag, start, end);
  57162. }
  57163. }
  57164. // Remove the open elements from the stack
  57165. stack.length = pos;
  57166. lastTag = pos && stack[pos - 1].tag;
  57167. } else if (lowerCasedTagName === 'br') {
  57168. if (options.start) {
  57169. options.start(tagName, [], true, start, end);
  57170. }
  57171. } else if (lowerCasedTagName === 'p') {
  57172. if (options.start) {
  57173. options.start(tagName, [], false, start, end);
  57174. }
  57175. if (options.end) {
  57176. options.end(tagName, start, end);
  57177. }
  57178. }
  57179. }
  57180. }
  57181. /* */
  57182. var onRE = /^@|^v-on:/;
  57183. var dirRE = /^v-|^@|^:|^#/;
  57184. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  57185. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  57186. var stripParensRE = /^\(|\)$/g;
  57187. var dynamicArgRE = /^\[.*\]$/;
  57188. var argRE = /:(.*)$/;
  57189. var bindRE = /^:|^\.|^v-bind:/;
  57190. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  57191. var slotRE = /^v-slot(:|$)|^#/;
  57192. var lineBreakRE = /[\r\n]/;
  57193. var whitespaceRE$1 = /\s+/g;
  57194. var invalidAttributeRE = /[\s"'<>\/=]/;
  57195. var decodeHTMLCached = cached(he.decode);
  57196. var emptySlotScopeToken = "_empty_";
  57197. // configurable state
  57198. var warn$2;
  57199. var delimiters;
  57200. var transforms;
  57201. var preTransforms;
  57202. var postTransforms;
  57203. var platformIsPreTag;
  57204. var platformMustUseProp;
  57205. var platformGetTagNamespace;
  57206. var maybeComponent;
  57207. function createASTElement (
  57208. tag,
  57209. attrs,
  57210. parent
  57211. ) {
  57212. return {
  57213. type: 1,
  57214. tag: tag,
  57215. attrsList: attrs,
  57216. attrsMap: makeAttrsMap(attrs),
  57217. rawAttrsMap: {},
  57218. parent: parent,
  57219. children: []
  57220. }
  57221. }
  57222. /**
  57223. * Convert HTML string to AST.
  57224. */
  57225. function parse (
  57226. template,
  57227. options
  57228. ) {
  57229. warn$2 = options.warn || baseWarn;
  57230. platformIsPreTag = options.isPreTag || no;
  57231. platformMustUseProp = options.mustUseProp || no;
  57232. platformGetTagNamespace = options.getTagNamespace || no;
  57233. var isReservedTag = options.isReservedTag || no;
  57234. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  57235. transforms = pluckModuleFunction(options.modules, 'transformNode');
  57236. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  57237. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  57238. delimiters = options.delimiters;
  57239. var stack = [];
  57240. var preserveWhitespace = options.preserveWhitespace !== false;
  57241. var whitespaceOption = options.whitespace;
  57242. var root;
  57243. var currentParent;
  57244. var inVPre = false;
  57245. var inPre = false;
  57246. var warned = false;
  57247. function warnOnce (msg, range) {
  57248. if (!warned) {
  57249. warned = true;
  57250. warn$2(msg, range);
  57251. }
  57252. }
  57253. function closeElement (element) {
  57254. trimEndingWhitespace(element);
  57255. if (!inVPre && !element.processed) {
  57256. element = processElement(element, options);
  57257. }
  57258. // tree management
  57259. if (!stack.length && element !== root) {
  57260. // allow root elements with v-if, v-else-if and v-else
  57261. if (root.if && (element.elseif || element.else)) {
  57262. {
  57263. checkRootConstraints(element);
  57264. }
  57265. addIfCondition(root, {
  57266. exp: element.elseif,
  57267. block: element
  57268. });
  57269. } else {
  57270. warnOnce(
  57271. "Component template should contain exactly one root element. " +
  57272. "If you are using v-if on multiple elements, " +
  57273. "use v-else-if to chain them instead.",
  57274. { start: element.start }
  57275. );
  57276. }
  57277. }
  57278. if (currentParent && !element.forbidden) {
  57279. if (element.elseif || element.else) {
  57280. processIfConditions(element, currentParent);
  57281. } else {
  57282. if (element.slotScope) {
  57283. // scoped slot
  57284. // keep it in the children list so that v-else(-if) conditions can
  57285. // find it as the prev node.
  57286. var name = element.slotTarget || '"default"'
  57287. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  57288. }
  57289. currentParent.children.push(element);
  57290. element.parent = currentParent;
  57291. }
  57292. }
  57293. // final children cleanup
  57294. // filter out scoped slots
  57295. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  57296. // remove trailing whitespace node again
  57297. trimEndingWhitespace(element);
  57298. // check pre state
  57299. if (element.pre) {
  57300. inVPre = false;
  57301. }
  57302. if (platformIsPreTag(element.tag)) {
  57303. inPre = false;
  57304. }
  57305. // apply post-transforms
  57306. for (var i = 0; i < postTransforms.length; i++) {
  57307. postTransforms[i](element, options);
  57308. }
  57309. }
  57310. function trimEndingWhitespace (el) {
  57311. // remove trailing whitespace node
  57312. if (!inPre) {
  57313. var lastNode;
  57314. while (
  57315. (lastNode = el.children[el.children.length - 1]) &&
  57316. lastNode.type === 3 &&
  57317. lastNode.text === ' '
  57318. ) {
  57319. el.children.pop();
  57320. }
  57321. }
  57322. }
  57323. function checkRootConstraints (el) {
  57324. if (el.tag === 'slot' || el.tag === 'template') {
  57325. warnOnce(
  57326. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  57327. 'contain multiple nodes.',
  57328. { start: el.start }
  57329. );
  57330. }
  57331. if (el.attrsMap.hasOwnProperty('v-for')) {
  57332. warnOnce(
  57333. 'Cannot use v-for on stateful component root element because ' +
  57334. 'it renders multiple elements.',
  57335. el.rawAttrsMap['v-for']
  57336. );
  57337. }
  57338. }
  57339. parseHTML(template, {
  57340. warn: warn$2,
  57341. expectHTML: options.expectHTML,
  57342. isUnaryTag: options.isUnaryTag,
  57343. canBeLeftOpenTag: options.canBeLeftOpenTag,
  57344. shouldDecodeNewlines: options.shouldDecodeNewlines,
  57345. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  57346. shouldKeepComment: options.comments,
  57347. outputSourceRange: options.outputSourceRange,
  57348. start: function start (tag, attrs, unary, start$1, end) {
  57349. // check namespace.
  57350. // inherit parent ns if there is one
  57351. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  57352. // handle IE svg bug
  57353. /* istanbul ignore if */
  57354. if (isIE && ns === 'svg') {
  57355. attrs = guardIESVGBug(attrs);
  57356. }
  57357. var element = createASTElement(tag, attrs, currentParent);
  57358. if (ns) {
  57359. element.ns = ns;
  57360. }
  57361. {
  57362. if (options.outputSourceRange) {
  57363. element.start = start$1;
  57364. element.end = end;
  57365. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  57366. cumulated[attr.name] = attr;
  57367. return cumulated
  57368. }, {});
  57369. }
  57370. attrs.forEach(function (attr) {
  57371. if (invalidAttributeRE.test(attr.name)) {
  57372. warn$2(
  57373. "Invalid dynamic argument expression: attribute names cannot contain " +
  57374. "spaces, quotes, <, >, / or =.",
  57375. {
  57376. start: attr.start + attr.name.indexOf("["),
  57377. end: attr.start + attr.name.length
  57378. }
  57379. );
  57380. }
  57381. });
  57382. }
  57383. if (isForbiddenTag(element) && !isServerRendering()) {
  57384. element.forbidden = true;
  57385. warn$2(
  57386. 'Templates should only be responsible for mapping the state to the ' +
  57387. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  57388. "<" + tag + ">" + ', as they will not be parsed.',
  57389. { start: element.start }
  57390. );
  57391. }
  57392. // apply pre-transforms
  57393. for (var i = 0; i < preTransforms.length; i++) {
  57394. element = preTransforms[i](element, options) || element;
  57395. }
  57396. if (!inVPre) {
  57397. processPre(element);
  57398. if (element.pre) {
  57399. inVPre = true;
  57400. }
  57401. }
  57402. if (platformIsPreTag(element.tag)) {
  57403. inPre = true;
  57404. }
  57405. if (inVPre) {
  57406. processRawAttrs(element);
  57407. } else if (!element.processed) {
  57408. // structural directives
  57409. processFor(element);
  57410. processIf(element);
  57411. processOnce(element);
  57412. }
  57413. if (!root) {
  57414. root = element;
  57415. {
  57416. checkRootConstraints(root);
  57417. }
  57418. }
  57419. if (!unary) {
  57420. currentParent = element;
  57421. stack.push(element);
  57422. } else {
  57423. closeElement(element);
  57424. }
  57425. },
  57426. end: function end (tag, start, end$1) {
  57427. var element = stack[stack.length - 1];
  57428. // pop stack
  57429. stack.length -= 1;
  57430. currentParent = stack[stack.length - 1];
  57431. if (options.outputSourceRange) {
  57432. element.end = end$1;
  57433. }
  57434. closeElement(element);
  57435. },
  57436. chars: function chars (text, start, end) {
  57437. if (!currentParent) {
  57438. {
  57439. if (text === template) {
  57440. warnOnce(
  57441. 'Component template requires a root element, rather than just text.',
  57442. { start: start }
  57443. );
  57444. } else if ((text = text.trim())) {
  57445. warnOnce(
  57446. ("text \"" + text + "\" outside root element will be ignored."),
  57447. { start: start }
  57448. );
  57449. }
  57450. }
  57451. return
  57452. }
  57453. // IE textarea placeholder bug
  57454. /* istanbul ignore if */
  57455. if (isIE &&
  57456. currentParent.tag === 'textarea' &&
  57457. currentParent.attrsMap.placeholder === text
  57458. ) {
  57459. return
  57460. }
  57461. var children = currentParent.children;
  57462. if (inPre || text.trim()) {
  57463. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  57464. } else if (!children.length) {
  57465. // remove the whitespace-only node right after an opening tag
  57466. text = '';
  57467. } else if (whitespaceOption) {
  57468. if (whitespaceOption === 'condense') {
  57469. // in condense mode, remove the whitespace node if it contains
  57470. // line break, otherwise condense to a single space
  57471. text = lineBreakRE.test(text) ? '' : ' ';
  57472. } else {
  57473. text = ' ';
  57474. }
  57475. } else {
  57476. text = preserveWhitespace ? ' ' : '';
  57477. }
  57478. if (text) {
  57479. if (!inPre && whitespaceOption === 'condense') {
  57480. // condense consecutive whitespaces into single space
  57481. text = text.replace(whitespaceRE$1, ' ');
  57482. }
  57483. var res;
  57484. var child;
  57485. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  57486. child = {
  57487. type: 2,
  57488. expression: res.expression,
  57489. tokens: res.tokens,
  57490. text: text
  57491. };
  57492. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  57493. child = {
  57494. type: 3,
  57495. text: text
  57496. };
  57497. }
  57498. if (child) {
  57499. if (options.outputSourceRange) {
  57500. child.start = start;
  57501. child.end = end;
  57502. }
  57503. children.push(child);
  57504. }
  57505. }
  57506. },
  57507. comment: function comment (text, start, end) {
  57508. // adding anyting as a sibling to the root node is forbidden
  57509. // comments should still be allowed, but ignored
  57510. if (currentParent) {
  57511. var child = {
  57512. type: 3,
  57513. text: text,
  57514. isComment: true
  57515. };
  57516. if (options.outputSourceRange) {
  57517. child.start = start;
  57518. child.end = end;
  57519. }
  57520. currentParent.children.push(child);
  57521. }
  57522. }
  57523. });
  57524. return root
  57525. }
  57526. function processPre (el) {
  57527. if (getAndRemoveAttr(el, 'v-pre') != null) {
  57528. el.pre = true;
  57529. }
  57530. }
  57531. function processRawAttrs (el) {
  57532. var list = el.attrsList;
  57533. var len = list.length;
  57534. if (len) {
  57535. var attrs = el.attrs = new Array(len);
  57536. for (var i = 0; i < len; i++) {
  57537. attrs[i] = {
  57538. name: list[i].name,
  57539. value: JSON.stringify(list[i].value)
  57540. };
  57541. if (list[i].start != null) {
  57542. attrs[i].start = list[i].start;
  57543. attrs[i].end = list[i].end;
  57544. }
  57545. }
  57546. } else if (!el.pre) {
  57547. // non root node in pre blocks with no attributes
  57548. el.plain = true;
  57549. }
  57550. }
  57551. function processElement (
  57552. element,
  57553. options
  57554. ) {
  57555. processKey(element);
  57556. // determine whether this is a plain element after
  57557. // removing structural attributes
  57558. element.plain = (
  57559. !element.key &&
  57560. !element.scopedSlots &&
  57561. !element.attrsList.length
  57562. );
  57563. processRef(element);
  57564. processSlotContent(element);
  57565. processSlotOutlet(element);
  57566. processComponent(element);
  57567. for (var i = 0; i < transforms.length; i++) {
  57568. element = transforms[i](element, options) || element;
  57569. }
  57570. processAttrs(element);
  57571. return element
  57572. }
  57573. function processKey (el) {
  57574. var exp = getBindingAttr(el, 'key');
  57575. if (exp) {
  57576. {
  57577. if (el.tag === 'template') {
  57578. warn$2(
  57579. "<template> cannot be keyed. Place the key on real elements instead.",
  57580. getRawBindingAttr(el, 'key')
  57581. );
  57582. }
  57583. if (el.for) {
  57584. var iterator = el.iterator2 || el.iterator1;
  57585. var parent = el.parent;
  57586. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  57587. warn$2(
  57588. "Do not use v-for index as key on <transition-group> children, " +
  57589. "this is the same as not using keys.",
  57590. getRawBindingAttr(el, 'key'),
  57591. true /* tip */
  57592. );
  57593. }
  57594. }
  57595. }
  57596. el.key = exp;
  57597. }
  57598. }
  57599. function processRef (el) {
  57600. var ref = getBindingAttr(el, 'ref');
  57601. if (ref) {
  57602. el.ref = ref;
  57603. el.refInFor = checkInFor(el);
  57604. }
  57605. }
  57606. function processFor (el) {
  57607. var exp;
  57608. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  57609. var res = parseFor(exp);
  57610. if (res) {
  57611. extend(el, res);
  57612. } else {
  57613. warn$2(
  57614. ("Invalid v-for expression: " + exp),
  57615. el.rawAttrsMap['v-for']
  57616. );
  57617. }
  57618. }
  57619. }
  57620. function parseFor (exp) {
  57621. var inMatch = exp.match(forAliasRE);
  57622. if (!inMatch) { return }
  57623. var res = {};
  57624. res.for = inMatch[2].trim();
  57625. var alias = inMatch[1].trim().replace(stripParensRE, '');
  57626. var iteratorMatch = alias.match(forIteratorRE);
  57627. if (iteratorMatch) {
  57628. res.alias = alias.replace(forIteratorRE, '').trim();
  57629. res.iterator1 = iteratorMatch[1].trim();
  57630. if (iteratorMatch[2]) {
  57631. res.iterator2 = iteratorMatch[2].trim();
  57632. }
  57633. } else {
  57634. res.alias = alias;
  57635. }
  57636. return res
  57637. }
  57638. function processIf (el) {
  57639. var exp = getAndRemoveAttr(el, 'v-if');
  57640. if (exp) {
  57641. el.if = exp;
  57642. addIfCondition(el, {
  57643. exp: exp,
  57644. block: el
  57645. });
  57646. } else {
  57647. if (getAndRemoveAttr(el, 'v-else') != null) {
  57648. el.else = true;
  57649. }
  57650. var elseif = getAndRemoveAttr(el, 'v-else-if');
  57651. if (elseif) {
  57652. el.elseif = elseif;
  57653. }
  57654. }
  57655. }
  57656. function processIfConditions (el, parent) {
  57657. var prev = findPrevElement(parent.children);
  57658. if (prev && prev.if) {
  57659. addIfCondition(prev, {
  57660. exp: el.elseif,
  57661. block: el
  57662. });
  57663. } else {
  57664. warn$2(
  57665. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  57666. "used on element <" + (el.tag) + "> without corresponding v-if.",
  57667. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  57668. );
  57669. }
  57670. }
  57671. function findPrevElement (children) {
  57672. var i = children.length;
  57673. while (i--) {
  57674. if (children[i].type === 1) {
  57675. return children[i]
  57676. } else {
  57677. if (children[i].text !== ' ') {
  57678. warn$2(
  57679. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  57680. "will be ignored.",
  57681. children[i]
  57682. );
  57683. }
  57684. children.pop();
  57685. }
  57686. }
  57687. }
  57688. function addIfCondition (el, condition) {
  57689. if (!el.ifConditions) {
  57690. el.ifConditions = [];
  57691. }
  57692. el.ifConditions.push(condition);
  57693. }
  57694. function processOnce (el) {
  57695. var once$$1 = getAndRemoveAttr(el, 'v-once');
  57696. if (once$$1 != null) {
  57697. el.once = true;
  57698. }
  57699. }
  57700. // handle content being passed to a component as slot,
  57701. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  57702. function processSlotContent (el) {
  57703. var slotScope;
  57704. if (el.tag === 'template') {
  57705. slotScope = getAndRemoveAttr(el, 'scope');
  57706. /* istanbul ignore if */
  57707. if (slotScope) {
  57708. warn$2(
  57709. "the \"scope\" attribute for scoped slots have been deprecated and " +
  57710. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  57711. "can also be used on plain elements in addition to <template> to " +
  57712. "denote scoped slots.",
  57713. el.rawAttrsMap['scope'],
  57714. true
  57715. );
  57716. }
  57717. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  57718. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  57719. /* istanbul ignore if */
  57720. if (el.attrsMap['v-for']) {
  57721. warn$2(
  57722. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  57723. "(v-for takes higher priority). Use a wrapper <template> for the " +
  57724. "scoped slot to make it clearer.",
  57725. el.rawAttrsMap['slot-scope'],
  57726. true
  57727. );
  57728. }
  57729. el.slotScope = slotScope;
  57730. }
  57731. // slot="xxx"
  57732. var slotTarget = getBindingAttr(el, 'slot');
  57733. if (slotTarget) {
  57734. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  57735. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  57736. // preserve slot as an attribute for native shadow DOM compat
  57737. // only for non-scoped slots.
  57738. if (el.tag !== 'template' && !el.slotScope) {
  57739. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  57740. }
  57741. }
  57742. // 2.6 v-slot syntax
  57743. {
  57744. if (el.tag === 'template') {
  57745. // v-slot on <template>
  57746. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  57747. if (slotBinding) {
  57748. {
  57749. if (el.slotTarget || el.slotScope) {
  57750. warn$2(
  57751. "Unexpected mixed usage of different slot syntaxes.",
  57752. el
  57753. );
  57754. }
  57755. if (el.parent && !maybeComponent(el.parent)) {
  57756. warn$2(
  57757. "<template v-slot> can only appear at the root level inside " +
  57758. "the receiving component",
  57759. el
  57760. );
  57761. }
  57762. }
  57763. var ref = getSlotName(slotBinding);
  57764. var name = ref.name;
  57765. var dynamic = ref.dynamic;
  57766. el.slotTarget = name;
  57767. el.slotTargetDynamic = dynamic;
  57768. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  57769. }
  57770. } else {
  57771. // v-slot on component, denotes default slot
  57772. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  57773. if (slotBinding$1) {
  57774. {
  57775. if (!maybeComponent(el)) {
  57776. warn$2(
  57777. "v-slot can only be used on components or <template>.",
  57778. slotBinding$1
  57779. );
  57780. }
  57781. if (el.slotScope || el.slotTarget) {
  57782. warn$2(
  57783. "Unexpected mixed usage of different slot syntaxes.",
  57784. el
  57785. );
  57786. }
  57787. if (el.scopedSlots) {
  57788. warn$2(
  57789. "To avoid scope ambiguity, the default slot should also use " +
  57790. "<template> syntax when there are other named slots.",
  57791. slotBinding$1
  57792. );
  57793. }
  57794. }
  57795. // add the component's children to its default slot
  57796. var slots = el.scopedSlots || (el.scopedSlots = {});
  57797. var ref$1 = getSlotName(slotBinding$1);
  57798. var name$1 = ref$1.name;
  57799. var dynamic$1 = ref$1.dynamic;
  57800. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  57801. slotContainer.slotTarget = name$1;
  57802. slotContainer.slotTargetDynamic = dynamic$1;
  57803. slotContainer.children = el.children.filter(function (c) {
  57804. if (!c.slotScope) {
  57805. c.parent = slotContainer;
  57806. return true
  57807. }
  57808. });
  57809. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  57810. // remove children as they are returned from scopedSlots now
  57811. el.children = [];
  57812. // mark el non-plain so data gets generated
  57813. el.plain = false;
  57814. }
  57815. }
  57816. }
  57817. }
  57818. function getSlotName (binding) {
  57819. var name = binding.name.replace(slotRE, '');
  57820. if (!name) {
  57821. if (binding.name[0] !== '#') {
  57822. name = 'default';
  57823. } else {
  57824. warn$2(
  57825. "v-slot shorthand syntax requires a slot name.",
  57826. binding
  57827. );
  57828. }
  57829. }
  57830. return dynamicArgRE.test(name)
  57831. // dynamic [name]
  57832. ? { name: name.slice(1, -1), dynamic: true }
  57833. // static name
  57834. : { name: ("\"" + name + "\""), dynamic: false }
  57835. }
  57836. // handle <slot/> outlets
  57837. function processSlotOutlet (el) {
  57838. if (el.tag === 'slot') {
  57839. el.slotName = getBindingAttr(el, 'name');
  57840. if (el.key) {
  57841. warn$2(
  57842. "`key` does not work on <slot> because slots are abstract outlets " +
  57843. "and can possibly expand into multiple elements. " +
  57844. "Use the key on a wrapping element instead.",
  57845. getRawBindingAttr(el, 'key')
  57846. );
  57847. }
  57848. }
  57849. }
  57850. function processComponent (el) {
  57851. var binding;
  57852. if ((binding = getBindingAttr(el, 'is'))) {
  57853. el.component = binding;
  57854. }
  57855. if (getAndRemoveAttr(el, 'inline-template') != null) {
  57856. el.inlineTemplate = true;
  57857. }
  57858. }
  57859. function processAttrs (el) {
  57860. var list = el.attrsList;
  57861. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  57862. for (i = 0, l = list.length; i < l; i++) {
  57863. name = rawName = list[i].name;
  57864. value = list[i].value;
  57865. if (dirRE.test(name)) {
  57866. // mark element as dynamic
  57867. el.hasBindings = true;
  57868. // modifiers
  57869. modifiers = parseModifiers(name.replace(dirRE, ''));
  57870. // support .foo shorthand syntax for the .prop modifier
  57871. if (modifiers) {
  57872. name = name.replace(modifierRE, '');
  57873. }
  57874. if (bindRE.test(name)) { // v-bind
  57875. name = name.replace(bindRE, '');
  57876. value = parseFilters(value);
  57877. isDynamic = dynamicArgRE.test(name);
  57878. if (isDynamic) {
  57879. name = name.slice(1, -1);
  57880. }
  57881. if (
  57882. value.trim().length === 0
  57883. ) {
  57884. warn$2(
  57885. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  57886. );
  57887. }
  57888. if (modifiers) {
  57889. if (modifiers.prop && !isDynamic) {
  57890. name = camelize(name);
  57891. if (name === 'innerHtml') { name = 'innerHTML'; }
  57892. }
  57893. if (modifiers.camel && !isDynamic) {
  57894. name = camelize(name);
  57895. }
  57896. if (modifiers.sync) {
  57897. syncGen = genAssignmentCode(value, "$event");
  57898. if (!isDynamic) {
  57899. addHandler(
  57900. el,
  57901. ("update:" + (camelize(name))),
  57902. syncGen,
  57903. null,
  57904. false,
  57905. warn$2,
  57906. list[i]
  57907. );
  57908. if (hyphenate(name) !== camelize(name)) {
  57909. addHandler(
  57910. el,
  57911. ("update:" + (hyphenate(name))),
  57912. syncGen,
  57913. null,
  57914. false,
  57915. warn$2,
  57916. list[i]
  57917. );
  57918. }
  57919. } else {
  57920. // handler w/ dynamic event name
  57921. addHandler(
  57922. el,
  57923. ("\"update:\"+(" + name + ")"),
  57924. syncGen,
  57925. null,
  57926. false,
  57927. warn$2,
  57928. list[i],
  57929. true // dynamic
  57930. );
  57931. }
  57932. }
  57933. }
  57934. if ((modifiers && modifiers.prop) || (
  57935. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  57936. )) {
  57937. addProp(el, name, value, list[i], isDynamic);
  57938. } else {
  57939. addAttr(el, name, value, list[i], isDynamic);
  57940. }
  57941. } else if (onRE.test(name)) { // v-on
  57942. name = name.replace(onRE, '');
  57943. isDynamic = dynamicArgRE.test(name);
  57944. if (isDynamic) {
  57945. name = name.slice(1, -1);
  57946. }
  57947. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  57948. } else { // normal directives
  57949. name = name.replace(dirRE, '');
  57950. // parse arg
  57951. var argMatch = name.match(argRE);
  57952. var arg = argMatch && argMatch[1];
  57953. isDynamic = false;
  57954. if (arg) {
  57955. name = name.slice(0, -(arg.length + 1));
  57956. if (dynamicArgRE.test(arg)) {
  57957. arg = arg.slice(1, -1);
  57958. isDynamic = true;
  57959. }
  57960. }
  57961. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  57962. if (name === 'model') {
  57963. checkForAliasModel(el, value);
  57964. }
  57965. }
  57966. } else {
  57967. // literal attribute
  57968. {
  57969. var res = parseText(value, delimiters);
  57970. if (res) {
  57971. warn$2(
  57972. name + "=\"" + value + "\": " +
  57973. 'Interpolation inside attributes has been removed. ' +
  57974. 'Use v-bind or the colon shorthand instead. For example, ' +
  57975. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  57976. list[i]
  57977. );
  57978. }
  57979. }
  57980. addAttr(el, name, JSON.stringify(value), list[i]);
  57981. // #6887 firefox doesn't update muted state if set via attribute
  57982. // even immediately after element creation
  57983. if (!el.component &&
  57984. name === 'muted' &&
  57985. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  57986. addProp(el, name, 'true', list[i]);
  57987. }
  57988. }
  57989. }
  57990. }
  57991. function checkInFor (el) {
  57992. var parent = el;
  57993. while (parent) {
  57994. if (parent.for !== undefined) {
  57995. return true
  57996. }
  57997. parent = parent.parent;
  57998. }
  57999. return false
  58000. }
  58001. function parseModifiers (name) {
  58002. var match = name.match(modifierRE);
  58003. if (match) {
  58004. var ret = {};
  58005. match.forEach(function (m) { ret[m.slice(1)] = true; });
  58006. return ret
  58007. }
  58008. }
  58009. function makeAttrsMap (attrs) {
  58010. var map = {};
  58011. for (var i = 0, l = attrs.length; i < l; i++) {
  58012. if (
  58013. map[attrs[i].name] && !isIE && !isEdge
  58014. ) {
  58015. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  58016. }
  58017. map[attrs[i].name] = attrs[i].value;
  58018. }
  58019. return map
  58020. }
  58021. // for script (e.g. type="x/template") or style, do not decode content
  58022. function isTextTag (el) {
  58023. return el.tag === 'script' || el.tag === 'style'
  58024. }
  58025. function isForbiddenTag (el) {
  58026. return (
  58027. el.tag === 'style' ||
  58028. (el.tag === 'script' && (
  58029. !el.attrsMap.type ||
  58030. el.attrsMap.type === 'text/javascript'
  58031. ))
  58032. )
  58033. }
  58034. var ieNSBug = /^xmlns:NS\d+/;
  58035. var ieNSPrefix = /^NS\d+:/;
  58036. /* istanbul ignore next */
  58037. function guardIESVGBug (attrs) {
  58038. var res = [];
  58039. for (var i = 0; i < attrs.length; i++) {
  58040. var attr = attrs[i];
  58041. if (!ieNSBug.test(attr.name)) {
  58042. attr.name = attr.name.replace(ieNSPrefix, '');
  58043. res.push(attr);
  58044. }
  58045. }
  58046. return res
  58047. }
  58048. function checkForAliasModel (el, value) {
  58049. var _el = el;
  58050. while (_el) {
  58051. if (_el.for && _el.alias === value) {
  58052. warn$2(
  58053. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  58054. "You are binding v-model directly to a v-for iteration alias. " +
  58055. "This will not be able to modify the v-for source array because " +
  58056. "writing to the alias is like modifying a function local variable. " +
  58057. "Consider using an array of objects and use v-model on an object property instead.",
  58058. el.rawAttrsMap['v-model']
  58059. );
  58060. }
  58061. _el = _el.parent;
  58062. }
  58063. }
  58064. /* */
  58065. function preTransformNode (el, options) {
  58066. if (el.tag === 'input') {
  58067. var map = el.attrsMap;
  58068. if (!map['v-model']) {
  58069. return
  58070. }
  58071. var typeBinding;
  58072. if (map[':type'] || map['v-bind:type']) {
  58073. typeBinding = getBindingAttr(el, 'type');
  58074. }
  58075. if (!map.type && !typeBinding && map['v-bind']) {
  58076. typeBinding = "(" + (map['v-bind']) + ").type";
  58077. }
  58078. if (typeBinding) {
  58079. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  58080. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  58081. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  58082. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  58083. // 1. checkbox
  58084. var branch0 = cloneASTElement(el);
  58085. // process for on the main node
  58086. processFor(branch0);
  58087. addRawAttr(branch0, 'type', 'checkbox');
  58088. processElement(branch0, options);
  58089. branch0.processed = true; // prevent it from double-processed
  58090. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  58091. addIfCondition(branch0, {
  58092. exp: branch0.if,
  58093. block: branch0
  58094. });
  58095. // 2. add radio else-if condition
  58096. var branch1 = cloneASTElement(el);
  58097. getAndRemoveAttr(branch1, 'v-for', true);
  58098. addRawAttr(branch1, 'type', 'radio');
  58099. processElement(branch1, options);
  58100. addIfCondition(branch0, {
  58101. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  58102. block: branch1
  58103. });
  58104. // 3. other
  58105. var branch2 = cloneASTElement(el);
  58106. getAndRemoveAttr(branch2, 'v-for', true);
  58107. addRawAttr(branch2, ':type', typeBinding);
  58108. processElement(branch2, options);
  58109. addIfCondition(branch0, {
  58110. exp: ifCondition,
  58111. block: branch2
  58112. });
  58113. if (hasElse) {
  58114. branch0.else = true;
  58115. } else if (elseIfCondition) {
  58116. branch0.elseif = elseIfCondition;
  58117. }
  58118. return branch0
  58119. }
  58120. }
  58121. }
  58122. function cloneASTElement (el) {
  58123. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  58124. }
  58125. var model$1 = {
  58126. preTransformNode: preTransformNode
  58127. };
  58128. var modules$1 = [
  58129. klass$1,
  58130. style$1,
  58131. model$1
  58132. ];
  58133. /* */
  58134. function text (el, dir) {
  58135. if (dir.value) {
  58136. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  58137. }
  58138. }
  58139. /* */
  58140. function html (el, dir) {
  58141. if (dir.value) {
  58142. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  58143. }
  58144. }
  58145. var directives$1 = {
  58146. model: model,
  58147. text: text,
  58148. html: html
  58149. };
  58150. /* */
  58151. var baseOptions = {
  58152. expectHTML: true,
  58153. modules: modules$1,
  58154. directives: directives$1,
  58155. isPreTag: isPreTag,
  58156. isUnaryTag: isUnaryTag,
  58157. mustUseProp: mustUseProp,
  58158. canBeLeftOpenTag: canBeLeftOpenTag,
  58159. isReservedTag: isReservedTag,
  58160. getTagNamespace: getTagNamespace,
  58161. staticKeys: genStaticKeys(modules$1)
  58162. };
  58163. /* */
  58164. var isStaticKey;
  58165. var isPlatformReservedTag;
  58166. var genStaticKeysCached = cached(genStaticKeys$1);
  58167. /**
  58168. * Goal of the optimizer: walk the generated template AST tree
  58169. * and detect sub-trees that are purely static, i.e. parts of
  58170. * the DOM that never needs to change.
  58171. *
  58172. * Once we detect these sub-trees, we can:
  58173. *
  58174. * 1. Hoist them into constants, so that we no longer need to
  58175. * create fresh nodes for them on each re-render;
  58176. * 2. Completely skip them in the patching process.
  58177. */
  58178. function optimize (root, options) {
  58179. if (!root) { return }
  58180. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  58181. isPlatformReservedTag = options.isReservedTag || no;
  58182. // first pass: mark all non-static nodes.
  58183. markStatic$1(root);
  58184. // second pass: mark static roots.
  58185. markStaticRoots(root, false);
  58186. }
  58187. function genStaticKeys$1 (keys) {
  58188. return makeMap(
  58189. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  58190. (keys ? ',' + keys : '')
  58191. )
  58192. }
  58193. function markStatic$1 (node) {
  58194. node.static = isStatic(node);
  58195. if (node.type === 1) {
  58196. // do not make component slot content static. this avoids
  58197. // 1. components not able to mutate slot nodes
  58198. // 2. static slot content fails for hot-reloading
  58199. if (
  58200. !isPlatformReservedTag(node.tag) &&
  58201. node.tag !== 'slot' &&
  58202. node.attrsMap['inline-template'] == null
  58203. ) {
  58204. return
  58205. }
  58206. for (var i = 0, l = node.children.length; i < l; i++) {
  58207. var child = node.children[i];
  58208. markStatic$1(child);
  58209. if (!child.static) {
  58210. node.static = false;
  58211. }
  58212. }
  58213. if (node.ifConditions) {
  58214. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  58215. var block = node.ifConditions[i$1].block;
  58216. markStatic$1(block);
  58217. if (!block.static) {
  58218. node.static = false;
  58219. }
  58220. }
  58221. }
  58222. }
  58223. }
  58224. function markStaticRoots (node, isInFor) {
  58225. if (node.type === 1) {
  58226. if (node.static || node.once) {
  58227. node.staticInFor = isInFor;
  58228. }
  58229. // For a node to qualify as a static root, it should have children that
  58230. // are not just static text. Otherwise the cost of hoisting out will
  58231. // outweigh the benefits and it's better off to just always render it fresh.
  58232. if (node.static && node.children.length && !(
  58233. node.children.length === 1 &&
  58234. node.children[0].type === 3
  58235. )) {
  58236. node.staticRoot = true;
  58237. return
  58238. } else {
  58239. node.staticRoot = false;
  58240. }
  58241. if (node.children) {
  58242. for (var i = 0, l = node.children.length; i < l; i++) {
  58243. markStaticRoots(node.children[i], isInFor || !!node.for);
  58244. }
  58245. }
  58246. if (node.ifConditions) {
  58247. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  58248. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  58249. }
  58250. }
  58251. }
  58252. }
  58253. function isStatic (node) {
  58254. if (node.type === 2) { // expression
  58255. return false
  58256. }
  58257. if (node.type === 3) { // text
  58258. return true
  58259. }
  58260. return !!(node.pre || (
  58261. !node.hasBindings && // no dynamic bindings
  58262. !node.if && !node.for && // not v-if or v-for or v-else
  58263. !isBuiltInTag(node.tag) && // not a built-in
  58264. isPlatformReservedTag(node.tag) && // not a component
  58265. !isDirectChildOfTemplateFor(node) &&
  58266. Object.keys(node).every(isStaticKey)
  58267. ))
  58268. }
  58269. function isDirectChildOfTemplateFor (node) {
  58270. while (node.parent) {
  58271. node = node.parent;
  58272. if (node.tag !== 'template') {
  58273. return false
  58274. }
  58275. if (node.for) {
  58276. return true
  58277. }
  58278. }
  58279. return false
  58280. }
  58281. /* */
  58282. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  58283. var fnInvokeRE = /\([^)]*?\);*$/;
  58284. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  58285. // KeyboardEvent.keyCode aliases
  58286. var keyCodes = {
  58287. esc: 27,
  58288. tab: 9,
  58289. enter: 13,
  58290. space: 32,
  58291. up: 38,
  58292. left: 37,
  58293. right: 39,
  58294. down: 40,
  58295. 'delete': [8, 46]
  58296. };
  58297. // KeyboardEvent.key aliases
  58298. var keyNames = {
  58299. // #7880: IE11 and Edge use `Esc` for Escape key name.
  58300. esc: ['Esc', 'Escape'],
  58301. tab: 'Tab',
  58302. enter: 'Enter',
  58303. // #9112: IE11 uses `Spacebar` for Space key name.
  58304. space: [' ', 'Spacebar'],
  58305. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  58306. up: ['Up', 'ArrowUp'],
  58307. left: ['Left', 'ArrowLeft'],
  58308. right: ['Right', 'ArrowRight'],
  58309. down: ['Down', 'ArrowDown'],
  58310. // #9112: IE11 uses `Del` for Delete key name.
  58311. 'delete': ['Backspace', 'Delete', 'Del']
  58312. };
  58313. // #4868: modifiers that prevent the execution of the listener
  58314. // need to explicitly return null so that we can determine whether to remove
  58315. // the listener for .once
  58316. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  58317. var modifierCode = {
  58318. stop: '$event.stopPropagation();',
  58319. prevent: '$event.preventDefault();',
  58320. self: genGuard("$event.target !== $event.currentTarget"),
  58321. ctrl: genGuard("!$event.ctrlKey"),
  58322. shift: genGuard("!$event.shiftKey"),
  58323. alt: genGuard("!$event.altKey"),
  58324. meta: genGuard("!$event.metaKey"),
  58325. left: genGuard("'button' in $event && $event.button !== 0"),
  58326. middle: genGuard("'button' in $event && $event.button !== 1"),
  58327. right: genGuard("'button' in $event && $event.button !== 2")
  58328. };
  58329. function genHandlers (
  58330. events,
  58331. isNative
  58332. ) {
  58333. var prefix = isNative ? 'nativeOn:' : 'on:';
  58334. var staticHandlers = "";
  58335. var dynamicHandlers = "";
  58336. for (var name in events) {
  58337. var handlerCode = genHandler(events[name]);
  58338. if (events[name] && events[name].dynamic) {
  58339. dynamicHandlers += name + "," + handlerCode + ",";
  58340. } else {
  58341. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  58342. }
  58343. }
  58344. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  58345. if (dynamicHandlers) {
  58346. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  58347. } else {
  58348. return prefix + staticHandlers
  58349. }
  58350. }
  58351. function genHandler (handler) {
  58352. if (!handler) {
  58353. return 'function(){}'
  58354. }
  58355. if (Array.isArray(handler)) {
  58356. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  58357. }
  58358. var isMethodPath = simplePathRE.test(handler.value);
  58359. var isFunctionExpression = fnExpRE.test(handler.value);
  58360. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  58361. if (!handler.modifiers) {
  58362. if (isMethodPath || isFunctionExpression) {
  58363. return handler.value
  58364. }
  58365. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  58366. } else {
  58367. var code = '';
  58368. var genModifierCode = '';
  58369. var keys = [];
  58370. for (var key in handler.modifiers) {
  58371. if (modifierCode[key]) {
  58372. genModifierCode += modifierCode[key];
  58373. // left/right
  58374. if (keyCodes[key]) {
  58375. keys.push(key);
  58376. }
  58377. } else if (key === 'exact') {
  58378. var modifiers = (handler.modifiers);
  58379. genModifierCode += genGuard(
  58380. ['ctrl', 'shift', 'alt', 'meta']
  58381. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  58382. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  58383. .join('||')
  58384. );
  58385. } else {
  58386. keys.push(key);
  58387. }
  58388. }
  58389. if (keys.length) {
  58390. code += genKeyFilter(keys);
  58391. }
  58392. // Make sure modifiers like prevent and stop get executed after key filtering
  58393. if (genModifierCode) {
  58394. code += genModifierCode;
  58395. }
  58396. var handlerCode = isMethodPath
  58397. ? ("return " + (handler.value) + "($event)")
  58398. : isFunctionExpression
  58399. ? ("return (" + (handler.value) + ")($event)")
  58400. : isFunctionInvocation
  58401. ? ("return " + (handler.value))
  58402. : handler.value;
  58403. return ("function($event){" + code + handlerCode + "}")
  58404. }
  58405. }
  58406. function genKeyFilter (keys) {
  58407. return (
  58408. // make sure the key filters only apply to KeyboardEvents
  58409. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  58410. // key events that do not have keyCode property...
  58411. "if(!$event.type.indexOf('key')&&" +
  58412. (keys.map(genFilterCode).join('&&')) + ")return null;"
  58413. )
  58414. }
  58415. function genFilterCode (key) {
  58416. var keyVal = parseInt(key, 10);
  58417. if (keyVal) {
  58418. return ("$event.keyCode!==" + keyVal)
  58419. }
  58420. var keyCode = keyCodes[key];
  58421. var keyName = keyNames[key];
  58422. return (
  58423. "_k($event.keyCode," +
  58424. (JSON.stringify(key)) + "," +
  58425. (JSON.stringify(keyCode)) + "," +
  58426. "$event.key," +
  58427. "" + (JSON.stringify(keyName)) +
  58428. ")"
  58429. )
  58430. }
  58431. /* */
  58432. function on (el, dir) {
  58433. if (dir.modifiers) {
  58434. warn("v-on without argument does not support modifiers.");
  58435. }
  58436. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  58437. }
  58438. /* */
  58439. function bind$1 (el, dir) {
  58440. el.wrapData = function (code) {
  58441. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  58442. };
  58443. }
  58444. /* */
  58445. var baseDirectives = {
  58446. on: on,
  58447. bind: bind$1,
  58448. cloak: noop
  58449. };
  58450. /* */
  58451. var CodegenState = function CodegenState (options) {
  58452. this.options = options;
  58453. this.warn = options.warn || baseWarn;
  58454. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  58455. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  58456. this.directives = extend(extend({}, baseDirectives), options.directives);
  58457. var isReservedTag = options.isReservedTag || no;
  58458. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  58459. this.onceId = 0;
  58460. this.staticRenderFns = [];
  58461. this.pre = false;
  58462. };
  58463. function generate (
  58464. ast,
  58465. options
  58466. ) {
  58467. var state = new CodegenState(options);
  58468. var code = ast ? genElement(ast, state) : '_c("div")';
  58469. return {
  58470. render: ("with(this){return " + code + "}"),
  58471. staticRenderFns: state.staticRenderFns
  58472. }
  58473. }
  58474. function genElement (el, state) {
  58475. if (el.parent) {
  58476. el.pre = el.pre || el.parent.pre;
  58477. }
  58478. if (el.staticRoot && !el.staticProcessed) {
  58479. return genStatic(el, state)
  58480. } else if (el.once && !el.onceProcessed) {
  58481. return genOnce(el, state)
  58482. } else if (el.for && !el.forProcessed) {
  58483. return genFor(el, state)
  58484. } else if (el.if && !el.ifProcessed) {
  58485. return genIf(el, state)
  58486. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  58487. return genChildren(el, state) || 'void 0'
  58488. } else if (el.tag === 'slot') {
  58489. return genSlot(el, state)
  58490. } else {
  58491. // component or element
  58492. var code;
  58493. if (el.component) {
  58494. code = genComponent(el.component, el, state);
  58495. } else {
  58496. var data;
  58497. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  58498. data = genData$2(el, state);
  58499. }
  58500. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  58501. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  58502. }
  58503. // module transforms
  58504. for (var i = 0; i < state.transforms.length; i++) {
  58505. code = state.transforms[i](el, code);
  58506. }
  58507. return code
  58508. }
  58509. }
  58510. // hoist static sub-trees out
  58511. function genStatic (el, state) {
  58512. el.staticProcessed = true;
  58513. // Some elements (templates) need to behave differently inside of a v-pre
  58514. // node. All pre nodes are static roots, so we can use this as a location to
  58515. // wrap a state change and reset it upon exiting the pre node.
  58516. var originalPreState = state.pre;
  58517. if (el.pre) {
  58518. state.pre = el.pre;
  58519. }
  58520. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  58521. state.pre = originalPreState;
  58522. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  58523. }
  58524. // v-once
  58525. function genOnce (el, state) {
  58526. el.onceProcessed = true;
  58527. if (el.if && !el.ifProcessed) {
  58528. return genIf(el, state)
  58529. } else if (el.staticInFor) {
  58530. var key = '';
  58531. var parent = el.parent;
  58532. while (parent) {
  58533. if (parent.for) {
  58534. key = parent.key;
  58535. break
  58536. }
  58537. parent = parent.parent;
  58538. }
  58539. if (!key) {
  58540. state.warn(
  58541. "v-once can only be used inside v-for that is keyed. ",
  58542. el.rawAttrsMap['v-once']
  58543. );
  58544. return genElement(el, state)
  58545. }
  58546. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  58547. } else {
  58548. return genStatic(el, state)
  58549. }
  58550. }
  58551. function genIf (
  58552. el,
  58553. state,
  58554. altGen,
  58555. altEmpty
  58556. ) {
  58557. el.ifProcessed = true; // avoid recursion
  58558. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  58559. }
  58560. function genIfConditions (
  58561. conditions,
  58562. state,
  58563. altGen,
  58564. altEmpty
  58565. ) {
  58566. if (!conditions.length) {
  58567. return altEmpty || '_e()'
  58568. }
  58569. var condition = conditions.shift();
  58570. if (condition.exp) {
  58571. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  58572. } else {
  58573. return ("" + (genTernaryExp(condition.block)))
  58574. }
  58575. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  58576. function genTernaryExp (el) {
  58577. return altGen
  58578. ? altGen(el, state)
  58579. : el.once
  58580. ? genOnce(el, state)
  58581. : genElement(el, state)
  58582. }
  58583. }
  58584. function genFor (
  58585. el,
  58586. state,
  58587. altGen,
  58588. altHelper
  58589. ) {
  58590. var exp = el.for;
  58591. var alias = el.alias;
  58592. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  58593. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  58594. if (state.maybeComponent(el) &&
  58595. el.tag !== 'slot' &&
  58596. el.tag !== 'template' &&
  58597. !el.key
  58598. ) {
  58599. state.warn(
  58600. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  58601. "v-for should have explicit keys. " +
  58602. "See https://vuejs.org/guide/list.html#key for more info.",
  58603. el.rawAttrsMap['v-for'],
  58604. true /* tip */
  58605. );
  58606. }
  58607. el.forProcessed = true; // avoid recursion
  58608. return (altHelper || '_l') + "((" + exp + ")," +
  58609. "function(" + alias + iterator1 + iterator2 + "){" +
  58610. "return " + ((altGen || genElement)(el, state)) +
  58611. '})'
  58612. }
  58613. function genData$2 (el, state) {
  58614. var data = '{';
  58615. // directives first.
  58616. // directives may mutate the el's other properties before they are generated.
  58617. var dirs = genDirectives(el, state);
  58618. if (dirs) { data += dirs + ','; }
  58619. // key
  58620. if (el.key) {
  58621. data += "key:" + (el.key) + ",";
  58622. }
  58623. // ref
  58624. if (el.ref) {
  58625. data += "ref:" + (el.ref) + ",";
  58626. }
  58627. if (el.refInFor) {
  58628. data += "refInFor:true,";
  58629. }
  58630. // pre
  58631. if (el.pre) {
  58632. data += "pre:true,";
  58633. }
  58634. // record original tag name for components using "is" attribute
  58635. if (el.component) {
  58636. data += "tag:\"" + (el.tag) + "\",";
  58637. }
  58638. // module data generation functions
  58639. for (var i = 0; i < state.dataGenFns.length; i++) {
  58640. data += state.dataGenFns[i](el);
  58641. }
  58642. // attributes
  58643. if (el.attrs) {
  58644. data += "attrs:" + (genProps(el.attrs)) + ",";
  58645. }
  58646. // DOM props
  58647. if (el.props) {
  58648. data += "domProps:" + (genProps(el.props)) + ",";
  58649. }
  58650. // event handlers
  58651. if (el.events) {
  58652. data += (genHandlers(el.events, false)) + ",";
  58653. }
  58654. if (el.nativeEvents) {
  58655. data += (genHandlers(el.nativeEvents, true)) + ",";
  58656. }
  58657. // slot target
  58658. // only for non-scoped slots
  58659. if (el.slotTarget && !el.slotScope) {
  58660. data += "slot:" + (el.slotTarget) + ",";
  58661. }
  58662. // scoped slots
  58663. if (el.scopedSlots) {
  58664. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  58665. }
  58666. // component v-model
  58667. if (el.model) {
  58668. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  58669. }
  58670. // inline-template
  58671. if (el.inlineTemplate) {
  58672. var inlineTemplate = genInlineTemplate(el, state);
  58673. if (inlineTemplate) {
  58674. data += inlineTemplate + ",";
  58675. }
  58676. }
  58677. data = data.replace(/,$/, '') + '}';
  58678. // v-bind dynamic argument wrap
  58679. // v-bind with dynamic arguments must be applied using the same v-bind object
  58680. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  58681. if (el.dynamicAttrs) {
  58682. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  58683. }
  58684. // v-bind data wrap
  58685. if (el.wrapData) {
  58686. data = el.wrapData(data);
  58687. }
  58688. // v-on data wrap
  58689. if (el.wrapListeners) {
  58690. data = el.wrapListeners(data);
  58691. }
  58692. return data
  58693. }
  58694. function genDirectives (el, state) {
  58695. var dirs = el.directives;
  58696. if (!dirs) { return }
  58697. var res = 'directives:[';
  58698. var hasRuntime = false;
  58699. var i, l, dir, needRuntime;
  58700. for (i = 0, l = dirs.length; i < l; i++) {
  58701. dir = dirs[i];
  58702. needRuntime = true;
  58703. var gen = state.directives[dir.name];
  58704. if (gen) {
  58705. // compile-time directive that manipulates AST.
  58706. // returns true if it also needs a runtime counterpart.
  58707. needRuntime = !!gen(el, dir, state.warn);
  58708. }
  58709. if (needRuntime) {
  58710. hasRuntime = true;
  58711. 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))) : '') + "},";
  58712. }
  58713. }
  58714. if (hasRuntime) {
  58715. return res.slice(0, -1) + ']'
  58716. }
  58717. }
  58718. function genInlineTemplate (el, state) {
  58719. var ast = el.children[0];
  58720. if (el.children.length !== 1 || ast.type !== 1) {
  58721. state.warn(
  58722. 'Inline-template components must have exactly one child element.',
  58723. { start: el.start }
  58724. );
  58725. }
  58726. if (ast && ast.type === 1) {
  58727. var inlineRenderFns = generate(ast, state.options);
  58728. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  58729. }
  58730. }
  58731. function genScopedSlots (
  58732. el,
  58733. slots,
  58734. state
  58735. ) {
  58736. // by default scoped slots are considered "stable", this allows child
  58737. // components with only scoped slots to skip forced updates from parent.
  58738. // but in some cases we have to bail-out of this optimization
  58739. // for example if the slot contains dynamic names, has v-if or v-for on them...
  58740. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  58741. var slot = slots[key];
  58742. return (
  58743. slot.slotTargetDynamic ||
  58744. slot.if ||
  58745. slot.for ||
  58746. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  58747. )
  58748. });
  58749. // #9534: if a component with scoped slots is inside a conditional branch,
  58750. // it's possible for the same component to be reused but with different
  58751. // compiled slot content. To avoid that, we generate a unique key based on
  58752. // the generated code of all the slot contents.
  58753. var needsKey = !!el.if;
  58754. // OR when it is inside another scoped slot or v-for (the reactivity may be
  58755. // disconnected due to the intermediate scope variable)
  58756. // #9438, #9506
  58757. // TODO: this can be further optimized by properly analyzing in-scope bindings
  58758. // and skip force updating ones that do not actually use scope variables.
  58759. if (!needsForceUpdate) {
  58760. var parent = el.parent;
  58761. while (parent) {
  58762. if (
  58763. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  58764. parent.for
  58765. ) {
  58766. needsForceUpdate = true;
  58767. break
  58768. }
  58769. if (parent.if) {
  58770. needsKey = true;
  58771. }
  58772. parent = parent.parent;
  58773. }
  58774. }
  58775. var generatedSlots = Object.keys(slots)
  58776. .map(function (key) { return genScopedSlot(slots[key], state); })
  58777. .join(',');
  58778. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  58779. }
  58780. function hash(str) {
  58781. var hash = 5381;
  58782. var i = str.length;
  58783. while(i) {
  58784. hash = (hash * 33) ^ str.charCodeAt(--i);
  58785. }
  58786. return hash >>> 0
  58787. }
  58788. function containsSlotChild (el) {
  58789. if (el.type === 1) {
  58790. if (el.tag === 'slot') {
  58791. return true
  58792. }
  58793. return el.children.some(containsSlotChild)
  58794. }
  58795. return false
  58796. }
  58797. function genScopedSlot (
  58798. el,
  58799. state
  58800. ) {
  58801. var isLegacySyntax = el.attrsMap['slot-scope'];
  58802. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  58803. return genIf(el, state, genScopedSlot, "null")
  58804. }
  58805. if (el.for && !el.forProcessed) {
  58806. return genFor(el, state, genScopedSlot)
  58807. }
  58808. var slotScope = el.slotScope === emptySlotScopeToken
  58809. ? ""
  58810. : String(el.slotScope);
  58811. var fn = "function(" + slotScope + "){" +
  58812. "return " + (el.tag === 'template'
  58813. ? el.if && isLegacySyntax
  58814. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  58815. : genChildren(el, state) || 'undefined'
  58816. : genElement(el, state)) + "}";
  58817. // reverse proxy v-slot without scope on this.$slots
  58818. var reverseProxy = slotScope ? "" : ",proxy:true";
  58819. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  58820. }
  58821. function genChildren (
  58822. el,
  58823. state,
  58824. checkSkip,
  58825. altGenElement,
  58826. altGenNode
  58827. ) {
  58828. var children = el.children;
  58829. if (children.length) {
  58830. var el$1 = children[0];
  58831. // optimize single v-for
  58832. if (children.length === 1 &&
  58833. el$1.for &&
  58834. el$1.tag !== 'template' &&
  58835. el$1.tag !== 'slot'
  58836. ) {
  58837. var normalizationType = checkSkip
  58838. ? state.maybeComponent(el$1) ? ",1" : ",0"
  58839. : "";
  58840. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  58841. }
  58842. var normalizationType$1 = checkSkip
  58843. ? getNormalizationType(children, state.maybeComponent)
  58844. : 0;
  58845. var gen = altGenNode || genNode;
  58846. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  58847. }
  58848. }
  58849. // determine the normalization needed for the children array.
  58850. // 0: no normalization needed
  58851. // 1: simple normalization needed (possible 1-level deep nested array)
  58852. // 2: full normalization needed
  58853. function getNormalizationType (
  58854. children,
  58855. maybeComponent
  58856. ) {
  58857. var res = 0;
  58858. for (var i = 0; i < children.length; i++) {
  58859. var el = children[i];
  58860. if (el.type !== 1) {
  58861. continue
  58862. }
  58863. if (needsNormalization(el) ||
  58864. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  58865. res = 2;
  58866. break
  58867. }
  58868. if (maybeComponent(el) ||
  58869. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  58870. res = 1;
  58871. }
  58872. }
  58873. return res
  58874. }
  58875. function needsNormalization (el) {
  58876. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  58877. }
  58878. function genNode (node, state) {
  58879. if (node.type === 1) {
  58880. return genElement(node, state)
  58881. } else if (node.type === 3 && node.isComment) {
  58882. return genComment(node)
  58883. } else {
  58884. return genText(node)
  58885. }
  58886. }
  58887. function genText (text) {
  58888. return ("_v(" + (text.type === 2
  58889. ? text.expression // no need for () because already wrapped in _s()
  58890. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  58891. }
  58892. function genComment (comment) {
  58893. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  58894. }
  58895. function genSlot (el, state) {
  58896. var slotName = el.slotName || '"default"';
  58897. var children = genChildren(el, state);
  58898. var res = "_t(" + slotName + (children ? ("," + children) : '');
  58899. var attrs = el.attrs || el.dynamicAttrs
  58900. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  58901. // slot props are camelized
  58902. name: camelize(attr.name),
  58903. value: attr.value,
  58904. dynamic: attr.dynamic
  58905. }); }))
  58906. : null;
  58907. var bind$$1 = el.attrsMap['v-bind'];
  58908. if ((attrs || bind$$1) && !children) {
  58909. res += ",null";
  58910. }
  58911. if (attrs) {
  58912. res += "," + attrs;
  58913. }
  58914. if (bind$$1) {
  58915. res += (attrs ? '' : ',null') + "," + bind$$1;
  58916. }
  58917. return res + ')'
  58918. }
  58919. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  58920. function genComponent (
  58921. componentName,
  58922. el,
  58923. state
  58924. ) {
  58925. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  58926. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  58927. }
  58928. function genProps (props) {
  58929. var staticProps = "";
  58930. var dynamicProps = "";
  58931. for (var i = 0; i < props.length; i++) {
  58932. var prop = props[i];
  58933. var value = transformSpecialNewlines(prop.value);
  58934. if (prop.dynamic) {
  58935. dynamicProps += (prop.name) + "," + value + ",";
  58936. } else {
  58937. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  58938. }
  58939. }
  58940. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  58941. if (dynamicProps) {
  58942. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  58943. } else {
  58944. return staticProps
  58945. }
  58946. }
  58947. // #3895, #4268
  58948. function transformSpecialNewlines (text) {
  58949. return text
  58950. .replace(/\u2028/g, '\\u2028')
  58951. .replace(/\u2029/g, '\\u2029')
  58952. }
  58953. /* */
  58954. // these keywords should not appear inside expressions, but operators like
  58955. // typeof, instanceof and in are allowed
  58956. var prohibitedKeywordRE = new RegExp('\\b' + (
  58957. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  58958. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  58959. 'extends,finally,continue,debugger,function,arguments'
  58960. ).split(',').join('\\b|\\b') + '\\b');
  58961. // these unary operators should not be used as property/method names
  58962. var unaryOperatorsRE = new RegExp('\\b' + (
  58963. 'delete,typeof,void'
  58964. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  58965. // strip strings in expressions
  58966. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  58967. // detect problematic expressions in a template
  58968. function detectErrors (ast, warn) {
  58969. if (ast) {
  58970. checkNode(ast, warn);
  58971. }
  58972. }
  58973. function checkNode (node, warn) {
  58974. if (node.type === 1) {
  58975. for (var name in node.attrsMap) {
  58976. if (dirRE.test(name)) {
  58977. var value = node.attrsMap[name];
  58978. if (value) {
  58979. var range = node.rawAttrsMap[name];
  58980. if (name === 'v-for') {
  58981. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  58982. } else if (name === 'v-slot' || name[0] === '#') {
  58983. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  58984. } else if (onRE.test(name)) {
  58985. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  58986. } else {
  58987. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  58988. }
  58989. }
  58990. }
  58991. }
  58992. if (node.children) {
  58993. for (var i = 0; i < node.children.length; i++) {
  58994. checkNode(node.children[i], warn);
  58995. }
  58996. }
  58997. } else if (node.type === 2) {
  58998. checkExpression(node.expression, node.text, warn, node);
  58999. }
  59000. }
  59001. function checkEvent (exp, text, warn, range) {
  59002. var stripped = exp.replace(stripStringRE, '');
  59003. var keywordMatch = stripped.match(unaryOperatorsRE);
  59004. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  59005. warn(
  59006. "avoid using JavaScript unary operator as property name: " +
  59007. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  59008. range
  59009. );
  59010. }
  59011. checkExpression(exp, text, warn, range);
  59012. }
  59013. function checkFor (node, text, warn, range) {
  59014. checkExpression(node.for || '', text, warn, range);
  59015. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  59016. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  59017. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  59018. }
  59019. function checkIdentifier (
  59020. ident,
  59021. type,
  59022. text,
  59023. warn,
  59024. range
  59025. ) {
  59026. if (typeof ident === 'string') {
  59027. try {
  59028. new Function(("var " + ident + "=_"));
  59029. } catch (e) {
  59030. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  59031. }
  59032. }
  59033. }
  59034. function checkExpression (exp, text, warn, range) {
  59035. try {
  59036. new Function(("return " + exp));
  59037. } catch (e) {
  59038. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  59039. if (keywordMatch) {
  59040. warn(
  59041. "avoid using JavaScript keyword as property name: " +
  59042. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  59043. range
  59044. );
  59045. } else {
  59046. warn(
  59047. "invalid expression: " + (e.message) + " in\n\n" +
  59048. " " + exp + "\n\n" +
  59049. " Raw expression: " + (text.trim()) + "\n",
  59050. range
  59051. );
  59052. }
  59053. }
  59054. }
  59055. function checkFunctionParameterExpression (exp, text, warn, range) {
  59056. try {
  59057. new Function(exp, '');
  59058. } catch (e) {
  59059. warn(
  59060. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  59061. " " + exp + "\n\n" +
  59062. " Raw expression: " + (text.trim()) + "\n",
  59063. range
  59064. );
  59065. }
  59066. }
  59067. /* */
  59068. var range = 2;
  59069. function generateCodeFrame (
  59070. source,
  59071. start,
  59072. end
  59073. ) {
  59074. if ( start === void 0 ) start = 0;
  59075. if ( end === void 0 ) end = source.length;
  59076. var lines = source.split(/\r?\n/);
  59077. var count = 0;
  59078. var res = [];
  59079. for (var i = 0; i < lines.length; i++) {
  59080. count += lines[i].length + 1;
  59081. if (count >= start) {
  59082. for (var j = i - range; j <= i + range || end > count; j++) {
  59083. if (j < 0 || j >= lines.length) { continue }
  59084. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  59085. var lineLength = lines[j].length;
  59086. if (j === i) {
  59087. // push underline
  59088. var pad = start - (count - lineLength) + 1;
  59089. var length = end > count ? lineLength - pad : end - start;
  59090. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  59091. } else if (j > i) {
  59092. if (end > count) {
  59093. var length$1 = Math.min(end - count, lineLength);
  59094. res.push(" | " + repeat$1("^", length$1));
  59095. }
  59096. count += lineLength + 1;
  59097. }
  59098. }
  59099. break
  59100. }
  59101. }
  59102. return res.join('\n')
  59103. }
  59104. function repeat$1 (str, n) {
  59105. var result = '';
  59106. if (n > 0) {
  59107. while (true) { // eslint-disable-line
  59108. if (n & 1) { result += str; }
  59109. n >>>= 1;
  59110. if (n <= 0) { break }
  59111. str += str;
  59112. }
  59113. }
  59114. return result
  59115. }
  59116. /* */
  59117. function createFunction (code, errors) {
  59118. try {
  59119. return new Function(code)
  59120. } catch (err) {
  59121. errors.push({ err: err, code: code });
  59122. return noop
  59123. }
  59124. }
  59125. function createCompileToFunctionFn (compile) {
  59126. var cache = Object.create(null);
  59127. return function compileToFunctions (
  59128. template,
  59129. options,
  59130. vm
  59131. ) {
  59132. options = extend({}, options);
  59133. var warn$$1 = options.warn || warn;
  59134. delete options.warn;
  59135. /* istanbul ignore if */
  59136. {
  59137. // detect possible CSP restriction
  59138. try {
  59139. new Function('return 1');
  59140. } catch (e) {
  59141. if (e.toString().match(/unsafe-eval|CSP/)) {
  59142. warn$$1(
  59143. 'It seems you are using the standalone build of Vue.js in an ' +
  59144. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  59145. 'The template compiler cannot work in this environment. Consider ' +
  59146. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  59147. 'templates into render functions.'
  59148. );
  59149. }
  59150. }
  59151. }
  59152. // check cache
  59153. var key = options.delimiters
  59154. ? String(options.delimiters) + template
  59155. : template;
  59156. if (cache[key]) {
  59157. return cache[key]
  59158. }
  59159. // compile
  59160. var compiled = compile(template, options);
  59161. // check compilation errors/tips
  59162. {
  59163. if (compiled.errors && compiled.errors.length) {
  59164. if (options.outputSourceRange) {
  59165. compiled.errors.forEach(function (e) {
  59166. warn$$1(
  59167. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  59168. generateCodeFrame(template, e.start, e.end),
  59169. vm
  59170. );
  59171. });
  59172. } else {
  59173. warn$$1(
  59174. "Error compiling template:\n\n" + template + "\n\n" +
  59175. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  59176. vm
  59177. );
  59178. }
  59179. }
  59180. if (compiled.tips && compiled.tips.length) {
  59181. if (options.outputSourceRange) {
  59182. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  59183. } else {
  59184. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  59185. }
  59186. }
  59187. }
  59188. // turn code into functions
  59189. var res = {};
  59190. var fnGenErrors = [];
  59191. res.render = createFunction(compiled.render, fnGenErrors);
  59192. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  59193. return createFunction(code, fnGenErrors)
  59194. });
  59195. // check function generation errors.
  59196. // this should only happen if there is a bug in the compiler itself.
  59197. // mostly for codegen development use
  59198. /* istanbul ignore if */
  59199. {
  59200. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  59201. warn$$1(
  59202. "Failed to generate render function:\n\n" +
  59203. fnGenErrors.map(function (ref) {
  59204. var err = ref.err;
  59205. var code = ref.code;
  59206. return ((err.toString()) + " in\n\n" + code + "\n");
  59207. }).join('\n'),
  59208. vm
  59209. );
  59210. }
  59211. }
  59212. return (cache[key] = res)
  59213. }
  59214. }
  59215. /* */
  59216. function createCompilerCreator (baseCompile) {
  59217. return function createCompiler (baseOptions) {
  59218. function compile (
  59219. template,
  59220. options
  59221. ) {
  59222. var finalOptions = Object.create(baseOptions);
  59223. var errors = [];
  59224. var tips = [];
  59225. var warn = function (msg, range, tip) {
  59226. (tip ? tips : errors).push(msg);
  59227. };
  59228. if (options) {
  59229. if (options.outputSourceRange) {
  59230. // $flow-disable-line
  59231. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  59232. warn = function (msg, range, tip) {
  59233. var data = { msg: msg };
  59234. if (range) {
  59235. if (range.start != null) {
  59236. data.start = range.start + leadingSpaceLength;
  59237. }
  59238. if (range.end != null) {
  59239. data.end = range.end + leadingSpaceLength;
  59240. }
  59241. }
  59242. (tip ? tips : errors).push(data);
  59243. };
  59244. }
  59245. // merge custom modules
  59246. if (options.modules) {
  59247. finalOptions.modules =
  59248. (baseOptions.modules || []).concat(options.modules);
  59249. }
  59250. // merge custom directives
  59251. if (options.directives) {
  59252. finalOptions.directives = extend(
  59253. Object.create(baseOptions.directives || null),
  59254. options.directives
  59255. );
  59256. }
  59257. // copy other options
  59258. for (var key in options) {
  59259. if (key !== 'modules' && key !== 'directives') {
  59260. finalOptions[key] = options[key];
  59261. }
  59262. }
  59263. }
  59264. finalOptions.warn = warn;
  59265. var compiled = baseCompile(template.trim(), finalOptions);
  59266. {
  59267. detectErrors(compiled.ast, warn);
  59268. }
  59269. compiled.errors = errors;
  59270. compiled.tips = tips;
  59271. return compiled
  59272. }
  59273. return {
  59274. compile: compile,
  59275. compileToFunctions: createCompileToFunctionFn(compile)
  59276. }
  59277. }
  59278. }
  59279. /* */
  59280. // `createCompilerCreator` allows creating compilers that use alternative
  59281. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  59282. // Here we just export a default compiler using the default parts.
  59283. var createCompiler = createCompilerCreator(function baseCompile (
  59284. template,
  59285. options
  59286. ) {
  59287. var ast = parse(template.trim(), options);
  59288. if (options.optimize !== false) {
  59289. optimize(ast, options);
  59290. }
  59291. var code = generate(ast, options);
  59292. return {
  59293. ast: ast,
  59294. render: code.render,
  59295. staticRenderFns: code.staticRenderFns
  59296. }
  59297. });
  59298. /* */
  59299. var ref$1 = createCompiler(baseOptions);
  59300. var compile = ref$1.compile;
  59301. var compileToFunctions = ref$1.compileToFunctions;
  59302. /* */
  59303. // check whether current browser encodes a char inside attribute values
  59304. var div;
  59305. function getShouldDecode (href) {
  59306. div = div || document.createElement('div');
  59307. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  59308. return div.innerHTML.indexOf('&#10;') > 0
  59309. }
  59310. // #3663: IE encodes newlines inside attribute values while other browsers don't
  59311. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  59312. // #6828: chrome encodes content in a[href]
  59313. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  59314. /* */
  59315. var idToTemplate = cached(function (id) {
  59316. var el = query(id);
  59317. return el && el.innerHTML
  59318. });
  59319. var mount = Vue.prototype.$mount;
  59320. Vue.prototype.$mount = function (
  59321. el,
  59322. hydrating
  59323. ) {
  59324. el = el && query(el);
  59325. /* istanbul ignore if */
  59326. if (el === document.body || el === document.documentElement) {
  59327. warn(
  59328. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  59329. );
  59330. return this
  59331. }
  59332. var options = this.$options;
  59333. // resolve template/el and convert to render function
  59334. if (!options.render) {
  59335. var template = options.template;
  59336. if (template) {
  59337. if (typeof template === 'string') {
  59338. if (template.charAt(0) === '#') {
  59339. template = idToTemplate(template);
  59340. /* istanbul ignore if */
  59341. if (!template) {
  59342. warn(
  59343. ("Template element not found or is empty: " + (options.template)),
  59344. this
  59345. );
  59346. }
  59347. }
  59348. } else if (template.nodeType) {
  59349. template = template.innerHTML;
  59350. } else {
  59351. {
  59352. warn('invalid template option:' + template, this);
  59353. }
  59354. return this
  59355. }
  59356. } else if (el) {
  59357. template = getOuterHTML(el);
  59358. }
  59359. if (template) {
  59360. /* istanbul ignore if */
  59361. if (config.performance && mark) {
  59362. mark('compile');
  59363. }
  59364. var ref = compileToFunctions(template, {
  59365. outputSourceRange: "development" !== 'production',
  59366. shouldDecodeNewlines: shouldDecodeNewlines,
  59367. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  59368. delimiters: options.delimiters,
  59369. comments: options.comments
  59370. }, this);
  59371. var render = ref.render;
  59372. var staticRenderFns = ref.staticRenderFns;
  59373. options.render = render;
  59374. options.staticRenderFns = staticRenderFns;
  59375. /* istanbul ignore if */
  59376. if (config.performance && mark) {
  59377. mark('compile end');
  59378. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  59379. }
  59380. }
  59381. }
  59382. return mount.call(this, el, hydrating)
  59383. };
  59384. /**
  59385. * Get outerHTML of elements, taking care
  59386. * of SVG elements in IE as well.
  59387. */
  59388. function getOuterHTML (el) {
  59389. if (el.outerHTML) {
  59390. return el.outerHTML
  59391. } else {
  59392. var container = document.createElement('div');
  59393. container.appendChild(el.cloneNode(true));
  59394. return container.innerHTML
  59395. }
  59396. }
  59397. Vue.compile = compileToFunctions;
  59398. module.exports = Vue;
  59399. /* 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))
  59400. /***/ }),
  59401. /***/ "./node_modules/vue/dist/vue.common.js":
  59402. /*!*********************************************!*\
  59403. !*** ./node_modules/vue/dist/vue.common.js ***!
  59404. \*********************************************/
  59405. /*! no static exports found */
  59406. /***/ (function(module, exports, __webpack_require__) {
  59407. if (false) {} else {
  59408. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  59409. }
  59410. /***/ }),
  59411. /***/ "./node_modules/webpack/buildin/global.js":
  59412. /*!***********************************!*\
  59413. !*** (webpack)/buildin/global.js ***!
  59414. \***********************************/
  59415. /*! no static exports found */
  59416. /***/ (function(module, exports) {
  59417. var g;
  59418. // This works in non-strict mode
  59419. g = (function() {
  59420. return this;
  59421. })();
  59422. try {
  59423. // This works if eval is allowed (see CSP)
  59424. g = g || new Function("return this")();
  59425. } catch (e) {
  59426. // This works if the window reference is available
  59427. if (typeof window === "object") g = window;
  59428. }
  59429. // g can still be undefined, but nothing to do about it...
  59430. // We return undefined, instead of nothing here, so it's
  59431. // easier to handle this case. if(!global) { ...}
  59432. module.exports = g;
  59433. /***/ }),
  59434. /***/ "./node_modules/webpack/buildin/module.js":
  59435. /*!***********************************!*\
  59436. !*** (webpack)/buildin/module.js ***!
  59437. \***********************************/
  59438. /*! no static exports found */
  59439. /***/ (function(module, exports) {
  59440. module.exports = function(module) {
  59441. if (!module.webpackPolyfill) {
  59442. module.deprecate = function() {};
  59443. module.paths = [];
  59444. // module.parent = undefined by default
  59445. if (!module.children) module.children = [];
  59446. Object.defineProperty(module, "loaded", {
  59447. enumerable: true,
  59448. get: function() {
  59449. return module.l;
  59450. }
  59451. });
  59452. Object.defineProperty(module, "id", {
  59453. enumerable: true,
  59454. get: function() {
  59455. return module.i;
  59456. }
  59457. });
  59458. module.webpackPolyfill = 1;
  59459. }
  59460. return module;
  59461. };
  59462. /***/ }),
  59463. /***/ "./resources/js/app.js":
  59464. /*!*****************************!*\
  59465. !*** ./resources/js/app.js ***!
  59466. \*****************************/
  59467. /*! no exports provided */
  59468. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59469. "use strict";
  59470. __webpack_require__.r(__webpack_exports__);
  59471. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  59472. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
  59473. /* harmony import */ var vue_router__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vue-router */ "./node_modules/vue-router/dist/vue-router.esm.js");
  59474. /* harmony import */ var _views_App__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./views/App */ "./resources/js/views/App.vue");
  59475. /* harmony import */ var _views_Dashboard__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./views/Dashboard */ "./resources/js/views/Dashboard.vue");
  59476. /* harmony import */ var _views_WorkOrder__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./views/WorkOrder */ "./resources/js/views/WorkOrder.vue");
  59477. /* harmony import */ var _views_Login__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./views/Login */ "./resources/js/views/Login.vue");
  59478. /* harmony import */ var _views_Welcome__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./views/Welcome */ "./resources/js/views/Welcome.vue");
  59479. /**
  59480. * First we will load all of this project's JavaScript dependencies which
  59481. * includes Vue and other libraries. It is a great starting point when
  59482. * building robust, powerful web applications using Vue and Laravel.
  59483. */
  59484. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  59485. window.Clipboard = __webpack_require__(/*! clipboard */ "./node_modules/clipboard/dist/clipboard.js");
  59486. __webpack_require__(/*! ./notify.min.js */ "./resources/js/notify.min.js");
  59487. vue__WEBPACK_IMPORTED_MODULE_0___default.a.use(vue_router__WEBPACK_IMPORTED_MODULE_1__["default"]);
  59488. var router = new vue_router__WEBPACK_IMPORTED_MODULE_1__["default"]({
  59489. mode: 'history',
  59490. routes: [{
  59491. path: '/',
  59492. name: 'home',
  59493. component: _views_Welcome__WEBPACK_IMPORTED_MODULE_6__["default"]
  59494. }, {
  59495. path: '/login',
  59496. name: 'login',
  59497. component: _views_Login__WEBPACK_IMPORTED_MODULE_5__["default"]
  59498. }, {
  59499. path: '/dashboard',
  59500. name: 'dashboard',
  59501. component: _views_Dashboard__WEBPACK_IMPORTED_MODULE_3__["default"]
  59502. }, {
  59503. path: '/workorders/:id',
  59504. name: 'workorders',
  59505. component: _views_WorkOrder__WEBPACK_IMPORTED_MODULE_4__["default"],
  59506. props: true
  59507. }]
  59508. });
  59509. var app = new vue__WEBPACK_IMPORTED_MODULE_0___default.a({
  59510. el: '#app',
  59511. components: {
  59512. App: _views_App__WEBPACK_IMPORTED_MODULE_2__["default"]
  59513. },
  59514. router: router
  59515. });
  59516. $(function () {
  59517. $('[data-toggle="tooltip"]').tooltip();
  59518. });
  59519. var clipboard = new Clipboard('.btn-clip');
  59520. clipboard.on('success', function (e) {
  59521. $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard', {
  59522. position: "right",
  59523. className: 'success'
  59524. });
  59525. e.clearSelection();
  59526. });
  59527. /***/ }),
  59528. /***/ "./resources/js/bootstrap.js":
  59529. /*!***********************************!*\
  59530. !*** ./resources/js/bootstrap.js ***!
  59531. \***********************************/
  59532. /*! no exports provided */
  59533. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59534. "use strict";
  59535. __webpack_require__.r(__webpack_exports__);
  59536. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  59537. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  59538. /**
  59539. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  59540. * for JavaScript based Bootstrap features such as modals and tabs. This
  59541. * code may be modified to fit the specific needs of your application.
  59542. */
  59543. try {
  59544. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  59545. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  59546. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  59547. } catch (e) {}
  59548. /**
  59549. * We'll load the axios HTTP library which allows us to easily issue requests
  59550. * to our Laravel back-end. This library automatically handles sending the
  59551. * CSRF token as a header based on the value of the "XSRF" token cookie.
  59552. */
  59553. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  59554. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  59555. /**
  59556. * Echo exposes an expressive API for subscribing to channels and listening
  59557. * for events that are broadcast by Laravel. Echo and event broadcasting
  59558. * allows your team to easily build robust real-time web applications.
  59559. */
  59560. window.Pusher = __webpack_require__(/*! pusher-js */ "./node_modules/pusher-js/dist/web/pusher.js");
  59561. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  59562. broadcaster: 'pusher',
  59563. key: "upccrt",
  59564. authEndpoint: '/broadcasting/auth',
  59565. wsHost: window.location.hostname,
  59566. wsPort: 6001,
  59567. disableStats: true
  59568. });
  59569. /***/ }),
  59570. /***/ "./resources/js/components/AssetInfo.vue":
  59571. /*!***********************************************!*\
  59572. !*** ./resources/js/components/AssetInfo.vue ***!
  59573. \***********************************************/
  59574. /*! exports provided: default */
  59575. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59576. "use strict";
  59577. __webpack_require__.r(__webpack_exports__);
  59578. /* harmony import */ var _AssetInfo_vue_vue_type_template_id_f949323a___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AssetInfo.vue?vue&type=template&id=f949323a& */ "./resources/js/components/AssetInfo.vue?vue&type=template&id=f949323a&");
  59579. /* harmony import */ var _AssetInfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AssetInfo.vue?vue&type=script&lang=js& */ "./resources/js/components/AssetInfo.vue?vue&type=script&lang=js&");
  59580. /* 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");
  59581. /* normalize component */
  59582. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  59583. _AssetInfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  59584. _AssetInfo_vue_vue_type_template_id_f949323a___WEBPACK_IMPORTED_MODULE_0__["render"],
  59585. _AssetInfo_vue_vue_type_template_id_f949323a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  59586. false,
  59587. null,
  59588. null,
  59589. null
  59590. )
  59591. /* hot reload */
  59592. if (false) { var api; }
  59593. component.options.__file = "resources/js/components/AssetInfo.vue"
  59594. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  59595. /***/ }),
  59596. /***/ "./resources/js/components/AssetInfo.vue?vue&type=script&lang=js&":
  59597. /*!************************************************************************!*\
  59598. !*** ./resources/js/components/AssetInfo.vue?vue&type=script&lang=js& ***!
  59599. \************************************************************************/
  59600. /*! exports provided: default */
  59601. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59602. "use strict";
  59603. __webpack_require__.r(__webpack_exports__);
  59604. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_AssetInfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./AssetInfo.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AssetInfo.vue?vue&type=script&lang=js&");
  59605. /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_AssetInfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  59606. /***/ }),
  59607. /***/ "./resources/js/components/AssetInfo.vue?vue&type=template&id=f949323a&":
  59608. /*!******************************************************************************!*\
  59609. !*** ./resources/js/components/AssetInfo.vue?vue&type=template&id=f949323a& ***!
  59610. \******************************************************************************/
  59611. /*! exports provided: render, staticRenderFns */
  59612. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59613. "use strict";
  59614. __webpack_require__.r(__webpack_exports__);
  59615. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_AssetInfo_vue_vue_type_template_id_f949323a___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./AssetInfo.vue?vue&type=template&id=f949323a& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AssetInfo.vue?vue&type=template&id=f949323a&");
  59616. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_AssetInfo_vue_vue_type_template_id_f949323a___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  59617. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_AssetInfo_vue_vue_type_template_id_f949323a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  59618. /***/ }),
  59619. /***/ "./resources/js/components/AssetInfoEditModal.vue":
  59620. /*!********************************************************!*\
  59621. !*** ./resources/js/components/AssetInfoEditModal.vue ***!
  59622. \********************************************************/
  59623. /*! exports provided: default */
  59624. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59625. "use strict";
  59626. __webpack_require__.r(__webpack_exports__);
  59627. /* harmony import */ var _AssetInfoEditModal_vue_vue_type_template_id_24c98bd0___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AssetInfoEditModal.vue?vue&type=template&id=24c98bd0& */ "./resources/js/components/AssetInfoEditModal.vue?vue&type=template&id=24c98bd0&");
  59628. /* harmony import */ var _AssetInfoEditModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AssetInfoEditModal.vue?vue&type=script&lang=js& */ "./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js&");
  59629. /* 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");
  59630. /* normalize component */
  59631. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  59632. _AssetInfoEditModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  59633. _AssetInfoEditModal_vue_vue_type_template_id_24c98bd0___WEBPACK_IMPORTED_MODULE_0__["render"],
  59634. _AssetInfoEditModal_vue_vue_type_template_id_24c98bd0___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  59635. false,
  59636. null,
  59637. null,
  59638. null
  59639. )
  59640. /* hot reload */
  59641. if (false) { var api; }
  59642. component.options.__file = "resources/js/components/AssetInfoEditModal.vue"
  59643. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  59644. /***/ }),
  59645. /***/ "./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js&":
  59646. /*!*********************************************************************************!*\
  59647. !*** ./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js& ***!
  59648. \*********************************************************************************/
  59649. /*! exports provided: default */
  59650. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59651. "use strict";
  59652. __webpack_require__.r(__webpack_exports__);
  59653. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_AssetInfoEditModal_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!./AssetInfoEditModal.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js&");
  59654. /* 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_AssetInfoEditModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  59655. /***/ }),
  59656. /***/ "./resources/js/components/AssetInfoEditModal.vue?vue&type=template&id=24c98bd0&":
  59657. /*!***************************************************************************************!*\
  59658. !*** ./resources/js/components/AssetInfoEditModal.vue?vue&type=template&id=24c98bd0& ***!
  59659. \***************************************************************************************/
  59660. /*! exports provided: render, staticRenderFns */
  59661. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59662. "use strict";
  59663. __webpack_require__.r(__webpack_exports__);
  59664. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_AssetInfoEditModal_vue_vue_type_template_id_24c98bd0___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!./AssetInfoEditModal.vue?vue&type=template&id=24c98bd0& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AssetInfoEditModal.vue?vue&type=template&id=24c98bd0&");
  59665. /* 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_AssetInfoEditModal_vue_vue_type_template_id_24c98bd0___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  59666. /* 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_AssetInfoEditModal_vue_vue_type_template_id_24c98bd0___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  59667. /***/ }),
  59668. /***/ "./resources/js/components/AutocompleteCustomDropdown.vue":
  59669. /*!****************************************************************!*\
  59670. !*** ./resources/js/components/AutocompleteCustomDropdown.vue ***!
  59671. \****************************************************************/
  59672. /*! exports provided: default */
  59673. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59674. "use strict";
  59675. __webpack_require__.r(__webpack_exports__);
  59676. /* 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&");
  59677. /* 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&");
  59678. /* 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");
  59679. /* normalize component */
  59680. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  59681. _AutocompleteCustomDropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  59682. _AutocompleteCustomDropdown_vue_vue_type_template_id_5fcc8b56___WEBPACK_IMPORTED_MODULE_0__["render"],
  59683. _AutocompleteCustomDropdown_vue_vue_type_template_id_5fcc8b56___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  59684. false,
  59685. null,
  59686. null,
  59687. null
  59688. )
  59689. /* hot reload */
  59690. if (false) { var api; }
  59691. component.options.__file = "resources/js/components/AutocompleteCustomDropdown.vue"
  59692. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  59693. /***/ }),
  59694. /***/ "./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js&":
  59695. /*!*****************************************************************************************!*\
  59696. !*** ./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js& ***!
  59697. \*****************************************************************************************/
  59698. /*! exports provided: default */
  59699. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59700. "use strict";
  59701. __webpack_require__.r(__webpack_exports__);
  59702. /* 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&");
  59703. /* 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"]);
  59704. /***/ }),
  59705. /***/ "./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56&":
  59706. /*!***********************************************************************************************!*\
  59707. !*** ./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56& ***!
  59708. \***********************************************************************************************/
  59709. /*! exports provided: render, staticRenderFns */
  59710. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59711. "use strict";
  59712. __webpack_require__.r(__webpack_exports__);
  59713. /* 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&");
  59714. /* 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"]; });
  59715. /* 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"]; });
  59716. /***/ }),
  59717. /***/ "./resources/js/components/CircleSpinner.vue":
  59718. /*!***************************************************!*\
  59719. !*** ./resources/js/components/CircleSpinner.vue ***!
  59720. \***************************************************/
  59721. /*! no static exports found */
  59722. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59723. "use strict";
  59724. __webpack_require__.r(__webpack_exports__);
  59725. /* harmony import */ var _CircleSpinner_vue_vue_type_template_id_9a543b64_scoped_true___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true& */ "./resources/js/components/CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true&");
  59726. /* harmony import */ var _CircleSpinner_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./CircleSpinner.vue?vue&type=script&lang=js& */ "./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js&");
  59727. /* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _CircleSpinner_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__) if(__WEBPACK_IMPORT_KEY__ !== 'default') (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _CircleSpinner_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__[key]; }) }(__WEBPACK_IMPORT_KEY__));
  59728. /* harmony import */ var _CircleSpinner_vue_vue_type_style_index_0_id_9a543b64_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css& */ "./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css&");
  59729. /* 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");
  59730. /* normalize component */
  59731. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__["default"])(
  59732. _CircleSpinner_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  59733. _CircleSpinner_vue_vue_type_template_id_9a543b64_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"],
  59734. _CircleSpinner_vue_vue_type_template_id_9a543b64_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  59735. false,
  59736. null,
  59737. "9a543b64",
  59738. null
  59739. )
  59740. /* hot reload */
  59741. if (false) { var api; }
  59742. component.options.__file = "resources/js/components/CircleSpinner.vue"
  59743. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  59744. /***/ }),
  59745. /***/ "./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js&":
  59746. /*!****************************************************************************!*\
  59747. !*** ./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js& ***!
  59748. \****************************************************************************/
  59749. /*! no static exports found */
  59750. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59751. "use strict";
  59752. __webpack_require__.r(__webpack_exports__);
  59753. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_CircleSpinner_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!./CircleSpinner.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js&");
  59754. /* 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_CircleSpinner_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  59755. /***/ }),
  59756. /***/ "./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css&":
  59757. /*!************************************************************************************************************!*\
  59758. !*** ./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css& ***!
  59759. \************************************************************************************************************/
  59760. /*! no static exports found */
  59761. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59762. "use strict";
  59763. __webpack_require__.r(__webpack_exports__);
  59764. /* 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_CircleSpinner_vue_vue_type_style_index_0_id_9a543b64_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!./CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&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/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css&");
  59765. /* 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_CircleSpinner_vue_vue_type_style_index_0_id_9a543b64_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_CircleSpinner_vue_vue_type_style_index_0_id_9a543b64_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__);
  59766. /* 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_CircleSpinner_vue_vue_type_style_index_0_id_9a543b64_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_CircleSpinner_vue_vue_type_style_index_0_id_9a543b64_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__));
  59767. /* 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_CircleSpinner_vue_vue_type_style_index_0_id_9a543b64_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0___default.a);
  59768. /***/ }),
  59769. /***/ "./resources/js/components/CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true&":
  59770. /*!**********************************************************************************************!*\
  59771. !*** ./resources/js/components/CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true& ***!
  59772. \**********************************************************************************************/
  59773. /*! exports provided: render, staticRenderFns */
  59774. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59775. "use strict";
  59776. __webpack_require__.r(__webpack_exports__);
  59777. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_CircleSpinner_vue_vue_type_template_id_9a543b64_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!./CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true&");
  59778. /* 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_CircleSpinner_vue_vue_type_template_id_9a543b64_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  59779. /* 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_CircleSpinner_vue_vue_type_template_id_9a543b64_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  59780. /***/ }),
  59781. /***/ "./resources/js/components/Credential.vue":
  59782. /*!************************************************!*\
  59783. !*** ./resources/js/components/Credential.vue ***!
  59784. \************************************************/
  59785. /*! exports provided: default */
  59786. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59787. "use strict";
  59788. __webpack_require__.r(__webpack_exports__);
  59789. /* harmony import */ var _Credential_vue_vue_type_template_id_58b8dcfc___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Credential.vue?vue&type=template&id=58b8dcfc& */ "./resources/js/components/Credential.vue?vue&type=template&id=58b8dcfc&");
  59790. /* harmony import */ var _Credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Credential.vue?vue&type=script&lang=js& */ "./resources/js/components/Credential.vue?vue&type=script&lang=js&");
  59791. /* 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");
  59792. /* normalize component */
  59793. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  59794. _Credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  59795. _Credential_vue_vue_type_template_id_58b8dcfc___WEBPACK_IMPORTED_MODULE_0__["render"],
  59796. _Credential_vue_vue_type_template_id_58b8dcfc___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  59797. false,
  59798. null,
  59799. null,
  59800. null
  59801. )
  59802. /* hot reload */
  59803. if (false) { var api; }
  59804. component.options.__file = "resources/js/components/Credential.vue"
  59805. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  59806. /***/ }),
  59807. /***/ "./resources/js/components/Credential.vue?vue&type=script&lang=js&":
  59808. /*!*************************************************************************!*\
  59809. !*** ./resources/js/components/Credential.vue?vue&type=script&lang=js& ***!
  59810. \*************************************************************************/
  59811. /*! exports provided: default */
  59812. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59813. "use strict";
  59814. __webpack_require__.r(__webpack_exports__);
  59815. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./Credential.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/Credential.vue?vue&type=script&lang=js&");
  59816. /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  59817. /***/ }),
  59818. /***/ "./resources/js/components/Credential.vue?vue&type=template&id=58b8dcfc&":
  59819. /*!*******************************************************************************!*\
  59820. !*** ./resources/js/components/Credential.vue?vue&type=template&id=58b8dcfc& ***!
  59821. \*******************************************************************************/
  59822. /*! exports provided: render, staticRenderFns */
  59823. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59824. "use strict";
  59825. __webpack_require__.r(__webpack_exports__);
  59826. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_Credential_vue_vue_type_template_id_58b8dcfc___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./Credential.vue?vue&type=template&id=58b8dcfc& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/Credential.vue?vue&type=template&id=58b8dcfc&");
  59827. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_Credential_vue_vue_type_template_id_58b8dcfc___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  59828. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_Credential_vue_vue_type_template_id_58b8dcfc___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  59829. /***/ }),
  59830. /***/ "./resources/js/components/CredentialFormModal.vue":
  59831. /*!*********************************************************!*\
  59832. !*** ./resources/js/components/CredentialFormModal.vue ***!
  59833. \*********************************************************/
  59834. /*! exports provided: default */
  59835. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59836. "use strict";
  59837. __webpack_require__.r(__webpack_exports__);
  59838. /* harmony import */ var _CredentialFormModal_vue_vue_type_template_id_3cdb3697___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./CredentialFormModal.vue?vue&type=template&id=3cdb3697& */ "./resources/js/components/CredentialFormModal.vue?vue&type=template&id=3cdb3697&");
  59839. /* harmony import */ var _CredentialFormModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./CredentialFormModal.vue?vue&type=script&lang=js& */ "./resources/js/components/CredentialFormModal.vue?vue&type=script&lang=js&");
  59840. /* 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");
  59841. /* normalize component */
  59842. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  59843. _CredentialFormModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  59844. _CredentialFormModal_vue_vue_type_template_id_3cdb3697___WEBPACK_IMPORTED_MODULE_0__["render"],
  59845. _CredentialFormModal_vue_vue_type_template_id_3cdb3697___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  59846. false,
  59847. null,
  59848. null,
  59849. null
  59850. )
  59851. /* hot reload */
  59852. if (false) { var api; }
  59853. component.options.__file = "resources/js/components/CredentialFormModal.vue"
  59854. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  59855. /***/ }),
  59856. /***/ "./resources/js/components/CredentialFormModal.vue?vue&type=script&lang=js&":
  59857. /*!**********************************************************************************!*\
  59858. !*** ./resources/js/components/CredentialFormModal.vue?vue&type=script&lang=js& ***!
  59859. \**********************************************************************************/
  59860. /*! exports provided: default */
  59861. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59862. "use strict";
  59863. __webpack_require__.r(__webpack_exports__);
  59864. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_CredentialFormModal_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!./CredentialFormModal.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CredentialFormModal.vue?vue&type=script&lang=js&");
  59865. /* 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_CredentialFormModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  59866. /***/ }),
  59867. /***/ "./resources/js/components/CredentialFormModal.vue?vue&type=template&id=3cdb3697&":
  59868. /*!****************************************************************************************!*\
  59869. !*** ./resources/js/components/CredentialFormModal.vue?vue&type=template&id=3cdb3697& ***!
  59870. \****************************************************************************************/
  59871. /*! exports provided: render, staticRenderFns */
  59872. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59873. "use strict";
  59874. __webpack_require__.r(__webpack_exports__);
  59875. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_CredentialFormModal_vue_vue_type_template_id_3cdb3697___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!./CredentialFormModal.vue?vue&type=template&id=3cdb3697& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CredentialFormModal.vue?vue&type=template&id=3cdb3697&");
  59876. /* 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_CredentialFormModal_vue_vue_type_template_id_3cdb3697___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  59877. /* 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_CredentialFormModal_vue_vue_type_template_id_3cdb3697___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  59878. /***/ }),
  59879. /***/ "./resources/js/components/CredentialList.vue":
  59880. /*!****************************************************!*\
  59881. !*** ./resources/js/components/CredentialList.vue ***!
  59882. \****************************************************/
  59883. /*! exports provided: default */
  59884. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59885. "use strict";
  59886. __webpack_require__.r(__webpack_exports__);
  59887. /* harmony import */ var _CredentialList_vue_vue_type_template_id_7264bb80___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./CredentialList.vue?vue&type=template&id=7264bb80& */ "./resources/js/components/CredentialList.vue?vue&type=template&id=7264bb80&");
  59888. /* harmony import */ var _CredentialList_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./CredentialList.vue?vue&type=script&lang=js& */ "./resources/js/components/CredentialList.vue?vue&type=script&lang=js&");
  59889. /* 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");
  59890. /* normalize component */
  59891. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  59892. _CredentialList_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  59893. _CredentialList_vue_vue_type_template_id_7264bb80___WEBPACK_IMPORTED_MODULE_0__["render"],
  59894. _CredentialList_vue_vue_type_template_id_7264bb80___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  59895. false,
  59896. null,
  59897. null,
  59898. null
  59899. )
  59900. /* hot reload */
  59901. if (false) { var api; }
  59902. component.options.__file = "resources/js/components/CredentialList.vue"
  59903. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  59904. /***/ }),
  59905. /***/ "./resources/js/components/CredentialList.vue?vue&type=script&lang=js&":
  59906. /*!*****************************************************************************!*\
  59907. !*** ./resources/js/components/CredentialList.vue?vue&type=script&lang=js& ***!
  59908. \*****************************************************************************/
  59909. /*! exports provided: default */
  59910. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59911. "use strict";
  59912. __webpack_require__.r(__webpack_exports__);
  59913. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_CredentialList_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!./CredentialList.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CredentialList.vue?vue&type=script&lang=js&");
  59914. /* 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_CredentialList_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  59915. /***/ }),
  59916. /***/ "./resources/js/components/CredentialList.vue?vue&type=template&id=7264bb80&":
  59917. /*!***********************************************************************************!*\
  59918. !*** ./resources/js/components/CredentialList.vue?vue&type=template&id=7264bb80& ***!
  59919. \***********************************************************************************/
  59920. /*! exports provided: render, staticRenderFns */
  59921. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59922. "use strict";
  59923. __webpack_require__.r(__webpack_exports__);
  59924. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_CredentialList_vue_vue_type_template_id_7264bb80___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!./CredentialList.vue?vue&type=template&id=7264bb80& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CredentialList.vue?vue&type=template&id=7264bb80&");
  59925. /* 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_CredentialList_vue_vue_type_template_id_7264bb80___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  59926. /* 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_CredentialList_vue_vue_type_template_id_7264bb80___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  59927. /***/ }),
  59928. /***/ "./resources/js/components/Modal.vue":
  59929. /*!*******************************************!*\
  59930. !*** ./resources/js/components/Modal.vue ***!
  59931. \*******************************************/
  59932. /*! exports provided: default */
  59933. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59934. "use strict";
  59935. __webpack_require__.r(__webpack_exports__);
  59936. /* 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&");
  59937. /* 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");
  59938. var script = {}
  59939. /* normalize component */
  59940. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(
  59941. script,
  59942. _Modal_vue_vue_type_template_id_53ab54d2___WEBPACK_IMPORTED_MODULE_0__["render"],
  59943. _Modal_vue_vue_type_template_id_53ab54d2___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  59944. false,
  59945. null,
  59946. null,
  59947. null
  59948. )
  59949. /* hot reload */
  59950. if (false) { var api; }
  59951. component.options.__file = "resources/js/components/Modal.vue"
  59952. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  59953. /***/ }),
  59954. /***/ "./resources/js/components/Modal.vue?vue&type=template&id=53ab54d2&":
  59955. /*!**************************************************************************!*\
  59956. !*** ./resources/js/components/Modal.vue?vue&type=template&id=53ab54d2& ***!
  59957. \**************************************************************************/
  59958. /*! exports provided: render, staticRenderFns */
  59959. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59960. "use strict";
  59961. __webpack_require__.r(__webpack_exports__);
  59962. /* 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&");
  59963. /* 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"]; });
  59964. /* 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"]; });
  59965. /***/ }),
  59966. /***/ "./resources/js/components/WoInfoEditModal.vue":
  59967. /*!*****************************************************!*\
  59968. !*** ./resources/js/components/WoInfoEditModal.vue ***!
  59969. \*****************************************************/
  59970. /*! exports provided: default */
  59971. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59972. "use strict";
  59973. __webpack_require__.r(__webpack_exports__);
  59974. /* 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&");
  59975. /* 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&");
  59976. /* 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");
  59977. /* normalize component */
  59978. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  59979. _WoInfoEditModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  59980. _WoInfoEditModal_vue_vue_type_template_id_352dd7a2___WEBPACK_IMPORTED_MODULE_0__["render"],
  59981. _WoInfoEditModal_vue_vue_type_template_id_352dd7a2___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  59982. false,
  59983. null,
  59984. null,
  59985. null
  59986. )
  59987. /* hot reload */
  59988. if (false) { var api; }
  59989. component.options.__file = "resources/js/components/WoInfoEditModal.vue"
  59990. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  59991. /***/ }),
  59992. /***/ "./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js&":
  59993. /*!******************************************************************************!*\
  59994. !*** ./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js& ***!
  59995. \******************************************************************************/
  59996. /*! exports provided: default */
  59997. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59998. "use strict";
  59999. __webpack_require__.r(__webpack_exports__);
  60000. /* 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&");
  60001. /* 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"]);
  60002. /***/ }),
  60003. /***/ "./resources/js/components/WoInfoEditModal.vue?vue&type=template&id=352dd7a2&":
  60004. /*!************************************************************************************!*\
  60005. !*** ./resources/js/components/WoInfoEditModal.vue?vue&type=template&id=352dd7a2& ***!
  60006. \************************************************************************************/
  60007. /*! exports provided: render, staticRenderFns */
  60008. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60009. "use strict";
  60010. __webpack_require__.r(__webpack_exports__);
  60011. /* 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&");
  60012. /* 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"]; });
  60013. /* 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"]; });
  60014. /***/ }),
  60015. /***/ "./resources/js/components/WorkOrderInfo.vue":
  60016. /*!***************************************************!*\
  60017. !*** ./resources/js/components/WorkOrderInfo.vue ***!
  60018. \***************************************************/
  60019. /*! exports provided: default */
  60020. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60021. "use strict";
  60022. __webpack_require__.r(__webpack_exports__);
  60023. /* 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&");
  60024. /* 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&");
  60025. /* 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");
  60026. /* normalize component */
  60027. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60028. _WorkOrderInfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60029. _WorkOrderInfo_vue_vue_type_template_id_50116330___WEBPACK_IMPORTED_MODULE_0__["render"],
  60030. _WorkOrderInfo_vue_vue_type_template_id_50116330___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60031. false,
  60032. null,
  60033. null,
  60034. null
  60035. )
  60036. /* hot reload */
  60037. if (false) { var api; }
  60038. component.options.__file = "resources/js/components/WorkOrderInfo.vue"
  60039. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60040. /***/ }),
  60041. /***/ "./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js&":
  60042. /*!****************************************************************************!*\
  60043. !*** ./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js& ***!
  60044. \****************************************************************************/
  60045. /*! exports provided: default */
  60046. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60047. "use strict";
  60048. __webpack_require__.r(__webpack_exports__);
  60049. /* 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&");
  60050. /* 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"]);
  60051. /***/ }),
  60052. /***/ "./resources/js/components/WorkOrderInfo.vue?vue&type=template&id=50116330&":
  60053. /*!**********************************************************************************!*\
  60054. !*** ./resources/js/components/WorkOrderInfo.vue?vue&type=template&id=50116330& ***!
  60055. \**********************************************************************************/
  60056. /*! exports provided: render, staticRenderFns */
  60057. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60058. "use strict";
  60059. __webpack_require__.r(__webpack_exports__);
  60060. /* 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&");
  60061. /* 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"]; });
  60062. /* 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"]; });
  60063. /***/ }),
  60064. /***/ "./resources/js/mixins/dateMixin.js":
  60065. /*!******************************************!*\
  60066. !*** ./resources/js/mixins/dateMixin.js ***!
  60067. \******************************************/
  60068. /*! exports provided: default */
  60069. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60070. "use strict";
  60071. __webpack_require__.r(__webpack_exports__);
  60072. /* harmony default export */ __webpack_exports__["default"] = ({
  60073. methods: {
  60074. treatAsUTC: function treatAsUTC(date) {
  60075. var result = new Date(date);
  60076. result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
  60077. return result;
  60078. },
  60079. daysSinceToday: function daysSinceToday(date) {
  60080. var currentDate = new Date();
  60081. var millisecondsPerDay = 24 * 60 * 60 * 1000;
  60082. return (this.treatAsUTC(currentDate) - this.treatAsUTC(date)) / millisecondsPerDay;
  60083. },
  60084. getHRDate: function getHRDate(dateString) {
  60085. var date = new Date(dateString);
  60086. return date.toLocaleString('default', {
  60087. month: 'short',
  60088. day: 'numeric',
  60089. year: 'numeric',
  60090. hour: 'numeric',
  60091. minute: 'numeric'
  60092. });
  60093. },
  60094. isZero: function isZero(dateString) {
  60095. return dateString === '0000-00-00 00:00:00';
  60096. }
  60097. }
  60098. });
  60099. /***/ }),
  60100. /***/ "./resources/js/notify.min.js":
  60101. /*!************************************!*\
  60102. !*** ./resources/js/notify.min.js ***!
  60103. \************************************/
  60104. /*! no static exports found */
  60105. /***/ (function(module, exports, __webpack_require__) {
  60106. 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); }
  60107. (function (e) {
  60108. true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (e),
  60109. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  60110. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  60111. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
  60112. })(function (e) {
  60113. function A(t, n, i) {
  60114. typeof i == "string" && (i = {
  60115. className: i
  60116. }), 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);
  60117. }
  60118. var t = [].indexOf || function (e) {
  60119. for (var t = 0, n = this.length; t < n; t++) {
  60120. if (t in this && this[t] === e) return t;
  60121. }
  60122. return -1;
  60123. },
  60124. n = "notify",
  60125. r = n + "js",
  60126. i = n + "!blank",
  60127. s = {
  60128. t: "top",
  60129. m: "middle",
  60130. b: "bottom",
  60131. l: "left",
  60132. c: "center",
  60133. r: "right"
  60134. },
  60135. o = ["l", "c", "r"],
  60136. u = ["t", "m", "b"],
  60137. a = ["t", "b", "l", "r"],
  60138. f = {
  60139. t: "b",
  60140. m: null,
  60141. b: "t",
  60142. l: "r",
  60143. c: null,
  60144. r: "l"
  60145. },
  60146. l = function l(t) {
  60147. var n;
  60148. return n = [], e.each(t.split(/\W+/), function (e, t) {
  60149. var r;
  60150. r = t.toLowerCase().charAt(0);
  60151. if (s[r]) return n.push(r);
  60152. }), n;
  60153. },
  60154. c = {},
  60155. h = {
  60156. name: "core",
  60157. html: '<div class="' + r + '-wrapper">\n <div class="' + r + '-arrow"></div>\n <div class="' + r + '-container"></div>\n</div>',
  60158. 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}"
  60159. },
  60160. p = {
  60161. "border-radius": ["-webkit-", "-moz-"]
  60162. },
  60163. d = function d(e) {
  60164. return c[e];
  60165. },
  60166. v = function v(e) {
  60167. if (!e) throw "Missing Style name";
  60168. c[e] && delete c[e];
  60169. },
  60170. m = function m(t, i) {
  60171. if (!t) throw "Missing Style name";
  60172. if (!i) throw "Missing Style definition";
  60173. if (!i.html) throw "Missing Style HTML";
  60174. var s = c[t];
  60175. s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
  60176. var o = "";
  60177. i.classes && e.each(i.classes, function (t, n) {
  60178. return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
  60179. return p[t] && e.each(p[t], function (e, r) {
  60180. return o += " " + r + t + ": " + n + ";\n";
  60181. }), o += " " + t + ": " + n + ";\n";
  60182. }), o += "}\n";
  60183. }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
  60184. var u = {},
  60185. a = e(i.html);
  60186. y("html", a, u), y("text", a, u), i.fields = u;
  60187. },
  60188. g = function g(t) {
  60189. var n, r, i;
  60190. r = x("style"), r.attr("type", "text/css"), e("head").append(r);
  60191. try {
  60192. r.html(t);
  60193. } catch (s) {
  60194. r[0].styleSheet.cssText = t;
  60195. }
  60196. return r;
  60197. },
  60198. y = function y(t, n, r) {
  60199. var s;
  60200. return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
  60201. var n;
  60202. n = e(this).attr(s), n || (n = i), r[n] = t;
  60203. });
  60204. },
  60205. b = function b(e, t) {
  60206. return e.is(t) ? e : e.find(t);
  60207. },
  60208. w = {
  60209. clickToHide: !0,
  60210. autoHide: !0,
  60211. autoHideDelay: 5e3,
  60212. arrowShow: !0,
  60213. arrowSize: 5,
  60214. breakNewLines: !0,
  60215. elementPosition: "bottom",
  60216. globalPosition: "top right",
  60217. style: "bootstrap",
  60218. className: "error",
  60219. showAnimation: "slideDown",
  60220. showDuration: 400,
  60221. hideAnimation: "slideUp",
  60222. hideDuration: 200,
  60223. gap: 5
  60224. },
  60225. E = function E(t, n) {
  60226. var r;
  60227. return r = function r() {}, r.prototype = t, e.extend(!0, new r(), n);
  60228. },
  60229. S = function S(t) {
  60230. return e.extend(w, t);
  60231. },
  60232. x = function x(t) {
  60233. return e("<" + t + "></" + t + ">");
  60234. },
  60235. T = {},
  60236. N = function N(t) {
  60237. var n;
  60238. return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
  60239. return e(r).attr("name") === t.attr("name");
  60240. }), t = n.first()), t;
  60241. },
  60242. C = function C(e, t, n) {
  60243. var r, i;
  60244. if (typeof n == "string") n = parseInt(n, 10);else if (typeof n != "number") return;
  60245. if (isNaN(n)) return;
  60246. 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;
  60247. },
  60248. k = function k(e, t, n) {
  60249. if (e === "l" || e === "t") return 0;
  60250. if (e === "c" || e === "m") return n / 2 - t / 2;
  60251. if (e === "r" || e === "b") return n - t;
  60252. throw "Invalid alignment";
  60253. },
  60254. L = function L(e) {
  60255. return L.e = L.e || x("div"), L.e.text(e).html();
  60256. };
  60257. A.prototype.loadHTML = function () {
  60258. var t;
  60259. t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields;
  60260. }, A.prototype.show = function (e, t) {
  60261. var n, r, i, s, o;
  60262. r = function (n) {
  60263. return function () {
  60264. !e && !n.elem && n.destroy();
  60265. if (t) return t();
  60266. };
  60267. }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
  60268. 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 {
  60269. if (!!o || !!e) return r();
  60270. s = this.options.hideAnimation, n.push(this.options.hideDuration);
  60271. }
  60272. return n.push(r), i[s].apply(i, n);
  60273. }, A.prototype.setGlobalPosition = function () {
  60274. var t = this.getPosition(),
  60275. n = t[0],
  60276. i = t[1],
  60277. o = s[n],
  60278. u = s[i],
  60279. a = n + "|" + i,
  60280. f = T[a];
  60281. if (!f || !document.body.contains(f[0])) {
  60282. f = T[a] = x("div");
  60283. var l = {};
  60284. 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);
  60285. }
  60286. return f.prepend(this.wrapper);
  60287. }, A.prototype.setElementPosition = function () {
  60288. 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;
  60289. 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"];
  60290. for (w = 0, S = B.length; w < S; w++) {
  60291. D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
  60292. }
  60293. b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
  60294. if (!this.options.arrowShow) this.arrow.hide();else {
  60295. 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";
  60296. for (E = 0, x = a.length; E < x; E++) {
  60297. D = a[E], P = s[D];
  60298. if (D === L) continue;
  60299. l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l;
  60300. }
  60301. C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2);
  60302. }
  60303. 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);
  60304. if (r) return this.arrow.removeAttr("style").css(r);
  60305. }, A.prototype.getPosition = function () {
  60306. var e, n, r, i, s, f, c, h;
  60307. h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
  60308. if (n = e[0], t.call(a, n) < 0) throw "Must be one of [" + a + "]";
  60309. 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";
  60310. return e.length === 2 && (e[2] = e[1]), e;
  60311. }, A.prototype.getStyle = function (e) {
  60312. var t;
  60313. e || (e = this.options.style), e || (e = "default"), t = c[e];
  60314. if (!t) throw "Missing style: " + e;
  60315. return t;
  60316. }, A.prototype.updateClasses = function () {
  60317. var t, n;
  60318. 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) {
  60319. return r + "-" + n.name + "-" + e;
  60320. }).join(" "), this.userContainer.attr("class", t);
  60321. }, A.prototype.run = function (t, n) {
  60322. var r, s, o, u, a;
  60323. e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
  60324. if (this.container && !t) {
  60325. this.show(!1);
  60326. return;
  60327. }
  60328. if (!this.container && !t) return;
  60329. s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
  60330. for (o in s) {
  60331. r = s[o], u = this.userFields[o];
  60332. if (!u) continue;
  60333. 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);
  60334. }
  60335. 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));
  60336. }, A.prototype.destroy = function () {
  60337. this.wrapper.data(r, null), this.wrapper.remove();
  60338. }, e[n] = function (t, r, i) {
  60339. return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t;
  60340. }, e.fn[n] = function (t, n) {
  60341. return e(this).each(function () {
  60342. var i = N(e(this)).data(r);
  60343. i && i.destroy();
  60344. var s = new A(e(this), t, n);
  60345. }), this;
  60346. }, e.extend(e[n], {
  60347. defaults: S,
  60348. addStyle: m,
  60349. removeStyle: v,
  60350. pluginOptions: w,
  60351. getStyle: d,
  60352. insertCSS: g
  60353. }), m("bootstrap", {
  60354. html: "<div>\n<span data-notify-text></span>\n</div>",
  60355. classes: {
  60356. base: {
  60357. "font-weight": "bold",
  60358. padding: "8px 15px 8px 14px",
  60359. "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
  60360. "background-color": "#fcf8e3",
  60361. border: "1px solid #fbeed5",
  60362. "border-radius": "4px",
  60363. "white-space": "nowrap",
  60364. "padding-left": "25px",
  60365. "background-repeat": "no-repeat",
  60366. "background-position": "3px 7px"
  60367. },
  60368. error: {
  60369. color: "#B94A48",
  60370. "background-color": "#F2DEDE",
  60371. "border-color": "#EED3D7",
  60372. "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=)"
  60373. },
  60374. success: {
  60375. color: "#468847",
  60376. "background-color": "#DFF0D8",
  60377. "border-color": "#D6E9C6",
  60378. "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==)"
  60379. },
  60380. info: {
  60381. color: "#3A87AD",
  60382. "background-color": "#D9EDF7",
  60383. "border-color": "#BCE8F1",
  60384. "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=)"
  60385. },
  60386. warn: {
  60387. color: "#C09853",
  60388. "background-color": "#FCF8E3",
  60389. "border-color": "#FBEED5",
  60390. "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)"
  60391. }
  60392. }
  60393. }), e(function () {
  60394. g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
  60395. e(this).trigger("notify-hide");
  60396. }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
  60397. var n = e(this).data(r);
  60398. n && n.show(!1);
  60399. });
  60400. });
  60401. });
  60402. /***/ }),
  60403. /***/ "./resources/js/views/App.vue":
  60404. /*!************************************!*\
  60405. !*** ./resources/js/views/App.vue ***!
  60406. \************************************/
  60407. /*! exports provided: default */
  60408. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60409. "use strict";
  60410. __webpack_require__.r(__webpack_exports__);
  60411. /* 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&");
  60412. /* 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&");
  60413. /* 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");
  60414. /* normalize component */
  60415. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60416. _App_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60417. _App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__["render"],
  60418. _App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60419. false,
  60420. null,
  60421. null,
  60422. null
  60423. )
  60424. /* hot reload */
  60425. if (false) { var api; }
  60426. component.options.__file = "resources/js/views/App.vue"
  60427. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60428. /***/ }),
  60429. /***/ "./resources/js/views/App.vue?vue&type=script&lang=js&":
  60430. /*!*************************************************************!*\
  60431. !*** ./resources/js/views/App.vue?vue&type=script&lang=js& ***!
  60432. \*************************************************************/
  60433. /*! exports provided: default */
  60434. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60435. "use strict";
  60436. __webpack_require__.r(__webpack_exports__);
  60437. /* 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&");
  60438. /* 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"]);
  60439. /***/ }),
  60440. /***/ "./resources/js/views/App.vue?vue&type=template&id=91ac6b5c&":
  60441. /*!*******************************************************************!*\
  60442. !*** ./resources/js/views/App.vue?vue&type=template&id=91ac6b5c& ***!
  60443. \*******************************************************************/
  60444. /*! exports provided: render, staticRenderFns */
  60445. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60446. "use strict";
  60447. __webpack_require__.r(__webpack_exports__);
  60448. /* 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&");
  60449. /* 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"]; });
  60450. /* 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"]; });
  60451. /***/ }),
  60452. /***/ "./resources/js/views/Dashboard.vue":
  60453. /*!******************************************!*\
  60454. !*** ./resources/js/views/Dashboard.vue ***!
  60455. \******************************************/
  60456. /*! exports provided: default */
  60457. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60458. "use strict";
  60459. __webpack_require__.r(__webpack_exports__);
  60460. /* 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&");
  60461. /* 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&");
  60462. /* 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");
  60463. /* normalize component */
  60464. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60465. _Dashboard_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60466. _Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__["render"],
  60467. _Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60468. false,
  60469. null,
  60470. null,
  60471. null
  60472. )
  60473. /* hot reload */
  60474. if (false) { var api; }
  60475. component.options.__file = "resources/js/views/Dashboard.vue"
  60476. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60477. /***/ }),
  60478. /***/ "./resources/js/views/Dashboard.vue?vue&type=script&lang=js&":
  60479. /*!*******************************************************************!*\
  60480. !*** ./resources/js/views/Dashboard.vue?vue&type=script&lang=js& ***!
  60481. \*******************************************************************/
  60482. /*! exports provided: default */
  60483. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60484. "use strict";
  60485. __webpack_require__.r(__webpack_exports__);
  60486. /* 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&");
  60487. /* 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"]);
  60488. /***/ }),
  60489. /***/ "./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6&":
  60490. /*!*************************************************************************!*\
  60491. !*** ./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6& ***!
  60492. \*************************************************************************/
  60493. /*! exports provided: render, staticRenderFns */
  60494. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60495. "use strict";
  60496. __webpack_require__.r(__webpack_exports__);
  60497. /* 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&");
  60498. /* 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"]; });
  60499. /* 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"]; });
  60500. /***/ }),
  60501. /***/ "./resources/js/views/Login.vue":
  60502. /*!**************************************!*\
  60503. !*** ./resources/js/views/Login.vue ***!
  60504. \**************************************/
  60505. /*! exports provided: default */
  60506. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60507. "use strict";
  60508. __webpack_require__.r(__webpack_exports__);
  60509. /* 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&");
  60510. /* 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&");
  60511. /* 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");
  60512. /* normalize component */
  60513. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60514. _Login_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60515. _Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__["render"],
  60516. _Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60517. false,
  60518. null,
  60519. null,
  60520. null
  60521. )
  60522. /* hot reload */
  60523. if (false) { var api; }
  60524. component.options.__file = "resources/js/views/Login.vue"
  60525. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60526. /***/ }),
  60527. /***/ "./resources/js/views/Login.vue?vue&type=script&lang=js&":
  60528. /*!***************************************************************!*\
  60529. !*** ./resources/js/views/Login.vue?vue&type=script&lang=js& ***!
  60530. \***************************************************************/
  60531. /*! exports provided: default */
  60532. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60533. "use strict";
  60534. __webpack_require__.r(__webpack_exports__);
  60535. /* 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&");
  60536. /* 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"]);
  60537. /***/ }),
  60538. /***/ "./resources/js/views/Login.vue?vue&type=template&id=12f5395a&":
  60539. /*!*********************************************************************!*\
  60540. !*** ./resources/js/views/Login.vue?vue&type=template&id=12f5395a& ***!
  60541. \*********************************************************************/
  60542. /*! exports provided: render, staticRenderFns */
  60543. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60544. "use strict";
  60545. __webpack_require__.r(__webpack_exports__);
  60546. /* 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&");
  60547. /* 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"]; });
  60548. /* 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"]; });
  60549. /***/ }),
  60550. /***/ "./resources/js/views/Welcome.vue":
  60551. /*!****************************************!*\
  60552. !*** ./resources/js/views/Welcome.vue ***!
  60553. \****************************************/
  60554. /*! exports provided: default */
  60555. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60556. "use strict";
  60557. __webpack_require__.r(__webpack_exports__);
  60558. /* 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&");
  60559. /* 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&");
  60560. /* 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&");
  60561. /* 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");
  60562. /* normalize component */
  60563. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__["default"])(
  60564. _Welcome_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60565. _Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"],
  60566. _Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60567. false,
  60568. null,
  60569. "1ae8ae93",
  60570. null
  60571. )
  60572. /* hot reload */
  60573. if (false) { var api; }
  60574. component.options.__file = "resources/js/views/Welcome.vue"
  60575. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60576. /***/ }),
  60577. /***/ "./resources/js/views/Welcome.vue?vue&type=script&lang=js&":
  60578. /*!*****************************************************************!*\
  60579. !*** ./resources/js/views/Welcome.vue?vue&type=script&lang=js& ***!
  60580. \*****************************************************************/
  60581. /*! exports provided: default */
  60582. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60583. "use strict";
  60584. __webpack_require__.r(__webpack_exports__);
  60585. /* 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&");
  60586. /* 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"]);
  60587. /***/ }),
  60588. /***/ "./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css&":
  60589. /*!*************************************************************************************************!*\
  60590. !*** ./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css& ***!
  60591. \*************************************************************************************************/
  60592. /*! no static exports found */
  60593. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60594. "use strict";
  60595. __webpack_require__.r(__webpack_exports__);
  60596. /* 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&");
  60597. /* 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__);
  60598. /* 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__));
  60599. /* 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);
  60600. /***/ }),
  60601. /***/ "./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true&":
  60602. /*!***********************************************************************************!*\
  60603. !*** ./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true& ***!
  60604. \***********************************************************************************/
  60605. /*! exports provided: render, staticRenderFns */
  60606. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60607. "use strict";
  60608. __webpack_require__.r(__webpack_exports__);
  60609. /* 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&");
  60610. /* 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"]; });
  60611. /* 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"]; });
  60612. /***/ }),
  60613. /***/ "./resources/js/views/WorkOrder.vue":
  60614. /*!******************************************!*\
  60615. !*** ./resources/js/views/WorkOrder.vue ***!
  60616. \******************************************/
  60617. /*! exports provided: default */
  60618. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60619. "use strict";
  60620. __webpack_require__.r(__webpack_exports__);
  60621. /* 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&");
  60622. /* 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&");
  60623. /* 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");
  60624. /* normalize component */
  60625. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60626. _WorkOrder_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60627. _WorkOrder_vue_vue_type_template_id_17837e2e___WEBPACK_IMPORTED_MODULE_0__["render"],
  60628. _WorkOrder_vue_vue_type_template_id_17837e2e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60629. false,
  60630. null,
  60631. null,
  60632. null
  60633. )
  60634. /* hot reload */
  60635. if (false) { var api; }
  60636. component.options.__file = "resources/js/views/WorkOrder.vue"
  60637. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60638. /***/ }),
  60639. /***/ "./resources/js/views/WorkOrder.vue?vue&type=script&lang=js&":
  60640. /*!*******************************************************************!*\
  60641. !*** ./resources/js/views/WorkOrder.vue?vue&type=script&lang=js& ***!
  60642. \*******************************************************************/
  60643. /*! exports provided: default */
  60644. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60645. "use strict";
  60646. __webpack_require__.r(__webpack_exports__);
  60647. /* 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&");
  60648. /* 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"]);
  60649. /***/ }),
  60650. /***/ "./resources/js/views/WorkOrder.vue?vue&type=template&id=17837e2e&":
  60651. /*!*************************************************************************!*\
  60652. !*** ./resources/js/views/WorkOrder.vue?vue&type=template&id=17837e2e& ***!
  60653. \*************************************************************************/
  60654. /*! exports provided: render, staticRenderFns */
  60655. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60656. "use strict";
  60657. __webpack_require__.r(__webpack_exports__);
  60658. /* 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&");
  60659. /* 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"]; });
  60660. /* 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"]; });
  60661. /***/ }),
  60662. /***/ "./resources/sass/app.scss":
  60663. /*!*********************************!*\
  60664. !*** ./resources/sass/app.scss ***!
  60665. \*********************************/
  60666. /*! no static exports found */
  60667. /***/ (function(module, exports) {
  60668. // removed by extract-text-webpack-plugin
  60669. /***/ }),
  60670. /***/ 0:
  60671. /*!*************************************************************!*\
  60672. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  60673. \*************************************************************/
  60674. /*! no static exports found */
  60675. /***/ (function(module, exports, __webpack_require__) {
  60676. __webpack_require__(/*! /home/vagrant/upccrt/resources/js/app.js */"./resources/js/app.js");
  60677. module.exports = __webpack_require__(/*! /home/vagrant/upccrt/resources/sass/app.scss */"./resources/sass/app.scss");
  60678. /***/ })
  60679. /******/ });