app.js 2.0 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054640556405664057640586405964060640616406264063640646406564066640676406864069640706407164072640736407464075640766407764078640796408064081640826408364084640856408664087640886408964090640916409264093640946409564096640976409864099641006410164102641036410464105641066410764108641096411064111641126411364114641156411664117641186411964120641216412264123641246412564126641276412864129641306413164132641336413464135641366413764138641396414064141641426414364144641456414664147641486414964150641516415264153641546415564156641576415864159641606416164162641636416464165641666416764168641696417064171641726417364174641756417664177641786417964180641816418264183641846418564186641876418864189641906419164192641936419464195641966419764198641996420064201642026420364204642056420664207642086420964210642116421264213642146421564216642176421864219642206422164222642236422464225642266422764228642296423064231642326423364234642356423664237642386423964240642416424264243642446424564246642476424864249642506425164252642536425464255642566425764258642596426064261642626426364264642656426664267642686426964270642716427264273642746427564276642776427864279642806428164282642836428464285642866428764288642896429064291642926429364294642956429664297642986429964300643016430264303643046430564306643076430864309643106431164312643136431464315643166431764318643196432064321643226432364324643256432664327643286432964330643316433264333643346433564336643376433864339643406434164342643436434464345643466434764348643496435064351643526435364354643556435664357643586435964360643616436264363643646436564366643676436864369643706437164372643736437464375643766437764378643796438064381643826438364384643856438664387643886438964390643916439264393643946439564396643976439864399644006440164402644036440464405644066440764408644096441064411644126441364414644156441664417644186441964420644216442264423644246442564426644276442864429644306443164432644336443464435644366443764438644396444064441644426444364444644456444664447644486444964450644516445264453644546445564456644576445864459644606446164462644636446464465644666446764468644696447064471644726447364474644756447664477644786447964480644816448264483644846448564486644876448864489644906449164492644936449464495644966449764498644996450064501645026450364504645056450664507645086450964510645116451264513645146451564516645176451864519645206452164522645236452464525645266452764528645296453064531645326453364534645356453664537645386453964540645416454264543645446454564546645476454864549645506455164552645536455464555645566455764558645596456064561645626456364564645656456664567645686456964570645716457264573645746457564576645776457864579645806458164582645836458464585645866458764588645896459064591645926459364594645956459664597645986459964600646016460264603646046460564606646076460864609646106461164612646136461464615646166461764618646196462064621646226462364624646256462664627646286462964630646316463264633646346463564636646376463864639646406464164642646436464464645646466464764648646496465064651646526465364654646556465664657646586465964660646616466264663646646466564666646676466864669646706467164672646736467464675646766467764678646796468064681646826468364684646856468664687646886468964690646916469264693646946469564696646976469864699647006470164702647036470464705647066470764708647096471064711647126471364714647156471664717647186471964720647216472264723647246472564726647276472864729647306473164732647336473464735647366473764738647396474064741647426474364744647456474664747647486474964750647516475264753647546475564756647576475864759647606476164762647636476464765647666476764768647696477064771647726477364774647756477664777647786477964780647816478264783647846478564786647876478864789647906479164792647936479464795647966479764798647996480064801648026480364804648056480664807648086480964810648116481264813648146481564816648176481864819648206482164822648236482464825648266482764828648296483064831648326483364834648356483664837648386483964840648416484264843648446484564846648476484864849648506485164852648536485464855648566485764858648596486064861648626486364864648656486664867648686486964870648716487264873648746487564876648776487864879648806488164882648836488464885648866488764888648896489064891648926489364894648956489664897648986489964900649016490264903649046490564906649076490864909649106491164912649136491464915649166491764918649196492064921649226492364924649256492664927649286492964930649316493264933649346493564936649376493864939649406494164942649436494464945649466494764948649496495064951649526495364954649556495664957649586495964960649616496264963649646496564966649676496864969649706497164972649736497464975649766497764978649796498064981649826498364984649856498664987649886498964990649916499264993649946499564996649976499864999650006500165002650036500465005650066500765008650096501065011650126501365014650156501665017650186501965020650216502265023650246502565026650276502865029650306503165032650336503465035650366503765038650396504065041650426504365044650456504665047650486504965050650516505265053650546505565056650576505865059650606506165062650636506465065650666506765068650696507065071650726507365074650756507665077650786507965080650816508265083650846508565086650876508865089650906509165092650936509465095650966509765098650996510065101651026510365104651056510665107651086510965110651116511265113651146511565116651176511865119651206512165122651236512465125651266512765128651296513065131651326513365134651356513665137651386513965140651416514265143651446514565146651476514865149651506515165152651536515465155651566515765158651596516065161651626516365164651656516665167651686516965170651716517265173651746517565176651776517865179651806518165182651836518465185651866518765188651896519065191651926519365194651956519665197651986519965200652016520265203652046520565206652076520865209652106521165212652136521465215652166521765218652196522065221652226522365224652256522665227652286522965230652316523265233652346523565236652376523865239652406524165242652436524465245652466524765248652496525065251652526525365254652556525665257652586525965260652616526265263652646526565266652676526865269652706527165272652736527465275652766527765278652796528065281652826528365284652856528665287652886528965290652916529265293652946529565296652976529865299653006530165302653036530465305653066530765308653096531065311653126531365314653156531665317653186531965320653216532265323653246532565326653276532865329653306533165332653336533465335653366533765338653396534065341653426534365344653456534665347653486534965350653516535265353653546535565356653576535865359653606536165362653636536465365653666536765368653696537065371653726537365374653756537665377653786537965380653816538265383653846538565386653876538865389653906539165392653936539465395653966539765398653996540065401654026540365404654056540665407654086540965410654116541265413654146541565416654176541865419654206542165422654236542465425654266542765428654296543065431654326543365434654356543665437654386543965440654416544265443654446544565446654476544865449654506545165452654536545465455654566545765458654596546065461654626546365464654656546665467654686546965470654716547265473654746547565476654776547865479654806548165482654836548465485654866548765488654896549065491654926549365494654956549665497654986549965500655016550265503655046550565506655076550865509655106551165512655136551465515655166551765518655196552065521655226552365524655256552665527655286552965530655316553265533655346553565536655376553865539655406554165542655436554465545655466554765548655496555065551655526555365554655556555665557655586555965560655616556265563655646556565566655676556865569655706557165572655736557465575655766557765578655796558065581655826558365584655856558665587655886558965590655916559265593655946559565596655976559865599656006560165602656036560465605656066560765608656096561065611656126561365614656156561665617656186561965620656216562265623656246562565626656276562865629656306563165632656336563465635656366563765638656396564065641656426564365644656456564665647656486564965650656516565265653656546565565656656576565865659656606566165662656636566465665656666566765668656696567065671656726567365674656756567665677656786567965680656816568265683656846568565686656876568865689656906569165692656936569465695656966569765698656996570065701657026570365704657056570665707657086570965710657116571265713657146571565716657176571865719657206572165722657236572465725657266572765728657296573065731657326573365734657356573665737657386573965740657416574265743657446574565746657476574865749657506575165752657536575465755657566575765758657596576065761657626576365764657656576665767657686576965770657716577265773657746577565776657776577865779657806578165782657836578465785657866578765788657896579065791657926579365794657956579665797657986579965800658016580265803658046580565806658076580865809658106581165812658136581465815658166581765818658196582065821658226582365824658256582665827658286582965830658316583265833658346583565836658376583865839658406584165842658436584465845658466584765848658496585065851658526585365854658556585665857658586585965860658616586265863658646586565866658676586865869658706587165872658736587465875658766587765878658796588065881658826588365884658856588665887658886588965890658916589265893658946589565896658976589865899659006590165902659036590465905659066590765908659096591065911659126591365914659156591665917659186591965920659216592265923659246592565926659276592865929659306593165932659336593465935659366593765938659396594065941659426594365944659456594665947659486594965950659516595265953659546595565956659576595865959659606596165962659636596465965659666596765968659696597065971659726597365974659756597665977659786597965980659816598265983659846598565986659876598865989659906599165992659936599465995659966599765998659996600066001660026600366004660056600666007660086600966010660116601266013660146601566016660176601866019660206602166022660236602466025660266602766028660296603066031660326603366034660356603666037660386603966040660416604266043660446604566046660476604866049660506605166052660536605466055660566605766058660596606066061660626606366064660656606666067660686606966070660716607266073660746607566076660776607866079660806608166082660836608466085660866608766088660896609066091660926609366094660956609666097660986609966100661016610266103661046610566106661076610866109661106611166112661136611466115661166611766118661196612066121661226612366124661256612666127661286612966130661316613266133661346613566136661376613866139661406614166142661436614466145661466614766148661496615066151661526615366154661556615666157661586615966160661616616266163661646616566166661676616866169661706617166172661736617466175661766617766178661796618066181661826618366184661856618666187661886618966190661916619266193661946619566196661976619866199662006620166202662036620466205662066620766208662096621066211662126621366214662156621666217662186621966220662216622266223662246622566226662276622866229662306623166232662336623466235662366623766238662396624066241662426624366244662456624666247662486624966250662516625266253662546625566256662576625866259662606626166262662636626466265662666626766268662696627066271662726627366274662756627666277662786627966280662816628266283662846628566286662876628866289662906629166292662936629466295662966629766298662996630066301663026630366304663056630666307663086630966310663116631266313663146631566316663176631866319663206632166322663236632466325663266632766328663296633066331663326633366334663356633666337663386633966340663416634266343663446634566346663476634866349663506635166352663536635466355663566635766358663596636066361663626636366364663656636666367663686636966370663716637266373663746637566376663776637866379663806638166382663836638466385663866638766388663896639066391663926639366394663956639666397663986639966400664016640266403664046640566406664076640866409664106641166412664136641466415664166641766418664196642066421664226642366424664256642666427664286642966430664316643266433664346643566436664376643866439664406644166442664436644466445664466644766448664496645066451664526645366454664556645666457664586645966460664616646266463664646646566466664676646866469664706647166472664736647466475664766647766478664796648066481664826648366484664856648666487664886648966490664916649266493664946649566496664976649866499665006650166502665036650466505665066650766508665096651066511665126651366514665156651666517665186651966520665216652266523665246652566526665276652866529665306653166532665336653466535665366653766538665396654066541665426654366544665456654666547665486654966550665516655266553665546655566556665576655866559665606656166562665636656466565665666656766568665696657066571665726657366574665756657666577665786657966580665816658266583665846658566586665876658866589665906659166592665936659466595665966659766598665996660066601666026660366604666056660666607666086660966610666116661266613666146661566616666176661866619666206662166622666236662466625666266662766628666296663066631666326663366634666356663666637666386663966640666416664266643666446664566646666476664866649666506665166652666536665466655666566665766658666596666066661666626666366664666656666666667666686666966670666716667266673666746667566676666776667866679666806668166682666836668466685666866668766688666896669066691666926669366694666956669666697666986669966700667016670266703667046670566706667076670866709667106671166712667136671466715667166671766718667196672066721667226672366724667256672666727667286672966730667316673266733667346673566736667376673866739667406674166742667436674466745667466674766748667496675066751667526675366754667556675666757667586675966760667616676266763667646676566766667676676866769667706677166772667736677466775667766677766778667796678066781667826678366784667856678666787667886678966790667916679266793667946679566796667976679866799668006680166802668036680466805668066680766808668096681066811668126681366814668156681666817668186681966820668216682266823668246682566826668276682866829668306683166832668336683466835668366683766838668396684066841668426684366844668456684666847668486684966850668516685266853668546685566856668576685866859668606686166862668636686466865668666686766868668696687066871668726687366874668756687666877668786687966880668816688266883668846688566886668876688866889668906689166892668936689466895668966689766898668996690066901669026690366904669056690666907669086690966910669116691266913669146691566916669176691866919669206692166922669236692466925669266692766928669296693066931669326693366934669356693666937669386693966940669416694266943669446694566946669476694866949669506695166952669536695466955669566695766958669596696066961669626696366964669656696666967669686696966970669716697266973669746697566976669776697866979669806698166982669836698466985669866698766988669896699066991669926699366994669956699666997669986699967000670016700267003670046700567006670076700867009670106701167012670136701467015670166701767018670196702067021670226702367024670256702667027670286702967030670316703267033670346703567036670376703867039670406704167042670436704467045670466704767048670496705067051670526705367054670556705667057670586705967060670616706267063670646706567066670676706867069670706707167072670736707467075670766707767078670796708067081670826708367084670856708667087670886708967090670916709267093670946709567096670976709867099671006710167102671036710467105671066710767108671096711067111671126711367114671156711667117671186711967120671216712267123671246712567126671276712867129671306713167132671336713467135671366713767138671396714067141671426714367144671456714667147671486714967150671516715267153671546715567156671576715867159671606716167162671636716467165671666716767168671696717067171671726717367174671756717667177671786717967180671816718267183671846718567186671876718867189671906719167192671936719467195671966719767198671996720067201672026720367204672056720667207672086720967210672116721267213672146721567216672176721867219672206722167222672236722467225672266722767228672296723067231672326723367234672356723667237672386723967240672416724267243672446724567246672476724867249672506725167252672536725467255672566725767258672596726067261672626726367264672656726667267672686726967270672716727267273672746727567276672776727867279672806728167282672836728467285672866728767288672896729067291672926729367294672956729667297672986729967300673016730267303673046730567306673076730867309673106731167312673136731467315673166731767318673196732067321673226732367324673256732667327673286732967330673316733267333673346733567336673376733867339673406734167342673436734467345673466734767348673496735067351673526735367354673556735667357673586735967360673616736267363673646736567366673676736867369673706737167372673736737467375673766737767378673796738067381673826738367384673856738667387673886738967390673916739267393673946739567396673976739867399674006740167402674036740467405674066740767408674096741067411674126741367414674156741667417674186741967420674216742267423674246742567426674276742867429674306743167432674336743467435674366743767438674396744067441674426744367444674456744667447674486744967450674516745267453674546745567456674576745867459674606746167462674636746467465674666746767468674696747067471674726747367474674756747667477674786747967480674816748267483674846748567486674876748867489674906749167492674936749467495674966749767498674996750067501675026750367504675056750667507675086750967510675116751267513675146751567516675176751867519675206752167522675236752467525675266752767528675296753067531675326753367534675356753667537675386753967540675416754267543675446754567546675476754867549675506755167552675536755467555675566755767558675596756067561675626756367564675656756667567675686756967570675716757267573675746757567576675776757867579675806758167582675836758467585675866758767588675896759067591675926759367594675956759667597675986759967600676016760267603676046760567606676076760867609676106761167612676136761467615676166761767618676196762067621676226762367624676256762667627676286762967630676316763267633676346763567636676376763867639676406764167642676436764467645676466764767648676496765067651676526765367654676556765667657676586765967660676616766267663676646766567666676676766867669676706767167672676736767467675676766767767678676796768067681676826768367684676856768667687676886768967690676916769267693676946769567696676976769867699677006770167702677036770467705677066770767708677096771067711677126771367714677156771667717677186771967720677216772267723677246772567726677276772867729677306773167732677336773467735677366773767738677396774067741677426774367744677456774667747677486774967750677516775267753677546775567756677576775867759677606776167762677636776467765677666776767768677696777067771677726777367774677756777667777677786777967780677816778267783677846778567786677876778867789677906779167792677936779467795677966779767798677996780067801678026780367804678056780667807678086780967810678116781267813678146781567816678176781867819678206782167822678236782467825678266782767828678296783067831678326783367834678356783667837678386783967840678416784267843678446784567846678476784867849678506785167852678536785467855678566785767858678596786067861678626786367864678656786667867678686786967870678716787267873678746787567876678776787867879678806788167882678836788467885678866788767888678896789067891678926789367894678956789667897678986789967900679016790267903679046790567906679076790867909679106791167912679136791467915679166791767918679196792067921679226792367924679256792667927679286792967930679316793267933679346793567936679376793867939679406794167942679436794467945679466794767948679496795067951679526795367954679556795667957679586795967960679616796267963679646796567966679676796867969679706797167972679736797467975679766797767978679796798067981679826798367984679856798667987679886798967990679916799267993679946799567996679976799867999680006800168002680036800468005680066800768008680096801068011680126801368014680156801668017680186801968020680216802268023680246802568026680276802868029680306803168032680336803468035680366803768038680396804068041680426804368044680456804668047680486804968050680516805268053680546805568056680576805868059680606806168062680636806468065680666806768068680696807068071680726807368074680756807668077680786807968080680816808268083680846808568086680876808868089680906809168092680936809468095680966809768098680996810068101681026810368104681056810668107681086810968110681116811268113681146811568116681176811868119681206812168122681236812468125681266812768128681296813068131681326813368134681356813668137681386813968140681416814268143681446814568146681476814868149681506815168152681536815468155681566815768158681596816068161681626816368164681656816668167681686816968170681716817268173681746817568176681776817868179681806818168182681836818468185681866818768188681896819068191681926819368194681956819668197681986819968200682016820268203682046820568206682076820868209682106821168212682136821468215682166821768218682196822068221682226822368224682256822668227682286822968230682316823268233682346823568236682376823868239682406824168242682436824468245682466824768248682496825068251682526825368254682556825668257682586825968260682616826268263682646826568266682676826868269682706827168272682736827468275682766827768278682796828068281682826828368284682856828668287682886828968290682916829268293682946829568296682976829868299683006830168302683036830468305683066830768308683096831068311683126831368314683156831668317683186831968320683216832268323683246832568326683276832868329683306833168332683336833468335683366833768338683396834068341683426834368344683456834668347683486834968350683516835268353683546835568356683576835868359683606836168362683636836468365683666836768368683696837068371683726837368374683756837668377683786837968380683816838268383683846838568386683876838868389683906839168392683936839468395683966839768398683996840068401684026840368404684056840668407684086840968410684116841268413684146841568416684176841868419684206842168422684236842468425684266842768428684296843068431684326843368434684356843668437684386843968440684416844268443684446844568446684476844868449684506845168452684536845468455684566845768458684596846068461684626846368464684656846668467684686846968470684716847268473684746847568476684776847868479684806848168482684836848468485684866848768488684896849068491684926849368494684956849668497684986849968500685016850268503685046850568506685076850868509685106851168512685136851468515685166851768518685196852068521685226852368524685256852668527685286852968530685316853268533685346853568536685376853868539685406854168542685436854468545685466854768548685496855068551685526855368554685556855668557685586855968560685616856268563685646856568566685676856868569685706857168572685736857468575685766857768578685796858068581685826858368584685856858668587685886858968590685916859268593685946859568596685976859868599686006860168602686036860468605686066860768608686096861068611686126861368614686156861668617686186861968620686216862268623686246862568626686276862868629686306863168632686336863468635686366863768638686396864068641686426864368644686456864668647686486864968650686516865268653686546865568656686576865868659686606866168662686636866468665686666866768668686696867068671686726867368674686756867668677686786867968680686816868268683686846868568686686876868868689686906869168692686936869468695686966869768698686996870068701687026870368704687056870668707687086870968710687116871268713687146871568716687176871868719687206872168722687236872468725687266872768728687296873068731687326873368734687356873668737687386873968740687416874268743687446874568746687476874868749687506875168752687536875468755687566875768758687596876068761687626876368764687656876668767687686876968770687716877268773687746877568776687776877868779687806878168782687836878468785687866878768788687896879068791687926879368794687956879668797687986879968800688016880268803688046880568806688076880868809688106881168812688136881468815688166881768818688196882068821688226882368824688256882668827688286882968830688316883268833688346883568836688376883868839688406884168842688436884468845688466884768848688496885068851688526885368854688556885668857688586885968860688616886268863688646886568866688676886868869688706887168872688736887468875688766887768878688796888068881688826888368884688856888668887688886888968890688916889268893688946889568896688976889868899689006890168902689036890468905689066890768908689096891068911689126891368914689156891668917689186891968920689216892268923689246892568926689276892868929689306893168932689336893468935689366893768938689396894068941689426894368944689456894668947689486894968950689516895268953689546895568956689576895868959689606896168962689636896468965689666896768968689696897068971689726897368974689756897668977689786897968980689816898268983689846898568986689876898868989689906899168992689936899468995689966899768998689996900069001690026900369004690056900669007690086900969010690116901269013690146901569016690176901869019690206902169022690236902469025690266902769028690296903069031690326903369034690356903669037690386903969040690416904269043690446904569046690476904869049690506905169052690536905469055690566905769058690596906069061690626906369064690656906669067690686906969070690716907269073690746907569076690776907869079690806908169082690836908469085690866908769088690896909069091690926909369094690956909669097690986909969100691016910269103691046910569106691076910869109691106911169112691136911469115691166911769118691196912069121691226912369124691256912669127691286912969130691316913269133691346913569136691376913869139691406914169142691436914469145691466914769148691496915069151691526915369154691556915669157691586915969160691616916269163691646916569166691676916869169691706917169172691736917469175691766917769178691796918069181691826918369184691856918669187691886918969190691916919269193691946919569196691976919869199692006920169202692036920469205692066920769208692096921069211692126921369214692156921669217692186921969220692216922269223692246922569226692276922869229692306923169232692336923469235692366923769238692396924069241692426924369244692456924669247692486924969250692516925269253692546925569256692576925869259692606926169262692636926469265692666926769268692696927069271692726927369274692756927669277692786927969280692816928269283692846928569286692876928869289692906929169292692936929469295692966929769298692996930069301693026930369304693056930669307693086930969310693116931269313693146931569316693176931869319693206932169322693236932469325693266932769328693296933069331693326933369334693356933669337693386933969340693416934269343693446934569346693476934869349693506935169352693536935469355693566935769358693596936069361693626936369364693656936669367693686936969370693716937269373693746937569376693776937869379693806938169382693836938469385693866938769388693896939069391693926939369394693956939669397693986939969400694016940269403694046940569406694076940869409694106941169412694136941469415694166941769418694196942069421694226942369424694256942669427694286942969430694316943269433694346943569436694376943869439694406944169442694436944469445694466944769448694496945069451694526945369454694556945669457694586945969460694616946269463694646946569466694676946869469694706947169472694736947469475694766947769478694796948069481694826948369484694856948669487694886948969490694916949269493694946949569496694976949869499695006950169502695036950469505695066950769508695096951069511695126951369514695156951669517695186951969520695216952269523695246952569526695276952869529695306953169532695336953469535695366953769538695396954069541695426954369544695456954669547695486954969550695516955269553695546955569556695576955869559695606956169562695636956469565695666956769568695696957069571695726957369574695756957669577695786957969580695816958269583695846958569586695876958869589695906959169592695936959469595695966959769598695996960069601696026960369604696056960669607696086960969610696116961269613696146961569616696176961869619696206962169622696236962469625696266962769628696296963069631696326963369634696356963669637696386963969640696416964269643696446964569646696476964869649696506965169652696536965469655696566965769658696596966069661696626966369664696656966669667696686966969670696716967269673696746967569676696776967869679696806968169682696836968469685696866968769688696896969069691696926969369694696956969669697696986969969700697016970269703697046970569706697076970869709697106971169712697136971469715697166971769718697196972069721697226972369724697256972669727697286972969730697316973269733697346973569736697376973869739697406974169742697436974469745697466974769748697496975069751697526975369754697556975669757697586975969760
  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: {
  1600. asset: {
  1601. type: Object,
  1602. required: true
  1603. }
  1604. }
  1605. });
  1606. /***/ }),
  1607. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js&":
  1608. /*!*****************************************************************************************************************************************************************************!*\
  1609. !*** ./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& ***!
  1610. \*****************************************************************************************************************************************************************************/
  1611. /*! exports provided: default */
  1612. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1613. "use strict";
  1614. __webpack_require__.r(__webpack_exports__);
  1615. /* harmony import */ var _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Modal.vue */ "./resources/js/components/Modal.vue");
  1616. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  1617. //
  1618. //
  1619. //
  1620. //
  1621. //
  1622. //
  1623. //
  1624. //
  1625. //
  1626. //
  1627. //
  1628. //
  1629. //
  1630. //
  1631. //
  1632. //
  1633. //
  1634. //
  1635. //
  1636. //
  1637. //
  1638. //
  1639. //
  1640. //
  1641. //
  1642. //
  1643. //
  1644. //
  1645. //
  1646. //
  1647. //
  1648. //
  1649. //
  1650. //
  1651. //
  1652. //
  1653. //
  1654. //
  1655. //
  1656. //
  1657. //
  1658. //
  1659. //
  1660. //
  1661. //
  1662. //
  1663. //
  1664. //
  1665. //
  1666. /* harmony default export */ __webpack_exports__["default"] = ({
  1667. components: {
  1668. Modal: _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  1669. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_1__["default"]
  1670. },
  1671. props: {
  1672. populateWith: {
  1673. type: Object,
  1674. required: true
  1675. },
  1676. modalId: {
  1677. type: String,
  1678. required: true
  1679. }
  1680. },
  1681. data: function data() {
  1682. return {
  1683. // Essentially makes a copy of the object. Otherwise
  1684. // We would have a reference to the exising object causing
  1685. // unwanted mutations in the parent component.
  1686. asset: JSON.parse(JSON.stringify(this.populateWith)),
  1687. assetSaving: false
  1688. };
  1689. },
  1690. methods: {
  1691. updateAsset: function updateAsset() {
  1692. var _this = this;
  1693. this.assetSaving = true;
  1694. axios.put("/api/assets/".concat(this.asset.pcid), this.asset).then(function (response) {
  1695. _this.assetSaving = false;
  1696. $("#".concat(_this.modalId)).modal('hide');
  1697. })["catch"](function (error) {
  1698. _this.assetSaving = false;
  1699. });
  1700. }
  1701. }
  1702. });
  1703. /***/ }),
  1704. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js&":
  1705. /*!*************************************************************************************************************************************************************************************!*\
  1706. !*** ./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& ***!
  1707. \*************************************************************************************************************************************************************************************/
  1708. /*! exports provided: default */
  1709. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1710. "use strict";
  1711. __webpack_require__.r(__webpack_exports__);
  1712. //
  1713. //
  1714. //
  1715. //
  1716. //
  1717. //
  1718. //
  1719. //
  1720. //
  1721. //
  1722. //
  1723. //
  1724. //
  1725. //
  1726. //
  1727. //
  1728. //
  1729. //
  1730. //
  1731. //
  1732. //
  1733. /* harmony default export */ __webpack_exports__["default"] = ({
  1734. props: {
  1735. value: null,
  1736. // An object with the following format
  1737. // {
  1738. // key: value,
  1739. // key: value,
  1740. // }
  1741. options: {
  1742. type: Object,
  1743. required: true
  1744. },
  1745. allowCustom: {
  1746. type: Boolean,
  1747. "default": false
  1748. }
  1749. },
  1750. data: function data() {
  1751. return {
  1752. searchText: '',
  1753. selectedOption: null,
  1754. open: false,
  1755. // allows for checking whether button was clicked or text was typed.
  1756. // If button was clicked, we show all options without having to clear
  1757. // out any searchText that was autofilled when page loaded.
  1758. isSearching: false
  1759. };
  1760. },
  1761. computed: {
  1762. matches: function matches() {
  1763. var _this = this;
  1764. // If button was clicked, show all options, if typing, filter
  1765. // options based on searchText
  1766. return Object.entries(this.options).filter(function (option) {
  1767. var optionText = option[1].toUpperCase();
  1768. if (_this.isSearching) {
  1769. return optionText.match(_this.searchText.toUpperCase());
  1770. } else {
  1771. return optionText.match('');
  1772. }
  1773. });
  1774. }
  1775. },
  1776. methods: {
  1777. // if button is clicked, show all options
  1778. setOpen: function setOpen(isOpen) {
  1779. this.open = isOpen;
  1780. this.isSearching = false;
  1781. },
  1782. // if typing in the box, start filtering options
  1783. searchChanged: function searchChanged() {
  1784. if (!this.open) {
  1785. this.open = true;
  1786. }
  1787. if (!this.isSearching) {
  1788. this.isSearching = true;
  1789. } // If custom values are allowed, emits {id: 'custom', name: searchtext}
  1790. if (this.allowCustom) {
  1791. this.$emit('input', {
  1792. 'id': 'custom',
  1793. 'name': this.searchText
  1794. });
  1795. }
  1796. },
  1797. // emits { id: suggestion_id, name: suggestion_name} to v-model when
  1798. // a suggestion is selected
  1799. suggestionSelected: function suggestionSelected(suggestion) {
  1800. this.open = false;
  1801. this.searchText = suggestion[1];
  1802. this.$emit('input', {
  1803. 'id': suggestion[0],
  1804. 'name': suggestion[1]
  1805. });
  1806. },
  1807. updateComponentWithValue: function updateComponentWithValue(newValue) {
  1808. if (this.allowCustom) {
  1809. this.searchText = this.value.name;
  1810. } else {
  1811. if (newValue.id > -1) {
  1812. // Find the matching text for the supplied option value
  1813. for (var id in this.options) {
  1814. if (this.options.hasOwnProperty(id)) {
  1815. if (this.options[id] === this.options[newValue.id]) {
  1816. this.searchText = this.options[id];
  1817. }
  1818. }
  1819. }
  1820. }
  1821. }
  1822. }
  1823. },
  1824. mounted: function mounted() {
  1825. this.updateComponentWithValue(this.value);
  1826. },
  1827. watch: {
  1828. value: function value(newValue) {
  1829. this.updateComponentWithValue(newValue);
  1830. }
  1831. }
  1832. });
  1833. /***/ }),
  1834. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js&":
  1835. /*!************************************************************************************************************************************************************************!*\
  1836. !*** ./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& ***!
  1837. \************************************************************************************************************************************************************************/
  1838. /*! exports provided: default */
  1839. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1840. "use strict";
  1841. __webpack_require__.r(__webpack_exports__);
  1842. //
  1843. //
  1844. //
  1845. //
  1846. /* harmony default export */ __webpack_exports__["default"] = ({
  1847. name: 'IntersectingCirclesSpinner',
  1848. props: {
  1849. color: {
  1850. type: String,
  1851. "default": '#fff'
  1852. },
  1853. size: {
  1854. type: Number,
  1855. "default": 10
  1856. }
  1857. }
  1858. });
  1859. /***/ }),
  1860. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/Credential.vue?vue&type=script&lang=js&":
  1861. /*!*********************************************************************************************************************************************************************!*\
  1862. !*** ./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& ***!
  1863. \*********************************************************************************************************************************************************************/
  1864. /*! exports provided: default */
  1865. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1866. "use strict";
  1867. __webpack_require__.r(__webpack_exports__);
  1868. /* harmony import */ var _components_CredentialFormModal_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/CredentialFormModal.vue */ "./resources/js/components/CredentialFormModal.vue");
  1869. /* harmony import */ var _components_Modal_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/Modal.vue */ "./resources/js/components/Modal.vue");
  1870. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  1871. //
  1872. //
  1873. //
  1874. //
  1875. //
  1876. //
  1877. //
  1878. //
  1879. //
  1880. //
  1881. //
  1882. //
  1883. //
  1884. //
  1885. //
  1886. //
  1887. //
  1888. //
  1889. //
  1890. //
  1891. //
  1892. //
  1893. //
  1894. //
  1895. //
  1896. //
  1897. //
  1898. //
  1899. //
  1900. //
  1901. //
  1902. //
  1903. //
  1904. //
  1905. //
  1906. //
  1907. //
  1908. //
  1909. //
  1910. //
  1911. //
  1912. //
  1913. //
  1914. //
  1915. //
  1916. //
  1917. /* harmony default export */ __webpack_exports__["default"] = ({
  1918. components: {
  1919. CredentialFormModal: _components_CredentialFormModal_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  1920. Modal: _components_Modal_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
  1921. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_2__["default"]
  1922. },
  1923. props: {
  1924. credential: {
  1925. type: Object,
  1926. required: true
  1927. },
  1928. descriptions: {
  1929. type: Object,
  1930. required: true
  1931. }
  1932. },
  1933. data: function data() {
  1934. return {
  1935. data: this.credential,
  1936. creddescList: this.descriptions,
  1937. credentialDeleting: false
  1938. };
  1939. },
  1940. mounted: function mounted() {
  1941. var _this = this;
  1942. Echo.channel('credential.' + this.data.credid).listen('CredentialUpdated', function (e) {
  1943. _this.data = e.credential;
  1944. });
  1945. },
  1946. methods: {
  1947. deleteCredential: function deleteCredential() {
  1948. var _this2 = this;
  1949. this.credentialDeleting = true;
  1950. axios["delete"]('/api/credentials/' + this.data.credid, this.data).then(function (response) {
  1951. _this2.credentialDeleting = false;
  1952. $('#credential' + _this2.data.credid + 'deleteModal').modal('hide');
  1953. })["catch"](function (error) {
  1954. _this2.credentialDeleting = false;
  1955. console.error(error);
  1956. });
  1957. }
  1958. }
  1959. });
  1960. /***/ }),
  1961. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CredentialFormModal.vue?vue&type=script&lang=js&":
  1962. /*!******************************************************************************************************************************************************************************!*\
  1963. !*** ./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& ***!
  1964. \******************************************************************************************************************************************************************************/
  1965. /*! exports provided: default */
  1966. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1967. "use strict";
  1968. __webpack_require__.r(__webpack_exports__);
  1969. /* harmony import */ var _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Modal.vue */ "./resources/js/components/Modal.vue");
  1970. /* harmony import */ var _components_AutocompleteCustomDropdown_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/AutocompleteCustomDropdown.vue */ "./resources/js/components/AutocompleteCustomDropdown.vue");
  1971. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  1972. //
  1973. //
  1974. //
  1975. //
  1976. //
  1977. //
  1978. //
  1979. //
  1980. //
  1981. //
  1982. //
  1983. //
  1984. //
  1985. //
  1986. //
  1987. //
  1988. //
  1989. //
  1990. //
  1991. //
  1992. //
  1993. //
  1994. //
  1995. //
  1996. //
  1997. //
  1998. //
  1999. //
  2000. //
  2001. /* harmony default export */ __webpack_exports__["default"] = ({
  2002. components: {
  2003. AutocompleteCustomDropdown: _components_AutocompleteCustomDropdown_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
  2004. Modal: _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  2005. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_2__["default"]
  2006. },
  2007. props: {
  2008. populateWith: {
  2009. type: Object,
  2010. "default": function _default() {
  2011. return {
  2012. creddesc: null,
  2013. creduser: null,
  2014. credpass: null,
  2015. groupid: null,
  2016. pcid: null,
  2017. credtype: null
  2018. };
  2019. }
  2020. },
  2021. modalId: {
  2022. type: String,
  2023. required: true
  2024. },
  2025. descriptions: {
  2026. type: Object,
  2027. required: true
  2028. },
  2029. create: {
  2030. type: Boolean
  2031. },
  2032. pcid: {
  2033. type: Number
  2034. },
  2035. groupid: {
  2036. type: Number
  2037. }
  2038. },
  2039. data: function data() {
  2040. return {
  2041. data: JSON.parse(JSON.stringify(this.populateWith)),
  2042. creddesc: {},
  2043. id: this.modalId,
  2044. errors: [],
  2045. credentialSaving: false
  2046. };
  2047. },
  2048. mounted: function mounted() {
  2049. this.creddesc = {
  2050. 'id': this.data.credtype,
  2051. 'name': this.data.creddesc
  2052. };
  2053. },
  2054. methods: {
  2055. rndStr: function rndStr(len) {
  2056. var text = "";
  2057. var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%";
  2058. for (var i = 0; i < len; i++) {
  2059. text += chars.charAt(Math.floor(Math.random() * chars.length));
  2060. }
  2061. return text;
  2062. },
  2063. getRandomPassword: function getRandomPassword(id) {
  2064. this.data.credpass = this.rndStr(16);
  2065. },
  2066. updateCredential: function updateCredential() {
  2067. var _this = this;
  2068. this.credentialSaving = true;
  2069. if (this.creddesc.id === "custom") {
  2070. this.data.credtype = 1;
  2071. this.data.creddesc = this.creddesc.name;
  2072. } else {
  2073. this.data.credtype = this.creddesc.id;
  2074. this.data.creddesc = this.creddesc.name;
  2075. }
  2076. if (this.create) {
  2077. if (this.pcid) {
  2078. this.data.pcid = this.pcid;
  2079. }
  2080. if (this.groupid) {
  2081. this.data.groupid = this.groupid;
  2082. }
  2083. axios.post('/api/credentials/', this.data).then(function (response) {
  2084. _this.credentialSaving = false;
  2085. $('#' + _this.id).modal('hide');
  2086. })["catch"](function (error) {
  2087. _this.credentialSaving = false;
  2088. console.error(error);
  2089. });
  2090. } else {
  2091. axios.put('/api/credentials/' + this.data.credid, this.data).then(function (response) {
  2092. _this.credentialSaving = false;
  2093. $('#' + _this.id).modal('hide');
  2094. })["catch"](function (error) {
  2095. _this.credentialSaving = false;
  2096. console.error(error);
  2097. });
  2098. }
  2099. }
  2100. }
  2101. });
  2102. /***/ }),
  2103. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CredentialList.vue?vue&type=script&lang=js&":
  2104. /*!*************************************************************************************************************************************************************************!*\
  2105. !*** ./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& ***!
  2106. \*************************************************************************************************************************************************************************/
  2107. /*! exports provided: default */
  2108. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2109. "use strict";
  2110. __webpack_require__.r(__webpack_exports__);
  2111. /* harmony import */ var _components_Credential_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Credential.vue */ "./resources/js/components/Credential.vue");
  2112. /* harmony import */ var _components_CredentialFormModal_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/CredentialFormModal.vue */ "./resources/js/components/CredentialFormModal.vue");
  2113. //
  2114. //
  2115. //
  2116. //
  2117. //
  2118. //
  2119. //
  2120. //
  2121. //
  2122. /* harmony default export */ __webpack_exports__["default"] = ({
  2123. components: {
  2124. Credential: _components_Credential_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  2125. CredentialFormModal: _components_CredentialFormModal_vue__WEBPACK_IMPORTED_MODULE_1__["default"]
  2126. },
  2127. props: {
  2128. credentials: {
  2129. type: Array,
  2130. required: true
  2131. },
  2132. descriptions: {
  2133. type: Array,
  2134. required: true
  2135. },
  2136. pcid: {
  2137. type: Number
  2138. },
  2139. groupid: {
  2140. type: Number
  2141. }
  2142. },
  2143. computed: {
  2144. creddescList: function creddescList() {
  2145. var list = {};
  2146. this.descriptions.map(function (val) {
  2147. list[val.creddescid] = val.credtitle;
  2148. });
  2149. return list;
  2150. }
  2151. },
  2152. methods: {
  2153. deleteCred: function deleteCred(index) {
  2154. this.credentials.splice(index, 1);
  2155. }
  2156. },
  2157. mounted: function mounted() {
  2158. var _this = this;
  2159. if (this.pcid) {
  2160. Echo.channel('credlist.pcid.' + this.pcid).listen('CredentialDeleted', function (e) {
  2161. var deletedCred = e.credential;
  2162. var index = _this.credentials.findIndex(function (credential) {
  2163. return credential.credid === deletedCred['credid'];
  2164. });
  2165. $('#credential' + deletedCred['credid'] + 'deleteModal').modal('hide');
  2166. _this.deleteCred(index);
  2167. }).listen('CredentialAdded', function (e) {
  2168. _this.credentials.unshift(e.credential);
  2169. });
  2170. }
  2171. if (this.groupid) {
  2172. Echo.channel('credlist.groupid.' + this.groupid).listen('CredentialDeleted', function (e) {
  2173. var deletedCred = e.credential;
  2174. var index = _this.credentials.findIndex(function (credential) {
  2175. return credential.groupid === deletedCred['groupid'];
  2176. });
  2177. $('#credential' + deletedCred['credid'] + 'deleteModal').modal('hide');
  2178. _this.deleteCred(index);
  2179. }).listen('CredentialAdded', function (e) {
  2180. _this.credentials.unshift(e.credential);
  2181. });
  2182. }
  2183. }
  2184. });
  2185. /***/ }),
  2186. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ErrorList.vue?vue&type=script&lang=js&":
  2187. /*!********************************************************************************************************************************************************************!*\
  2188. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/ErrorList.vue?vue&type=script&lang=js& ***!
  2189. \********************************************************************************************************************************************************************/
  2190. /*! exports provided: default */
  2191. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2192. "use strict";
  2193. __webpack_require__.r(__webpack_exports__);
  2194. //
  2195. //
  2196. //
  2197. //
  2198. //
  2199. /* harmony default export */ __webpack_exports__["default"] = ({
  2200. props: ['errors'],
  2201. data: function data() {
  2202. return {
  2203. errorList: this.errors
  2204. };
  2205. },
  2206. watch: {
  2207. errors: function errors(newErrors) {
  2208. this.errorList = newErrors;
  2209. }
  2210. }
  2211. });
  2212. /***/ }),
  2213. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/NoteFormModal.vue?vue&type=script&lang=js&":
  2214. /*!************************************************************************************************************************************************************************!*\
  2215. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/NoteFormModal.vue?vue&type=script&lang=js& ***!
  2216. \************************************************************************************************************************************************************************/
  2217. /*! exports provided: default */
  2218. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2219. "use strict";
  2220. __webpack_require__.r(__webpack_exports__);
  2221. /* harmony import */ var _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Modal.vue */ "./resources/js/components/Modal.vue");
  2222. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  2223. //
  2224. //
  2225. //
  2226. //
  2227. //
  2228. //
  2229. //
  2230. //
  2231. //
  2232. //
  2233. //
  2234. //
  2235. //
  2236. //
  2237. //
  2238. //
  2239. //
  2240. //
  2241. //
  2242. //
  2243. /* harmony default export */ __webpack_exports__["default"] = ({
  2244. components: {
  2245. Modal: _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  2246. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_1__["default"]
  2247. },
  2248. props: {
  2249. populateWith: {
  2250. type: Object,
  2251. require: true
  2252. },
  2253. modalId: {
  2254. type: String,
  2255. require: true
  2256. },
  2257. noteType: {
  2258. type: Number
  2259. },
  2260. noteUser: {
  2261. type: String
  2262. },
  2263. woid: {
  2264. type: Number
  2265. }
  2266. },
  2267. data: function data() {
  2268. return {
  2269. note: JSON.parse(JSON.stringify(this.populateWith)),
  2270. noteSaving: false
  2271. };
  2272. },
  2273. methods: {
  2274. updateNote: function updateNote(note) {
  2275. var _this = this;
  2276. this.noteSaving = true;
  2277. axios.put('/api/workorders/notes/' + note.noteid, note).then(function (response) {
  2278. _this.noteSaving = false;
  2279. _this.hideModal();
  2280. });
  2281. },
  2282. hideModal: function hideModal() {
  2283. $('#' + this.modalId).modal('hide');
  2284. }
  2285. }
  2286. });
  2287. /***/ }),
  2288. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/Notes.vue?vue&type=script&lang=js&":
  2289. /*!****************************************************************************************************************************************************************!*\
  2290. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/Notes.vue?vue&type=script&lang=js& ***!
  2291. \****************************************************************************************************************************************************************/
  2292. /*! exports provided: default */
  2293. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2294. "use strict";
  2295. __webpack_require__.r(__webpack_exports__);
  2296. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2297. /* harmony import */ var _components_NoteFormModal_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/NoteFormModal.vue */ "./resources/js/components/NoteFormModal.vue");
  2298. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  2299. //
  2300. //
  2301. //
  2302. //
  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. /* harmony default export */ __webpack_exports__["default"] = ({
  2341. components: {
  2342. NoteFormModal: _components_NoteFormModal_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
  2343. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_2__["default"]
  2344. },
  2345. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2346. props: {
  2347. notes: {
  2348. type: Array,
  2349. "default": []
  2350. },
  2351. authusername: {
  2352. type: String,
  2353. required: true
  2354. },
  2355. noteType: {
  2356. type: Number,
  2357. required: true
  2358. },
  2359. woid: {
  2360. type: String,
  2361. required: true
  2362. }
  2363. },
  2364. data: function data() {
  2365. return {
  2366. newNote: {
  2367. notetype: this.noteType,
  2368. thenote: '',
  2369. noteuser: this.authusername,
  2370. woid: this.woid
  2371. },
  2372. noteSaving: false
  2373. };
  2374. },
  2375. computed: {
  2376. noteOrders: function noteOrders() {
  2377. return this.getNoteOrders(this.notes);
  2378. }
  2379. },
  2380. methods: {
  2381. createNote: function createNote() {
  2382. var _this = this;
  2383. this.noteSaving = true;
  2384. axios.post('/api/workorders/notes', this.newNote).then(function (response) {
  2385. _this.noteSaving = false;
  2386. $('#note' + _this.noteType + 'add').collapse('hide');
  2387. _this.newNote.thenote = '';
  2388. })["catch"](function (error) {
  2389. _this.noteSaving = false;
  2390. console.log(error);
  2391. });
  2392. },
  2393. getNoteOrders: function getNoteOrders(notes) {
  2394. var noteOrders = [];
  2395. notes.forEach(function (note, index) {
  2396. if (index === 0) {
  2397. noteOrders[index] = 'order-first';
  2398. } else if (note.noteuser !== notes[index - 1].noteuser) {
  2399. if (noteOrders[index - 1] === 'order-first') {
  2400. noteOrders[index] = 'order-last';
  2401. } else {
  2402. noteOrders[index] = 'order-first';
  2403. }
  2404. } else {
  2405. noteOrders[index] = noteOrders[index - 1];
  2406. }
  2407. });
  2408. return noteOrders;
  2409. }
  2410. }
  2411. });
  2412. /***/ }),
  2413. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js&":
  2414. /*!**************************************************************************************************************************************************************************!*\
  2415. !*** ./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& ***!
  2416. \**************************************************************************************************************************************************************************/
  2417. /*! exports provided: default */
  2418. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2419. "use strict";
  2420. __webpack_require__.r(__webpack_exports__);
  2421. /* harmony import */ var _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Modal.vue */ "./resources/js/components/Modal.vue");
  2422. /* harmony import */ var _components_AutocompleteCustomDropdown_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/AutocompleteCustomDropdown.vue */ "./resources/js/components/AutocompleteCustomDropdown.vue");
  2423. /* harmony import */ var _components_ErrorList_vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../components/ErrorList.vue */ "./resources/js/components/ErrorList.vue");
  2424. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  2425. //
  2426. //
  2427. //
  2428. //
  2429. //
  2430. //
  2431. //
  2432. //
  2433. //
  2434. //
  2435. //
  2436. //
  2437. //
  2438. //
  2439. //
  2440. //
  2441. //
  2442. //
  2443. //
  2444. //
  2445. //
  2446. //
  2447. //
  2448. //
  2449. //
  2450. //
  2451. //
  2452. //
  2453. //
  2454. //
  2455. //
  2456. //
  2457. //
  2458. //
  2459. //
  2460. //
  2461. /* harmony default export */ __webpack_exports__["default"] = ({
  2462. components: {
  2463. Modal: _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  2464. AutocompleteCustomDropdown: _components_AutocompleteCustomDropdown_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
  2465. ErrorList: _components_ErrorList_vue__WEBPACK_IMPORTED_MODULE_2__["default"],
  2466. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_3__["default"]
  2467. },
  2468. props: {
  2469. populateWith: {
  2470. type: Object,
  2471. required: true
  2472. },
  2473. storeList: {
  2474. type: Object,
  2475. required: true
  2476. },
  2477. modalId: {
  2478. type: String,
  2479. required: true
  2480. }
  2481. },
  2482. data: function data() {
  2483. return {
  2484. // Copies object from prop, so it doesn't mutate the object
  2485. // from the parent component. Parent component will be updated via
  2486. // Websocket if updateWorkOrder is successful.
  2487. data: JSON.parse(JSON.stringify(this.populateWith)),
  2488. id: this.modalId,
  2489. store: {},
  2490. errors: [],
  2491. woInfoSaving: false
  2492. };
  2493. },
  2494. methods: {
  2495. updateWorkOrder: function updateWorkOrder() {
  2496. var _this = this;
  2497. this.woInfoSaving = true;
  2498. this.data.storeid = this.store.id;
  2499. axios.put('/api/workorders/' + this.data.woid, this.data).then(function (response) {
  2500. _this.woInfoSaving = false;
  2501. $('#workordereditModal').modal('hide');
  2502. })["catch"](function (error) {
  2503. _this.woInfoSaving = false;
  2504. _this.errors = JSON.parse(error.response.request.response).errors;
  2505. });
  2506. }
  2507. },
  2508. mounted: function mounted() {
  2509. this.store = {
  2510. 'id': this.data.storeid,
  2511. 'name': this.storeList[this.data.storeid]
  2512. };
  2513. },
  2514. // This was originally here because the populateWith info would originally
  2515. // not necessarily be loaded when this component was mounted. That is no
  2516. // longer the case as I now don't render the parent component until the
  2517. // ajax request is finised. The watch statements are still here to cover
  2518. // the case where someone else updates the populateWith values while
  2519. // someone is editing, although it probably should be edited so it doesn't
  2520. // immediately overwrite the unsaved edits of the current user.
  2521. watch: {
  2522. populateWith: function populateWith(value) {
  2523. this.data = JSON.parse(JSON.stringify(this.populateWith));
  2524. this.store = {
  2525. 'id': this.data.storeid,
  2526. 'name': this.storeList[this.data.storeid]
  2527. };
  2528. },
  2529. storeList: function storeList(value) {
  2530. this.store = {
  2531. 'id': this.data.storeid,
  2532. 'name': this.storeList[this.data.storeid]
  2533. };
  2534. }
  2535. }
  2536. });
  2537. /***/ }),
  2538. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js&":
  2539. /*!************************************************************************************************************************************************************************!*\
  2540. !*** ./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& ***!
  2541. \************************************************************************************************************************************************************************/
  2542. /*! exports provided: default */
  2543. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2544. "use strict";
  2545. __webpack_require__.r(__webpack_exports__);
  2546. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2547. /* harmony import */ var _components_WoInfoEditModal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/WoInfoEditModal */ "./resources/js/components/WoInfoEditModal.vue");
  2548. //
  2549. //
  2550. //
  2551. //
  2552. //
  2553. //
  2554. //
  2555. //
  2556. //
  2557. //
  2558. //
  2559. //
  2560. //
  2561. //
  2562. //
  2563. //
  2564. //
  2565. //
  2566. //
  2567. //
  2568. /* harmony default export */ __webpack_exports__["default"] = ({
  2569. components: {
  2570. WoInfoEditModal: _components_WoInfoEditModal__WEBPACK_IMPORTED_MODULE_1__["default"]
  2571. },
  2572. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2573. props: ['workOrder', 'stores'],
  2574. computed: {
  2575. storeList: function storeList() {
  2576. var list = {};
  2577. Object.values(this.stores).map(function (val) {
  2578. list[val.storeid] = val.storesname;
  2579. });
  2580. return list;
  2581. }
  2582. }
  2583. });
  2584. /***/ }),
  2585. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/App.vue?vue&type=script&lang=js&":
  2586. /*!*********************************************************************************************************************************************************!*\
  2587. !*** ./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& ***!
  2588. \*********************************************************************************************************************************************************/
  2589. /*! exports provided: default */
  2590. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2591. "use strict";
  2592. __webpack_require__.r(__webpack_exports__);
  2593. //
  2594. //
  2595. //
  2596. //
  2597. //
  2598. //
  2599. //
  2600. //
  2601. //
  2602. //
  2603. //
  2604. //
  2605. //
  2606. //
  2607. //
  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. /* harmony default export */ __webpack_exports__["default"] = ({
  2665. data: function data() {
  2666. return {
  2667. isLoggedIn: null,
  2668. username: null
  2669. };
  2670. },
  2671. mounted: function mounted() {
  2672. this.isLoggedIn = localStorage.getItem('jwt');
  2673. this.username = localStorage.getItem('user');
  2674. }
  2675. });
  2676. /***/ }),
  2677. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Dashboard.vue?vue&type=script&lang=js&":
  2678. /*!***************************************************************************************************************************************************************!*\
  2679. !*** ./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& ***!
  2680. \***************************************************************************************************************************************************************/
  2681. /*! exports provided: default */
  2682. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2683. "use strict";
  2684. __webpack_require__.r(__webpack_exports__);
  2685. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  2686. //
  2687. //
  2688. //
  2689. //
  2690. //
  2691. //
  2692. //
  2693. //
  2694. //
  2695. //
  2696. //
  2697. //
  2698. //
  2699. //
  2700. //
  2701. //
  2702. //
  2703. //
  2704. //
  2705. //
  2706. //
  2707. //
  2708. //
  2709. //
  2710. //
  2711. //
  2712. /* harmony default export */ __webpack_exports__["default"] = ({
  2713. components: {
  2714. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_0__["default"]
  2715. },
  2716. data: function data() {
  2717. return {
  2718. workOrders: [],
  2719. isLoading: true
  2720. };
  2721. },
  2722. mounted: function mounted() {
  2723. var _this = this;
  2724. var token = localStorage.getItem('jwt');
  2725. var user = localStorage.getItem('user');
  2726. axios.defaults.headers.common['Content-Type'] = 'application/json';
  2727. axios.defaults.headers.common['Authorization'] = 'Bearer ' + token;
  2728. axios.get('api/users/' + user + '/workorders').then(function (response) {
  2729. _this.workOrders = response.data;
  2730. _this.isLoading = false;
  2731. })["catch"](function (error) {
  2732. console.log(error);
  2733. });
  2734. },
  2735. beforeRouteEnter: function beforeRouteEnter(to, from, next) {
  2736. if (!localStorage.getItem('jwt')) {
  2737. return next('login');
  2738. }
  2739. next();
  2740. }
  2741. });
  2742. /***/ }),
  2743. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Login.vue?vue&type=script&lang=js&":
  2744. /*!***********************************************************************************************************************************************************!*\
  2745. !*** ./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& ***!
  2746. \***********************************************************************************************************************************************************/
  2747. /*! exports provided: default */
  2748. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2749. "use strict";
  2750. __webpack_require__.r(__webpack_exports__);
  2751. //
  2752. //
  2753. //
  2754. //
  2755. //
  2756. //
  2757. //
  2758. //
  2759. //
  2760. //
  2761. //
  2762. //
  2763. //
  2764. //
  2765. //
  2766. //
  2767. //
  2768. //
  2769. //
  2770. //
  2771. //
  2772. //
  2773. //
  2774. //
  2775. //
  2776. //
  2777. //
  2778. //
  2779. //
  2780. //
  2781. //
  2782. //
  2783. //
  2784. //
  2785. //
  2786. //
  2787. //
  2788. //
  2789. //
  2790. /* harmony default export */ __webpack_exports__["default"] = ({
  2791. data: function data() {
  2792. return {
  2793. username: "",
  2794. password: ""
  2795. };
  2796. },
  2797. methods: {
  2798. handleSubmit: function handleSubmit(e) {
  2799. var _this = this;
  2800. e.preventDefault();
  2801. if (this.password.length > 0) {
  2802. axios.post('api/login', {
  2803. username: this.username,
  2804. password: this.password
  2805. }).then(function (response) {
  2806. localStorage.setItem('user', response.data.success.username);
  2807. localStorage.setItem('jwt', response.data.success.token);
  2808. if (localStorage.getItem('jwt') != null) {
  2809. _this.$router.go('/dashboard');
  2810. }
  2811. })["catch"](function (error) {
  2812. console.error(error);
  2813. });
  2814. }
  2815. }
  2816. },
  2817. beforeRouteEnter: function beforeRouteEnter(to, from, next) {
  2818. if (localStorage.getItem('jwt')) {
  2819. return next('dashboard');
  2820. }
  2821. next();
  2822. }
  2823. });
  2824. /***/ }),
  2825. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=script&lang=js&":
  2826. /*!*************************************************************************************************************************************************************!*\
  2827. !*** ./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& ***!
  2828. \*************************************************************************************************************************************************************/
  2829. /*! exports provided: default */
  2830. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2831. "use strict";
  2832. __webpack_require__.r(__webpack_exports__);
  2833. //
  2834. //
  2835. //
  2836. //
  2837. //
  2838. //
  2839. //
  2840. //
  2841. //
  2842. //
  2843. //
  2844. //
  2845. //
  2846. //
  2847. //
  2848. //
  2849. //
  2850. //
  2851. //
  2852. //
  2853. //
  2854. //
  2855. //
  2856. //
  2857. //
  2858. //
  2859. //
  2860. //
  2861. //
  2862. //
  2863. //
  2864. //
  2865. //
  2866. //
  2867. //
  2868. //
  2869. //
  2870. //
  2871. //
  2872. //
  2873. //
  2874. //
  2875. //
  2876. //
  2877. //
  2878. //
  2879. //
  2880. //
  2881. //
  2882. //
  2883. //
  2884. /* harmony default export */ __webpack_exports__["default"] = ({});
  2885. /***/ }),
  2886. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/WorkOrder.vue?vue&type=script&lang=js&":
  2887. /*!***************************************************************************************************************************************************************!*\
  2888. !*** ./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& ***!
  2889. \***************************************************************************************************************************************************************/
  2890. /*! exports provided: default */
  2891. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2892. "use strict";
  2893. __webpack_require__.r(__webpack_exports__);
  2894. /* harmony import */ var _components_WorkOrderInfo_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/WorkOrderInfo.vue */ "./resources/js/components/WorkOrderInfo.vue");
  2895. /* harmony import */ var _components_AssetInfo_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/AssetInfo.vue */ "./resources/js/components/AssetInfo.vue");
  2896. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  2897. /* harmony import */ var _components_CredentialList_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../components/CredentialList.vue */ "./resources/js/components/CredentialList.vue");
  2898. /* harmony import */ var _components_Notes_vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../components/Notes.vue */ "./resources/js/components/Notes.vue");
  2899. //
  2900. //
  2901. //
  2902. //
  2903. //
  2904. //
  2905. //
  2906. //
  2907. //
  2908. //
  2909. //
  2910. //
  2911. //
  2912. //
  2913. //
  2914. //
  2915. //
  2916. //
  2917. //
  2918. //
  2919. //
  2920. //
  2921. //
  2922. //
  2923. //
  2924. //
  2925. //
  2926. //
  2927. //
  2928. //
  2929. //
  2930. //
  2931. //
  2932. //
  2933. //
  2934. //
  2935. //
  2936. //
  2937. //
  2938. //
  2939. //
  2940. //
  2941. //
  2942. //
  2943. //
  2944. //
  2945. //
  2946. //
  2947. //
  2948. //
  2949. //
  2950. //
  2951. //
  2952. //
  2953. //
  2954. //
  2955. //
  2956. //
  2957. //
  2958. //
  2959. //
  2960. //
  2961. //
  2962. //
  2963. //
  2964. //
  2965. //
  2966. //
  2967. //
  2968. //
  2969. //
  2970. //
  2971. //
  2972. //
  2973. //
  2974. //
  2975. //
  2976. //
  2977. //
  2978. //
  2979. //
  2980. //
  2981. //
  2982. //
  2983. //
  2984. //
  2985. //
  2986. //
  2987. //
  2988. //
  2989. //
  2990. //
  2991. //
  2992. //
  2993. //
  2994. //
  2995. //
  2996. //
  2997. //
  2998. //
  2999. //
  3000. /* harmony default export */ __webpack_exports__["default"] = ({
  3001. components: {
  3002. WorkOrderInfo: _components_WorkOrderInfo_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  3003. AssetInfo: _components_AssetInfo_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
  3004. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_2__["default"],
  3005. CredentialList: _components_CredentialList_vue__WEBPACK_IMPORTED_MODULE_3__["default"],
  3006. Notes: _components_Notes_vue__WEBPACK_IMPORTED_MODULE_4__["default"]
  3007. },
  3008. props: {
  3009. id: {
  3010. type: String,
  3011. required: true
  3012. }
  3013. },
  3014. data: function data() {
  3015. return {
  3016. workOrder: {},
  3017. asset: {},
  3018. stores: {},
  3019. credentials: {},
  3020. credentialDescriptions: {},
  3021. workOrderNotes: [],
  3022. woLoading: true,
  3023. assetLoading: true,
  3024. storesLoading: true,
  3025. credentialsLoading: true,
  3026. credentialDescriptionsLoading: true,
  3027. workOrderNotesLoading: true,
  3028. authUser: localStorage.getItem('user')
  3029. };
  3030. },
  3031. computed: {
  3032. publicNotes: function publicNotes() {
  3033. var notes = [];
  3034. notes = this.workOrderNotes.filter(function (note) {
  3035. return note.notetype === 0;
  3036. });
  3037. return notes;
  3038. },
  3039. privateNotes: function privateNotes() {
  3040. var notes = [];
  3041. notes = this.workOrderNotes.filter(function (note) {
  3042. return note.notetype === 1;
  3043. });
  3044. return notes;
  3045. }
  3046. },
  3047. mounted: function mounted() {
  3048. var _this = this;
  3049. // Get authentication info from current user from local storage
  3050. var token = localStorage.getItem('jwt');
  3051. var user = localStorage.getItem('user'); // Set some axios config options for Content-Type and Authentication.
  3052. axios.defaults.headers.common['Content-Type'] = 'application/json';
  3053. axios.defaults.headers.common['Authorization'] = 'Bearer ' + token; // Get WorkOrder from API
  3054. axios.get('/api/workorders/' + this.id).then(function (response) {
  3055. _this.workOrder = response.data;
  3056. _this.woLoading = false;
  3057. })["catch"](function (error) {
  3058. console.log(error);
  3059. }); // Get list of stores from API
  3060. axios.get('/api/stores/').then(function (response) {
  3061. _this.stores = response.data;
  3062. _this.storesLoading = false;
  3063. })["catch"](function (error) {
  3064. console.log(error);
  3065. }); // Get Asset from API (will most likely be replaced with list of assets
  3066. // in the future. Current each WO can only have one but that is likely
  3067. // to change)
  3068. axios.get("/api/workorders/".concat(this.id, "/asset")).then(function (response) {
  3069. _this.asset = response.data;
  3070. _this.assetLoading = false; // Establish listener for liveupdate broadcasts.
  3071. // Must be done here or we can't guarantee this.asset
  3072. // exists by the time we execute this code.
  3073. Echo.channel('asset.' + _this.asset.pcid).listen('AssetUpdated', function (e) {
  3074. _this.asset = e.data;
  3075. }); // Get Credentials for this asset. May be relocated to be part of asset
  3076. // Component when WOs can have more than one asset.
  3077. axios.get("/api/assets/".concat(_this.asset.pcid, "/credentials")).then(function (response) {
  3078. _this.credentials = response.data;
  3079. _this.credentialsLoading = false;
  3080. })["catch"](function (error) {
  3081. console.log(error);
  3082. }); // Get default list of Credential Descriptions. May be relocated along with
  3083. // the above.
  3084. axios.get('/api/credentials/descriptions').then(function (response) {
  3085. _this.credentialDescriptions = response.data;
  3086. _this.credentialDescriptionsLoading = false;
  3087. })["catch"](function (error) {
  3088. console.log(error);
  3089. });
  3090. })["catch"](function (error) {
  3091. console.log(error);
  3092. });
  3093. axios.get("/api/workorders/".concat(this.id, "/notes")).then(function (response) {
  3094. _this.workOrderNotes = response.data;
  3095. _this.workOrderNotesLoading = false;
  3096. })["catch"](function (error) {
  3097. console.log(error);
  3098. });
  3099. Echo.channel('work-order.' + this.id).listen('WorkOrderUpdated', function (e) {
  3100. _this.workOrder = e.data;
  3101. });
  3102. Echo.channel('wonotes.' + this.id).listen('WorkOrderNoteAdded', function (e) {
  3103. _this.workOrderNotes.push(e.note);
  3104. }).listen('WorkOrderNoteUpdated', function (e) {
  3105. var index = _this.workOrderNotes.findIndex(function (note) {
  3106. return note.noteid === e.note.noteid;
  3107. }); // Note has to be edited this way, or else Vue cannot
  3108. // see it to recompute the computed values.
  3109. _this.workOrderNotes.splice(index, 1, e.note);
  3110. }).listen('WorkOrderNoteDeleted', function (e) {
  3111. var index = _this.notes.findIndex(function (note) {
  3112. return note.noteid === e.noteid;
  3113. });
  3114. _this.notes.splice(index, 1);
  3115. });
  3116. }
  3117. });
  3118. /***/ }),
  3119. /***/ "./node_modules/base64-js/index.js":
  3120. /*!*****************************************!*\
  3121. !*** ./node_modules/base64-js/index.js ***!
  3122. \*****************************************/
  3123. /*! no static exports found */
  3124. /***/ (function(module, exports, __webpack_require__) {
  3125. "use strict";
  3126. exports.byteLength = byteLength
  3127. exports.toByteArray = toByteArray
  3128. exports.fromByteArray = fromByteArray
  3129. var lookup = []
  3130. var revLookup = []
  3131. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  3132. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  3133. for (var i = 0, len = code.length; i < len; ++i) {
  3134. lookup[i] = code[i]
  3135. revLookup[code.charCodeAt(i)] = i
  3136. }
  3137. // Support decoding URL-safe base64 strings, as Node.js does.
  3138. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  3139. revLookup['-'.charCodeAt(0)] = 62
  3140. revLookup['_'.charCodeAt(0)] = 63
  3141. function getLens (b64) {
  3142. var len = b64.length
  3143. if (len % 4 > 0) {
  3144. throw new Error('Invalid string. Length must be a multiple of 4')
  3145. }
  3146. // Trim off extra bytes after placeholder bytes are found
  3147. // See: https://github.com/beatgammit/base64-js/issues/42
  3148. var validLen = b64.indexOf('=')
  3149. if (validLen === -1) validLen = len
  3150. var placeHoldersLen = validLen === len
  3151. ? 0
  3152. : 4 - (validLen % 4)
  3153. return [validLen, placeHoldersLen]
  3154. }
  3155. // base64 is 4/3 + up to two characters of the original data
  3156. function byteLength (b64) {
  3157. var lens = getLens(b64)
  3158. var validLen = lens[0]
  3159. var placeHoldersLen = lens[1]
  3160. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  3161. }
  3162. function _byteLength (b64, validLen, placeHoldersLen) {
  3163. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  3164. }
  3165. function toByteArray (b64) {
  3166. var tmp
  3167. var lens = getLens(b64)
  3168. var validLen = lens[0]
  3169. var placeHoldersLen = lens[1]
  3170. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  3171. var curByte = 0
  3172. // if there are placeholders, only get up to the last complete 4 chars
  3173. var len = placeHoldersLen > 0
  3174. ? validLen - 4
  3175. : validLen
  3176. var i
  3177. for (i = 0; i < len; i += 4) {
  3178. tmp =
  3179. (revLookup[b64.charCodeAt(i)] << 18) |
  3180. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  3181. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  3182. revLookup[b64.charCodeAt(i + 3)]
  3183. arr[curByte++] = (tmp >> 16) & 0xFF
  3184. arr[curByte++] = (tmp >> 8) & 0xFF
  3185. arr[curByte++] = tmp & 0xFF
  3186. }
  3187. if (placeHoldersLen === 2) {
  3188. tmp =
  3189. (revLookup[b64.charCodeAt(i)] << 2) |
  3190. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  3191. arr[curByte++] = tmp & 0xFF
  3192. }
  3193. if (placeHoldersLen === 1) {
  3194. tmp =
  3195. (revLookup[b64.charCodeAt(i)] << 10) |
  3196. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  3197. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  3198. arr[curByte++] = (tmp >> 8) & 0xFF
  3199. arr[curByte++] = tmp & 0xFF
  3200. }
  3201. return arr
  3202. }
  3203. function tripletToBase64 (num) {
  3204. return lookup[num >> 18 & 0x3F] +
  3205. lookup[num >> 12 & 0x3F] +
  3206. lookup[num >> 6 & 0x3F] +
  3207. lookup[num & 0x3F]
  3208. }
  3209. function encodeChunk (uint8, start, end) {
  3210. var tmp
  3211. var output = []
  3212. for (var i = start; i < end; i += 3) {
  3213. tmp =
  3214. ((uint8[i] << 16) & 0xFF0000) +
  3215. ((uint8[i + 1] << 8) & 0xFF00) +
  3216. (uint8[i + 2] & 0xFF)
  3217. output.push(tripletToBase64(tmp))
  3218. }
  3219. return output.join('')
  3220. }
  3221. function fromByteArray (uint8) {
  3222. var tmp
  3223. var len = uint8.length
  3224. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  3225. var parts = []
  3226. var maxChunkLength = 16383 // must be multiple of 3
  3227. // go through the array every three bytes, we'll deal with trailing stuff later
  3228. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  3229. parts.push(encodeChunk(
  3230. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  3231. ))
  3232. }
  3233. // pad the end with zeros, but make sure to not forget the extra bytes
  3234. if (extraBytes === 1) {
  3235. tmp = uint8[len - 1]
  3236. parts.push(
  3237. lookup[tmp >> 2] +
  3238. lookup[(tmp << 4) & 0x3F] +
  3239. '=='
  3240. )
  3241. } else if (extraBytes === 2) {
  3242. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  3243. parts.push(
  3244. lookup[tmp >> 10] +
  3245. lookup[(tmp >> 4) & 0x3F] +
  3246. lookup[(tmp << 2) & 0x3F] +
  3247. '='
  3248. )
  3249. }
  3250. return parts.join('')
  3251. }
  3252. /***/ }),
  3253. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  3254. /*!*****************************************************!*\
  3255. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  3256. \*****************************************************/
  3257. /*! no static exports found */
  3258. /***/ (function(module, exports, __webpack_require__) {
  3259. /*!
  3260. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  3261. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  3262. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  3263. */
  3264. (function (global, factory) {
  3265. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  3266. undefined;
  3267. }(this, (function (exports, $, Popper) { 'use strict';
  3268. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  3269. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  3270. function _defineProperties(target, props) {
  3271. for (var i = 0; i < props.length; i++) {
  3272. var descriptor = props[i];
  3273. descriptor.enumerable = descriptor.enumerable || false;
  3274. descriptor.configurable = true;
  3275. if ("value" in descriptor) descriptor.writable = true;
  3276. Object.defineProperty(target, descriptor.key, descriptor);
  3277. }
  3278. }
  3279. function _createClass(Constructor, protoProps, staticProps) {
  3280. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  3281. if (staticProps) _defineProperties(Constructor, staticProps);
  3282. return Constructor;
  3283. }
  3284. function _defineProperty(obj, key, value) {
  3285. if (key in obj) {
  3286. Object.defineProperty(obj, key, {
  3287. value: value,
  3288. enumerable: true,
  3289. configurable: true,
  3290. writable: true
  3291. });
  3292. } else {
  3293. obj[key] = value;
  3294. }
  3295. return obj;
  3296. }
  3297. function ownKeys(object, enumerableOnly) {
  3298. var keys = Object.keys(object);
  3299. if (Object.getOwnPropertySymbols) {
  3300. var symbols = Object.getOwnPropertySymbols(object);
  3301. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  3302. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  3303. });
  3304. keys.push.apply(keys, symbols);
  3305. }
  3306. return keys;
  3307. }
  3308. function _objectSpread2(target) {
  3309. for (var i = 1; i < arguments.length; i++) {
  3310. var source = arguments[i] != null ? arguments[i] : {};
  3311. if (i % 2) {
  3312. ownKeys(Object(source), true).forEach(function (key) {
  3313. _defineProperty(target, key, source[key]);
  3314. });
  3315. } else if (Object.getOwnPropertyDescriptors) {
  3316. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  3317. } else {
  3318. ownKeys(Object(source)).forEach(function (key) {
  3319. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  3320. });
  3321. }
  3322. }
  3323. return target;
  3324. }
  3325. function _inheritsLoose(subClass, superClass) {
  3326. subClass.prototype = Object.create(superClass.prototype);
  3327. subClass.prototype.constructor = subClass;
  3328. subClass.__proto__ = superClass;
  3329. }
  3330. /**
  3331. * --------------------------------------------------------------------------
  3332. * Bootstrap (v4.4.1): util.js
  3333. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  3334. * --------------------------------------------------------------------------
  3335. */
  3336. /**
  3337. * ------------------------------------------------------------------------
  3338. * Private TransitionEnd Helpers
  3339. * ------------------------------------------------------------------------
  3340. */
  3341. var TRANSITION_END = 'transitionend';
  3342. var MAX_UID = 1000000;
  3343. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  3344. function toType(obj) {
  3345. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  3346. }
  3347. function getSpecialTransitionEndEvent() {
  3348. return {
  3349. bindType: TRANSITION_END,
  3350. delegateType: TRANSITION_END,
  3351. handle: function handle(event) {
  3352. if ($(event.target).is(this)) {
  3353. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  3354. }
  3355. return undefined; // eslint-disable-line no-undefined
  3356. }
  3357. };
  3358. }
  3359. function transitionEndEmulator(duration) {
  3360. var _this = this;
  3361. var called = false;
  3362. $(this).one(Util.TRANSITION_END, function () {
  3363. called = true;
  3364. });
  3365. setTimeout(function () {
  3366. if (!called) {
  3367. Util.triggerTransitionEnd(_this);
  3368. }
  3369. }, duration);
  3370. return this;
  3371. }
  3372. function setTransitionEndSupport() {
  3373. $.fn.emulateTransitionEnd = transitionEndEmulator;
  3374. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  3375. }
  3376. /**
  3377. * --------------------------------------------------------------------------
  3378. * Public Util Api
  3379. * --------------------------------------------------------------------------
  3380. */
  3381. var Util = {
  3382. TRANSITION_END: 'bsTransitionEnd',
  3383. getUID: function getUID(prefix) {
  3384. do {
  3385. // eslint-disable-next-line no-bitwise
  3386. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  3387. } while (document.getElementById(prefix));
  3388. return prefix;
  3389. },
  3390. getSelectorFromElement: function getSelectorFromElement(element) {
  3391. var selector = element.getAttribute('data-target');
  3392. if (!selector || selector === '#') {
  3393. var hrefAttr = element.getAttribute('href');
  3394. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  3395. }
  3396. try {
  3397. return document.querySelector(selector) ? selector : null;
  3398. } catch (err) {
  3399. return null;
  3400. }
  3401. },
  3402. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  3403. if (!element) {
  3404. return 0;
  3405. } // Get transition-duration of the element
  3406. var transitionDuration = $(element).css('transition-duration');
  3407. var transitionDelay = $(element).css('transition-delay');
  3408. var floatTransitionDuration = parseFloat(transitionDuration);
  3409. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  3410. if (!floatTransitionDuration && !floatTransitionDelay) {
  3411. return 0;
  3412. } // If multiple durations are defined, take the first
  3413. transitionDuration = transitionDuration.split(',')[0];
  3414. transitionDelay = transitionDelay.split(',')[0];
  3415. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  3416. },
  3417. reflow: function reflow(element) {
  3418. return element.offsetHeight;
  3419. },
  3420. triggerTransitionEnd: function triggerTransitionEnd(element) {
  3421. $(element).trigger(TRANSITION_END);
  3422. },
  3423. // TODO: Remove in v5
  3424. supportsTransitionEnd: function supportsTransitionEnd() {
  3425. return Boolean(TRANSITION_END);
  3426. },
  3427. isElement: function isElement(obj) {
  3428. return (obj[0] || obj).nodeType;
  3429. },
  3430. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  3431. for (var property in configTypes) {
  3432. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  3433. var expectedTypes = configTypes[property];
  3434. var value = config[property];
  3435. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  3436. if (!new RegExp(expectedTypes).test(valueType)) {
  3437. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  3438. }
  3439. }
  3440. }
  3441. },
  3442. findShadowRoot: function findShadowRoot(element) {
  3443. if (!document.documentElement.attachShadow) {
  3444. return null;
  3445. } // Can find the shadow root otherwise it'll return the document
  3446. if (typeof element.getRootNode === 'function') {
  3447. var root = element.getRootNode();
  3448. return root instanceof ShadowRoot ? root : null;
  3449. }
  3450. if (element instanceof ShadowRoot) {
  3451. return element;
  3452. } // when we don't find a shadow root
  3453. if (!element.parentNode) {
  3454. return null;
  3455. }
  3456. return Util.findShadowRoot(element.parentNode);
  3457. },
  3458. jQueryDetection: function jQueryDetection() {
  3459. if (typeof $ === 'undefined') {
  3460. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  3461. }
  3462. var version = $.fn.jquery.split(' ')[0].split('.');
  3463. var minMajor = 1;
  3464. var ltMajor = 2;
  3465. var minMinor = 9;
  3466. var minPatch = 1;
  3467. var maxMajor = 4;
  3468. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  3469. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  3470. }
  3471. }
  3472. };
  3473. Util.jQueryDetection();
  3474. setTransitionEndSupport();
  3475. /**
  3476. * ------------------------------------------------------------------------
  3477. * Constants
  3478. * ------------------------------------------------------------------------
  3479. */
  3480. var NAME = 'alert';
  3481. var VERSION = '4.4.1';
  3482. var DATA_KEY = 'bs.alert';
  3483. var EVENT_KEY = "." + DATA_KEY;
  3484. var DATA_API_KEY = '.data-api';
  3485. var JQUERY_NO_CONFLICT = $.fn[NAME];
  3486. var Selector = {
  3487. DISMISS: '[data-dismiss="alert"]'
  3488. };
  3489. var Event = {
  3490. CLOSE: "close" + EVENT_KEY,
  3491. CLOSED: "closed" + EVENT_KEY,
  3492. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  3493. };
  3494. var ClassName = {
  3495. ALERT: 'alert',
  3496. FADE: 'fade',
  3497. SHOW: 'show'
  3498. };
  3499. /**
  3500. * ------------------------------------------------------------------------
  3501. * Class Definition
  3502. * ------------------------------------------------------------------------
  3503. */
  3504. var Alert =
  3505. /*#__PURE__*/
  3506. function () {
  3507. function Alert(element) {
  3508. this._element = element;
  3509. } // Getters
  3510. var _proto = Alert.prototype;
  3511. // Public
  3512. _proto.close = function close(element) {
  3513. var rootElement = this._element;
  3514. if (element) {
  3515. rootElement = this._getRootElement(element);
  3516. }
  3517. var customEvent = this._triggerCloseEvent(rootElement);
  3518. if (customEvent.isDefaultPrevented()) {
  3519. return;
  3520. }
  3521. this._removeElement(rootElement);
  3522. };
  3523. _proto.dispose = function dispose() {
  3524. $.removeData(this._element, DATA_KEY);
  3525. this._element = null;
  3526. } // Private
  3527. ;
  3528. _proto._getRootElement = function _getRootElement(element) {
  3529. var selector = Util.getSelectorFromElement(element);
  3530. var parent = false;
  3531. if (selector) {
  3532. parent = document.querySelector(selector);
  3533. }
  3534. if (!parent) {
  3535. parent = $(element).closest("." + ClassName.ALERT)[0];
  3536. }
  3537. return parent;
  3538. };
  3539. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  3540. var closeEvent = $.Event(Event.CLOSE);
  3541. $(element).trigger(closeEvent);
  3542. return closeEvent;
  3543. };
  3544. _proto._removeElement = function _removeElement(element) {
  3545. var _this = this;
  3546. $(element).removeClass(ClassName.SHOW);
  3547. if (!$(element).hasClass(ClassName.FADE)) {
  3548. this._destroyElement(element);
  3549. return;
  3550. }
  3551. var transitionDuration = Util.getTransitionDurationFromElement(element);
  3552. $(element).one(Util.TRANSITION_END, function (event) {
  3553. return _this._destroyElement(element, event);
  3554. }).emulateTransitionEnd(transitionDuration);
  3555. };
  3556. _proto._destroyElement = function _destroyElement(element) {
  3557. $(element).detach().trigger(Event.CLOSED).remove();
  3558. } // Static
  3559. ;
  3560. Alert._jQueryInterface = function _jQueryInterface(config) {
  3561. return this.each(function () {
  3562. var $element = $(this);
  3563. var data = $element.data(DATA_KEY);
  3564. if (!data) {
  3565. data = new Alert(this);
  3566. $element.data(DATA_KEY, data);
  3567. }
  3568. if (config === 'close') {
  3569. data[config](this);
  3570. }
  3571. });
  3572. };
  3573. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  3574. return function (event) {
  3575. if (event) {
  3576. event.preventDefault();
  3577. }
  3578. alertInstance.close(this);
  3579. };
  3580. };
  3581. _createClass(Alert, null, [{
  3582. key: "VERSION",
  3583. get: function get() {
  3584. return VERSION;
  3585. }
  3586. }]);
  3587. return Alert;
  3588. }();
  3589. /**
  3590. * ------------------------------------------------------------------------
  3591. * Data Api implementation
  3592. * ------------------------------------------------------------------------
  3593. */
  3594. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  3595. /**
  3596. * ------------------------------------------------------------------------
  3597. * jQuery
  3598. * ------------------------------------------------------------------------
  3599. */
  3600. $.fn[NAME] = Alert._jQueryInterface;
  3601. $.fn[NAME].Constructor = Alert;
  3602. $.fn[NAME].noConflict = function () {
  3603. $.fn[NAME] = JQUERY_NO_CONFLICT;
  3604. return Alert._jQueryInterface;
  3605. };
  3606. /**
  3607. * ------------------------------------------------------------------------
  3608. * Constants
  3609. * ------------------------------------------------------------------------
  3610. */
  3611. var NAME$1 = 'button';
  3612. var VERSION$1 = '4.4.1';
  3613. var DATA_KEY$1 = 'bs.button';
  3614. var EVENT_KEY$1 = "." + DATA_KEY$1;
  3615. var DATA_API_KEY$1 = '.data-api';
  3616. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  3617. var ClassName$1 = {
  3618. ACTIVE: 'active',
  3619. BUTTON: 'btn',
  3620. FOCUS: 'focus'
  3621. };
  3622. var Selector$1 = {
  3623. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  3624. DATA_TOGGLES: '[data-toggle="buttons"]',
  3625. DATA_TOGGLE: '[data-toggle="button"]',
  3626. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  3627. INPUT: 'input:not([type="hidden"])',
  3628. ACTIVE: '.active',
  3629. BUTTON: '.btn'
  3630. };
  3631. var Event$1 = {
  3632. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  3633. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  3634. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  3635. };
  3636. /**
  3637. * ------------------------------------------------------------------------
  3638. * Class Definition
  3639. * ------------------------------------------------------------------------
  3640. */
  3641. var Button =
  3642. /*#__PURE__*/
  3643. function () {
  3644. function Button(element) {
  3645. this._element = element;
  3646. } // Getters
  3647. var _proto = Button.prototype;
  3648. // Public
  3649. _proto.toggle = function toggle() {
  3650. var triggerChangeEvent = true;
  3651. var addAriaPressed = true;
  3652. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  3653. if (rootElement) {
  3654. var input = this._element.querySelector(Selector$1.INPUT);
  3655. if (input) {
  3656. if (input.type === 'radio') {
  3657. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  3658. triggerChangeEvent = false;
  3659. } else {
  3660. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  3661. if (activeElement) {
  3662. $(activeElement).removeClass(ClassName$1.ACTIVE);
  3663. }
  3664. }
  3665. } else if (input.type === 'checkbox') {
  3666. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  3667. triggerChangeEvent = false;
  3668. }
  3669. } else {
  3670. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  3671. triggerChangeEvent = false;
  3672. }
  3673. if (triggerChangeEvent) {
  3674. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  3675. $(input).trigger('change');
  3676. }
  3677. input.focus();
  3678. addAriaPressed = false;
  3679. }
  3680. }
  3681. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  3682. if (addAriaPressed) {
  3683. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  3684. }
  3685. if (triggerChangeEvent) {
  3686. $(this._element).toggleClass(ClassName$1.ACTIVE);
  3687. }
  3688. }
  3689. };
  3690. _proto.dispose = function dispose() {
  3691. $.removeData(this._element, DATA_KEY$1);
  3692. this._element = null;
  3693. } // Static
  3694. ;
  3695. Button._jQueryInterface = function _jQueryInterface(config) {
  3696. return this.each(function () {
  3697. var data = $(this).data(DATA_KEY$1);
  3698. if (!data) {
  3699. data = new Button(this);
  3700. $(this).data(DATA_KEY$1, data);
  3701. }
  3702. if (config === 'toggle') {
  3703. data[config]();
  3704. }
  3705. });
  3706. };
  3707. _createClass(Button, null, [{
  3708. key: "VERSION",
  3709. get: function get() {
  3710. return VERSION$1;
  3711. }
  3712. }]);
  3713. return Button;
  3714. }();
  3715. /**
  3716. * ------------------------------------------------------------------------
  3717. * Data Api implementation
  3718. * ------------------------------------------------------------------------
  3719. */
  3720. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  3721. var button = event.target;
  3722. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  3723. button = $(button).closest(Selector$1.BUTTON)[0];
  3724. }
  3725. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  3726. event.preventDefault(); // work around Firefox bug #1540995
  3727. } else {
  3728. var inputBtn = button.querySelector(Selector$1.INPUT);
  3729. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  3730. event.preventDefault(); // work around Firefox bug #1540995
  3731. return;
  3732. }
  3733. Button._jQueryInterface.call($(button), 'toggle');
  3734. }
  3735. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  3736. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  3737. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  3738. });
  3739. $(window).on(Event$1.LOAD_DATA_API, function () {
  3740. // ensure correct active class is set to match the controls' actual values/states
  3741. // find all checkboxes/readio buttons inside data-toggle groups
  3742. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  3743. for (var i = 0, len = buttons.length; i < len; i++) {
  3744. var button = buttons[i];
  3745. var input = button.querySelector(Selector$1.INPUT);
  3746. if (input.checked || input.hasAttribute('checked')) {
  3747. button.classList.add(ClassName$1.ACTIVE);
  3748. } else {
  3749. button.classList.remove(ClassName$1.ACTIVE);
  3750. }
  3751. } // find all button toggles
  3752. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  3753. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  3754. var _button = buttons[_i];
  3755. if (_button.getAttribute('aria-pressed') === 'true') {
  3756. _button.classList.add(ClassName$1.ACTIVE);
  3757. } else {
  3758. _button.classList.remove(ClassName$1.ACTIVE);
  3759. }
  3760. }
  3761. });
  3762. /**
  3763. * ------------------------------------------------------------------------
  3764. * jQuery
  3765. * ------------------------------------------------------------------------
  3766. */
  3767. $.fn[NAME$1] = Button._jQueryInterface;
  3768. $.fn[NAME$1].Constructor = Button;
  3769. $.fn[NAME$1].noConflict = function () {
  3770. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  3771. return Button._jQueryInterface;
  3772. };
  3773. /**
  3774. * ------------------------------------------------------------------------
  3775. * Constants
  3776. * ------------------------------------------------------------------------
  3777. */
  3778. var NAME$2 = 'carousel';
  3779. var VERSION$2 = '4.4.1';
  3780. var DATA_KEY$2 = 'bs.carousel';
  3781. var EVENT_KEY$2 = "." + DATA_KEY$2;
  3782. var DATA_API_KEY$2 = '.data-api';
  3783. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  3784. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  3785. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  3786. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  3787. var SWIPE_THRESHOLD = 40;
  3788. var Default = {
  3789. interval: 5000,
  3790. keyboard: true,
  3791. slide: false,
  3792. pause: 'hover',
  3793. wrap: true,
  3794. touch: true
  3795. };
  3796. var DefaultType = {
  3797. interval: '(number|boolean)',
  3798. keyboard: 'boolean',
  3799. slide: '(boolean|string)',
  3800. pause: '(string|boolean)',
  3801. wrap: 'boolean',
  3802. touch: 'boolean'
  3803. };
  3804. var Direction = {
  3805. NEXT: 'next',
  3806. PREV: 'prev',
  3807. LEFT: 'left',
  3808. RIGHT: 'right'
  3809. };
  3810. var Event$2 = {
  3811. SLIDE: "slide" + EVENT_KEY$2,
  3812. SLID: "slid" + EVENT_KEY$2,
  3813. KEYDOWN: "keydown" + EVENT_KEY$2,
  3814. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  3815. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  3816. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  3817. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  3818. TOUCHEND: "touchend" + EVENT_KEY$2,
  3819. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  3820. POINTERUP: "pointerup" + EVENT_KEY$2,
  3821. DRAG_START: "dragstart" + EVENT_KEY$2,
  3822. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  3823. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  3824. };
  3825. var ClassName$2 = {
  3826. CAROUSEL: 'carousel',
  3827. ACTIVE: 'active',
  3828. SLIDE: 'slide',
  3829. RIGHT: 'carousel-item-right',
  3830. LEFT: 'carousel-item-left',
  3831. NEXT: 'carousel-item-next',
  3832. PREV: 'carousel-item-prev',
  3833. ITEM: 'carousel-item',
  3834. POINTER_EVENT: 'pointer-event'
  3835. };
  3836. var Selector$2 = {
  3837. ACTIVE: '.active',
  3838. ACTIVE_ITEM: '.active.carousel-item',
  3839. ITEM: '.carousel-item',
  3840. ITEM_IMG: '.carousel-item img',
  3841. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  3842. INDICATORS: '.carousel-indicators',
  3843. DATA_SLIDE: '[data-slide], [data-slide-to]',
  3844. DATA_RIDE: '[data-ride="carousel"]'
  3845. };
  3846. var PointerType = {
  3847. TOUCH: 'touch',
  3848. PEN: 'pen'
  3849. };
  3850. /**
  3851. * ------------------------------------------------------------------------
  3852. * Class Definition
  3853. * ------------------------------------------------------------------------
  3854. */
  3855. var Carousel =
  3856. /*#__PURE__*/
  3857. function () {
  3858. function Carousel(element, config) {
  3859. this._items = null;
  3860. this._interval = null;
  3861. this._activeElement = null;
  3862. this._isPaused = false;
  3863. this._isSliding = false;
  3864. this.touchTimeout = null;
  3865. this.touchStartX = 0;
  3866. this.touchDeltaX = 0;
  3867. this._config = this._getConfig(config);
  3868. this._element = element;
  3869. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  3870. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  3871. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  3872. this._addEventListeners();
  3873. } // Getters
  3874. var _proto = Carousel.prototype;
  3875. // Public
  3876. _proto.next = function next() {
  3877. if (!this._isSliding) {
  3878. this._slide(Direction.NEXT);
  3879. }
  3880. };
  3881. _proto.nextWhenVisible = function nextWhenVisible() {
  3882. // Don't call next when the page isn't visible
  3883. // or the carousel or its parent isn't visible
  3884. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  3885. this.next();
  3886. }
  3887. };
  3888. _proto.prev = function prev() {
  3889. if (!this._isSliding) {
  3890. this._slide(Direction.PREV);
  3891. }
  3892. };
  3893. _proto.pause = function pause(event) {
  3894. if (!event) {
  3895. this._isPaused = true;
  3896. }
  3897. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  3898. Util.triggerTransitionEnd(this._element);
  3899. this.cycle(true);
  3900. }
  3901. clearInterval(this._interval);
  3902. this._interval = null;
  3903. };
  3904. _proto.cycle = function cycle(event) {
  3905. if (!event) {
  3906. this._isPaused = false;
  3907. }
  3908. if (this._interval) {
  3909. clearInterval(this._interval);
  3910. this._interval = null;
  3911. }
  3912. if (this._config.interval && !this._isPaused) {
  3913. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  3914. }
  3915. };
  3916. _proto.to = function to(index) {
  3917. var _this = this;
  3918. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3919. var activeIndex = this._getItemIndex(this._activeElement);
  3920. if (index > this._items.length - 1 || index < 0) {
  3921. return;
  3922. }
  3923. if (this._isSliding) {
  3924. $(this._element).one(Event$2.SLID, function () {
  3925. return _this.to(index);
  3926. });
  3927. return;
  3928. }
  3929. if (activeIndex === index) {
  3930. this.pause();
  3931. this.cycle();
  3932. return;
  3933. }
  3934. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  3935. this._slide(direction, this._items[index]);
  3936. };
  3937. _proto.dispose = function dispose() {
  3938. $(this._element).off(EVENT_KEY$2);
  3939. $.removeData(this._element, DATA_KEY$2);
  3940. this._items = null;
  3941. this._config = null;
  3942. this._element = null;
  3943. this._interval = null;
  3944. this._isPaused = null;
  3945. this._isSliding = null;
  3946. this._activeElement = null;
  3947. this._indicatorsElement = null;
  3948. } // Private
  3949. ;
  3950. _proto._getConfig = function _getConfig(config) {
  3951. config = _objectSpread2({}, Default, {}, config);
  3952. Util.typeCheckConfig(NAME$2, config, DefaultType);
  3953. return config;
  3954. };
  3955. _proto._handleSwipe = function _handleSwipe() {
  3956. var absDeltax = Math.abs(this.touchDeltaX);
  3957. if (absDeltax <= SWIPE_THRESHOLD) {
  3958. return;
  3959. }
  3960. var direction = absDeltax / this.touchDeltaX;
  3961. this.touchDeltaX = 0; // swipe left
  3962. if (direction > 0) {
  3963. this.prev();
  3964. } // swipe right
  3965. if (direction < 0) {
  3966. this.next();
  3967. }
  3968. };
  3969. _proto._addEventListeners = function _addEventListeners() {
  3970. var _this2 = this;
  3971. if (this._config.keyboard) {
  3972. $(this._element).on(Event$2.KEYDOWN, function (event) {
  3973. return _this2._keydown(event);
  3974. });
  3975. }
  3976. if (this._config.pause === 'hover') {
  3977. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  3978. return _this2.pause(event);
  3979. }).on(Event$2.MOUSELEAVE, function (event) {
  3980. return _this2.cycle(event);
  3981. });
  3982. }
  3983. if (this._config.touch) {
  3984. this._addTouchEventListeners();
  3985. }
  3986. };
  3987. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  3988. var _this3 = this;
  3989. if (!this._touchSupported) {
  3990. return;
  3991. }
  3992. var start = function start(event) {
  3993. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3994. _this3.touchStartX = event.originalEvent.clientX;
  3995. } else if (!_this3._pointerEvent) {
  3996. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  3997. }
  3998. };
  3999. var move = function move(event) {
  4000. // ensure swiping with one touch and not pinching
  4001. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  4002. _this3.touchDeltaX = 0;
  4003. } else {
  4004. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  4005. }
  4006. };
  4007. var end = function end(event) {
  4008. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  4009. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  4010. }
  4011. _this3._handleSwipe();
  4012. if (_this3._config.pause === 'hover') {
  4013. // If it's a touch-enabled device, mouseenter/leave are fired as
  4014. // part of the mouse compatibility events on first tap - the carousel
  4015. // would stop cycling until user tapped out of it;
  4016. // here, we listen for touchend, explicitly pause the carousel
  4017. // (as if it's the second time we tap on it, mouseenter compat event
  4018. // is NOT fired) and after a timeout (to allow for mouse compatibility
  4019. // events to fire) we explicitly restart cycling
  4020. _this3.pause();
  4021. if (_this3.touchTimeout) {
  4022. clearTimeout(_this3.touchTimeout);
  4023. }
  4024. _this3.touchTimeout = setTimeout(function (event) {
  4025. return _this3.cycle(event);
  4026. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  4027. }
  4028. };
  4029. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  4030. return e.preventDefault();
  4031. });
  4032. if (this._pointerEvent) {
  4033. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  4034. return start(event);
  4035. });
  4036. $(this._element).on(Event$2.POINTERUP, function (event) {
  4037. return end(event);
  4038. });
  4039. this._element.classList.add(ClassName$2.POINTER_EVENT);
  4040. } else {
  4041. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  4042. return start(event);
  4043. });
  4044. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  4045. return move(event);
  4046. });
  4047. $(this._element).on(Event$2.TOUCHEND, function (event) {
  4048. return end(event);
  4049. });
  4050. }
  4051. };
  4052. _proto._keydown = function _keydown(event) {
  4053. if (/input|textarea/i.test(event.target.tagName)) {
  4054. return;
  4055. }
  4056. switch (event.which) {
  4057. case ARROW_LEFT_KEYCODE:
  4058. event.preventDefault();
  4059. this.prev();
  4060. break;
  4061. case ARROW_RIGHT_KEYCODE:
  4062. event.preventDefault();
  4063. this.next();
  4064. break;
  4065. }
  4066. };
  4067. _proto._getItemIndex = function _getItemIndex(element) {
  4068. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  4069. return this._items.indexOf(element);
  4070. };
  4071. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  4072. var isNextDirection = direction === Direction.NEXT;
  4073. var isPrevDirection = direction === Direction.PREV;
  4074. var activeIndex = this._getItemIndex(activeElement);
  4075. var lastItemIndex = this._items.length - 1;
  4076. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  4077. if (isGoingToWrap && !this._config.wrap) {
  4078. return activeElement;
  4079. }
  4080. var delta = direction === Direction.PREV ? -1 : 1;
  4081. var itemIndex = (activeIndex + delta) % this._items.length;
  4082. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  4083. };
  4084. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  4085. var targetIndex = this._getItemIndex(relatedTarget);
  4086. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  4087. var slideEvent = $.Event(Event$2.SLIDE, {
  4088. relatedTarget: relatedTarget,
  4089. direction: eventDirectionName,
  4090. from: fromIndex,
  4091. to: targetIndex
  4092. });
  4093. $(this._element).trigger(slideEvent);
  4094. return slideEvent;
  4095. };
  4096. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  4097. if (this._indicatorsElement) {
  4098. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  4099. $(indicators).removeClass(ClassName$2.ACTIVE);
  4100. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  4101. if (nextIndicator) {
  4102. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  4103. }
  4104. }
  4105. };
  4106. _proto._slide = function _slide(direction, element) {
  4107. var _this4 = this;
  4108. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  4109. var activeElementIndex = this._getItemIndex(activeElement);
  4110. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  4111. var nextElementIndex = this._getItemIndex(nextElement);
  4112. var isCycling = Boolean(this._interval);
  4113. var directionalClassName;
  4114. var orderClassName;
  4115. var eventDirectionName;
  4116. if (direction === Direction.NEXT) {
  4117. directionalClassName = ClassName$2.LEFT;
  4118. orderClassName = ClassName$2.NEXT;
  4119. eventDirectionName = Direction.LEFT;
  4120. } else {
  4121. directionalClassName = ClassName$2.RIGHT;
  4122. orderClassName = ClassName$2.PREV;
  4123. eventDirectionName = Direction.RIGHT;
  4124. }
  4125. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  4126. this._isSliding = false;
  4127. return;
  4128. }
  4129. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  4130. if (slideEvent.isDefaultPrevented()) {
  4131. return;
  4132. }
  4133. if (!activeElement || !nextElement) {
  4134. // Some weirdness is happening, so we bail
  4135. return;
  4136. }
  4137. this._isSliding = true;
  4138. if (isCycling) {
  4139. this.pause();
  4140. }
  4141. this._setActiveIndicatorElement(nextElement);
  4142. var slidEvent = $.Event(Event$2.SLID, {
  4143. relatedTarget: nextElement,
  4144. direction: eventDirectionName,
  4145. from: activeElementIndex,
  4146. to: nextElementIndex
  4147. });
  4148. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  4149. $(nextElement).addClass(orderClassName);
  4150. Util.reflow(nextElement);
  4151. $(activeElement).addClass(directionalClassName);
  4152. $(nextElement).addClass(directionalClassName);
  4153. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  4154. if (nextElementInterval) {
  4155. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  4156. this._config.interval = nextElementInterval;
  4157. } else {
  4158. this._config.interval = this._config.defaultInterval || this._config.interval;
  4159. }
  4160. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  4161. $(activeElement).one(Util.TRANSITION_END, function () {
  4162. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  4163. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  4164. _this4._isSliding = false;
  4165. setTimeout(function () {
  4166. return $(_this4._element).trigger(slidEvent);
  4167. }, 0);
  4168. }).emulateTransitionEnd(transitionDuration);
  4169. } else {
  4170. $(activeElement).removeClass(ClassName$2.ACTIVE);
  4171. $(nextElement).addClass(ClassName$2.ACTIVE);
  4172. this._isSliding = false;
  4173. $(this._element).trigger(slidEvent);
  4174. }
  4175. if (isCycling) {
  4176. this.cycle();
  4177. }
  4178. } // Static
  4179. ;
  4180. Carousel._jQueryInterface = function _jQueryInterface(config) {
  4181. return this.each(function () {
  4182. var data = $(this).data(DATA_KEY$2);
  4183. var _config = _objectSpread2({}, Default, {}, $(this).data());
  4184. if (typeof config === 'object') {
  4185. _config = _objectSpread2({}, _config, {}, config);
  4186. }
  4187. var action = typeof config === 'string' ? config : _config.slide;
  4188. if (!data) {
  4189. data = new Carousel(this, _config);
  4190. $(this).data(DATA_KEY$2, data);
  4191. }
  4192. if (typeof config === 'number') {
  4193. data.to(config);
  4194. } else if (typeof action === 'string') {
  4195. if (typeof data[action] === 'undefined') {
  4196. throw new TypeError("No method named \"" + action + "\"");
  4197. }
  4198. data[action]();
  4199. } else if (_config.interval && _config.ride) {
  4200. data.pause();
  4201. data.cycle();
  4202. }
  4203. });
  4204. };
  4205. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  4206. var selector = Util.getSelectorFromElement(this);
  4207. if (!selector) {
  4208. return;
  4209. }
  4210. var target = $(selector)[0];
  4211. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  4212. return;
  4213. }
  4214. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  4215. var slideIndex = this.getAttribute('data-slide-to');
  4216. if (slideIndex) {
  4217. config.interval = false;
  4218. }
  4219. Carousel._jQueryInterface.call($(target), config);
  4220. if (slideIndex) {
  4221. $(target).data(DATA_KEY$2).to(slideIndex);
  4222. }
  4223. event.preventDefault();
  4224. };
  4225. _createClass(Carousel, null, [{
  4226. key: "VERSION",
  4227. get: function get() {
  4228. return VERSION$2;
  4229. }
  4230. }, {
  4231. key: "Default",
  4232. get: function get() {
  4233. return Default;
  4234. }
  4235. }]);
  4236. return Carousel;
  4237. }();
  4238. /**
  4239. * ------------------------------------------------------------------------
  4240. * Data Api implementation
  4241. * ------------------------------------------------------------------------
  4242. */
  4243. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  4244. $(window).on(Event$2.LOAD_DATA_API, function () {
  4245. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  4246. for (var i = 0, len = carousels.length; i < len; i++) {
  4247. var $carousel = $(carousels[i]);
  4248. Carousel._jQueryInterface.call($carousel, $carousel.data());
  4249. }
  4250. });
  4251. /**
  4252. * ------------------------------------------------------------------------
  4253. * jQuery
  4254. * ------------------------------------------------------------------------
  4255. */
  4256. $.fn[NAME$2] = Carousel._jQueryInterface;
  4257. $.fn[NAME$2].Constructor = Carousel;
  4258. $.fn[NAME$2].noConflict = function () {
  4259. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  4260. return Carousel._jQueryInterface;
  4261. };
  4262. /**
  4263. * ------------------------------------------------------------------------
  4264. * Constants
  4265. * ------------------------------------------------------------------------
  4266. */
  4267. var NAME$3 = 'collapse';
  4268. var VERSION$3 = '4.4.1';
  4269. var DATA_KEY$3 = 'bs.collapse';
  4270. var EVENT_KEY$3 = "." + DATA_KEY$3;
  4271. var DATA_API_KEY$3 = '.data-api';
  4272. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  4273. var Default$1 = {
  4274. toggle: true,
  4275. parent: ''
  4276. };
  4277. var DefaultType$1 = {
  4278. toggle: 'boolean',
  4279. parent: '(string|element)'
  4280. };
  4281. var Event$3 = {
  4282. SHOW: "show" + EVENT_KEY$3,
  4283. SHOWN: "shown" + EVENT_KEY$3,
  4284. HIDE: "hide" + EVENT_KEY$3,
  4285. HIDDEN: "hidden" + EVENT_KEY$3,
  4286. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  4287. };
  4288. var ClassName$3 = {
  4289. SHOW: 'show',
  4290. COLLAPSE: 'collapse',
  4291. COLLAPSING: 'collapsing',
  4292. COLLAPSED: 'collapsed'
  4293. };
  4294. var Dimension = {
  4295. WIDTH: 'width',
  4296. HEIGHT: 'height'
  4297. };
  4298. var Selector$3 = {
  4299. ACTIVES: '.show, .collapsing',
  4300. DATA_TOGGLE: '[data-toggle="collapse"]'
  4301. };
  4302. /**
  4303. * ------------------------------------------------------------------------
  4304. * Class Definition
  4305. * ------------------------------------------------------------------------
  4306. */
  4307. var Collapse =
  4308. /*#__PURE__*/
  4309. function () {
  4310. function Collapse(element, config) {
  4311. this._isTransitioning = false;
  4312. this._element = element;
  4313. this._config = this._getConfig(config);
  4314. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  4315. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  4316. for (var i = 0, len = toggleList.length; i < len; i++) {
  4317. var elem = toggleList[i];
  4318. var selector = Util.getSelectorFromElement(elem);
  4319. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  4320. return foundElem === element;
  4321. });
  4322. if (selector !== null && filterElement.length > 0) {
  4323. this._selector = selector;
  4324. this._triggerArray.push(elem);
  4325. }
  4326. }
  4327. this._parent = this._config.parent ? this._getParent() : null;
  4328. if (!this._config.parent) {
  4329. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  4330. }
  4331. if (this._config.toggle) {
  4332. this.toggle();
  4333. }
  4334. } // Getters
  4335. var _proto = Collapse.prototype;
  4336. // Public
  4337. _proto.toggle = function toggle() {
  4338. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  4339. this.hide();
  4340. } else {
  4341. this.show();
  4342. }
  4343. };
  4344. _proto.show = function show() {
  4345. var _this = this;
  4346. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  4347. return;
  4348. }
  4349. var actives;
  4350. var activesData;
  4351. if (this._parent) {
  4352. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  4353. if (typeof _this._config.parent === 'string') {
  4354. return elem.getAttribute('data-parent') === _this._config.parent;
  4355. }
  4356. return elem.classList.contains(ClassName$3.COLLAPSE);
  4357. });
  4358. if (actives.length === 0) {
  4359. actives = null;
  4360. }
  4361. }
  4362. if (actives) {
  4363. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  4364. if (activesData && activesData._isTransitioning) {
  4365. return;
  4366. }
  4367. }
  4368. var startEvent = $.Event(Event$3.SHOW);
  4369. $(this._element).trigger(startEvent);
  4370. if (startEvent.isDefaultPrevented()) {
  4371. return;
  4372. }
  4373. if (actives) {
  4374. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  4375. if (!activesData) {
  4376. $(actives).data(DATA_KEY$3, null);
  4377. }
  4378. }
  4379. var dimension = this._getDimension();
  4380. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  4381. this._element.style[dimension] = 0;
  4382. if (this._triggerArray.length) {
  4383. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  4384. }
  4385. this.setTransitioning(true);
  4386. var complete = function complete() {
  4387. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  4388. _this._element.style[dimension] = '';
  4389. _this.setTransitioning(false);
  4390. $(_this._element).trigger(Event$3.SHOWN);
  4391. };
  4392. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  4393. var scrollSize = "scroll" + capitalizedDimension;
  4394. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4395. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4396. this._element.style[dimension] = this._element[scrollSize] + "px";
  4397. };
  4398. _proto.hide = function hide() {
  4399. var _this2 = this;
  4400. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  4401. return;
  4402. }
  4403. var startEvent = $.Event(Event$3.HIDE);
  4404. $(this._element).trigger(startEvent);
  4405. if (startEvent.isDefaultPrevented()) {
  4406. return;
  4407. }
  4408. var dimension = this._getDimension();
  4409. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  4410. Util.reflow(this._element);
  4411. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  4412. var triggerArrayLength = this._triggerArray.length;
  4413. if (triggerArrayLength > 0) {
  4414. for (var i = 0; i < triggerArrayLength; i++) {
  4415. var trigger = this._triggerArray[i];
  4416. var selector = Util.getSelectorFromElement(trigger);
  4417. if (selector !== null) {
  4418. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  4419. if (!$elem.hasClass(ClassName$3.SHOW)) {
  4420. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  4421. }
  4422. }
  4423. }
  4424. }
  4425. this.setTransitioning(true);
  4426. var complete = function complete() {
  4427. _this2.setTransitioning(false);
  4428. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  4429. };
  4430. this._element.style[dimension] = '';
  4431. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4432. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4433. };
  4434. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  4435. this._isTransitioning = isTransitioning;
  4436. };
  4437. _proto.dispose = function dispose() {
  4438. $.removeData(this._element, DATA_KEY$3);
  4439. this._config = null;
  4440. this._parent = null;
  4441. this._element = null;
  4442. this._triggerArray = null;
  4443. this._isTransitioning = null;
  4444. } // Private
  4445. ;
  4446. _proto._getConfig = function _getConfig(config) {
  4447. config = _objectSpread2({}, Default$1, {}, config);
  4448. config.toggle = Boolean(config.toggle); // Coerce string values
  4449. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  4450. return config;
  4451. };
  4452. _proto._getDimension = function _getDimension() {
  4453. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  4454. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  4455. };
  4456. _proto._getParent = function _getParent() {
  4457. var _this3 = this;
  4458. var parent;
  4459. if (Util.isElement(this._config.parent)) {
  4460. parent = this._config.parent; // It's a jQuery object
  4461. if (typeof this._config.parent.jquery !== 'undefined') {
  4462. parent = this._config.parent[0];
  4463. }
  4464. } else {
  4465. parent = document.querySelector(this._config.parent);
  4466. }
  4467. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  4468. var children = [].slice.call(parent.querySelectorAll(selector));
  4469. $(children).each(function (i, element) {
  4470. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  4471. });
  4472. return parent;
  4473. };
  4474. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  4475. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  4476. if (triggerArray.length) {
  4477. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  4478. }
  4479. } // Static
  4480. ;
  4481. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  4482. var selector = Util.getSelectorFromElement(element);
  4483. return selector ? document.querySelector(selector) : null;
  4484. };
  4485. Collapse._jQueryInterface = function _jQueryInterface(config) {
  4486. return this.each(function () {
  4487. var $this = $(this);
  4488. var data = $this.data(DATA_KEY$3);
  4489. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  4490. if (!data && _config.toggle && /show|hide/.test(config)) {
  4491. _config.toggle = false;
  4492. }
  4493. if (!data) {
  4494. data = new Collapse(this, _config);
  4495. $this.data(DATA_KEY$3, data);
  4496. }
  4497. if (typeof config === 'string') {
  4498. if (typeof data[config] === 'undefined') {
  4499. throw new TypeError("No method named \"" + config + "\"");
  4500. }
  4501. data[config]();
  4502. }
  4503. });
  4504. };
  4505. _createClass(Collapse, null, [{
  4506. key: "VERSION",
  4507. get: function get() {
  4508. return VERSION$3;
  4509. }
  4510. }, {
  4511. key: "Default",
  4512. get: function get() {
  4513. return Default$1;
  4514. }
  4515. }]);
  4516. return Collapse;
  4517. }();
  4518. /**
  4519. * ------------------------------------------------------------------------
  4520. * Data Api implementation
  4521. * ------------------------------------------------------------------------
  4522. */
  4523. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  4524. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  4525. if (event.currentTarget.tagName === 'A') {
  4526. event.preventDefault();
  4527. }
  4528. var $trigger = $(this);
  4529. var selector = Util.getSelectorFromElement(this);
  4530. var selectors = [].slice.call(document.querySelectorAll(selector));
  4531. $(selectors).each(function () {
  4532. var $target = $(this);
  4533. var data = $target.data(DATA_KEY$3);
  4534. var config = data ? 'toggle' : $trigger.data();
  4535. Collapse._jQueryInterface.call($target, config);
  4536. });
  4537. });
  4538. /**
  4539. * ------------------------------------------------------------------------
  4540. * jQuery
  4541. * ------------------------------------------------------------------------
  4542. */
  4543. $.fn[NAME$3] = Collapse._jQueryInterface;
  4544. $.fn[NAME$3].Constructor = Collapse;
  4545. $.fn[NAME$3].noConflict = function () {
  4546. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  4547. return Collapse._jQueryInterface;
  4548. };
  4549. /**
  4550. * ------------------------------------------------------------------------
  4551. * Constants
  4552. * ------------------------------------------------------------------------
  4553. */
  4554. var NAME$4 = 'dropdown';
  4555. var VERSION$4 = '4.4.1';
  4556. var DATA_KEY$4 = 'bs.dropdown';
  4557. var EVENT_KEY$4 = "." + DATA_KEY$4;
  4558. var DATA_API_KEY$4 = '.data-api';
  4559. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  4560. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  4561. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  4562. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  4563. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  4564. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  4565. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  4566. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  4567. var Event$4 = {
  4568. HIDE: "hide" + EVENT_KEY$4,
  4569. HIDDEN: "hidden" + EVENT_KEY$4,
  4570. SHOW: "show" + EVENT_KEY$4,
  4571. SHOWN: "shown" + EVENT_KEY$4,
  4572. CLICK: "click" + EVENT_KEY$4,
  4573. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  4574. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  4575. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  4576. };
  4577. var ClassName$4 = {
  4578. DISABLED: 'disabled',
  4579. SHOW: 'show',
  4580. DROPUP: 'dropup',
  4581. DROPRIGHT: 'dropright',
  4582. DROPLEFT: 'dropleft',
  4583. MENURIGHT: 'dropdown-menu-right',
  4584. MENULEFT: 'dropdown-menu-left',
  4585. POSITION_STATIC: 'position-static'
  4586. };
  4587. var Selector$4 = {
  4588. DATA_TOGGLE: '[data-toggle="dropdown"]',
  4589. FORM_CHILD: '.dropdown form',
  4590. MENU: '.dropdown-menu',
  4591. NAVBAR_NAV: '.navbar-nav',
  4592. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  4593. };
  4594. var AttachmentMap = {
  4595. TOP: 'top-start',
  4596. TOPEND: 'top-end',
  4597. BOTTOM: 'bottom-start',
  4598. BOTTOMEND: 'bottom-end',
  4599. RIGHT: 'right-start',
  4600. RIGHTEND: 'right-end',
  4601. LEFT: 'left-start',
  4602. LEFTEND: 'left-end'
  4603. };
  4604. var Default$2 = {
  4605. offset: 0,
  4606. flip: true,
  4607. boundary: 'scrollParent',
  4608. reference: 'toggle',
  4609. display: 'dynamic',
  4610. popperConfig: null
  4611. };
  4612. var DefaultType$2 = {
  4613. offset: '(number|string|function)',
  4614. flip: 'boolean',
  4615. boundary: '(string|element)',
  4616. reference: '(string|element)',
  4617. display: 'string',
  4618. popperConfig: '(null|object)'
  4619. };
  4620. /**
  4621. * ------------------------------------------------------------------------
  4622. * Class Definition
  4623. * ------------------------------------------------------------------------
  4624. */
  4625. var Dropdown =
  4626. /*#__PURE__*/
  4627. function () {
  4628. function Dropdown(element, config) {
  4629. this._element = element;
  4630. this._popper = null;
  4631. this._config = this._getConfig(config);
  4632. this._menu = this._getMenuElement();
  4633. this._inNavbar = this._detectNavbar();
  4634. this._addEventListeners();
  4635. } // Getters
  4636. var _proto = Dropdown.prototype;
  4637. // Public
  4638. _proto.toggle = function toggle() {
  4639. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  4640. return;
  4641. }
  4642. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  4643. Dropdown._clearMenus();
  4644. if (isActive) {
  4645. return;
  4646. }
  4647. this.show(true);
  4648. };
  4649. _proto.show = function show(usePopper) {
  4650. if (usePopper === void 0) {
  4651. usePopper = false;
  4652. }
  4653. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  4654. return;
  4655. }
  4656. var relatedTarget = {
  4657. relatedTarget: this._element
  4658. };
  4659. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  4660. var parent = Dropdown._getParentFromElement(this._element);
  4661. $(parent).trigger(showEvent);
  4662. if (showEvent.isDefaultPrevented()) {
  4663. return;
  4664. } // Disable totally Popper.js for Dropdown in Navbar
  4665. if (!this._inNavbar && usePopper) {
  4666. /**
  4667. * Check for Popper dependency
  4668. * Popper - https://popper.js.org
  4669. */
  4670. if (typeof Popper === 'undefined') {
  4671. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  4672. }
  4673. var referenceElement = this._element;
  4674. if (this._config.reference === 'parent') {
  4675. referenceElement = parent;
  4676. } else if (Util.isElement(this._config.reference)) {
  4677. referenceElement = this._config.reference; // Check if it's jQuery element
  4678. if (typeof this._config.reference.jquery !== 'undefined') {
  4679. referenceElement = this._config.reference[0];
  4680. }
  4681. } // If boundary is not `scrollParent`, then set position to `static`
  4682. // to allow the menu to "escape" the scroll parent's boundaries
  4683. // https://github.com/twbs/bootstrap/issues/24251
  4684. if (this._config.boundary !== 'scrollParent') {
  4685. $(parent).addClass(ClassName$4.POSITION_STATIC);
  4686. }
  4687. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  4688. } // If this is a touch-enabled device we add extra
  4689. // empty mouseover listeners to the body's immediate children;
  4690. // only needed because of broken event delegation on iOS
  4691. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4692. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  4693. $(document.body).children().on('mouseover', null, $.noop);
  4694. }
  4695. this._element.focus();
  4696. this._element.setAttribute('aria-expanded', true);
  4697. $(this._menu).toggleClass(ClassName$4.SHOW);
  4698. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  4699. };
  4700. _proto.hide = function hide() {
  4701. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  4702. return;
  4703. }
  4704. var relatedTarget = {
  4705. relatedTarget: this._element
  4706. };
  4707. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4708. var parent = Dropdown._getParentFromElement(this._element);
  4709. $(parent).trigger(hideEvent);
  4710. if (hideEvent.isDefaultPrevented()) {
  4711. return;
  4712. }
  4713. if (this._popper) {
  4714. this._popper.destroy();
  4715. }
  4716. $(this._menu).toggleClass(ClassName$4.SHOW);
  4717. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4718. };
  4719. _proto.dispose = function dispose() {
  4720. $.removeData(this._element, DATA_KEY$4);
  4721. $(this._element).off(EVENT_KEY$4);
  4722. this._element = null;
  4723. this._menu = null;
  4724. if (this._popper !== null) {
  4725. this._popper.destroy();
  4726. this._popper = null;
  4727. }
  4728. };
  4729. _proto.update = function update() {
  4730. this._inNavbar = this._detectNavbar();
  4731. if (this._popper !== null) {
  4732. this._popper.scheduleUpdate();
  4733. }
  4734. } // Private
  4735. ;
  4736. _proto._addEventListeners = function _addEventListeners() {
  4737. var _this = this;
  4738. $(this._element).on(Event$4.CLICK, function (event) {
  4739. event.preventDefault();
  4740. event.stopPropagation();
  4741. _this.toggle();
  4742. });
  4743. };
  4744. _proto._getConfig = function _getConfig(config) {
  4745. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  4746. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  4747. return config;
  4748. };
  4749. _proto._getMenuElement = function _getMenuElement() {
  4750. if (!this._menu) {
  4751. var parent = Dropdown._getParentFromElement(this._element);
  4752. if (parent) {
  4753. this._menu = parent.querySelector(Selector$4.MENU);
  4754. }
  4755. }
  4756. return this._menu;
  4757. };
  4758. _proto._getPlacement = function _getPlacement() {
  4759. var $parentDropdown = $(this._element.parentNode);
  4760. var placement = AttachmentMap.BOTTOM; // Handle dropup
  4761. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  4762. placement = AttachmentMap.TOP;
  4763. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  4764. placement = AttachmentMap.TOPEND;
  4765. }
  4766. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  4767. placement = AttachmentMap.RIGHT;
  4768. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  4769. placement = AttachmentMap.LEFT;
  4770. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  4771. placement = AttachmentMap.BOTTOMEND;
  4772. }
  4773. return placement;
  4774. };
  4775. _proto._detectNavbar = function _detectNavbar() {
  4776. return $(this._element).closest('.navbar').length > 0;
  4777. };
  4778. _proto._getOffset = function _getOffset() {
  4779. var _this2 = this;
  4780. var offset = {};
  4781. if (typeof this._config.offset === 'function') {
  4782. offset.fn = function (data) {
  4783. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  4784. return data;
  4785. };
  4786. } else {
  4787. offset.offset = this._config.offset;
  4788. }
  4789. return offset;
  4790. };
  4791. _proto._getPopperConfig = function _getPopperConfig() {
  4792. var popperConfig = {
  4793. placement: this._getPlacement(),
  4794. modifiers: {
  4795. offset: this._getOffset(),
  4796. flip: {
  4797. enabled: this._config.flip
  4798. },
  4799. preventOverflow: {
  4800. boundariesElement: this._config.boundary
  4801. }
  4802. }
  4803. }; // Disable Popper.js if we have a static display
  4804. if (this._config.display === 'static') {
  4805. popperConfig.modifiers.applyStyle = {
  4806. enabled: false
  4807. };
  4808. }
  4809. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  4810. } // Static
  4811. ;
  4812. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  4813. return this.each(function () {
  4814. var data = $(this).data(DATA_KEY$4);
  4815. var _config = typeof config === 'object' ? config : null;
  4816. if (!data) {
  4817. data = new Dropdown(this, _config);
  4818. $(this).data(DATA_KEY$4, data);
  4819. }
  4820. if (typeof config === 'string') {
  4821. if (typeof data[config] === 'undefined') {
  4822. throw new TypeError("No method named \"" + config + "\"");
  4823. }
  4824. data[config]();
  4825. }
  4826. });
  4827. };
  4828. Dropdown._clearMenus = function _clearMenus(event) {
  4829. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  4830. return;
  4831. }
  4832. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  4833. for (var i = 0, len = toggles.length; i < len; i++) {
  4834. var parent = Dropdown._getParentFromElement(toggles[i]);
  4835. var context = $(toggles[i]).data(DATA_KEY$4);
  4836. var relatedTarget = {
  4837. relatedTarget: toggles[i]
  4838. };
  4839. if (event && event.type === 'click') {
  4840. relatedTarget.clickEvent = event;
  4841. }
  4842. if (!context) {
  4843. continue;
  4844. }
  4845. var dropdownMenu = context._menu;
  4846. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  4847. continue;
  4848. }
  4849. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  4850. continue;
  4851. }
  4852. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4853. $(parent).trigger(hideEvent);
  4854. if (hideEvent.isDefaultPrevented()) {
  4855. continue;
  4856. } // If this is a touch-enabled device we remove the extra
  4857. // empty mouseover listeners we added for iOS support
  4858. if ('ontouchstart' in document.documentElement) {
  4859. $(document.body).children().off('mouseover', null, $.noop);
  4860. }
  4861. toggles[i].setAttribute('aria-expanded', 'false');
  4862. if (context._popper) {
  4863. context._popper.destroy();
  4864. }
  4865. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  4866. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4867. }
  4868. };
  4869. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  4870. var parent;
  4871. var selector = Util.getSelectorFromElement(element);
  4872. if (selector) {
  4873. parent = document.querySelector(selector);
  4874. }
  4875. return parent || element.parentNode;
  4876. } // eslint-disable-next-line complexity
  4877. ;
  4878. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  4879. // If not input/textarea:
  4880. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  4881. // If input/textarea:
  4882. // - If space key => not a dropdown command
  4883. // - If key is other than escape
  4884. // - If key is not up or down => not a dropdown command
  4885. // - If trigger inside the menu => not a dropdown command
  4886. 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)) {
  4887. return;
  4888. }
  4889. event.preventDefault();
  4890. event.stopPropagation();
  4891. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  4892. return;
  4893. }
  4894. var parent = Dropdown._getParentFromElement(this);
  4895. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  4896. if (!isActive && event.which === ESCAPE_KEYCODE) {
  4897. return;
  4898. }
  4899. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  4900. if (event.which === ESCAPE_KEYCODE) {
  4901. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  4902. $(toggle).trigger('focus');
  4903. }
  4904. $(this).trigger('click');
  4905. return;
  4906. }
  4907. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  4908. return $(item).is(':visible');
  4909. });
  4910. if (items.length === 0) {
  4911. return;
  4912. }
  4913. var index = items.indexOf(event.target);
  4914. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  4915. // Up
  4916. index--;
  4917. }
  4918. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  4919. // Down
  4920. index++;
  4921. }
  4922. if (index < 0) {
  4923. index = 0;
  4924. }
  4925. items[index].focus();
  4926. };
  4927. _createClass(Dropdown, null, [{
  4928. key: "VERSION",
  4929. get: function get() {
  4930. return VERSION$4;
  4931. }
  4932. }, {
  4933. key: "Default",
  4934. get: function get() {
  4935. return Default$2;
  4936. }
  4937. }, {
  4938. key: "DefaultType",
  4939. get: function get() {
  4940. return DefaultType$2;
  4941. }
  4942. }]);
  4943. return Dropdown;
  4944. }();
  4945. /**
  4946. * ------------------------------------------------------------------------
  4947. * Data Api implementation
  4948. * ------------------------------------------------------------------------
  4949. */
  4950. $(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) {
  4951. event.preventDefault();
  4952. event.stopPropagation();
  4953. Dropdown._jQueryInterface.call($(this), 'toggle');
  4954. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  4955. e.stopPropagation();
  4956. });
  4957. /**
  4958. * ------------------------------------------------------------------------
  4959. * jQuery
  4960. * ------------------------------------------------------------------------
  4961. */
  4962. $.fn[NAME$4] = Dropdown._jQueryInterface;
  4963. $.fn[NAME$4].Constructor = Dropdown;
  4964. $.fn[NAME$4].noConflict = function () {
  4965. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  4966. return Dropdown._jQueryInterface;
  4967. };
  4968. /**
  4969. * ------------------------------------------------------------------------
  4970. * Constants
  4971. * ------------------------------------------------------------------------
  4972. */
  4973. var NAME$5 = 'modal';
  4974. var VERSION$5 = '4.4.1';
  4975. var DATA_KEY$5 = 'bs.modal';
  4976. var EVENT_KEY$5 = "." + DATA_KEY$5;
  4977. var DATA_API_KEY$5 = '.data-api';
  4978. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  4979. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  4980. var Default$3 = {
  4981. backdrop: true,
  4982. keyboard: true,
  4983. focus: true,
  4984. show: true
  4985. };
  4986. var DefaultType$3 = {
  4987. backdrop: '(boolean|string)',
  4988. keyboard: 'boolean',
  4989. focus: 'boolean',
  4990. show: 'boolean'
  4991. };
  4992. var Event$5 = {
  4993. HIDE: "hide" + EVENT_KEY$5,
  4994. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  4995. HIDDEN: "hidden" + EVENT_KEY$5,
  4996. SHOW: "show" + EVENT_KEY$5,
  4997. SHOWN: "shown" + EVENT_KEY$5,
  4998. FOCUSIN: "focusin" + EVENT_KEY$5,
  4999. RESIZE: "resize" + EVENT_KEY$5,
  5000. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  5001. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  5002. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  5003. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  5004. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  5005. };
  5006. var ClassName$5 = {
  5007. SCROLLABLE: 'modal-dialog-scrollable',
  5008. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  5009. BACKDROP: 'modal-backdrop',
  5010. OPEN: 'modal-open',
  5011. FADE: 'fade',
  5012. SHOW: 'show',
  5013. STATIC: 'modal-static'
  5014. };
  5015. var Selector$5 = {
  5016. DIALOG: '.modal-dialog',
  5017. MODAL_BODY: '.modal-body',
  5018. DATA_TOGGLE: '[data-toggle="modal"]',
  5019. DATA_DISMISS: '[data-dismiss="modal"]',
  5020. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  5021. STICKY_CONTENT: '.sticky-top'
  5022. };
  5023. /**
  5024. * ------------------------------------------------------------------------
  5025. * Class Definition
  5026. * ------------------------------------------------------------------------
  5027. */
  5028. var Modal =
  5029. /*#__PURE__*/
  5030. function () {
  5031. function Modal(element, config) {
  5032. this._config = this._getConfig(config);
  5033. this._element = element;
  5034. this._dialog = element.querySelector(Selector$5.DIALOG);
  5035. this._backdrop = null;
  5036. this._isShown = false;
  5037. this._isBodyOverflowing = false;
  5038. this._ignoreBackdropClick = false;
  5039. this._isTransitioning = false;
  5040. this._scrollbarWidth = 0;
  5041. } // Getters
  5042. var _proto = Modal.prototype;
  5043. // Public
  5044. _proto.toggle = function toggle(relatedTarget) {
  5045. return this._isShown ? this.hide() : this.show(relatedTarget);
  5046. };
  5047. _proto.show = function show(relatedTarget) {
  5048. var _this = this;
  5049. if (this._isShown || this._isTransitioning) {
  5050. return;
  5051. }
  5052. if ($(this._element).hasClass(ClassName$5.FADE)) {
  5053. this._isTransitioning = true;
  5054. }
  5055. var showEvent = $.Event(Event$5.SHOW, {
  5056. relatedTarget: relatedTarget
  5057. });
  5058. $(this._element).trigger(showEvent);
  5059. if (this._isShown || showEvent.isDefaultPrevented()) {
  5060. return;
  5061. }
  5062. this._isShown = true;
  5063. this._checkScrollbar();
  5064. this._setScrollbar();
  5065. this._adjustDialog();
  5066. this._setEscapeEvent();
  5067. this._setResizeEvent();
  5068. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  5069. return _this.hide(event);
  5070. });
  5071. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  5072. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  5073. if ($(event.target).is(_this._element)) {
  5074. _this._ignoreBackdropClick = true;
  5075. }
  5076. });
  5077. });
  5078. this._showBackdrop(function () {
  5079. return _this._showElement(relatedTarget);
  5080. });
  5081. };
  5082. _proto.hide = function hide(event) {
  5083. var _this2 = this;
  5084. if (event) {
  5085. event.preventDefault();
  5086. }
  5087. if (!this._isShown || this._isTransitioning) {
  5088. return;
  5089. }
  5090. var hideEvent = $.Event(Event$5.HIDE);
  5091. $(this._element).trigger(hideEvent);
  5092. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  5093. return;
  5094. }
  5095. this._isShown = false;
  5096. var transition = $(this._element).hasClass(ClassName$5.FADE);
  5097. if (transition) {
  5098. this._isTransitioning = true;
  5099. }
  5100. this._setEscapeEvent();
  5101. this._setResizeEvent();
  5102. $(document).off(Event$5.FOCUSIN);
  5103. $(this._element).removeClass(ClassName$5.SHOW);
  5104. $(this._element).off(Event$5.CLICK_DISMISS);
  5105. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  5106. if (transition) {
  5107. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5108. $(this._element).one(Util.TRANSITION_END, function (event) {
  5109. return _this2._hideModal(event);
  5110. }).emulateTransitionEnd(transitionDuration);
  5111. } else {
  5112. this._hideModal();
  5113. }
  5114. };
  5115. _proto.dispose = function dispose() {
  5116. [window, this._element, this._dialog].forEach(function (htmlElement) {
  5117. return $(htmlElement).off(EVENT_KEY$5);
  5118. });
  5119. /**
  5120. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  5121. * Do not move `document` in `htmlElements` array
  5122. * It will remove `Event.CLICK_DATA_API` event that should remain
  5123. */
  5124. $(document).off(Event$5.FOCUSIN);
  5125. $.removeData(this._element, DATA_KEY$5);
  5126. this._config = null;
  5127. this._element = null;
  5128. this._dialog = null;
  5129. this._backdrop = null;
  5130. this._isShown = null;
  5131. this._isBodyOverflowing = null;
  5132. this._ignoreBackdropClick = null;
  5133. this._isTransitioning = null;
  5134. this._scrollbarWidth = null;
  5135. };
  5136. _proto.handleUpdate = function handleUpdate() {
  5137. this._adjustDialog();
  5138. } // Private
  5139. ;
  5140. _proto._getConfig = function _getConfig(config) {
  5141. config = _objectSpread2({}, Default$3, {}, config);
  5142. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  5143. return config;
  5144. };
  5145. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  5146. var _this3 = this;
  5147. if (this._config.backdrop === 'static') {
  5148. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  5149. $(this._element).trigger(hideEventPrevented);
  5150. if (hideEventPrevented.defaultPrevented) {
  5151. return;
  5152. }
  5153. this._element.classList.add(ClassName$5.STATIC);
  5154. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  5155. $(this._element).one(Util.TRANSITION_END, function () {
  5156. _this3._element.classList.remove(ClassName$5.STATIC);
  5157. }).emulateTransitionEnd(modalTransitionDuration);
  5158. this._element.focus();
  5159. } else {
  5160. this.hide();
  5161. }
  5162. };
  5163. _proto._showElement = function _showElement(relatedTarget) {
  5164. var _this4 = this;
  5165. var transition = $(this._element).hasClass(ClassName$5.FADE);
  5166. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  5167. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  5168. // Don't move modal's DOM position
  5169. document.body.appendChild(this._element);
  5170. }
  5171. this._element.style.display = 'block';
  5172. this._element.removeAttribute('aria-hidden');
  5173. this._element.setAttribute('aria-modal', true);
  5174. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  5175. modalBody.scrollTop = 0;
  5176. } else {
  5177. this._element.scrollTop = 0;
  5178. }
  5179. if (transition) {
  5180. Util.reflow(this._element);
  5181. }
  5182. $(this._element).addClass(ClassName$5.SHOW);
  5183. if (this._config.focus) {
  5184. this._enforceFocus();
  5185. }
  5186. var shownEvent = $.Event(Event$5.SHOWN, {
  5187. relatedTarget: relatedTarget
  5188. });
  5189. var transitionComplete = function transitionComplete() {
  5190. if (_this4._config.focus) {
  5191. _this4._element.focus();
  5192. }
  5193. _this4._isTransitioning = false;
  5194. $(_this4._element).trigger(shownEvent);
  5195. };
  5196. if (transition) {
  5197. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  5198. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  5199. } else {
  5200. transitionComplete();
  5201. }
  5202. };
  5203. _proto._enforceFocus = function _enforceFocus() {
  5204. var _this5 = this;
  5205. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  5206. .on(Event$5.FOCUSIN, function (event) {
  5207. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  5208. _this5._element.focus();
  5209. }
  5210. });
  5211. };
  5212. _proto._setEscapeEvent = function _setEscapeEvent() {
  5213. var _this6 = this;
  5214. if (this._isShown && this._config.keyboard) {
  5215. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  5216. if (event.which === ESCAPE_KEYCODE$1) {
  5217. _this6._triggerBackdropTransition();
  5218. }
  5219. });
  5220. } else if (!this._isShown) {
  5221. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  5222. }
  5223. };
  5224. _proto._setResizeEvent = function _setResizeEvent() {
  5225. var _this7 = this;
  5226. if (this._isShown) {
  5227. $(window).on(Event$5.RESIZE, function (event) {
  5228. return _this7.handleUpdate(event);
  5229. });
  5230. } else {
  5231. $(window).off(Event$5.RESIZE);
  5232. }
  5233. };
  5234. _proto._hideModal = function _hideModal() {
  5235. var _this8 = this;
  5236. this._element.style.display = 'none';
  5237. this._element.setAttribute('aria-hidden', true);
  5238. this._element.removeAttribute('aria-modal');
  5239. this._isTransitioning = false;
  5240. this._showBackdrop(function () {
  5241. $(document.body).removeClass(ClassName$5.OPEN);
  5242. _this8._resetAdjustments();
  5243. _this8._resetScrollbar();
  5244. $(_this8._element).trigger(Event$5.HIDDEN);
  5245. });
  5246. };
  5247. _proto._removeBackdrop = function _removeBackdrop() {
  5248. if (this._backdrop) {
  5249. $(this._backdrop).remove();
  5250. this._backdrop = null;
  5251. }
  5252. };
  5253. _proto._showBackdrop = function _showBackdrop(callback) {
  5254. var _this9 = this;
  5255. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  5256. if (this._isShown && this._config.backdrop) {
  5257. this._backdrop = document.createElement('div');
  5258. this._backdrop.className = ClassName$5.BACKDROP;
  5259. if (animate) {
  5260. this._backdrop.classList.add(animate);
  5261. }
  5262. $(this._backdrop).appendTo(document.body);
  5263. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  5264. if (_this9._ignoreBackdropClick) {
  5265. _this9._ignoreBackdropClick = false;
  5266. return;
  5267. }
  5268. if (event.target !== event.currentTarget) {
  5269. return;
  5270. }
  5271. _this9._triggerBackdropTransition();
  5272. });
  5273. if (animate) {
  5274. Util.reflow(this._backdrop);
  5275. }
  5276. $(this._backdrop).addClass(ClassName$5.SHOW);
  5277. if (!callback) {
  5278. return;
  5279. }
  5280. if (!animate) {
  5281. callback();
  5282. return;
  5283. }
  5284. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  5285. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  5286. } else if (!this._isShown && this._backdrop) {
  5287. $(this._backdrop).removeClass(ClassName$5.SHOW);
  5288. var callbackRemove = function callbackRemove() {
  5289. _this9._removeBackdrop();
  5290. if (callback) {
  5291. callback();
  5292. }
  5293. };
  5294. if ($(this._element).hasClass(ClassName$5.FADE)) {
  5295. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  5296. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  5297. } else {
  5298. callbackRemove();
  5299. }
  5300. } else if (callback) {
  5301. callback();
  5302. }
  5303. } // ----------------------------------------------------------------------
  5304. // the following methods are used to handle overflowing modals
  5305. // todo (fat): these should probably be refactored out of modal.js
  5306. // ----------------------------------------------------------------------
  5307. ;
  5308. _proto._adjustDialog = function _adjustDialog() {
  5309. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  5310. if (!this._isBodyOverflowing && isModalOverflowing) {
  5311. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  5312. }
  5313. if (this._isBodyOverflowing && !isModalOverflowing) {
  5314. this._element.style.paddingRight = this._scrollbarWidth + "px";
  5315. }
  5316. };
  5317. _proto._resetAdjustments = function _resetAdjustments() {
  5318. this._element.style.paddingLeft = '';
  5319. this._element.style.paddingRight = '';
  5320. };
  5321. _proto._checkScrollbar = function _checkScrollbar() {
  5322. var rect = document.body.getBoundingClientRect();
  5323. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  5324. this._scrollbarWidth = this._getScrollbarWidth();
  5325. };
  5326. _proto._setScrollbar = function _setScrollbar() {
  5327. var _this10 = this;
  5328. if (this._isBodyOverflowing) {
  5329. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  5330. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  5331. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  5332. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  5333. $(fixedContent).each(function (index, element) {
  5334. var actualPadding = element.style.paddingRight;
  5335. var calculatedPadding = $(element).css('padding-right');
  5336. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  5337. }); // Adjust sticky content margin
  5338. $(stickyContent).each(function (index, element) {
  5339. var actualMargin = element.style.marginRight;
  5340. var calculatedMargin = $(element).css('margin-right');
  5341. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  5342. }); // Adjust body padding
  5343. var actualPadding = document.body.style.paddingRight;
  5344. var calculatedPadding = $(document.body).css('padding-right');
  5345. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  5346. }
  5347. $(document.body).addClass(ClassName$5.OPEN);
  5348. };
  5349. _proto._resetScrollbar = function _resetScrollbar() {
  5350. // Restore fixed content padding
  5351. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  5352. $(fixedContent).each(function (index, element) {
  5353. var padding = $(element).data('padding-right');
  5354. $(element).removeData('padding-right');
  5355. element.style.paddingRight = padding ? padding : '';
  5356. }); // Restore sticky content
  5357. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  5358. $(elements).each(function (index, element) {
  5359. var margin = $(element).data('margin-right');
  5360. if (typeof margin !== 'undefined') {
  5361. $(element).css('margin-right', margin).removeData('margin-right');
  5362. }
  5363. }); // Restore body padding
  5364. var padding = $(document.body).data('padding-right');
  5365. $(document.body).removeData('padding-right');
  5366. document.body.style.paddingRight = padding ? padding : '';
  5367. };
  5368. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  5369. // thx d.walsh
  5370. var scrollDiv = document.createElement('div');
  5371. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  5372. document.body.appendChild(scrollDiv);
  5373. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  5374. document.body.removeChild(scrollDiv);
  5375. return scrollbarWidth;
  5376. } // Static
  5377. ;
  5378. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  5379. return this.each(function () {
  5380. var data = $(this).data(DATA_KEY$5);
  5381. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  5382. if (!data) {
  5383. data = new Modal(this, _config);
  5384. $(this).data(DATA_KEY$5, data);
  5385. }
  5386. if (typeof config === 'string') {
  5387. if (typeof data[config] === 'undefined') {
  5388. throw new TypeError("No method named \"" + config + "\"");
  5389. }
  5390. data[config](relatedTarget);
  5391. } else if (_config.show) {
  5392. data.show(relatedTarget);
  5393. }
  5394. });
  5395. };
  5396. _createClass(Modal, null, [{
  5397. key: "VERSION",
  5398. get: function get() {
  5399. return VERSION$5;
  5400. }
  5401. }, {
  5402. key: "Default",
  5403. get: function get() {
  5404. return Default$3;
  5405. }
  5406. }]);
  5407. return Modal;
  5408. }();
  5409. /**
  5410. * ------------------------------------------------------------------------
  5411. * Data Api implementation
  5412. * ------------------------------------------------------------------------
  5413. */
  5414. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  5415. var _this11 = this;
  5416. var target;
  5417. var selector = Util.getSelectorFromElement(this);
  5418. if (selector) {
  5419. target = document.querySelector(selector);
  5420. }
  5421. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  5422. if (this.tagName === 'A' || this.tagName === 'AREA') {
  5423. event.preventDefault();
  5424. }
  5425. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  5426. if (showEvent.isDefaultPrevented()) {
  5427. // Only register focus restorer if modal will actually get shown
  5428. return;
  5429. }
  5430. $target.one(Event$5.HIDDEN, function () {
  5431. if ($(_this11).is(':visible')) {
  5432. _this11.focus();
  5433. }
  5434. });
  5435. });
  5436. Modal._jQueryInterface.call($(target), config, this);
  5437. });
  5438. /**
  5439. * ------------------------------------------------------------------------
  5440. * jQuery
  5441. * ------------------------------------------------------------------------
  5442. */
  5443. $.fn[NAME$5] = Modal._jQueryInterface;
  5444. $.fn[NAME$5].Constructor = Modal;
  5445. $.fn[NAME$5].noConflict = function () {
  5446. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  5447. return Modal._jQueryInterface;
  5448. };
  5449. /**
  5450. * --------------------------------------------------------------------------
  5451. * Bootstrap (v4.4.1): tools/sanitizer.js
  5452. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  5453. * --------------------------------------------------------------------------
  5454. */
  5455. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  5456. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  5457. var DefaultWhitelist = {
  5458. // Global attributes allowed on any supplied element below.
  5459. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  5460. a: ['target', 'href', 'title', 'rel'],
  5461. area: [],
  5462. b: [],
  5463. br: [],
  5464. col: [],
  5465. code: [],
  5466. div: [],
  5467. em: [],
  5468. hr: [],
  5469. h1: [],
  5470. h2: [],
  5471. h3: [],
  5472. h4: [],
  5473. h5: [],
  5474. h6: [],
  5475. i: [],
  5476. img: ['src', 'alt', 'title', 'width', 'height'],
  5477. li: [],
  5478. ol: [],
  5479. p: [],
  5480. pre: [],
  5481. s: [],
  5482. small: [],
  5483. span: [],
  5484. sub: [],
  5485. sup: [],
  5486. strong: [],
  5487. u: [],
  5488. ul: []
  5489. };
  5490. /**
  5491. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  5492. *
  5493. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  5494. */
  5495. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  5496. /**
  5497. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  5498. *
  5499. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  5500. */
  5501. 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;
  5502. function allowedAttribute(attr, allowedAttributeList) {
  5503. var attrName = attr.nodeName.toLowerCase();
  5504. if (allowedAttributeList.indexOf(attrName) !== -1) {
  5505. if (uriAttrs.indexOf(attrName) !== -1) {
  5506. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  5507. }
  5508. return true;
  5509. }
  5510. var regExp = allowedAttributeList.filter(function (attrRegex) {
  5511. return attrRegex instanceof RegExp;
  5512. }); // Check if a regular expression validates the attribute.
  5513. for (var i = 0, l = regExp.length; i < l; i++) {
  5514. if (attrName.match(regExp[i])) {
  5515. return true;
  5516. }
  5517. }
  5518. return false;
  5519. }
  5520. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  5521. if (unsafeHtml.length === 0) {
  5522. return unsafeHtml;
  5523. }
  5524. if (sanitizeFn && typeof sanitizeFn === 'function') {
  5525. return sanitizeFn(unsafeHtml);
  5526. }
  5527. var domParser = new window.DOMParser();
  5528. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  5529. var whitelistKeys = Object.keys(whiteList);
  5530. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  5531. var _loop = function _loop(i, len) {
  5532. var el = elements[i];
  5533. var elName = el.nodeName.toLowerCase();
  5534. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  5535. el.parentNode.removeChild(el);
  5536. return "continue";
  5537. }
  5538. var attributeList = [].slice.call(el.attributes);
  5539. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  5540. attributeList.forEach(function (attr) {
  5541. if (!allowedAttribute(attr, whitelistedAttributes)) {
  5542. el.removeAttribute(attr.nodeName);
  5543. }
  5544. });
  5545. };
  5546. for (var i = 0, len = elements.length; i < len; i++) {
  5547. var _ret = _loop(i);
  5548. if (_ret === "continue") continue;
  5549. }
  5550. return createdDocument.body.innerHTML;
  5551. }
  5552. /**
  5553. * ------------------------------------------------------------------------
  5554. * Constants
  5555. * ------------------------------------------------------------------------
  5556. */
  5557. var NAME$6 = 'tooltip';
  5558. var VERSION$6 = '4.4.1';
  5559. var DATA_KEY$6 = 'bs.tooltip';
  5560. var EVENT_KEY$6 = "." + DATA_KEY$6;
  5561. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  5562. var CLASS_PREFIX = 'bs-tooltip';
  5563. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  5564. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  5565. var DefaultType$4 = {
  5566. animation: 'boolean',
  5567. template: 'string',
  5568. title: '(string|element|function)',
  5569. trigger: 'string',
  5570. delay: '(number|object)',
  5571. html: 'boolean',
  5572. selector: '(string|boolean)',
  5573. placement: '(string|function)',
  5574. offset: '(number|string|function)',
  5575. container: '(string|element|boolean)',
  5576. fallbackPlacement: '(string|array)',
  5577. boundary: '(string|element)',
  5578. sanitize: 'boolean',
  5579. sanitizeFn: '(null|function)',
  5580. whiteList: 'object',
  5581. popperConfig: '(null|object)'
  5582. };
  5583. var AttachmentMap$1 = {
  5584. AUTO: 'auto',
  5585. TOP: 'top',
  5586. RIGHT: 'right',
  5587. BOTTOM: 'bottom',
  5588. LEFT: 'left'
  5589. };
  5590. var Default$4 = {
  5591. animation: true,
  5592. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  5593. trigger: 'hover focus',
  5594. title: '',
  5595. delay: 0,
  5596. html: false,
  5597. selector: false,
  5598. placement: 'top',
  5599. offset: 0,
  5600. container: false,
  5601. fallbackPlacement: 'flip',
  5602. boundary: 'scrollParent',
  5603. sanitize: true,
  5604. sanitizeFn: null,
  5605. whiteList: DefaultWhitelist,
  5606. popperConfig: null
  5607. };
  5608. var HoverState = {
  5609. SHOW: 'show',
  5610. OUT: 'out'
  5611. };
  5612. var Event$6 = {
  5613. HIDE: "hide" + EVENT_KEY$6,
  5614. HIDDEN: "hidden" + EVENT_KEY$6,
  5615. SHOW: "show" + EVENT_KEY$6,
  5616. SHOWN: "shown" + EVENT_KEY$6,
  5617. INSERTED: "inserted" + EVENT_KEY$6,
  5618. CLICK: "click" + EVENT_KEY$6,
  5619. FOCUSIN: "focusin" + EVENT_KEY$6,
  5620. FOCUSOUT: "focusout" + EVENT_KEY$6,
  5621. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  5622. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  5623. };
  5624. var ClassName$6 = {
  5625. FADE: 'fade',
  5626. SHOW: 'show'
  5627. };
  5628. var Selector$6 = {
  5629. TOOLTIP: '.tooltip',
  5630. TOOLTIP_INNER: '.tooltip-inner',
  5631. ARROW: '.arrow'
  5632. };
  5633. var Trigger = {
  5634. HOVER: 'hover',
  5635. FOCUS: 'focus',
  5636. CLICK: 'click',
  5637. MANUAL: 'manual'
  5638. };
  5639. /**
  5640. * ------------------------------------------------------------------------
  5641. * Class Definition
  5642. * ------------------------------------------------------------------------
  5643. */
  5644. var Tooltip =
  5645. /*#__PURE__*/
  5646. function () {
  5647. function Tooltip(element, config) {
  5648. if (typeof Popper === 'undefined') {
  5649. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  5650. } // private
  5651. this._isEnabled = true;
  5652. this._timeout = 0;
  5653. this._hoverState = '';
  5654. this._activeTrigger = {};
  5655. this._popper = null; // Protected
  5656. this.element = element;
  5657. this.config = this._getConfig(config);
  5658. this.tip = null;
  5659. this._setListeners();
  5660. } // Getters
  5661. var _proto = Tooltip.prototype;
  5662. // Public
  5663. _proto.enable = function enable() {
  5664. this._isEnabled = true;
  5665. };
  5666. _proto.disable = function disable() {
  5667. this._isEnabled = false;
  5668. };
  5669. _proto.toggleEnabled = function toggleEnabled() {
  5670. this._isEnabled = !this._isEnabled;
  5671. };
  5672. _proto.toggle = function toggle(event) {
  5673. if (!this._isEnabled) {
  5674. return;
  5675. }
  5676. if (event) {
  5677. var dataKey = this.constructor.DATA_KEY;
  5678. var context = $(event.currentTarget).data(dataKey);
  5679. if (!context) {
  5680. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5681. $(event.currentTarget).data(dataKey, context);
  5682. }
  5683. context._activeTrigger.click = !context._activeTrigger.click;
  5684. if (context._isWithActiveTrigger()) {
  5685. context._enter(null, context);
  5686. } else {
  5687. context._leave(null, context);
  5688. }
  5689. } else {
  5690. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  5691. this._leave(null, this);
  5692. return;
  5693. }
  5694. this._enter(null, this);
  5695. }
  5696. };
  5697. _proto.dispose = function dispose() {
  5698. clearTimeout(this._timeout);
  5699. $.removeData(this.element, this.constructor.DATA_KEY);
  5700. $(this.element).off(this.constructor.EVENT_KEY);
  5701. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  5702. if (this.tip) {
  5703. $(this.tip).remove();
  5704. }
  5705. this._isEnabled = null;
  5706. this._timeout = null;
  5707. this._hoverState = null;
  5708. this._activeTrigger = null;
  5709. if (this._popper) {
  5710. this._popper.destroy();
  5711. }
  5712. this._popper = null;
  5713. this.element = null;
  5714. this.config = null;
  5715. this.tip = null;
  5716. };
  5717. _proto.show = function show() {
  5718. var _this = this;
  5719. if ($(this.element).css('display') === 'none') {
  5720. throw new Error('Please use show on visible elements');
  5721. }
  5722. var showEvent = $.Event(this.constructor.Event.SHOW);
  5723. if (this.isWithContent() && this._isEnabled) {
  5724. $(this.element).trigger(showEvent);
  5725. var shadowRoot = Util.findShadowRoot(this.element);
  5726. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  5727. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  5728. return;
  5729. }
  5730. var tip = this.getTipElement();
  5731. var tipId = Util.getUID(this.constructor.NAME);
  5732. tip.setAttribute('id', tipId);
  5733. this.element.setAttribute('aria-describedby', tipId);
  5734. this.setContent();
  5735. if (this.config.animation) {
  5736. $(tip).addClass(ClassName$6.FADE);
  5737. }
  5738. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  5739. var attachment = this._getAttachment(placement);
  5740. this.addAttachmentClass(attachment);
  5741. var container = this._getContainer();
  5742. $(tip).data(this.constructor.DATA_KEY, this);
  5743. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  5744. $(tip).appendTo(container);
  5745. }
  5746. $(this.element).trigger(this.constructor.Event.INSERTED);
  5747. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  5748. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  5749. // empty mouseover listeners to the body's immediate children;
  5750. // only needed because of broken event delegation on iOS
  5751. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  5752. if ('ontouchstart' in document.documentElement) {
  5753. $(document.body).children().on('mouseover', null, $.noop);
  5754. }
  5755. var complete = function complete() {
  5756. if (_this.config.animation) {
  5757. _this._fixTransition();
  5758. }
  5759. var prevHoverState = _this._hoverState;
  5760. _this._hoverState = null;
  5761. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  5762. if (prevHoverState === HoverState.OUT) {
  5763. _this._leave(null, _this);
  5764. }
  5765. };
  5766. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  5767. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  5768. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5769. } else {
  5770. complete();
  5771. }
  5772. }
  5773. };
  5774. _proto.hide = function hide(callback) {
  5775. var _this2 = this;
  5776. var tip = this.getTipElement();
  5777. var hideEvent = $.Event(this.constructor.Event.HIDE);
  5778. var complete = function complete() {
  5779. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  5780. tip.parentNode.removeChild(tip);
  5781. }
  5782. _this2._cleanTipClass();
  5783. _this2.element.removeAttribute('aria-describedby');
  5784. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  5785. if (_this2._popper !== null) {
  5786. _this2._popper.destroy();
  5787. }
  5788. if (callback) {
  5789. callback();
  5790. }
  5791. };
  5792. $(this.element).trigger(hideEvent);
  5793. if (hideEvent.isDefaultPrevented()) {
  5794. return;
  5795. }
  5796. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  5797. // empty mouseover listeners we added for iOS support
  5798. if ('ontouchstart' in document.documentElement) {
  5799. $(document.body).children().off('mouseover', null, $.noop);
  5800. }
  5801. this._activeTrigger[Trigger.CLICK] = false;
  5802. this._activeTrigger[Trigger.FOCUS] = false;
  5803. this._activeTrigger[Trigger.HOVER] = false;
  5804. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  5805. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  5806. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5807. } else {
  5808. complete();
  5809. }
  5810. this._hoverState = '';
  5811. };
  5812. _proto.update = function update() {
  5813. if (this._popper !== null) {
  5814. this._popper.scheduleUpdate();
  5815. }
  5816. } // Protected
  5817. ;
  5818. _proto.isWithContent = function isWithContent() {
  5819. return Boolean(this.getTitle());
  5820. };
  5821. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5822. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  5823. };
  5824. _proto.getTipElement = function getTipElement() {
  5825. this.tip = this.tip || $(this.config.template)[0];
  5826. return this.tip;
  5827. };
  5828. _proto.setContent = function setContent() {
  5829. var tip = this.getTipElement();
  5830. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  5831. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  5832. };
  5833. _proto.setElementContent = function setElementContent($element, content) {
  5834. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  5835. // Content is a DOM node or a jQuery
  5836. if (this.config.html) {
  5837. if (!$(content).parent().is($element)) {
  5838. $element.empty().append(content);
  5839. }
  5840. } else {
  5841. $element.text($(content).text());
  5842. }
  5843. return;
  5844. }
  5845. if (this.config.html) {
  5846. if (this.config.sanitize) {
  5847. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  5848. }
  5849. $element.html(content);
  5850. } else {
  5851. $element.text(content);
  5852. }
  5853. };
  5854. _proto.getTitle = function getTitle() {
  5855. var title = this.element.getAttribute('data-original-title');
  5856. if (!title) {
  5857. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  5858. }
  5859. return title;
  5860. } // Private
  5861. ;
  5862. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  5863. var _this3 = this;
  5864. var defaultBsConfig = {
  5865. placement: attachment,
  5866. modifiers: {
  5867. offset: this._getOffset(),
  5868. flip: {
  5869. behavior: this.config.fallbackPlacement
  5870. },
  5871. arrow: {
  5872. element: Selector$6.ARROW
  5873. },
  5874. preventOverflow: {
  5875. boundariesElement: this.config.boundary
  5876. }
  5877. },
  5878. onCreate: function onCreate(data) {
  5879. if (data.originalPlacement !== data.placement) {
  5880. _this3._handlePopperPlacementChange(data);
  5881. }
  5882. },
  5883. onUpdate: function onUpdate(data) {
  5884. return _this3._handlePopperPlacementChange(data);
  5885. }
  5886. };
  5887. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  5888. };
  5889. _proto._getOffset = function _getOffset() {
  5890. var _this4 = this;
  5891. var offset = {};
  5892. if (typeof this.config.offset === 'function') {
  5893. offset.fn = function (data) {
  5894. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  5895. return data;
  5896. };
  5897. } else {
  5898. offset.offset = this.config.offset;
  5899. }
  5900. return offset;
  5901. };
  5902. _proto._getContainer = function _getContainer() {
  5903. if (this.config.container === false) {
  5904. return document.body;
  5905. }
  5906. if (Util.isElement(this.config.container)) {
  5907. return $(this.config.container);
  5908. }
  5909. return $(document).find(this.config.container);
  5910. };
  5911. _proto._getAttachment = function _getAttachment(placement) {
  5912. return AttachmentMap$1[placement.toUpperCase()];
  5913. };
  5914. _proto._setListeners = function _setListeners() {
  5915. var _this5 = this;
  5916. var triggers = this.config.trigger.split(' ');
  5917. triggers.forEach(function (trigger) {
  5918. if (trigger === 'click') {
  5919. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  5920. return _this5.toggle(event);
  5921. });
  5922. } else if (trigger !== Trigger.MANUAL) {
  5923. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  5924. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  5925. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  5926. return _this5._enter(event);
  5927. }).on(eventOut, _this5.config.selector, function (event) {
  5928. return _this5._leave(event);
  5929. });
  5930. }
  5931. });
  5932. this._hideModalHandler = function () {
  5933. if (_this5.element) {
  5934. _this5.hide();
  5935. }
  5936. };
  5937. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  5938. if (this.config.selector) {
  5939. this.config = _objectSpread2({}, this.config, {
  5940. trigger: 'manual',
  5941. selector: ''
  5942. });
  5943. } else {
  5944. this._fixTitle();
  5945. }
  5946. };
  5947. _proto._fixTitle = function _fixTitle() {
  5948. var titleType = typeof this.element.getAttribute('data-original-title');
  5949. if (this.element.getAttribute('title') || titleType !== 'string') {
  5950. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  5951. this.element.setAttribute('title', '');
  5952. }
  5953. };
  5954. _proto._enter = function _enter(event, context) {
  5955. var dataKey = this.constructor.DATA_KEY;
  5956. context = context || $(event.currentTarget).data(dataKey);
  5957. if (!context) {
  5958. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5959. $(event.currentTarget).data(dataKey, context);
  5960. }
  5961. if (event) {
  5962. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  5963. }
  5964. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  5965. context._hoverState = HoverState.SHOW;
  5966. return;
  5967. }
  5968. clearTimeout(context._timeout);
  5969. context._hoverState = HoverState.SHOW;
  5970. if (!context.config.delay || !context.config.delay.show) {
  5971. context.show();
  5972. return;
  5973. }
  5974. context._timeout = setTimeout(function () {
  5975. if (context._hoverState === HoverState.SHOW) {
  5976. context.show();
  5977. }
  5978. }, context.config.delay.show);
  5979. };
  5980. _proto._leave = function _leave(event, context) {
  5981. var dataKey = this.constructor.DATA_KEY;
  5982. context = context || $(event.currentTarget).data(dataKey);
  5983. if (!context) {
  5984. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5985. $(event.currentTarget).data(dataKey, context);
  5986. }
  5987. if (event) {
  5988. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  5989. }
  5990. if (context._isWithActiveTrigger()) {
  5991. return;
  5992. }
  5993. clearTimeout(context._timeout);
  5994. context._hoverState = HoverState.OUT;
  5995. if (!context.config.delay || !context.config.delay.hide) {
  5996. context.hide();
  5997. return;
  5998. }
  5999. context._timeout = setTimeout(function () {
  6000. if (context._hoverState === HoverState.OUT) {
  6001. context.hide();
  6002. }
  6003. }, context.config.delay.hide);
  6004. };
  6005. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  6006. for (var trigger in this._activeTrigger) {
  6007. if (this._activeTrigger[trigger]) {
  6008. return true;
  6009. }
  6010. }
  6011. return false;
  6012. };
  6013. _proto._getConfig = function _getConfig(config) {
  6014. var dataAttributes = $(this.element).data();
  6015. Object.keys(dataAttributes).forEach(function (dataAttr) {
  6016. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  6017. delete dataAttributes[dataAttr];
  6018. }
  6019. });
  6020. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  6021. if (typeof config.delay === 'number') {
  6022. config.delay = {
  6023. show: config.delay,
  6024. hide: config.delay
  6025. };
  6026. }
  6027. if (typeof config.title === 'number') {
  6028. config.title = config.title.toString();
  6029. }
  6030. if (typeof config.content === 'number') {
  6031. config.content = config.content.toString();
  6032. }
  6033. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  6034. if (config.sanitize) {
  6035. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  6036. }
  6037. return config;
  6038. };
  6039. _proto._getDelegateConfig = function _getDelegateConfig() {
  6040. var config = {};
  6041. if (this.config) {
  6042. for (var key in this.config) {
  6043. if (this.constructor.Default[key] !== this.config[key]) {
  6044. config[key] = this.config[key];
  6045. }
  6046. }
  6047. }
  6048. return config;
  6049. };
  6050. _proto._cleanTipClass = function _cleanTipClass() {
  6051. var $tip = $(this.getTipElement());
  6052. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  6053. if (tabClass !== null && tabClass.length) {
  6054. $tip.removeClass(tabClass.join(''));
  6055. }
  6056. };
  6057. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  6058. var popperInstance = popperData.instance;
  6059. this.tip = popperInstance.popper;
  6060. this._cleanTipClass();
  6061. this.addAttachmentClass(this._getAttachment(popperData.placement));
  6062. };
  6063. _proto._fixTransition = function _fixTransition() {
  6064. var tip = this.getTipElement();
  6065. var initConfigAnimation = this.config.animation;
  6066. if (tip.getAttribute('x-placement') !== null) {
  6067. return;
  6068. }
  6069. $(tip).removeClass(ClassName$6.FADE);
  6070. this.config.animation = false;
  6071. this.hide();
  6072. this.show();
  6073. this.config.animation = initConfigAnimation;
  6074. } // Static
  6075. ;
  6076. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  6077. return this.each(function () {
  6078. var data = $(this).data(DATA_KEY$6);
  6079. var _config = typeof config === 'object' && config;
  6080. if (!data && /dispose|hide/.test(config)) {
  6081. return;
  6082. }
  6083. if (!data) {
  6084. data = new Tooltip(this, _config);
  6085. $(this).data(DATA_KEY$6, data);
  6086. }
  6087. if (typeof config === 'string') {
  6088. if (typeof data[config] === 'undefined') {
  6089. throw new TypeError("No method named \"" + config + "\"");
  6090. }
  6091. data[config]();
  6092. }
  6093. });
  6094. };
  6095. _createClass(Tooltip, null, [{
  6096. key: "VERSION",
  6097. get: function get() {
  6098. return VERSION$6;
  6099. }
  6100. }, {
  6101. key: "Default",
  6102. get: function get() {
  6103. return Default$4;
  6104. }
  6105. }, {
  6106. key: "NAME",
  6107. get: function get() {
  6108. return NAME$6;
  6109. }
  6110. }, {
  6111. key: "DATA_KEY",
  6112. get: function get() {
  6113. return DATA_KEY$6;
  6114. }
  6115. }, {
  6116. key: "Event",
  6117. get: function get() {
  6118. return Event$6;
  6119. }
  6120. }, {
  6121. key: "EVENT_KEY",
  6122. get: function get() {
  6123. return EVENT_KEY$6;
  6124. }
  6125. }, {
  6126. key: "DefaultType",
  6127. get: function get() {
  6128. return DefaultType$4;
  6129. }
  6130. }]);
  6131. return Tooltip;
  6132. }();
  6133. /**
  6134. * ------------------------------------------------------------------------
  6135. * jQuery
  6136. * ------------------------------------------------------------------------
  6137. */
  6138. $.fn[NAME$6] = Tooltip._jQueryInterface;
  6139. $.fn[NAME$6].Constructor = Tooltip;
  6140. $.fn[NAME$6].noConflict = function () {
  6141. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  6142. return Tooltip._jQueryInterface;
  6143. };
  6144. /**
  6145. * ------------------------------------------------------------------------
  6146. * Constants
  6147. * ------------------------------------------------------------------------
  6148. */
  6149. var NAME$7 = 'popover';
  6150. var VERSION$7 = '4.4.1';
  6151. var DATA_KEY$7 = 'bs.popover';
  6152. var EVENT_KEY$7 = "." + DATA_KEY$7;
  6153. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  6154. var CLASS_PREFIX$1 = 'bs-popover';
  6155. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  6156. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  6157. placement: 'right',
  6158. trigger: 'click',
  6159. content: '',
  6160. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  6161. });
  6162. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  6163. content: '(string|element|function)'
  6164. });
  6165. var ClassName$7 = {
  6166. FADE: 'fade',
  6167. SHOW: 'show'
  6168. };
  6169. var Selector$7 = {
  6170. TITLE: '.popover-header',
  6171. CONTENT: '.popover-body'
  6172. };
  6173. var Event$7 = {
  6174. HIDE: "hide" + EVENT_KEY$7,
  6175. HIDDEN: "hidden" + EVENT_KEY$7,
  6176. SHOW: "show" + EVENT_KEY$7,
  6177. SHOWN: "shown" + EVENT_KEY$7,
  6178. INSERTED: "inserted" + EVENT_KEY$7,
  6179. CLICK: "click" + EVENT_KEY$7,
  6180. FOCUSIN: "focusin" + EVENT_KEY$7,
  6181. FOCUSOUT: "focusout" + EVENT_KEY$7,
  6182. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  6183. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  6184. };
  6185. /**
  6186. * ------------------------------------------------------------------------
  6187. * Class Definition
  6188. * ------------------------------------------------------------------------
  6189. */
  6190. var Popover =
  6191. /*#__PURE__*/
  6192. function (_Tooltip) {
  6193. _inheritsLoose(Popover, _Tooltip);
  6194. function Popover() {
  6195. return _Tooltip.apply(this, arguments) || this;
  6196. }
  6197. var _proto = Popover.prototype;
  6198. // Overrides
  6199. _proto.isWithContent = function isWithContent() {
  6200. return this.getTitle() || this._getContent();
  6201. };
  6202. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  6203. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  6204. };
  6205. _proto.getTipElement = function getTipElement() {
  6206. this.tip = this.tip || $(this.config.template)[0];
  6207. return this.tip;
  6208. };
  6209. _proto.setContent = function setContent() {
  6210. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  6211. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  6212. var content = this._getContent();
  6213. if (typeof content === 'function') {
  6214. content = content.call(this.element);
  6215. }
  6216. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  6217. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  6218. } // Private
  6219. ;
  6220. _proto._getContent = function _getContent() {
  6221. return this.element.getAttribute('data-content') || this.config.content;
  6222. };
  6223. _proto._cleanTipClass = function _cleanTipClass() {
  6224. var $tip = $(this.getTipElement());
  6225. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  6226. if (tabClass !== null && tabClass.length > 0) {
  6227. $tip.removeClass(tabClass.join(''));
  6228. }
  6229. } // Static
  6230. ;
  6231. Popover._jQueryInterface = function _jQueryInterface(config) {
  6232. return this.each(function () {
  6233. var data = $(this).data(DATA_KEY$7);
  6234. var _config = typeof config === 'object' ? config : null;
  6235. if (!data && /dispose|hide/.test(config)) {
  6236. return;
  6237. }
  6238. if (!data) {
  6239. data = new Popover(this, _config);
  6240. $(this).data(DATA_KEY$7, data);
  6241. }
  6242. if (typeof config === 'string') {
  6243. if (typeof data[config] === 'undefined') {
  6244. throw new TypeError("No method named \"" + config + "\"");
  6245. }
  6246. data[config]();
  6247. }
  6248. });
  6249. };
  6250. _createClass(Popover, null, [{
  6251. key: "VERSION",
  6252. // Getters
  6253. get: function get() {
  6254. return VERSION$7;
  6255. }
  6256. }, {
  6257. key: "Default",
  6258. get: function get() {
  6259. return Default$5;
  6260. }
  6261. }, {
  6262. key: "NAME",
  6263. get: function get() {
  6264. return NAME$7;
  6265. }
  6266. }, {
  6267. key: "DATA_KEY",
  6268. get: function get() {
  6269. return DATA_KEY$7;
  6270. }
  6271. }, {
  6272. key: "Event",
  6273. get: function get() {
  6274. return Event$7;
  6275. }
  6276. }, {
  6277. key: "EVENT_KEY",
  6278. get: function get() {
  6279. return EVENT_KEY$7;
  6280. }
  6281. }, {
  6282. key: "DefaultType",
  6283. get: function get() {
  6284. return DefaultType$5;
  6285. }
  6286. }]);
  6287. return Popover;
  6288. }(Tooltip);
  6289. /**
  6290. * ------------------------------------------------------------------------
  6291. * jQuery
  6292. * ------------------------------------------------------------------------
  6293. */
  6294. $.fn[NAME$7] = Popover._jQueryInterface;
  6295. $.fn[NAME$7].Constructor = Popover;
  6296. $.fn[NAME$7].noConflict = function () {
  6297. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  6298. return Popover._jQueryInterface;
  6299. };
  6300. /**
  6301. * ------------------------------------------------------------------------
  6302. * Constants
  6303. * ------------------------------------------------------------------------
  6304. */
  6305. var NAME$8 = 'scrollspy';
  6306. var VERSION$8 = '4.4.1';
  6307. var DATA_KEY$8 = 'bs.scrollspy';
  6308. var EVENT_KEY$8 = "." + DATA_KEY$8;
  6309. var DATA_API_KEY$6 = '.data-api';
  6310. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  6311. var Default$6 = {
  6312. offset: 10,
  6313. method: 'auto',
  6314. target: ''
  6315. };
  6316. var DefaultType$6 = {
  6317. offset: 'number',
  6318. method: 'string',
  6319. target: '(string|element)'
  6320. };
  6321. var Event$8 = {
  6322. ACTIVATE: "activate" + EVENT_KEY$8,
  6323. SCROLL: "scroll" + EVENT_KEY$8,
  6324. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  6325. };
  6326. var ClassName$8 = {
  6327. DROPDOWN_ITEM: 'dropdown-item',
  6328. DROPDOWN_MENU: 'dropdown-menu',
  6329. ACTIVE: 'active'
  6330. };
  6331. var Selector$8 = {
  6332. DATA_SPY: '[data-spy="scroll"]',
  6333. ACTIVE: '.active',
  6334. NAV_LIST_GROUP: '.nav, .list-group',
  6335. NAV_LINKS: '.nav-link',
  6336. NAV_ITEMS: '.nav-item',
  6337. LIST_ITEMS: '.list-group-item',
  6338. DROPDOWN: '.dropdown',
  6339. DROPDOWN_ITEMS: '.dropdown-item',
  6340. DROPDOWN_TOGGLE: '.dropdown-toggle'
  6341. };
  6342. var OffsetMethod = {
  6343. OFFSET: 'offset',
  6344. POSITION: 'position'
  6345. };
  6346. /**
  6347. * ------------------------------------------------------------------------
  6348. * Class Definition
  6349. * ------------------------------------------------------------------------
  6350. */
  6351. var ScrollSpy =
  6352. /*#__PURE__*/
  6353. function () {
  6354. function ScrollSpy(element, config) {
  6355. var _this = this;
  6356. this._element = element;
  6357. this._scrollElement = element.tagName === 'BODY' ? window : element;
  6358. this._config = this._getConfig(config);
  6359. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  6360. this._offsets = [];
  6361. this._targets = [];
  6362. this._activeTarget = null;
  6363. this._scrollHeight = 0;
  6364. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  6365. return _this._process(event);
  6366. });
  6367. this.refresh();
  6368. this._process();
  6369. } // Getters
  6370. var _proto = ScrollSpy.prototype;
  6371. // Public
  6372. _proto.refresh = function refresh() {
  6373. var _this2 = this;
  6374. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  6375. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  6376. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  6377. this._offsets = [];
  6378. this._targets = [];
  6379. this._scrollHeight = this._getScrollHeight();
  6380. var targets = [].slice.call(document.querySelectorAll(this._selector));
  6381. targets.map(function (element) {
  6382. var target;
  6383. var targetSelector = Util.getSelectorFromElement(element);
  6384. if (targetSelector) {
  6385. target = document.querySelector(targetSelector);
  6386. }
  6387. if (target) {
  6388. var targetBCR = target.getBoundingClientRect();
  6389. if (targetBCR.width || targetBCR.height) {
  6390. // TODO (fat): remove sketch reliance on jQuery position/offset
  6391. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  6392. }
  6393. }
  6394. return null;
  6395. }).filter(function (item) {
  6396. return item;
  6397. }).sort(function (a, b) {
  6398. return a[0] - b[0];
  6399. }).forEach(function (item) {
  6400. _this2._offsets.push(item[0]);
  6401. _this2._targets.push(item[1]);
  6402. });
  6403. };
  6404. _proto.dispose = function dispose() {
  6405. $.removeData(this._element, DATA_KEY$8);
  6406. $(this._scrollElement).off(EVENT_KEY$8);
  6407. this._element = null;
  6408. this._scrollElement = null;
  6409. this._config = null;
  6410. this._selector = null;
  6411. this._offsets = null;
  6412. this._targets = null;
  6413. this._activeTarget = null;
  6414. this._scrollHeight = null;
  6415. } // Private
  6416. ;
  6417. _proto._getConfig = function _getConfig(config) {
  6418. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  6419. if (typeof config.target !== 'string') {
  6420. var id = $(config.target).attr('id');
  6421. if (!id) {
  6422. id = Util.getUID(NAME$8);
  6423. $(config.target).attr('id', id);
  6424. }
  6425. config.target = "#" + id;
  6426. }
  6427. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  6428. return config;
  6429. };
  6430. _proto._getScrollTop = function _getScrollTop() {
  6431. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  6432. };
  6433. _proto._getScrollHeight = function _getScrollHeight() {
  6434. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  6435. };
  6436. _proto._getOffsetHeight = function _getOffsetHeight() {
  6437. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  6438. };
  6439. _proto._process = function _process() {
  6440. var scrollTop = this._getScrollTop() + this._config.offset;
  6441. var scrollHeight = this._getScrollHeight();
  6442. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  6443. if (this._scrollHeight !== scrollHeight) {
  6444. this.refresh();
  6445. }
  6446. if (scrollTop >= maxScroll) {
  6447. var target = this._targets[this._targets.length - 1];
  6448. if (this._activeTarget !== target) {
  6449. this._activate(target);
  6450. }
  6451. return;
  6452. }
  6453. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  6454. this._activeTarget = null;
  6455. this._clear();
  6456. return;
  6457. }
  6458. var offsetLength = this._offsets.length;
  6459. for (var i = offsetLength; i--;) {
  6460. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  6461. if (isActiveTarget) {
  6462. this._activate(this._targets[i]);
  6463. }
  6464. }
  6465. };
  6466. _proto._activate = function _activate(target) {
  6467. this._activeTarget = target;
  6468. this._clear();
  6469. var queries = this._selector.split(',').map(function (selector) {
  6470. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  6471. });
  6472. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  6473. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  6474. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  6475. $link.addClass(ClassName$8.ACTIVE);
  6476. } else {
  6477. // Set triggered link as active
  6478. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  6479. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  6480. $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
  6481. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  6482. }
  6483. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  6484. relatedTarget: target
  6485. });
  6486. };
  6487. _proto._clear = function _clear() {
  6488. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  6489. return node.classList.contains(ClassName$8.ACTIVE);
  6490. }).forEach(function (node) {
  6491. return node.classList.remove(ClassName$8.ACTIVE);
  6492. });
  6493. } // Static
  6494. ;
  6495. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  6496. return this.each(function () {
  6497. var data = $(this).data(DATA_KEY$8);
  6498. var _config = typeof config === 'object' && config;
  6499. if (!data) {
  6500. data = new ScrollSpy(this, _config);
  6501. $(this).data(DATA_KEY$8, data);
  6502. }
  6503. if (typeof config === 'string') {
  6504. if (typeof data[config] === 'undefined') {
  6505. throw new TypeError("No method named \"" + config + "\"");
  6506. }
  6507. data[config]();
  6508. }
  6509. });
  6510. };
  6511. _createClass(ScrollSpy, null, [{
  6512. key: "VERSION",
  6513. get: function get() {
  6514. return VERSION$8;
  6515. }
  6516. }, {
  6517. key: "Default",
  6518. get: function get() {
  6519. return Default$6;
  6520. }
  6521. }]);
  6522. return ScrollSpy;
  6523. }();
  6524. /**
  6525. * ------------------------------------------------------------------------
  6526. * Data Api implementation
  6527. * ------------------------------------------------------------------------
  6528. */
  6529. $(window).on(Event$8.LOAD_DATA_API, function () {
  6530. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  6531. var scrollSpysLength = scrollSpys.length;
  6532. for (var i = scrollSpysLength; i--;) {
  6533. var $spy = $(scrollSpys[i]);
  6534. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  6535. }
  6536. });
  6537. /**
  6538. * ------------------------------------------------------------------------
  6539. * jQuery
  6540. * ------------------------------------------------------------------------
  6541. */
  6542. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  6543. $.fn[NAME$8].Constructor = ScrollSpy;
  6544. $.fn[NAME$8].noConflict = function () {
  6545. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  6546. return ScrollSpy._jQueryInterface;
  6547. };
  6548. /**
  6549. * ------------------------------------------------------------------------
  6550. * Constants
  6551. * ------------------------------------------------------------------------
  6552. */
  6553. var NAME$9 = 'tab';
  6554. var VERSION$9 = '4.4.1';
  6555. var DATA_KEY$9 = 'bs.tab';
  6556. var EVENT_KEY$9 = "." + DATA_KEY$9;
  6557. var DATA_API_KEY$7 = '.data-api';
  6558. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  6559. var Event$9 = {
  6560. HIDE: "hide" + EVENT_KEY$9,
  6561. HIDDEN: "hidden" + EVENT_KEY$9,
  6562. SHOW: "show" + EVENT_KEY$9,
  6563. SHOWN: "shown" + EVENT_KEY$9,
  6564. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  6565. };
  6566. var ClassName$9 = {
  6567. DROPDOWN_MENU: 'dropdown-menu',
  6568. ACTIVE: 'active',
  6569. DISABLED: 'disabled',
  6570. FADE: 'fade',
  6571. SHOW: 'show'
  6572. };
  6573. var Selector$9 = {
  6574. DROPDOWN: '.dropdown',
  6575. NAV_LIST_GROUP: '.nav, .list-group',
  6576. ACTIVE: '.active',
  6577. ACTIVE_UL: '> li > .active',
  6578. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  6579. DROPDOWN_TOGGLE: '.dropdown-toggle',
  6580. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  6581. };
  6582. /**
  6583. * ------------------------------------------------------------------------
  6584. * Class Definition
  6585. * ------------------------------------------------------------------------
  6586. */
  6587. var Tab =
  6588. /*#__PURE__*/
  6589. function () {
  6590. function Tab(element) {
  6591. this._element = element;
  6592. } // Getters
  6593. var _proto = Tab.prototype;
  6594. // Public
  6595. _proto.show = function show() {
  6596. var _this = this;
  6597. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  6598. return;
  6599. }
  6600. var target;
  6601. var previous;
  6602. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  6603. var selector = Util.getSelectorFromElement(this._element);
  6604. if (listElement) {
  6605. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  6606. previous = $.makeArray($(listElement).find(itemSelector));
  6607. previous = previous[previous.length - 1];
  6608. }
  6609. var hideEvent = $.Event(Event$9.HIDE, {
  6610. relatedTarget: this._element
  6611. });
  6612. var showEvent = $.Event(Event$9.SHOW, {
  6613. relatedTarget: previous
  6614. });
  6615. if (previous) {
  6616. $(previous).trigger(hideEvent);
  6617. }
  6618. $(this._element).trigger(showEvent);
  6619. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  6620. return;
  6621. }
  6622. if (selector) {
  6623. target = document.querySelector(selector);
  6624. }
  6625. this._activate(this._element, listElement);
  6626. var complete = function complete() {
  6627. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  6628. relatedTarget: _this._element
  6629. });
  6630. var shownEvent = $.Event(Event$9.SHOWN, {
  6631. relatedTarget: previous
  6632. });
  6633. $(previous).trigger(hiddenEvent);
  6634. $(_this._element).trigger(shownEvent);
  6635. };
  6636. if (target) {
  6637. this._activate(target, target.parentNode, complete);
  6638. } else {
  6639. complete();
  6640. }
  6641. };
  6642. _proto.dispose = function dispose() {
  6643. $.removeData(this._element, DATA_KEY$9);
  6644. this._element = null;
  6645. } // Private
  6646. ;
  6647. _proto._activate = function _activate(element, container, callback) {
  6648. var _this2 = this;
  6649. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  6650. var active = activeElements[0];
  6651. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  6652. var complete = function complete() {
  6653. return _this2._transitionComplete(element, active, callback);
  6654. };
  6655. if (active && isTransitioning) {
  6656. var transitionDuration = Util.getTransitionDurationFromElement(active);
  6657. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6658. } else {
  6659. complete();
  6660. }
  6661. };
  6662. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  6663. if (active) {
  6664. $(active).removeClass(ClassName$9.ACTIVE);
  6665. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  6666. if (dropdownChild) {
  6667. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  6668. }
  6669. if (active.getAttribute('role') === 'tab') {
  6670. active.setAttribute('aria-selected', false);
  6671. }
  6672. }
  6673. $(element).addClass(ClassName$9.ACTIVE);
  6674. if (element.getAttribute('role') === 'tab') {
  6675. element.setAttribute('aria-selected', true);
  6676. }
  6677. Util.reflow(element);
  6678. if (element.classList.contains(ClassName$9.FADE)) {
  6679. element.classList.add(ClassName$9.SHOW);
  6680. }
  6681. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  6682. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  6683. if (dropdownElement) {
  6684. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  6685. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  6686. }
  6687. element.setAttribute('aria-expanded', true);
  6688. }
  6689. if (callback) {
  6690. callback();
  6691. }
  6692. } // Static
  6693. ;
  6694. Tab._jQueryInterface = function _jQueryInterface(config) {
  6695. return this.each(function () {
  6696. var $this = $(this);
  6697. var data = $this.data(DATA_KEY$9);
  6698. if (!data) {
  6699. data = new Tab(this);
  6700. $this.data(DATA_KEY$9, data);
  6701. }
  6702. if (typeof config === 'string') {
  6703. if (typeof data[config] === 'undefined') {
  6704. throw new TypeError("No method named \"" + config + "\"");
  6705. }
  6706. data[config]();
  6707. }
  6708. });
  6709. };
  6710. _createClass(Tab, null, [{
  6711. key: "VERSION",
  6712. get: function get() {
  6713. return VERSION$9;
  6714. }
  6715. }]);
  6716. return Tab;
  6717. }();
  6718. /**
  6719. * ------------------------------------------------------------------------
  6720. * Data Api implementation
  6721. * ------------------------------------------------------------------------
  6722. */
  6723. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  6724. event.preventDefault();
  6725. Tab._jQueryInterface.call($(this), 'show');
  6726. });
  6727. /**
  6728. * ------------------------------------------------------------------------
  6729. * jQuery
  6730. * ------------------------------------------------------------------------
  6731. */
  6732. $.fn[NAME$9] = Tab._jQueryInterface;
  6733. $.fn[NAME$9].Constructor = Tab;
  6734. $.fn[NAME$9].noConflict = function () {
  6735. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  6736. return Tab._jQueryInterface;
  6737. };
  6738. /**
  6739. * ------------------------------------------------------------------------
  6740. * Constants
  6741. * ------------------------------------------------------------------------
  6742. */
  6743. var NAME$a = 'toast';
  6744. var VERSION$a = '4.4.1';
  6745. var DATA_KEY$a = 'bs.toast';
  6746. var EVENT_KEY$a = "." + DATA_KEY$a;
  6747. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  6748. var Event$a = {
  6749. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  6750. HIDE: "hide" + EVENT_KEY$a,
  6751. HIDDEN: "hidden" + EVENT_KEY$a,
  6752. SHOW: "show" + EVENT_KEY$a,
  6753. SHOWN: "shown" + EVENT_KEY$a
  6754. };
  6755. var ClassName$a = {
  6756. FADE: 'fade',
  6757. HIDE: 'hide',
  6758. SHOW: 'show',
  6759. SHOWING: 'showing'
  6760. };
  6761. var DefaultType$7 = {
  6762. animation: 'boolean',
  6763. autohide: 'boolean',
  6764. delay: 'number'
  6765. };
  6766. var Default$7 = {
  6767. animation: true,
  6768. autohide: true,
  6769. delay: 500
  6770. };
  6771. var Selector$a = {
  6772. DATA_DISMISS: '[data-dismiss="toast"]'
  6773. };
  6774. /**
  6775. * ------------------------------------------------------------------------
  6776. * Class Definition
  6777. * ------------------------------------------------------------------------
  6778. */
  6779. var Toast =
  6780. /*#__PURE__*/
  6781. function () {
  6782. function Toast(element, config) {
  6783. this._element = element;
  6784. this._config = this._getConfig(config);
  6785. this._timeout = null;
  6786. this._setListeners();
  6787. } // Getters
  6788. var _proto = Toast.prototype;
  6789. // Public
  6790. _proto.show = function show() {
  6791. var _this = this;
  6792. var showEvent = $.Event(Event$a.SHOW);
  6793. $(this._element).trigger(showEvent);
  6794. if (showEvent.isDefaultPrevented()) {
  6795. return;
  6796. }
  6797. if (this._config.animation) {
  6798. this._element.classList.add(ClassName$a.FADE);
  6799. }
  6800. var complete = function complete() {
  6801. _this._element.classList.remove(ClassName$a.SHOWING);
  6802. _this._element.classList.add(ClassName$a.SHOW);
  6803. $(_this._element).trigger(Event$a.SHOWN);
  6804. if (_this._config.autohide) {
  6805. _this._timeout = setTimeout(function () {
  6806. _this.hide();
  6807. }, _this._config.delay);
  6808. }
  6809. };
  6810. this._element.classList.remove(ClassName$a.HIDE);
  6811. Util.reflow(this._element);
  6812. this._element.classList.add(ClassName$a.SHOWING);
  6813. if (this._config.animation) {
  6814. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6815. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6816. } else {
  6817. complete();
  6818. }
  6819. };
  6820. _proto.hide = function hide() {
  6821. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  6822. return;
  6823. }
  6824. var hideEvent = $.Event(Event$a.HIDE);
  6825. $(this._element).trigger(hideEvent);
  6826. if (hideEvent.isDefaultPrevented()) {
  6827. return;
  6828. }
  6829. this._close();
  6830. };
  6831. _proto.dispose = function dispose() {
  6832. clearTimeout(this._timeout);
  6833. this._timeout = null;
  6834. if (this._element.classList.contains(ClassName$a.SHOW)) {
  6835. this._element.classList.remove(ClassName$a.SHOW);
  6836. }
  6837. $(this._element).off(Event$a.CLICK_DISMISS);
  6838. $.removeData(this._element, DATA_KEY$a);
  6839. this._element = null;
  6840. this._config = null;
  6841. } // Private
  6842. ;
  6843. _proto._getConfig = function _getConfig(config) {
  6844. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  6845. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  6846. return config;
  6847. };
  6848. _proto._setListeners = function _setListeners() {
  6849. var _this2 = this;
  6850. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  6851. return _this2.hide();
  6852. });
  6853. };
  6854. _proto._close = function _close() {
  6855. var _this3 = this;
  6856. var complete = function complete() {
  6857. _this3._element.classList.add(ClassName$a.HIDE);
  6858. $(_this3._element).trigger(Event$a.HIDDEN);
  6859. };
  6860. this._element.classList.remove(ClassName$a.SHOW);
  6861. if (this._config.animation) {
  6862. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6863. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6864. } else {
  6865. complete();
  6866. }
  6867. } // Static
  6868. ;
  6869. Toast._jQueryInterface = function _jQueryInterface(config) {
  6870. return this.each(function () {
  6871. var $element = $(this);
  6872. var data = $element.data(DATA_KEY$a);
  6873. var _config = typeof config === 'object' && config;
  6874. if (!data) {
  6875. data = new Toast(this, _config);
  6876. $element.data(DATA_KEY$a, data);
  6877. }
  6878. if (typeof config === 'string') {
  6879. if (typeof data[config] === 'undefined') {
  6880. throw new TypeError("No method named \"" + config + "\"");
  6881. }
  6882. data[config](this);
  6883. }
  6884. });
  6885. };
  6886. _createClass(Toast, null, [{
  6887. key: "VERSION",
  6888. get: function get() {
  6889. return VERSION$a;
  6890. }
  6891. }, {
  6892. key: "DefaultType",
  6893. get: function get() {
  6894. return DefaultType$7;
  6895. }
  6896. }, {
  6897. key: "Default",
  6898. get: function get() {
  6899. return Default$7;
  6900. }
  6901. }]);
  6902. return Toast;
  6903. }();
  6904. /**
  6905. * ------------------------------------------------------------------------
  6906. * jQuery
  6907. * ------------------------------------------------------------------------
  6908. */
  6909. $.fn[NAME$a] = Toast._jQueryInterface;
  6910. $.fn[NAME$a].Constructor = Toast;
  6911. $.fn[NAME$a].noConflict = function () {
  6912. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  6913. return Toast._jQueryInterface;
  6914. };
  6915. exports.Alert = Alert;
  6916. exports.Button = Button;
  6917. exports.Carousel = Carousel;
  6918. exports.Collapse = Collapse;
  6919. exports.Dropdown = Dropdown;
  6920. exports.Modal = Modal;
  6921. exports.Popover = Popover;
  6922. exports.Scrollspy = ScrollSpy;
  6923. exports.Tab = Tab;
  6924. exports.Toast = Toast;
  6925. exports.Tooltip = Tooltip;
  6926. exports.Util = Util;
  6927. Object.defineProperty(exports, '__esModule', { value: true });
  6928. })));
  6929. //# sourceMappingURL=bootstrap.js.map
  6930. /***/ }),
  6931. /***/ "./node_modules/buffer/index.js":
  6932. /*!**************************************!*\
  6933. !*** ./node_modules/buffer/index.js ***!
  6934. \**************************************/
  6935. /*! no static exports found */
  6936. /***/ (function(module, exports, __webpack_require__) {
  6937. "use strict";
  6938. /* WEBPACK VAR INJECTION */(function(global) {/*!
  6939. * The buffer module from node.js, for the browser.
  6940. *
  6941. * @author Feross Aboukhadijeh <http://feross.org>
  6942. * @license MIT
  6943. */
  6944. /* eslint-disable no-proto */
  6945. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  6946. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  6947. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  6948. exports.Buffer = Buffer
  6949. exports.SlowBuffer = SlowBuffer
  6950. exports.INSPECT_MAX_BYTES = 50
  6951. /**
  6952. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  6953. * === true Use Uint8Array implementation (fastest)
  6954. * === false Use Object implementation (most compatible, even IE6)
  6955. *
  6956. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  6957. * Opera 11.6+, iOS 4.2+.
  6958. *
  6959. * Due to various browser bugs, sometimes the Object implementation will be used even
  6960. * when the browser supports typed arrays.
  6961. *
  6962. * Note:
  6963. *
  6964. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  6965. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  6966. *
  6967. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  6968. *
  6969. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  6970. * incorrect length in some situations.
  6971. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  6972. * get the Object implementation, which is slower but behaves correctly.
  6973. */
  6974. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  6975. ? global.TYPED_ARRAY_SUPPORT
  6976. : typedArraySupport()
  6977. /*
  6978. * Export kMaxLength after typed array support is determined.
  6979. */
  6980. exports.kMaxLength = kMaxLength()
  6981. function typedArraySupport () {
  6982. try {
  6983. var arr = new Uint8Array(1)
  6984. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  6985. return arr.foo() === 42 && // typed array instances can be augmented
  6986. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  6987. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  6988. } catch (e) {
  6989. return false
  6990. }
  6991. }
  6992. function kMaxLength () {
  6993. return Buffer.TYPED_ARRAY_SUPPORT
  6994. ? 0x7fffffff
  6995. : 0x3fffffff
  6996. }
  6997. function createBuffer (that, length) {
  6998. if (kMaxLength() < length) {
  6999. throw new RangeError('Invalid typed array length')
  7000. }
  7001. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7002. // Return an augmented `Uint8Array` instance, for best performance
  7003. that = new Uint8Array(length)
  7004. that.__proto__ = Buffer.prototype
  7005. } else {
  7006. // Fallback: Return an object instance of the Buffer class
  7007. if (that === null) {
  7008. that = new Buffer(length)
  7009. }
  7010. that.length = length
  7011. }
  7012. return that
  7013. }
  7014. /**
  7015. * The Buffer constructor returns instances of `Uint8Array` that have their
  7016. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  7017. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  7018. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  7019. * returns a single octet.
  7020. *
  7021. * The `Uint8Array` prototype remains unmodified.
  7022. */
  7023. function Buffer (arg, encodingOrOffset, length) {
  7024. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  7025. return new Buffer(arg, encodingOrOffset, length)
  7026. }
  7027. // Common case.
  7028. if (typeof arg === 'number') {
  7029. if (typeof encodingOrOffset === 'string') {
  7030. throw new Error(
  7031. 'If encoding is specified then the first argument must be a string'
  7032. )
  7033. }
  7034. return allocUnsafe(this, arg)
  7035. }
  7036. return from(this, arg, encodingOrOffset, length)
  7037. }
  7038. Buffer.poolSize = 8192 // not used by this implementation
  7039. // TODO: Legacy, not needed anymore. Remove in next major version.
  7040. Buffer._augment = function (arr) {
  7041. arr.__proto__ = Buffer.prototype
  7042. return arr
  7043. }
  7044. function from (that, value, encodingOrOffset, length) {
  7045. if (typeof value === 'number') {
  7046. throw new TypeError('"value" argument must not be a number')
  7047. }
  7048. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  7049. return fromArrayBuffer(that, value, encodingOrOffset, length)
  7050. }
  7051. if (typeof value === 'string') {
  7052. return fromString(that, value, encodingOrOffset)
  7053. }
  7054. return fromObject(that, value)
  7055. }
  7056. /**
  7057. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  7058. * if value is a number.
  7059. * Buffer.from(str[, encoding])
  7060. * Buffer.from(array)
  7061. * Buffer.from(buffer)
  7062. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  7063. **/
  7064. Buffer.from = function (value, encodingOrOffset, length) {
  7065. return from(null, value, encodingOrOffset, length)
  7066. }
  7067. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7068. Buffer.prototype.__proto__ = Uint8Array.prototype
  7069. Buffer.__proto__ = Uint8Array
  7070. if (typeof Symbol !== 'undefined' && Symbol.species &&
  7071. Buffer[Symbol.species] === Buffer) {
  7072. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  7073. Object.defineProperty(Buffer, Symbol.species, {
  7074. value: null,
  7075. configurable: true
  7076. })
  7077. }
  7078. }
  7079. function assertSize (size) {
  7080. if (typeof size !== 'number') {
  7081. throw new TypeError('"size" argument must be a number')
  7082. } else if (size < 0) {
  7083. throw new RangeError('"size" argument must not be negative')
  7084. }
  7085. }
  7086. function alloc (that, size, fill, encoding) {
  7087. assertSize(size)
  7088. if (size <= 0) {
  7089. return createBuffer(that, size)
  7090. }
  7091. if (fill !== undefined) {
  7092. // Only pay attention to encoding if it's a string. This
  7093. // prevents accidentally sending in a number that would
  7094. // be interpretted as a start offset.
  7095. return typeof encoding === 'string'
  7096. ? createBuffer(that, size).fill(fill, encoding)
  7097. : createBuffer(that, size).fill(fill)
  7098. }
  7099. return createBuffer(that, size)
  7100. }
  7101. /**
  7102. * Creates a new filled Buffer instance.
  7103. * alloc(size[, fill[, encoding]])
  7104. **/
  7105. Buffer.alloc = function (size, fill, encoding) {
  7106. return alloc(null, size, fill, encoding)
  7107. }
  7108. function allocUnsafe (that, size) {
  7109. assertSize(size)
  7110. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  7111. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  7112. for (var i = 0; i < size; ++i) {
  7113. that[i] = 0
  7114. }
  7115. }
  7116. return that
  7117. }
  7118. /**
  7119. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  7120. * */
  7121. Buffer.allocUnsafe = function (size) {
  7122. return allocUnsafe(null, size)
  7123. }
  7124. /**
  7125. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  7126. */
  7127. Buffer.allocUnsafeSlow = function (size) {
  7128. return allocUnsafe(null, size)
  7129. }
  7130. function fromString (that, string, encoding) {
  7131. if (typeof encoding !== 'string' || encoding === '') {
  7132. encoding = 'utf8'
  7133. }
  7134. if (!Buffer.isEncoding(encoding)) {
  7135. throw new TypeError('"encoding" must be a valid string encoding')
  7136. }
  7137. var length = byteLength(string, encoding) | 0
  7138. that = createBuffer(that, length)
  7139. var actual = that.write(string, encoding)
  7140. if (actual !== length) {
  7141. // Writing a hex string, for example, that contains invalid characters will
  7142. // cause everything after the first invalid character to be ignored. (e.g.
  7143. // 'abxxcd' will be treated as 'ab')
  7144. that = that.slice(0, actual)
  7145. }
  7146. return that
  7147. }
  7148. function fromArrayLike (that, array) {
  7149. var length = array.length < 0 ? 0 : checked(array.length) | 0
  7150. that = createBuffer(that, length)
  7151. for (var i = 0; i < length; i += 1) {
  7152. that[i] = array[i] & 255
  7153. }
  7154. return that
  7155. }
  7156. function fromArrayBuffer (that, array, byteOffset, length) {
  7157. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  7158. if (byteOffset < 0 || array.byteLength < byteOffset) {
  7159. throw new RangeError('\'offset\' is out of bounds')
  7160. }
  7161. if (array.byteLength < byteOffset + (length || 0)) {
  7162. throw new RangeError('\'length\' is out of bounds')
  7163. }
  7164. if (byteOffset === undefined && length === undefined) {
  7165. array = new Uint8Array(array)
  7166. } else if (length === undefined) {
  7167. array = new Uint8Array(array, byteOffset)
  7168. } else {
  7169. array = new Uint8Array(array, byteOffset, length)
  7170. }
  7171. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7172. // Return an augmented `Uint8Array` instance, for best performance
  7173. that = array
  7174. that.__proto__ = Buffer.prototype
  7175. } else {
  7176. // Fallback: Return an object instance of the Buffer class
  7177. that = fromArrayLike(that, array)
  7178. }
  7179. return that
  7180. }
  7181. function fromObject (that, obj) {
  7182. if (Buffer.isBuffer(obj)) {
  7183. var len = checked(obj.length) | 0
  7184. that = createBuffer(that, len)
  7185. if (that.length === 0) {
  7186. return that
  7187. }
  7188. obj.copy(that, 0, 0, len)
  7189. return that
  7190. }
  7191. if (obj) {
  7192. if ((typeof ArrayBuffer !== 'undefined' &&
  7193. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  7194. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  7195. return createBuffer(that, 0)
  7196. }
  7197. return fromArrayLike(that, obj)
  7198. }
  7199. if (obj.type === 'Buffer' && isArray(obj.data)) {
  7200. return fromArrayLike(that, obj.data)
  7201. }
  7202. }
  7203. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  7204. }
  7205. function checked (length) {
  7206. // Note: cannot use `length < kMaxLength()` here because that fails when
  7207. // length is NaN (which is otherwise coerced to zero.)
  7208. if (length >= kMaxLength()) {
  7209. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  7210. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  7211. }
  7212. return length | 0
  7213. }
  7214. function SlowBuffer (length) {
  7215. if (+length != length) { // eslint-disable-line eqeqeq
  7216. length = 0
  7217. }
  7218. return Buffer.alloc(+length)
  7219. }
  7220. Buffer.isBuffer = function isBuffer (b) {
  7221. return !!(b != null && b._isBuffer)
  7222. }
  7223. Buffer.compare = function compare (a, b) {
  7224. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  7225. throw new TypeError('Arguments must be Buffers')
  7226. }
  7227. if (a === b) return 0
  7228. var x = a.length
  7229. var y = b.length
  7230. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  7231. if (a[i] !== b[i]) {
  7232. x = a[i]
  7233. y = b[i]
  7234. break
  7235. }
  7236. }
  7237. if (x < y) return -1
  7238. if (y < x) return 1
  7239. return 0
  7240. }
  7241. Buffer.isEncoding = function isEncoding (encoding) {
  7242. switch (String(encoding).toLowerCase()) {
  7243. case 'hex':
  7244. case 'utf8':
  7245. case 'utf-8':
  7246. case 'ascii':
  7247. case 'latin1':
  7248. case 'binary':
  7249. case 'base64':
  7250. case 'ucs2':
  7251. case 'ucs-2':
  7252. case 'utf16le':
  7253. case 'utf-16le':
  7254. return true
  7255. default:
  7256. return false
  7257. }
  7258. }
  7259. Buffer.concat = function concat (list, length) {
  7260. if (!isArray(list)) {
  7261. throw new TypeError('"list" argument must be an Array of Buffers')
  7262. }
  7263. if (list.length === 0) {
  7264. return Buffer.alloc(0)
  7265. }
  7266. var i
  7267. if (length === undefined) {
  7268. length = 0
  7269. for (i = 0; i < list.length; ++i) {
  7270. length += list[i].length
  7271. }
  7272. }
  7273. var buffer = Buffer.allocUnsafe(length)
  7274. var pos = 0
  7275. for (i = 0; i < list.length; ++i) {
  7276. var buf = list[i]
  7277. if (!Buffer.isBuffer(buf)) {
  7278. throw new TypeError('"list" argument must be an Array of Buffers')
  7279. }
  7280. buf.copy(buffer, pos)
  7281. pos += buf.length
  7282. }
  7283. return buffer
  7284. }
  7285. function byteLength (string, encoding) {
  7286. if (Buffer.isBuffer(string)) {
  7287. return string.length
  7288. }
  7289. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  7290. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  7291. return string.byteLength
  7292. }
  7293. if (typeof string !== 'string') {
  7294. string = '' + string
  7295. }
  7296. var len = string.length
  7297. if (len === 0) return 0
  7298. // Use a for loop to avoid recursion
  7299. var loweredCase = false
  7300. for (;;) {
  7301. switch (encoding) {
  7302. case 'ascii':
  7303. case 'latin1':
  7304. case 'binary':
  7305. return len
  7306. case 'utf8':
  7307. case 'utf-8':
  7308. case undefined:
  7309. return utf8ToBytes(string).length
  7310. case 'ucs2':
  7311. case 'ucs-2':
  7312. case 'utf16le':
  7313. case 'utf-16le':
  7314. return len * 2
  7315. case 'hex':
  7316. return len >>> 1
  7317. case 'base64':
  7318. return base64ToBytes(string).length
  7319. default:
  7320. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  7321. encoding = ('' + encoding).toLowerCase()
  7322. loweredCase = true
  7323. }
  7324. }
  7325. }
  7326. Buffer.byteLength = byteLength
  7327. function slowToString (encoding, start, end) {
  7328. var loweredCase = false
  7329. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  7330. // property of a typed array.
  7331. // This behaves neither like String nor Uint8Array in that we set start/end
  7332. // to their upper/lower bounds if the value passed is out of range.
  7333. // undefined is handled specially as per ECMA-262 6th Edition,
  7334. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  7335. if (start === undefined || start < 0) {
  7336. start = 0
  7337. }
  7338. // Return early if start > this.length. Done here to prevent potential uint32
  7339. // coercion fail below.
  7340. if (start > this.length) {
  7341. return ''
  7342. }
  7343. if (end === undefined || end > this.length) {
  7344. end = this.length
  7345. }
  7346. if (end <= 0) {
  7347. return ''
  7348. }
  7349. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  7350. end >>>= 0
  7351. start >>>= 0
  7352. if (end <= start) {
  7353. return ''
  7354. }
  7355. if (!encoding) encoding = 'utf8'
  7356. while (true) {
  7357. switch (encoding) {
  7358. case 'hex':
  7359. return hexSlice(this, start, end)
  7360. case 'utf8':
  7361. case 'utf-8':
  7362. return utf8Slice(this, start, end)
  7363. case 'ascii':
  7364. return asciiSlice(this, start, end)
  7365. case 'latin1':
  7366. case 'binary':
  7367. return latin1Slice(this, start, end)
  7368. case 'base64':
  7369. return base64Slice(this, start, end)
  7370. case 'ucs2':
  7371. case 'ucs-2':
  7372. case 'utf16le':
  7373. case 'utf-16le':
  7374. return utf16leSlice(this, start, end)
  7375. default:
  7376. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  7377. encoding = (encoding + '').toLowerCase()
  7378. loweredCase = true
  7379. }
  7380. }
  7381. }
  7382. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  7383. // Buffer instances.
  7384. Buffer.prototype._isBuffer = true
  7385. function swap (b, n, m) {
  7386. var i = b[n]
  7387. b[n] = b[m]
  7388. b[m] = i
  7389. }
  7390. Buffer.prototype.swap16 = function swap16 () {
  7391. var len = this.length
  7392. if (len % 2 !== 0) {
  7393. throw new RangeError('Buffer size must be a multiple of 16-bits')
  7394. }
  7395. for (var i = 0; i < len; i += 2) {
  7396. swap(this, i, i + 1)
  7397. }
  7398. return this
  7399. }
  7400. Buffer.prototype.swap32 = function swap32 () {
  7401. var len = this.length
  7402. if (len % 4 !== 0) {
  7403. throw new RangeError('Buffer size must be a multiple of 32-bits')
  7404. }
  7405. for (var i = 0; i < len; i += 4) {
  7406. swap(this, i, i + 3)
  7407. swap(this, i + 1, i + 2)
  7408. }
  7409. return this
  7410. }
  7411. Buffer.prototype.swap64 = function swap64 () {
  7412. var len = this.length
  7413. if (len % 8 !== 0) {
  7414. throw new RangeError('Buffer size must be a multiple of 64-bits')
  7415. }
  7416. for (var i = 0; i < len; i += 8) {
  7417. swap(this, i, i + 7)
  7418. swap(this, i + 1, i + 6)
  7419. swap(this, i + 2, i + 5)
  7420. swap(this, i + 3, i + 4)
  7421. }
  7422. return this
  7423. }
  7424. Buffer.prototype.toString = function toString () {
  7425. var length = this.length | 0
  7426. if (length === 0) return ''
  7427. if (arguments.length === 0) return utf8Slice(this, 0, length)
  7428. return slowToString.apply(this, arguments)
  7429. }
  7430. Buffer.prototype.equals = function equals (b) {
  7431. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  7432. if (this === b) return true
  7433. return Buffer.compare(this, b) === 0
  7434. }
  7435. Buffer.prototype.inspect = function inspect () {
  7436. var str = ''
  7437. var max = exports.INSPECT_MAX_BYTES
  7438. if (this.length > 0) {
  7439. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  7440. if (this.length > max) str += ' ... '
  7441. }
  7442. return '<Buffer ' + str + '>'
  7443. }
  7444. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  7445. if (!Buffer.isBuffer(target)) {
  7446. throw new TypeError('Argument must be a Buffer')
  7447. }
  7448. if (start === undefined) {
  7449. start = 0
  7450. }
  7451. if (end === undefined) {
  7452. end = target ? target.length : 0
  7453. }
  7454. if (thisStart === undefined) {
  7455. thisStart = 0
  7456. }
  7457. if (thisEnd === undefined) {
  7458. thisEnd = this.length
  7459. }
  7460. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  7461. throw new RangeError('out of range index')
  7462. }
  7463. if (thisStart >= thisEnd && start >= end) {
  7464. return 0
  7465. }
  7466. if (thisStart >= thisEnd) {
  7467. return -1
  7468. }
  7469. if (start >= end) {
  7470. return 1
  7471. }
  7472. start >>>= 0
  7473. end >>>= 0
  7474. thisStart >>>= 0
  7475. thisEnd >>>= 0
  7476. if (this === target) return 0
  7477. var x = thisEnd - thisStart
  7478. var y = end - start
  7479. var len = Math.min(x, y)
  7480. var thisCopy = this.slice(thisStart, thisEnd)
  7481. var targetCopy = target.slice(start, end)
  7482. for (var i = 0; i < len; ++i) {
  7483. if (thisCopy[i] !== targetCopy[i]) {
  7484. x = thisCopy[i]
  7485. y = targetCopy[i]
  7486. break
  7487. }
  7488. }
  7489. if (x < y) return -1
  7490. if (y < x) return 1
  7491. return 0
  7492. }
  7493. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  7494. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  7495. //
  7496. // Arguments:
  7497. // - buffer - a Buffer to search
  7498. // - val - a string, Buffer, or number
  7499. // - byteOffset - an index into `buffer`; will be clamped to an int32
  7500. // - encoding - an optional encoding, relevant is val is a string
  7501. // - dir - true for indexOf, false for lastIndexOf
  7502. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  7503. // Empty buffer means no match
  7504. if (buffer.length === 0) return -1
  7505. // Normalize byteOffset
  7506. if (typeof byteOffset === 'string') {
  7507. encoding = byteOffset
  7508. byteOffset = 0
  7509. } else if (byteOffset > 0x7fffffff) {
  7510. byteOffset = 0x7fffffff
  7511. } else if (byteOffset < -0x80000000) {
  7512. byteOffset = -0x80000000
  7513. }
  7514. byteOffset = +byteOffset // Coerce to Number.
  7515. if (isNaN(byteOffset)) {
  7516. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  7517. byteOffset = dir ? 0 : (buffer.length - 1)
  7518. }
  7519. // Normalize byteOffset: negative offsets start from the end of the buffer
  7520. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  7521. if (byteOffset >= buffer.length) {
  7522. if (dir) return -1
  7523. else byteOffset = buffer.length - 1
  7524. } else if (byteOffset < 0) {
  7525. if (dir) byteOffset = 0
  7526. else return -1
  7527. }
  7528. // Normalize val
  7529. if (typeof val === 'string') {
  7530. val = Buffer.from(val, encoding)
  7531. }
  7532. // Finally, search either indexOf (if dir is true) or lastIndexOf
  7533. if (Buffer.isBuffer(val)) {
  7534. // Special case: looking for empty string/buffer always fails
  7535. if (val.length === 0) {
  7536. return -1
  7537. }
  7538. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  7539. } else if (typeof val === 'number') {
  7540. val = val & 0xFF // Search for a byte value [0-255]
  7541. if (Buffer.TYPED_ARRAY_SUPPORT &&
  7542. typeof Uint8Array.prototype.indexOf === 'function') {
  7543. if (dir) {
  7544. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  7545. } else {
  7546. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  7547. }
  7548. }
  7549. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  7550. }
  7551. throw new TypeError('val must be string, number or Buffer')
  7552. }
  7553. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  7554. var indexSize = 1
  7555. var arrLength = arr.length
  7556. var valLength = val.length
  7557. if (encoding !== undefined) {
  7558. encoding = String(encoding).toLowerCase()
  7559. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  7560. encoding === 'utf16le' || encoding === 'utf-16le') {
  7561. if (arr.length < 2 || val.length < 2) {
  7562. return -1
  7563. }
  7564. indexSize = 2
  7565. arrLength /= 2
  7566. valLength /= 2
  7567. byteOffset /= 2
  7568. }
  7569. }
  7570. function read (buf, i) {
  7571. if (indexSize === 1) {
  7572. return buf[i]
  7573. } else {
  7574. return buf.readUInt16BE(i * indexSize)
  7575. }
  7576. }
  7577. var i
  7578. if (dir) {
  7579. var foundIndex = -1
  7580. for (i = byteOffset; i < arrLength; i++) {
  7581. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  7582. if (foundIndex === -1) foundIndex = i
  7583. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  7584. } else {
  7585. if (foundIndex !== -1) i -= i - foundIndex
  7586. foundIndex = -1
  7587. }
  7588. }
  7589. } else {
  7590. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  7591. for (i = byteOffset; i >= 0; i--) {
  7592. var found = true
  7593. for (var j = 0; j < valLength; j++) {
  7594. if (read(arr, i + j) !== read(val, j)) {
  7595. found = false
  7596. break
  7597. }
  7598. }
  7599. if (found) return i
  7600. }
  7601. }
  7602. return -1
  7603. }
  7604. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  7605. return this.indexOf(val, byteOffset, encoding) !== -1
  7606. }
  7607. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  7608. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  7609. }
  7610. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  7611. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  7612. }
  7613. function hexWrite (buf, string, offset, length) {
  7614. offset = Number(offset) || 0
  7615. var remaining = buf.length - offset
  7616. if (!length) {
  7617. length = remaining
  7618. } else {
  7619. length = Number(length)
  7620. if (length > remaining) {
  7621. length = remaining
  7622. }
  7623. }
  7624. // must be an even number of digits
  7625. var strLen = string.length
  7626. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  7627. if (length > strLen / 2) {
  7628. length = strLen / 2
  7629. }
  7630. for (var i = 0; i < length; ++i) {
  7631. var parsed = parseInt(string.substr(i * 2, 2), 16)
  7632. if (isNaN(parsed)) return i
  7633. buf[offset + i] = parsed
  7634. }
  7635. return i
  7636. }
  7637. function utf8Write (buf, string, offset, length) {
  7638. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  7639. }
  7640. function asciiWrite (buf, string, offset, length) {
  7641. return blitBuffer(asciiToBytes(string), buf, offset, length)
  7642. }
  7643. function latin1Write (buf, string, offset, length) {
  7644. return asciiWrite(buf, string, offset, length)
  7645. }
  7646. function base64Write (buf, string, offset, length) {
  7647. return blitBuffer(base64ToBytes(string), buf, offset, length)
  7648. }
  7649. function ucs2Write (buf, string, offset, length) {
  7650. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  7651. }
  7652. Buffer.prototype.write = function write (string, offset, length, encoding) {
  7653. // Buffer#write(string)
  7654. if (offset === undefined) {
  7655. encoding = 'utf8'
  7656. length = this.length
  7657. offset = 0
  7658. // Buffer#write(string, encoding)
  7659. } else if (length === undefined && typeof offset === 'string') {
  7660. encoding = offset
  7661. length = this.length
  7662. offset = 0
  7663. // Buffer#write(string, offset[, length][, encoding])
  7664. } else if (isFinite(offset)) {
  7665. offset = offset | 0
  7666. if (isFinite(length)) {
  7667. length = length | 0
  7668. if (encoding === undefined) encoding = 'utf8'
  7669. } else {
  7670. encoding = length
  7671. length = undefined
  7672. }
  7673. // legacy write(string, encoding, offset, length) - remove in v0.13
  7674. } else {
  7675. throw new Error(
  7676. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  7677. )
  7678. }
  7679. var remaining = this.length - offset
  7680. if (length === undefined || length > remaining) length = remaining
  7681. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  7682. throw new RangeError('Attempt to write outside buffer bounds')
  7683. }
  7684. if (!encoding) encoding = 'utf8'
  7685. var loweredCase = false
  7686. for (;;) {
  7687. switch (encoding) {
  7688. case 'hex':
  7689. return hexWrite(this, string, offset, length)
  7690. case 'utf8':
  7691. case 'utf-8':
  7692. return utf8Write(this, string, offset, length)
  7693. case 'ascii':
  7694. return asciiWrite(this, string, offset, length)
  7695. case 'latin1':
  7696. case 'binary':
  7697. return latin1Write(this, string, offset, length)
  7698. case 'base64':
  7699. // Warning: maxLength not taken into account in base64Write
  7700. return base64Write(this, string, offset, length)
  7701. case 'ucs2':
  7702. case 'ucs-2':
  7703. case 'utf16le':
  7704. case 'utf-16le':
  7705. return ucs2Write(this, string, offset, length)
  7706. default:
  7707. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  7708. encoding = ('' + encoding).toLowerCase()
  7709. loweredCase = true
  7710. }
  7711. }
  7712. }
  7713. Buffer.prototype.toJSON = function toJSON () {
  7714. return {
  7715. type: 'Buffer',
  7716. data: Array.prototype.slice.call(this._arr || this, 0)
  7717. }
  7718. }
  7719. function base64Slice (buf, start, end) {
  7720. if (start === 0 && end === buf.length) {
  7721. return base64.fromByteArray(buf)
  7722. } else {
  7723. return base64.fromByteArray(buf.slice(start, end))
  7724. }
  7725. }
  7726. function utf8Slice (buf, start, end) {
  7727. end = Math.min(buf.length, end)
  7728. var res = []
  7729. var i = start
  7730. while (i < end) {
  7731. var firstByte = buf[i]
  7732. var codePoint = null
  7733. var bytesPerSequence = (firstByte > 0xEF) ? 4
  7734. : (firstByte > 0xDF) ? 3
  7735. : (firstByte > 0xBF) ? 2
  7736. : 1
  7737. if (i + bytesPerSequence <= end) {
  7738. var secondByte, thirdByte, fourthByte, tempCodePoint
  7739. switch (bytesPerSequence) {
  7740. case 1:
  7741. if (firstByte < 0x80) {
  7742. codePoint = firstByte
  7743. }
  7744. break
  7745. case 2:
  7746. secondByte = buf[i + 1]
  7747. if ((secondByte & 0xC0) === 0x80) {
  7748. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  7749. if (tempCodePoint > 0x7F) {
  7750. codePoint = tempCodePoint
  7751. }
  7752. }
  7753. break
  7754. case 3:
  7755. secondByte = buf[i + 1]
  7756. thirdByte = buf[i + 2]
  7757. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  7758. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  7759. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  7760. codePoint = tempCodePoint
  7761. }
  7762. }
  7763. break
  7764. case 4:
  7765. secondByte = buf[i + 1]
  7766. thirdByte = buf[i + 2]
  7767. fourthByte = buf[i + 3]
  7768. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  7769. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  7770. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  7771. codePoint = tempCodePoint
  7772. }
  7773. }
  7774. }
  7775. }
  7776. if (codePoint === null) {
  7777. // we did not generate a valid codePoint so insert a
  7778. // replacement char (U+FFFD) and advance only 1 byte
  7779. codePoint = 0xFFFD
  7780. bytesPerSequence = 1
  7781. } else if (codePoint > 0xFFFF) {
  7782. // encode to utf16 (surrogate pair dance)
  7783. codePoint -= 0x10000
  7784. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  7785. codePoint = 0xDC00 | codePoint & 0x3FF
  7786. }
  7787. res.push(codePoint)
  7788. i += bytesPerSequence
  7789. }
  7790. return decodeCodePointsArray(res)
  7791. }
  7792. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  7793. // the lowest limit is Chrome, with 0x10000 args.
  7794. // We go 1 magnitude less, for safety
  7795. var MAX_ARGUMENTS_LENGTH = 0x1000
  7796. function decodeCodePointsArray (codePoints) {
  7797. var len = codePoints.length
  7798. if (len <= MAX_ARGUMENTS_LENGTH) {
  7799. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  7800. }
  7801. // Decode in chunks to avoid "call stack size exceeded".
  7802. var res = ''
  7803. var i = 0
  7804. while (i < len) {
  7805. res += String.fromCharCode.apply(
  7806. String,
  7807. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  7808. )
  7809. }
  7810. return res
  7811. }
  7812. function asciiSlice (buf, start, end) {
  7813. var ret = ''
  7814. end = Math.min(buf.length, end)
  7815. for (var i = start; i < end; ++i) {
  7816. ret += String.fromCharCode(buf[i] & 0x7F)
  7817. }
  7818. return ret
  7819. }
  7820. function latin1Slice (buf, start, end) {
  7821. var ret = ''
  7822. end = Math.min(buf.length, end)
  7823. for (var i = start; i < end; ++i) {
  7824. ret += String.fromCharCode(buf[i])
  7825. }
  7826. return ret
  7827. }
  7828. function hexSlice (buf, start, end) {
  7829. var len = buf.length
  7830. if (!start || start < 0) start = 0
  7831. if (!end || end < 0 || end > len) end = len
  7832. var out = ''
  7833. for (var i = start; i < end; ++i) {
  7834. out += toHex(buf[i])
  7835. }
  7836. return out
  7837. }
  7838. function utf16leSlice (buf, start, end) {
  7839. var bytes = buf.slice(start, end)
  7840. var res = ''
  7841. for (var i = 0; i < bytes.length; i += 2) {
  7842. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  7843. }
  7844. return res
  7845. }
  7846. Buffer.prototype.slice = function slice (start, end) {
  7847. var len = this.length
  7848. start = ~~start
  7849. end = end === undefined ? len : ~~end
  7850. if (start < 0) {
  7851. start += len
  7852. if (start < 0) start = 0
  7853. } else if (start > len) {
  7854. start = len
  7855. }
  7856. if (end < 0) {
  7857. end += len
  7858. if (end < 0) end = 0
  7859. } else if (end > len) {
  7860. end = len
  7861. }
  7862. if (end < start) end = start
  7863. var newBuf
  7864. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7865. newBuf = this.subarray(start, end)
  7866. newBuf.__proto__ = Buffer.prototype
  7867. } else {
  7868. var sliceLen = end - start
  7869. newBuf = new Buffer(sliceLen, undefined)
  7870. for (var i = 0; i < sliceLen; ++i) {
  7871. newBuf[i] = this[i + start]
  7872. }
  7873. }
  7874. return newBuf
  7875. }
  7876. /*
  7877. * Need to make sure that buffer isn't trying to write out of bounds.
  7878. */
  7879. function checkOffset (offset, ext, length) {
  7880. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  7881. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  7882. }
  7883. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  7884. offset = offset | 0
  7885. byteLength = byteLength | 0
  7886. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7887. var val = this[offset]
  7888. var mul = 1
  7889. var i = 0
  7890. while (++i < byteLength && (mul *= 0x100)) {
  7891. val += this[offset + i] * mul
  7892. }
  7893. return val
  7894. }
  7895. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  7896. offset = offset | 0
  7897. byteLength = byteLength | 0
  7898. if (!noAssert) {
  7899. checkOffset(offset, byteLength, this.length)
  7900. }
  7901. var val = this[offset + --byteLength]
  7902. var mul = 1
  7903. while (byteLength > 0 && (mul *= 0x100)) {
  7904. val += this[offset + --byteLength] * mul
  7905. }
  7906. return val
  7907. }
  7908. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  7909. if (!noAssert) checkOffset(offset, 1, this.length)
  7910. return this[offset]
  7911. }
  7912. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  7913. if (!noAssert) checkOffset(offset, 2, this.length)
  7914. return this[offset] | (this[offset + 1] << 8)
  7915. }
  7916. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  7917. if (!noAssert) checkOffset(offset, 2, this.length)
  7918. return (this[offset] << 8) | this[offset + 1]
  7919. }
  7920. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  7921. if (!noAssert) checkOffset(offset, 4, this.length)
  7922. return ((this[offset]) |
  7923. (this[offset + 1] << 8) |
  7924. (this[offset + 2] << 16)) +
  7925. (this[offset + 3] * 0x1000000)
  7926. }
  7927. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  7928. if (!noAssert) checkOffset(offset, 4, this.length)
  7929. return (this[offset] * 0x1000000) +
  7930. ((this[offset + 1] << 16) |
  7931. (this[offset + 2] << 8) |
  7932. this[offset + 3])
  7933. }
  7934. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  7935. offset = offset | 0
  7936. byteLength = byteLength | 0
  7937. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7938. var val = this[offset]
  7939. var mul = 1
  7940. var i = 0
  7941. while (++i < byteLength && (mul *= 0x100)) {
  7942. val += this[offset + i] * mul
  7943. }
  7944. mul *= 0x80
  7945. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7946. return val
  7947. }
  7948. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  7949. offset = offset | 0
  7950. byteLength = byteLength | 0
  7951. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7952. var i = byteLength
  7953. var mul = 1
  7954. var val = this[offset + --i]
  7955. while (i > 0 && (mul *= 0x100)) {
  7956. val += this[offset + --i] * mul
  7957. }
  7958. mul *= 0x80
  7959. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7960. return val
  7961. }
  7962. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  7963. if (!noAssert) checkOffset(offset, 1, this.length)
  7964. if (!(this[offset] & 0x80)) return (this[offset])
  7965. return ((0xff - this[offset] + 1) * -1)
  7966. }
  7967. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  7968. if (!noAssert) checkOffset(offset, 2, this.length)
  7969. var val = this[offset] | (this[offset + 1] << 8)
  7970. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7971. }
  7972. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  7973. if (!noAssert) checkOffset(offset, 2, this.length)
  7974. var val = this[offset + 1] | (this[offset] << 8)
  7975. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7976. }
  7977. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  7978. if (!noAssert) checkOffset(offset, 4, this.length)
  7979. return (this[offset]) |
  7980. (this[offset + 1] << 8) |
  7981. (this[offset + 2] << 16) |
  7982. (this[offset + 3] << 24)
  7983. }
  7984. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  7985. if (!noAssert) checkOffset(offset, 4, this.length)
  7986. return (this[offset] << 24) |
  7987. (this[offset + 1] << 16) |
  7988. (this[offset + 2] << 8) |
  7989. (this[offset + 3])
  7990. }
  7991. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  7992. if (!noAssert) checkOffset(offset, 4, this.length)
  7993. return ieee754.read(this, offset, true, 23, 4)
  7994. }
  7995. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  7996. if (!noAssert) checkOffset(offset, 4, this.length)
  7997. return ieee754.read(this, offset, false, 23, 4)
  7998. }
  7999. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  8000. if (!noAssert) checkOffset(offset, 8, this.length)
  8001. return ieee754.read(this, offset, true, 52, 8)
  8002. }
  8003. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  8004. if (!noAssert) checkOffset(offset, 8, this.length)
  8005. return ieee754.read(this, offset, false, 52, 8)
  8006. }
  8007. function checkInt (buf, value, offset, ext, max, min) {
  8008. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  8009. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  8010. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  8011. }
  8012. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  8013. value = +value
  8014. offset = offset | 0
  8015. byteLength = byteLength | 0
  8016. if (!noAssert) {
  8017. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  8018. checkInt(this, value, offset, byteLength, maxBytes, 0)
  8019. }
  8020. var mul = 1
  8021. var i = 0
  8022. this[offset] = value & 0xFF
  8023. while (++i < byteLength && (mul *= 0x100)) {
  8024. this[offset + i] = (value / mul) & 0xFF
  8025. }
  8026. return offset + byteLength
  8027. }
  8028. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  8029. value = +value
  8030. offset = offset | 0
  8031. byteLength = byteLength | 0
  8032. if (!noAssert) {
  8033. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  8034. checkInt(this, value, offset, byteLength, maxBytes, 0)
  8035. }
  8036. var i = byteLength - 1
  8037. var mul = 1
  8038. this[offset + i] = value & 0xFF
  8039. while (--i >= 0 && (mul *= 0x100)) {
  8040. this[offset + i] = (value / mul) & 0xFF
  8041. }
  8042. return offset + byteLength
  8043. }
  8044. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  8045. value = +value
  8046. offset = offset | 0
  8047. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  8048. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  8049. this[offset] = (value & 0xff)
  8050. return offset + 1
  8051. }
  8052. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  8053. if (value < 0) value = 0xffff + value + 1
  8054. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  8055. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  8056. (littleEndian ? i : 1 - i) * 8
  8057. }
  8058. }
  8059. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  8060. value = +value
  8061. offset = offset | 0
  8062. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  8063. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8064. this[offset] = (value & 0xff)
  8065. this[offset + 1] = (value >>> 8)
  8066. } else {
  8067. objectWriteUInt16(this, value, offset, true)
  8068. }
  8069. return offset + 2
  8070. }
  8071. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  8072. value = +value
  8073. offset = offset | 0
  8074. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  8075. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8076. this[offset] = (value >>> 8)
  8077. this[offset + 1] = (value & 0xff)
  8078. } else {
  8079. objectWriteUInt16(this, value, offset, false)
  8080. }
  8081. return offset + 2
  8082. }
  8083. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  8084. if (value < 0) value = 0xffffffff + value + 1
  8085. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  8086. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  8087. }
  8088. }
  8089. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  8090. value = +value
  8091. offset = offset | 0
  8092. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  8093. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8094. this[offset + 3] = (value >>> 24)
  8095. this[offset + 2] = (value >>> 16)
  8096. this[offset + 1] = (value >>> 8)
  8097. this[offset] = (value & 0xff)
  8098. } else {
  8099. objectWriteUInt32(this, value, offset, true)
  8100. }
  8101. return offset + 4
  8102. }
  8103. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  8104. value = +value
  8105. offset = offset | 0
  8106. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  8107. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8108. this[offset] = (value >>> 24)
  8109. this[offset + 1] = (value >>> 16)
  8110. this[offset + 2] = (value >>> 8)
  8111. this[offset + 3] = (value & 0xff)
  8112. } else {
  8113. objectWriteUInt32(this, value, offset, false)
  8114. }
  8115. return offset + 4
  8116. }
  8117. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  8118. value = +value
  8119. offset = offset | 0
  8120. if (!noAssert) {
  8121. var limit = Math.pow(2, 8 * byteLength - 1)
  8122. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  8123. }
  8124. var i = 0
  8125. var mul = 1
  8126. var sub = 0
  8127. this[offset] = value & 0xFF
  8128. while (++i < byteLength && (mul *= 0x100)) {
  8129. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  8130. sub = 1
  8131. }
  8132. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  8133. }
  8134. return offset + byteLength
  8135. }
  8136. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  8137. value = +value
  8138. offset = offset | 0
  8139. if (!noAssert) {
  8140. var limit = Math.pow(2, 8 * byteLength - 1)
  8141. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  8142. }
  8143. var i = byteLength - 1
  8144. var mul = 1
  8145. var sub = 0
  8146. this[offset + i] = value & 0xFF
  8147. while (--i >= 0 && (mul *= 0x100)) {
  8148. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  8149. sub = 1
  8150. }
  8151. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  8152. }
  8153. return offset + byteLength
  8154. }
  8155. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  8156. value = +value
  8157. offset = offset | 0
  8158. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  8159. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  8160. if (value < 0) value = 0xff + value + 1
  8161. this[offset] = (value & 0xff)
  8162. return offset + 1
  8163. }
  8164. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  8165. value = +value
  8166. offset = offset | 0
  8167. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  8168. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8169. this[offset] = (value & 0xff)
  8170. this[offset + 1] = (value >>> 8)
  8171. } else {
  8172. objectWriteUInt16(this, value, offset, true)
  8173. }
  8174. return offset + 2
  8175. }
  8176. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  8177. value = +value
  8178. offset = offset | 0
  8179. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  8180. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8181. this[offset] = (value >>> 8)
  8182. this[offset + 1] = (value & 0xff)
  8183. } else {
  8184. objectWriteUInt16(this, value, offset, false)
  8185. }
  8186. return offset + 2
  8187. }
  8188. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  8189. value = +value
  8190. offset = offset | 0
  8191. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  8192. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8193. this[offset] = (value & 0xff)
  8194. this[offset + 1] = (value >>> 8)
  8195. this[offset + 2] = (value >>> 16)
  8196. this[offset + 3] = (value >>> 24)
  8197. } else {
  8198. objectWriteUInt32(this, value, offset, true)
  8199. }
  8200. return offset + 4
  8201. }
  8202. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  8203. value = +value
  8204. offset = offset | 0
  8205. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  8206. if (value < 0) value = 0xffffffff + value + 1
  8207. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8208. this[offset] = (value >>> 24)
  8209. this[offset + 1] = (value >>> 16)
  8210. this[offset + 2] = (value >>> 8)
  8211. this[offset + 3] = (value & 0xff)
  8212. } else {
  8213. objectWriteUInt32(this, value, offset, false)
  8214. }
  8215. return offset + 4
  8216. }
  8217. function checkIEEE754 (buf, value, offset, ext, max, min) {
  8218. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  8219. if (offset < 0) throw new RangeError('Index out of range')
  8220. }
  8221. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  8222. if (!noAssert) {
  8223. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  8224. }
  8225. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  8226. return offset + 4
  8227. }
  8228. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  8229. return writeFloat(this, value, offset, true, noAssert)
  8230. }
  8231. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  8232. return writeFloat(this, value, offset, false, noAssert)
  8233. }
  8234. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  8235. if (!noAssert) {
  8236. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  8237. }
  8238. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  8239. return offset + 8
  8240. }
  8241. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  8242. return writeDouble(this, value, offset, true, noAssert)
  8243. }
  8244. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  8245. return writeDouble(this, value, offset, false, noAssert)
  8246. }
  8247. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  8248. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  8249. if (!start) start = 0
  8250. if (!end && end !== 0) end = this.length
  8251. if (targetStart >= target.length) targetStart = target.length
  8252. if (!targetStart) targetStart = 0
  8253. if (end > 0 && end < start) end = start
  8254. // Copy 0 bytes; we're done
  8255. if (end === start) return 0
  8256. if (target.length === 0 || this.length === 0) return 0
  8257. // Fatal error conditions
  8258. if (targetStart < 0) {
  8259. throw new RangeError('targetStart out of bounds')
  8260. }
  8261. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  8262. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  8263. // Are we oob?
  8264. if (end > this.length) end = this.length
  8265. if (target.length - targetStart < end - start) {
  8266. end = target.length - targetStart + start
  8267. }
  8268. var len = end - start
  8269. var i
  8270. if (this === target && start < targetStart && targetStart < end) {
  8271. // descending copy from end
  8272. for (i = len - 1; i >= 0; --i) {
  8273. target[i + targetStart] = this[i + start]
  8274. }
  8275. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  8276. // ascending copy from start
  8277. for (i = 0; i < len; ++i) {
  8278. target[i + targetStart] = this[i + start]
  8279. }
  8280. } else {
  8281. Uint8Array.prototype.set.call(
  8282. target,
  8283. this.subarray(start, start + len),
  8284. targetStart
  8285. )
  8286. }
  8287. return len
  8288. }
  8289. // Usage:
  8290. // buffer.fill(number[, offset[, end]])
  8291. // buffer.fill(buffer[, offset[, end]])
  8292. // buffer.fill(string[, offset[, end]][, encoding])
  8293. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  8294. // Handle string cases:
  8295. if (typeof val === 'string') {
  8296. if (typeof start === 'string') {
  8297. encoding = start
  8298. start = 0
  8299. end = this.length
  8300. } else if (typeof end === 'string') {
  8301. encoding = end
  8302. end = this.length
  8303. }
  8304. if (val.length === 1) {
  8305. var code = val.charCodeAt(0)
  8306. if (code < 256) {
  8307. val = code
  8308. }
  8309. }
  8310. if (encoding !== undefined && typeof encoding !== 'string') {
  8311. throw new TypeError('encoding must be a string')
  8312. }
  8313. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  8314. throw new TypeError('Unknown encoding: ' + encoding)
  8315. }
  8316. } else if (typeof val === 'number') {
  8317. val = val & 255
  8318. }
  8319. // Invalid ranges are not set to a default, so can range check early.
  8320. if (start < 0 || this.length < start || this.length < end) {
  8321. throw new RangeError('Out of range index')
  8322. }
  8323. if (end <= start) {
  8324. return this
  8325. }
  8326. start = start >>> 0
  8327. end = end === undefined ? this.length : end >>> 0
  8328. if (!val) val = 0
  8329. var i
  8330. if (typeof val === 'number') {
  8331. for (i = start; i < end; ++i) {
  8332. this[i] = val
  8333. }
  8334. } else {
  8335. var bytes = Buffer.isBuffer(val)
  8336. ? val
  8337. : utf8ToBytes(new Buffer(val, encoding).toString())
  8338. var len = bytes.length
  8339. for (i = 0; i < end - start; ++i) {
  8340. this[i + start] = bytes[i % len]
  8341. }
  8342. }
  8343. return this
  8344. }
  8345. // HELPER FUNCTIONS
  8346. // ================
  8347. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  8348. function base64clean (str) {
  8349. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  8350. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  8351. // Node converts strings with length < 2 to ''
  8352. if (str.length < 2) return ''
  8353. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  8354. while (str.length % 4 !== 0) {
  8355. str = str + '='
  8356. }
  8357. return str
  8358. }
  8359. function stringtrim (str) {
  8360. if (str.trim) return str.trim()
  8361. return str.replace(/^\s+|\s+$/g, '')
  8362. }
  8363. function toHex (n) {
  8364. if (n < 16) return '0' + n.toString(16)
  8365. return n.toString(16)
  8366. }
  8367. function utf8ToBytes (string, units) {
  8368. units = units || Infinity
  8369. var codePoint
  8370. var length = string.length
  8371. var leadSurrogate = null
  8372. var bytes = []
  8373. for (var i = 0; i < length; ++i) {
  8374. codePoint = string.charCodeAt(i)
  8375. // is surrogate component
  8376. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  8377. // last char was a lead
  8378. if (!leadSurrogate) {
  8379. // no lead yet
  8380. if (codePoint > 0xDBFF) {
  8381. // unexpected trail
  8382. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8383. continue
  8384. } else if (i + 1 === length) {
  8385. // unpaired lead
  8386. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8387. continue
  8388. }
  8389. // valid lead
  8390. leadSurrogate = codePoint
  8391. continue
  8392. }
  8393. // 2 leads in a row
  8394. if (codePoint < 0xDC00) {
  8395. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8396. leadSurrogate = codePoint
  8397. continue
  8398. }
  8399. // valid surrogate pair
  8400. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  8401. } else if (leadSurrogate) {
  8402. // valid bmp char, but last char was a lead
  8403. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8404. }
  8405. leadSurrogate = null
  8406. // encode utf8
  8407. if (codePoint < 0x80) {
  8408. if ((units -= 1) < 0) break
  8409. bytes.push(codePoint)
  8410. } else if (codePoint < 0x800) {
  8411. if ((units -= 2) < 0) break
  8412. bytes.push(
  8413. codePoint >> 0x6 | 0xC0,
  8414. codePoint & 0x3F | 0x80
  8415. )
  8416. } else if (codePoint < 0x10000) {
  8417. if ((units -= 3) < 0) break
  8418. bytes.push(
  8419. codePoint >> 0xC | 0xE0,
  8420. codePoint >> 0x6 & 0x3F | 0x80,
  8421. codePoint & 0x3F | 0x80
  8422. )
  8423. } else if (codePoint < 0x110000) {
  8424. if ((units -= 4) < 0) break
  8425. bytes.push(
  8426. codePoint >> 0x12 | 0xF0,
  8427. codePoint >> 0xC & 0x3F | 0x80,
  8428. codePoint >> 0x6 & 0x3F | 0x80,
  8429. codePoint & 0x3F | 0x80
  8430. )
  8431. } else {
  8432. throw new Error('Invalid code point')
  8433. }
  8434. }
  8435. return bytes
  8436. }
  8437. function asciiToBytes (str) {
  8438. var byteArray = []
  8439. for (var i = 0; i < str.length; ++i) {
  8440. // Node's code seems to be doing this and not & 0x7F..
  8441. byteArray.push(str.charCodeAt(i) & 0xFF)
  8442. }
  8443. return byteArray
  8444. }
  8445. function utf16leToBytes (str, units) {
  8446. var c, hi, lo
  8447. var byteArray = []
  8448. for (var i = 0; i < str.length; ++i) {
  8449. if ((units -= 2) < 0) break
  8450. c = str.charCodeAt(i)
  8451. hi = c >> 8
  8452. lo = c % 256
  8453. byteArray.push(lo)
  8454. byteArray.push(hi)
  8455. }
  8456. return byteArray
  8457. }
  8458. function base64ToBytes (str) {
  8459. return base64.toByteArray(base64clean(str))
  8460. }
  8461. function blitBuffer (src, dst, offset, length) {
  8462. for (var i = 0; i < length; ++i) {
  8463. if ((i + offset >= dst.length) || (i >= src.length)) break
  8464. dst[i + offset] = src[i]
  8465. }
  8466. return i
  8467. }
  8468. function isnan (val) {
  8469. return val !== val // eslint-disable-line no-self-compare
  8470. }
  8471. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  8472. /***/ }),
  8473. /***/ "./node_modules/clipboard/dist/clipboard.js":
  8474. /*!**************************************************!*\
  8475. !*** ./node_modules/clipboard/dist/clipboard.js ***!
  8476. \**************************************************/
  8477. /*! no static exports found */
  8478. /***/ (function(module, exports, __webpack_require__) {
  8479. /*!
  8480. * clipboard.js v2.0.4
  8481. * https://zenorocha.github.io/clipboard.js
  8482. *
  8483. * Licensed MIT © Zeno Rocha
  8484. */
  8485. (function webpackUniversalModuleDefinition(root, factory) {
  8486. if(true)
  8487. module.exports = factory();
  8488. else {}
  8489. })(this, function() {
  8490. return /******/ (function(modules) { // webpackBootstrap
  8491. /******/ // The module cache
  8492. /******/ var installedModules = {};
  8493. /******/
  8494. /******/ // The require function
  8495. /******/ function __webpack_require__(moduleId) {
  8496. /******/
  8497. /******/ // Check if module is in cache
  8498. /******/ if(installedModules[moduleId]) {
  8499. /******/ return installedModules[moduleId].exports;
  8500. /******/ }
  8501. /******/ // Create a new module (and put it into the cache)
  8502. /******/ var module = installedModules[moduleId] = {
  8503. /******/ i: moduleId,
  8504. /******/ l: false,
  8505. /******/ exports: {}
  8506. /******/ };
  8507. /******/
  8508. /******/ // Execute the module function
  8509. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  8510. /******/
  8511. /******/ // Flag the module as loaded
  8512. /******/ module.l = true;
  8513. /******/
  8514. /******/ // Return the exports of the module
  8515. /******/ return module.exports;
  8516. /******/ }
  8517. /******/
  8518. /******/
  8519. /******/ // expose the modules object (__webpack_modules__)
  8520. /******/ __webpack_require__.m = modules;
  8521. /******/
  8522. /******/ // expose the module cache
  8523. /******/ __webpack_require__.c = installedModules;
  8524. /******/
  8525. /******/ // define getter function for harmony exports
  8526. /******/ __webpack_require__.d = function(exports, name, getter) {
  8527. /******/ if(!__webpack_require__.o(exports, name)) {
  8528. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  8529. /******/ }
  8530. /******/ };
  8531. /******/
  8532. /******/ // define __esModule on exports
  8533. /******/ __webpack_require__.r = function(exports) {
  8534. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  8535. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  8536. /******/ }
  8537. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  8538. /******/ };
  8539. /******/
  8540. /******/ // create a fake namespace object
  8541. /******/ // mode & 1: value is a module id, require it
  8542. /******/ // mode & 2: merge all properties of value into the ns
  8543. /******/ // mode & 4: return value when already ns object
  8544. /******/ // mode & 8|1: behave like require
  8545. /******/ __webpack_require__.t = function(value, mode) {
  8546. /******/ if(mode & 1) value = __webpack_require__(value);
  8547. /******/ if(mode & 8) return value;
  8548. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  8549. /******/ var ns = Object.create(null);
  8550. /******/ __webpack_require__.r(ns);
  8551. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  8552. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  8553. /******/ return ns;
  8554. /******/ };
  8555. /******/
  8556. /******/ // getDefaultExport function for compatibility with non-harmony modules
  8557. /******/ __webpack_require__.n = function(module) {
  8558. /******/ var getter = module && module.__esModule ?
  8559. /******/ function getDefault() { return module['default']; } :
  8560. /******/ function getModuleExports() { return module; };
  8561. /******/ __webpack_require__.d(getter, 'a', getter);
  8562. /******/ return getter;
  8563. /******/ };
  8564. /******/
  8565. /******/ // Object.prototype.hasOwnProperty.call
  8566. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  8567. /******/
  8568. /******/ // __webpack_public_path__
  8569. /******/ __webpack_require__.p = "";
  8570. /******/
  8571. /******/
  8572. /******/ // Load entry module and return exports
  8573. /******/ return __webpack_require__(__webpack_require__.s = 0);
  8574. /******/ })
  8575. /************************************************************************/
  8576. /******/ ([
  8577. /* 0 */
  8578. /***/ (function(module, exports, __webpack_require__) {
  8579. "use strict";
  8580. 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; };
  8581. 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; }; }();
  8582. var _clipboardAction = __webpack_require__(1);
  8583. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  8584. var _tinyEmitter = __webpack_require__(3);
  8585. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  8586. var _goodListener = __webpack_require__(4);
  8587. var _goodListener2 = _interopRequireDefault(_goodListener);
  8588. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8589. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8590. 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; }
  8591. 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; }
  8592. /**
  8593. * Base class which takes one or more elements, adds event listeners to them,
  8594. * and instantiates a new `ClipboardAction` on each click.
  8595. */
  8596. var Clipboard = function (_Emitter) {
  8597. _inherits(Clipboard, _Emitter);
  8598. /**
  8599. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  8600. * @param {Object} options
  8601. */
  8602. function Clipboard(trigger, options) {
  8603. _classCallCheck(this, Clipboard);
  8604. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  8605. _this.resolveOptions(options);
  8606. _this.listenClick(trigger);
  8607. return _this;
  8608. }
  8609. /**
  8610. * Defines if attributes would be resolved using internal setter functions
  8611. * or custom functions that were passed in the constructor.
  8612. * @param {Object} options
  8613. */
  8614. _createClass(Clipboard, [{
  8615. key: 'resolveOptions',
  8616. value: function resolveOptions() {
  8617. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  8618. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  8619. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  8620. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  8621. this.container = _typeof(options.container) === 'object' ? options.container : document.body;
  8622. }
  8623. /**
  8624. * Adds a click event listener to the passed trigger.
  8625. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  8626. */
  8627. }, {
  8628. key: 'listenClick',
  8629. value: function listenClick(trigger) {
  8630. var _this2 = this;
  8631. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  8632. return _this2.onClick(e);
  8633. });
  8634. }
  8635. /**
  8636. * Defines a new `ClipboardAction` on each click event.
  8637. * @param {Event} e
  8638. */
  8639. }, {
  8640. key: 'onClick',
  8641. value: function onClick(e) {
  8642. var trigger = e.delegateTarget || e.currentTarget;
  8643. if (this.clipboardAction) {
  8644. this.clipboardAction = null;
  8645. }
  8646. this.clipboardAction = new _clipboardAction2.default({
  8647. action: this.action(trigger),
  8648. target: this.target(trigger),
  8649. text: this.text(trigger),
  8650. container: this.container,
  8651. trigger: trigger,
  8652. emitter: this
  8653. });
  8654. }
  8655. /**
  8656. * Default `action` lookup function.
  8657. * @param {Element} trigger
  8658. */
  8659. }, {
  8660. key: 'defaultAction',
  8661. value: function defaultAction(trigger) {
  8662. return getAttributeValue('action', trigger);
  8663. }
  8664. /**
  8665. * Default `target` lookup function.
  8666. * @param {Element} trigger
  8667. */
  8668. }, {
  8669. key: 'defaultTarget',
  8670. value: function defaultTarget(trigger) {
  8671. var selector = getAttributeValue('target', trigger);
  8672. if (selector) {
  8673. return document.querySelector(selector);
  8674. }
  8675. }
  8676. /**
  8677. * Returns the support of the given action, or all actions if no action is
  8678. * given.
  8679. * @param {String} [action]
  8680. */
  8681. }, {
  8682. key: 'defaultText',
  8683. /**
  8684. * Default `text` lookup function.
  8685. * @param {Element} trigger
  8686. */
  8687. value: function defaultText(trigger) {
  8688. return getAttributeValue('text', trigger);
  8689. }
  8690. /**
  8691. * Destroy lifecycle.
  8692. */
  8693. }, {
  8694. key: 'destroy',
  8695. value: function destroy() {
  8696. this.listener.destroy();
  8697. if (this.clipboardAction) {
  8698. this.clipboardAction.destroy();
  8699. this.clipboardAction = null;
  8700. }
  8701. }
  8702. }], [{
  8703. key: 'isSupported',
  8704. value: function isSupported() {
  8705. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
  8706. var actions = typeof action === 'string' ? [action] : action;
  8707. var support = !!document.queryCommandSupported;
  8708. actions.forEach(function (action) {
  8709. support = support && !!document.queryCommandSupported(action);
  8710. });
  8711. return support;
  8712. }
  8713. }]);
  8714. return Clipboard;
  8715. }(_tinyEmitter2.default);
  8716. /**
  8717. * Helper function to retrieve attribute value.
  8718. * @param {String} suffix
  8719. * @param {Element} element
  8720. */
  8721. function getAttributeValue(suffix, element) {
  8722. var attribute = 'data-clipboard-' + suffix;
  8723. if (!element.hasAttribute(attribute)) {
  8724. return;
  8725. }
  8726. return element.getAttribute(attribute);
  8727. }
  8728. module.exports = Clipboard;
  8729. /***/ }),
  8730. /* 1 */
  8731. /***/ (function(module, exports, __webpack_require__) {
  8732. "use strict";
  8733. 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; };
  8734. 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; }; }();
  8735. var _select = __webpack_require__(2);
  8736. var _select2 = _interopRequireDefault(_select);
  8737. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8738. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8739. /**
  8740. * Inner class which performs selection from either `text` or `target`
  8741. * properties and then executes copy or cut operations.
  8742. */
  8743. var ClipboardAction = function () {
  8744. /**
  8745. * @param {Object} options
  8746. */
  8747. function ClipboardAction(options) {
  8748. _classCallCheck(this, ClipboardAction);
  8749. this.resolveOptions(options);
  8750. this.initSelection();
  8751. }
  8752. /**
  8753. * Defines base properties passed from constructor.
  8754. * @param {Object} options
  8755. */
  8756. _createClass(ClipboardAction, [{
  8757. key: 'resolveOptions',
  8758. value: function resolveOptions() {
  8759. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  8760. this.action = options.action;
  8761. this.container = options.container;
  8762. this.emitter = options.emitter;
  8763. this.target = options.target;
  8764. this.text = options.text;
  8765. this.trigger = options.trigger;
  8766. this.selectedText = '';
  8767. }
  8768. /**
  8769. * Decides which selection strategy is going to be applied based
  8770. * on the existence of `text` and `target` properties.
  8771. */
  8772. }, {
  8773. key: 'initSelection',
  8774. value: function initSelection() {
  8775. if (this.text) {
  8776. this.selectFake();
  8777. } else if (this.target) {
  8778. this.selectTarget();
  8779. }
  8780. }
  8781. /**
  8782. * Creates a fake textarea element, sets its value from `text` property,
  8783. * and makes a selection on it.
  8784. */
  8785. }, {
  8786. key: 'selectFake',
  8787. value: function selectFake() {
  8788. var _this = this;
  8789. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  8790. this.removeFake();
  8791. this.fakeHandlerCallback = function () {
  8792. return _this.removeFake();
  8793. };
  8794. this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
  8795. this.fakeElem = document.createElement('textarea');
  8796. // Prevent zooming on iOS
  8797. this.fakeElem.style.fontSize = '12pt';
  8798. // Reset box model
  8799. this.fakeElem.style.border = '0';
  8800. this.fakeElem.style.padding = '0';
  8801. this.fakeElem.style.margin = '0';
  8802. // Move element out of screen horizontally
  8803. this.fakeElem.style.position = 'absolute';
  8804. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  8805. // Move element to the same position vertically
  8806. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  8807. this.fakeElem.style.top = yPosition + 'px';
  8808. this.fakeElem.setAttribute('readonly', '');
  8809. this.fakeElem.value = this.text;
  8810. this.container.appendChild(this.fakeElem);
  8811. this.selectedText = (0, _select2.default)(this.fakeElem);
  8812. this.copyText();
  8813. }
  8814. /**
  8815. * Only removes the fake element after another click event, that way
  8816. * a user can hit `Ctrl+C` to copy because selection still exists.
  8817. */
  8818. }, {
  8819. key: 'removeFake',
  8820. value: function removeFake() {
  8821. if (this.fakeHandler) {
  8822. this.container.removeEventListener('click', this.fakeHandlerCallback);
  8823. this.fakeHandler = null;
  8824. this.fakeHandlerCallback = null;
  8825. }
  8826. if (this.fakeElem) {
  8827. this.container.removeChild(this.fakeElem);
  8828. this.fakeElem = null;
  8829. }
  8830. }
  8831. /**
  8832. * Selects the content from element passed on `target` property.
  8833. */
  8834. }, {
  8835. key: 'selectTarget',
  8836. value: function selectTarget() {
  8837. this.selectedText = (0, _select2.default)(this.target);
  8838. this.copyText();
  8839. }
  8840. /**
  8841. * Executes the copy operation based on the current selection.
  8842. */
  8843. }, {
  8844. key: 'copyText',
  8845. value: function copyText() {
  8846. var succeeded = void 0;
  8847. try {
  8848. succeeded = document.execCommand(this.action);
  8849. } catch (err) {
  8850. succeeded = false;
  8851. }
  8852. this.handleResult(succeeded);
  8853. }
  8854. /**
  8855. * Fires an event based on the copy operation result.
  8856. * @param {Boolean} succeeded
  8857. */
  8858. }, {
  8859. key: 'handleResult',
  8860. value: function handleResult(succeeded) {
  8861. this.emitter.emit(succeeded ? 'success' : 'error', {
  8862. action: this.action,
  8863. text: this.selectedText,
  8864. trigger: this.trigger,
  8865. clearSelection: this.clearSelection.bind(this)
  8866. });
  8867. }
  8868. /**
  8869. * Moves focus away from `target` and back to the trigger, removes current selection.
  8870. */
  8871. }, {
  8872. key: 'clearSelection',
  8873. value: function clearSelection() {
  8874. if (this.trigger) {
  8875. this.trigger.focus();
  8876. }
  8877. window.getSelection().removeAllRanges();
  8878. }
  8879. /**
  8880. * Sets the `action` to be performed which can be either 'copy' or 'cut'.
  8881. * @param {String} action
  8882. */
  8883. }, {
  8884. key: 'destroy',
  8885. /**
  8886. * Destroy lifecycle.
  8887. */
  8888. value: function destroy() {
  8889. this.removeFake();
  8890. }
  8891. }, {
  8892. key: 'action',
  8893. set: function set() {
  8894. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  8895. this._action = action;
  8896. if (this._action !== 'copy' && this._action !== 'cut') {
  8897. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  8898. }
  8899. }
  8900. /**
  8901. * Gets the `action` property.
  8902. * @return {String}
  8903. */
  8904. ,
  8905. get: function get() {
  8906. return this._action;
  8907. }
  8908. /**
  8909. * Sets the `target` property using an element
  8910. * that will be have its content copied.
  8911. * @param {Element} target
  8912. */
  8913. }, {
  8914. key: 'target',
  8915. set: function set(target) {
  8916. if (target !== undefined) {
  8917. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  8918. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  8919. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  8920. }
  8921. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  8922. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  8923. }
  8924. this._target = target;
  8925. } else {
  8926. throw new Error('Invalid "target" value, use a valid Element');
  8927. }
  8928. }
  8929. }
  8930. /**
  8931. * Gets the `target` property.
  8932. * @return {String|HTMLElement}
  8933. */
  8934. ,
  8935. get: function get() {
  8936. return this._target;
  8937. }
  8938. }]);
  8939. return ClipboardAction;
  8940. }();
  8941. module.exports = ClipboardAction;
  8942. /***/ }),
  8943. /* 2 */
  8944. /***/ (function(module, exports) {
  8945. function select(element) {
  8946. var selectedText;
  8947. if (element.nodeName === 'SELECT') {
  8948. element.focus();
  8949. selectedText = element.value;
  8950. }
  8951. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  8952. var isReadOnly = element.hasAttribute('readonly');
  8953. if (!isReadOnly) {
  8954. element.setAttribute('readonly', '');
  8955. }
  8956. element.select();
  8957. element.setSelectionRange(0, element.value.length);
  8958. if (!isReadOnly) {
  8959. element.removeAttribute('readonly');
  8960. }
  8961. selectedText = element.value;
  8962. }
  8963. else {
  8964. if (element.hasAttribute('contenteditable')) {
  8965. element.focus();
  8966. }
  8967. var selection = window.getSelection();
  8968. var range = document.createRange();
  8969. range.selectNodeContents(element);
  8970. selection.removeAllRanges();
  8971. selection.addRange(range);
  8972. selectedText = selection.toString();
  8973. }
  8974. return selectedText;
  8975. }
  8976. module.exports = select;
  8977. /***/ }),
  8978. /* 3 */
  8979. /***/ (function(module, exports) {
  8980. function E () {
  8981. // Keep this empty so it's easier to inherit from
  8982. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  8983. }
  8984. E.prototype = {
  8985. on: function (name, callback, ctx) {
  8986. var e = this.e || (this.e = {});
  8987. (e[name] || (e[name] = [])).push({
  8988. fn: callback,
  8989. ctx: ctx
  8990. });
  8991. return this;
  8992. },
  8993. once: function (name, callback, ctx) {
  8994. var self = this;
  8995. function listener () {
  8996. self.off(name, listener);
  8997. callback.apply(ctx, arguments);
  8998. };
  8999. listener._ = callback
  9000. return this.on(name, listener, ctx);
  9001. },
  9002. emit: function (name) {
  9003. var data = [].slice.call(arguments, 1);
  9004. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  9005. var i = 0;
  9006. var len = evtArr.length;
  9007. for (i; i < len; i++) {
  9008. evtArr[i].fn.apply(evtArr[i].ctx, data);
  9009. }
  9010. return this;
  9011. },
  9012. off: function (name, callback) {
  9013. var e = this.e || (this.e = {});
  9014. var evts = e[name];
  9015. var liveEvents = [];
  9016. if (evts && callback) {
  9017. for (var i = 0, len = evts.length; i < len; i++) {
  9018. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  9019. liveEvents.push(evts[i]);
  9020. }
  9021. }
  9022. // Remove event from queue to prevent memory leak
  9023. // Suggested by https://github.com/lazd
  9024. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  9025. (liveEvents.length)
  9026. ? e[name] = liveEvents
  9027. : delete e[name];
  9028. return this;
  9029. }
  9030. };
  9031. module.exports = E;
  9032. /***/ }),
  9033. /* 4 */
  9034. /***/ (function(module, exports, __webpack_require__) {
  9035. var is = __webpack_require__(5);
  9036. var delegate = __webpack_require__(6);
  9037. /**
  9038. * Validates all params and calls the right
  9039. * listener function based on its target type.
  9040. *
  9041. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  9042. * @param {String} type
  9043. * @param {Function} callback
  9044. * @return {Object}
  9045. */
  9046. function listen(target, type, callback) {
  9047. if (!target && !type && !callback) {
  9048. throw new Error('Missing required arguments');
  9049. }
  9050. if (!is.string(type)) {
  9051. throw new TypeError('Second argument must be a String');
  9052. }
  9053. if (!is.fn(callback)) {
  9054. throw new TypeError('Third argument must be a Function');
  9055. }
  9056. if (is.node(target)) {
  9057. return listenNode(target, type, callback);
  9058. }
  9059. else if (is.nodeList(target)) {
  9060. return listenNodeList(target, type, callback);
  9061. }
  9062. else if (is.string(target)) {
  9063. return listenSelector(target, type, callback);
  9064. }
  9065. else {
  9066. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  9067. }
  9068. }
  9069. /**
  9070. * Adds an event listener to a HTML element
  9071. * and returns a remove listener function.
  9072. *
  9073. * @param {HTMLElement} node
  9074. * @param {String} type
  9075. * @param {Function} callback
  9076. * @return {Object}
  9077. */
  9078. function listenNode(node, type, callback) {
  9079. node.addEventListener(type, callback);
  9080. return {
  9081. destroy: function() {
  9082. node.removeEventListener(type, callback);
  9083. }
  9084. }
  9085. }
  9086. /**
  9087. * Add an event listener to a list of HTML elements
  9088. * and returns a remove listener function.
  9089. *
  9090. * @param {NodeList|HTMLCollection} nodeList
  9091. * @param {String} type
  9092. * @param {Function} callback
  9093. * @return {Object}
  9094. */
  9095. function listenNodeList(nodeList, type, callback) {
  9096. Array.prototype.forEach.call(nodeList, function(node) {
  9097. node.addEventListener(type, callback);
  9098. });
  9099. return {
  9100. destroy: function() {
  9101. Array.prototype.forEach.call(nodeList, function(node) {
  9102. node.removeEventListener(type, callback);
  9103. });
  9104. }
  9105. }
  9106. }
  9107. /**
  9108. * Add an event listener to a selector
  9109. * and returns a remove listener function.
  9110. *
  9111. * @param {String} selector
  9112. * @param {String} type
  9113. * @param {Function} callback
  9114. * @return {Object}
  9115. */
  9116. function listenSelector(selector, type, callback) {
  9117. return delegate(document.body, selector, type, callback);
  9118. }
  9119. module.exports = listen;
  9120. /***/ }),
  9121. /* 5 */
  9122. /***/ (function(module, exports) {
  9123. /**
  9124. * Check if argument is a HTML element.
  9125. *
  9126. * @param {Object} value
  9127. * @return {Boolean}
  9128. */
  9129. exports.node = function(value) {
  9130. return value !== undefined
  9131. && value instanceof HTMLElement
  9132. && value.nodeType === 1;
  9133. };
  9134. /**
  9135. * Check if argument is a list of HTML elements.
  9136. *
  9137. * @param {Object} value
  9138. * @return {Boolean}
  9139. */
  9140. exports.nodeList = function(value) {
  9141. var type = Object.prototype.toString.call(value);
  9142. return value !== undefined
  9143. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  9144. && ('length' in value)
  9145. && (value.length === 0 || exports.node(value[0]));
  9146. };
  9147. /**
  9148. * Check if argument is a string.
  9149. *
  9150. * @param {Object} value
  9151. * @return {Boolean}
  9152. */
  9153. exports.string = function(value) {
  9154. return typeof value === 'string'
  9155. || value instanceof String;
  9156. };
  9157. /**
  9158. * Check if argument is a function.
  9159. *
  9160. * @param {Object} value
  9161. * @return {Boolean}
  9162. */
  9163. exports.fn = function(value) {
  9164. var type = Object.prototype.toString.call(value);
  9165. return type === '[object Function]';
  9166. };
  9167. /***/ }),
  9168. /* 6 */
  9169. /***/ (function(module, exports, __webpack_require__) {
  9170. var closest = __webpack_require__(7);
  9171. /**
  9172. * Delegates event to a selector.
  9173. *
  9174. * @param {Element} element
  9175. * @param {String} selector
  9176. * @param {String} type
  9177. * @param {Function} callback
  9178. * @param {Boolean} useCapture
  9179. * @return {Object}
  9180. */
  9181. function _delegate(element, selector, type, callback, useCapture) {
  9182. var listenerFn = listener.apply(this, arguments);
  9183. element.addEventListener(type, listenerFn, useCapture);
  9184. return {
  9185. destroy: function() {
  9186. element.removeEventListener(type, listenerFn, useCapture);
  9187. }
  9188. }
  9189. }
  9190. /**
  9191. * Delegates event to a selector.
  9192. *
  9193. * @param {Element|String|Array} [elements]
  9194. * @param {String} selector
  9195. * @param {String} type
  9196. * @param {Function} callback
  9197. * @param {Boolean} useCapture
  9198. * @return {Object}
  9199. */
  9200. function delegate(elements, selector, type, callback, useCapture) {
  9201. // Handle the regular Element usage
  9202. if (typeof elements.addEventListener === 'function') {
  9203. return _delegate.apply(null, arguments);
  9204. }
  9205. // Handle Element-less usage, it defaults to global delegation
  9206. if (typeof type === 'function') {
  9207. // Use `document` as the first parameter, then apply arguments
  9208. // This is a short way to .unshift `arguments` without running into deoptimizations
  9209. return _delegate.bind(null, document).apply(null, arguments);
  9210. }
  9211. // Handle Selector-based usage
  9212. if (typeof elements === 'string') {
  9213. elements = document.querySelectorAll(elements);
  9214. }
  9215. // Handle Array-like based usage
  9216. return Array.prototype.map.call(elements, function (element) {
  9217. return _delegate(element, selector, type, callback, useCapture);
  9218. });
  9219. }
  9220. /**
  9221. * Finds closest match and invokes callback.
  9222. *
  9223. * @param {Element} element
  9224. * @param {String} selector
  9225. * @param {String} type
  9226. * @param {Function} callback
  9227. * @return {Function}
  9228. */
  9229. function listener(element, selector, type, callback) {
  9230. return function(e) {
  9231. e.delegateTarget = closest(e.target, selector);
  9232. if (e.delegateTarget) {
  9233. callback.call(element, e);
  9234. }
  9235. }
  9236. }
  9237. module.exports = delegate;
  9238. /***/ }),
  9239. /* 7 */
  9240. /***/ (function(module, exports) {
  9241. var DOCUMENT_NODE_TYPE = 9;
  9242. /**
  9243. * A polyfill for Element.matches()
  9244. */
  9245. if (typeof Element !== 'undefined' && !Element.prototype.matches) {
  9246. var proto = Element.prototype;
  9247. proto.matches = proto.matchesSelector ||
  9248. proto.mozMatchesSelector ||
  9249. proto.msMatchesSelector ||
  9250. proto.oMatchesSelector ||
  9251. proto.webkitMatchesSelector;
  9252. }
  9253. /**
  9254. * Finds the closest parent that matches a selector.
  9255. *
  9256. * @param {Element} element
  9257. * @param {String} selector
  9258. * @return {Function}
  9259. */
  9260. function closest (element, selector) {
  9261. while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
  9262. if (typeof element.matches === 'function' &&
  9263. element.matches(selector)) {
  9264. return element;
  9265. }
  9266. element = element.parentNode;
  9267. }
  9268. }
  9269. module.exports = closest;
  9270. /***/ })
  9271. /******/ ]);
  9272. });
  9273. /***/ }),
  9274. /***/ "./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&":
  9275. /*!*******************************************************************************************************************************************************************************************************************************************************************************************************!*\
  9276. !*** ./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& ***!
  9277. \*******************************************************************************************************************************************************************************************************************************************************************************************************/
  9278. /*! no static exports found */
  9279. /***/ (function(module, exports, __webpack_require__) {
  9280. exports = module.exports = __webpack_require__(/*! ../../../node_modules/css-loader/lib/css-base.js */ "./node_modules/css-loader/lib/css-base.js")(false);
  9281. // imports
  9282. // module
  9283. 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", ""]);
  9284. // exports
  9285. /***/ }),
  9286. /***/ "./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&":
  9287. /*!********************************************************************************************************************************************************************************************************************************************************************************************!*\
  9288. !*** ./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& ***!
  9289. \********************************************************************************************************************************************************************************************************************************************************************************************/
  9290. /*! no static exports found */
  9291. /***/ (function(module, exports, __webpack_require__) {
  9292. exports = module.exports = __webpack_require__(/*! ../../../node_modules/css-loader/lib/css-base.js */ "./node_modules/css-loader/lib/css-base.js")(false);
  9293. // imports
  9294. // module
  9295. 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", ""]);
  9296. // exports
  9297. /***/ }),
  9298. /***/ "./node_modules/css-loader/lib/css-base.js":
  9299. /*!*************************************************!*\
  9300. !*** ./node_modules/css-loader/lib/css-base.js ***!
  9301. \*************************************************/
  9302. /*! no static exports found */
  9303. /***/ (function(module, exports) {
  9304. /*
  9305. MIT License http://www.opensource.org/licenses/mit-license.php
  9306. Author Tobias Koppers @sokra
  9307. */
  9308. // css base code, injected by the css-loader
  9309. module.exports = function(useSourceMap) {
  9310. var list = [];
  9311. // return the list of modules as css string
  9312. list.toString = function toString() {
  9313. return this.map(function (item) {
  9314. var content = cssWithMappingToString(item, useSourceMap);
  9315. if(item[2]) {
  9316. return "@media " + item[2] + "{" + content + "}";
  9317. } else {
  9318. return content;
  9319. }
  9320. }).join("");
  9321. };
  9322. // import a list of modules into the list
  9323. list.i = function(modules, mediaQuery) {
  9324. if(typeof modules === "string")
  9325. modules = [[null, modules, ""]];
  9326. var alreadyImportedModules = {};
  9327. for(var i = 0; i < this.length; i++) {
  9328. var id = this[i][0];
  9329. if(typeof id === "number")
  9330. alreadyImportedModules[id] = true;
  9331. }
  9332. for(i = 0; i < modules.length; i++) {
  9333. var item = modules[i];
  9334. // skip already imported module
  9335. // this implementation is not 100% perfect for weird media query combinations
  9336. // when a module is imported multiple times with different media queries.
  9337. // I hope this will never occur (Hey this way we have smaller bundles)
  9338. if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
  9339. if(mediaQuery && !item[2]) {
  9340. item[2] = mediaQuery;
  9341. } else if(mediaQuery) {
  9342. item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
  9343. }
  9344. list.push(item);
  9345. }
  9346. }
  9347. };
  9348. return list;
  9349. };
  9350. function cssWithMappingToString(item, useSourceMap) {
  9351. var content = item[1] || '';
  9352. var cssMapping = item[3];
  9353. if (!cssMapping) {
  9354. return content;
  9355. }
  9356. if (useSourceMap && typeof btoa === 'function') {
  9357. var sourceMapping = toComment(cssMapping);
  9358. var sourceURLs = cssMapping.sources.map(function (source) {
  9359. return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'
  9360. });
  9361. return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
  9362. }
  9363. return [content].join('\n');
  9364. }
  9365. // Adapted from convert-source-map (MIT)
  9366. function toComment(sourceMap) {
  9367. // eslint-disable-next-line no-undef
  9368. var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
  9369. var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;
  9370. return '/*# ' + data + ' */';
  9371. }
  9372. /***/ }),
  9373. /***/ "./node_modules/ieee754/index.js":
  9374. /*!***************************************!*\
  9375. !*** ./node_modules/ieee754/index.js ***!
  9376. \***************************************/
  9377. /*! no static exports found */
  9378. /***/ (function(module, exports) {
  9379. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  9380. var e, m
  9381. var eLen = (nBytes * 8) - mLen - 1
  9382. var eMax = (1 << eLen) - 1
  9383. var eBias = eMax >> 1
  9384. var nBits = -7
  9385. var i = isLE ? (nBytes - 1) : 0
  9386. var d = isLE ? -1 : 1
  9387. var s = buffer[offset + i]
  9388. i += d
  9389. e = s & ((1 << (-nBits)) - 1)
  9390. s >>= (-nBits)
  9391. nBits += eLen
  9392. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  9393. m = e & ((1 << (-nBits)) - 1)
  9394. e >>= (-nBits)
  9395. nBits += mLen
  9396. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  9397. if (e === 0) {
  9398. e = 1 - eBias
  9399. } else if (e === eMax) {
  9400. return m ? NaN : ((s ? -1 : 1) * Infinity)
  9401. } else {
  9402. m = m + Math.pow(2, mLen)
  9403. e = e - eBias
  9404. }
  9405. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  9406. }
  9407. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  9408. var e, m, c
  9409. var eLen = (nBytes * 8) - mLen - 1
  9410. var eMax = (1 << eLen) - 1
  9411. var eBias = eMax >> 1
  9412. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  9413. var i = isLE ? 0 : (nBytes - 1)
  9414. var d = isLE ? 1 : -1
  9415. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  9416. value = Math.abs(value)
  9417. if (isNaN(value) || value === Infinity) {
  9418. m = isNaN(value) ? 1 : 0
  9419. e = eMax
  9420. } else {
  9421. e = Math.floor(Math.log(value) / Math.LN2)
  9422. if (value * (c = Math.pow(2, -e)) < 1) {
  9423. e--
  9424. c *= 2
  9425. }
  9426. if (e + eBias >= 1) {
  9427. value += rt / c
  9428. } else {
  9429. value += rt * Math.pow(2, 1 - eBias)
  9430. }
  9431. if (value * c >= 2) {
  9432. e++
  9433. c /= 2
  9434. }
  9435. if (e + eBias >= eMax) {
  9436. m = 0
  9437. e = eMax
  9438. } else if (e + eBias >= 1) {
  9439. m = ((value * c) - 1) * Math.pow(2, mLen)
  9440. e = e + eBias
  9441. } else {
  9442. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  9443. e = 0
  9444. }
  9445. }
  9446. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  9447. e = (e << mLen) | m
  9448. eLen += mLen
  9449. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  9450. buffer[offset + i - d] |= s * 128
  9451. }
  9452. /***/ }),
  9453. /***/ "./node_modules/isarray/index.js":
  9454. /*!***************************************!*\
  9455. !*** ./node_modules/isarray/index.js ***!
  9456. \***************************************/
  9457. /*! no static exports found */
  9458. /***/ (function(module, exports) {
  9459. var toString = {}.toString;
  9460. module.exports = Array.isArray || function (arr) {
  9461. return toString.call(arr) == '[object Array]';
  9462. };
  9463. /***/ }),
  9464. /***/ "./node_modules/jquery/dist/jquery.js":
  9465. /*!********************************************!*\
  9466. !*** ./node_modules/jquery/dist/jquery.js ***!
  9467. \********************************************/
  9468. /*! no static exports found */
  9469. /***/ (function(module, exports, __webpack_require__) {
  9470. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  9471. * jQuery JavaScript Library v3.4.1
  9472. * https://jquery.com/
  9473. *
  9474. * Includes Sizzle.js
  9475. * https://sizzlejs.com/
  9476. *
  9477. * Copyright JS Foundation and other contributors
  9478. * Released under the MIT license
  9479. * https://jquery.org/license
  9480. *
  9481. * Date: 2019-05-01T21:04Z
  9482. */
  9483. ( function( global, factory ) {
  9484. "use strict";
  9485. if ( true && typeof module.exports === "object" ) {
  9486. // For CommonJS and CommonJS-like environments where a proper `window`
  9487. // is present, execute the factory and get jQuery.
  9488. // For environments that do not have a `window` with a `document`
  9489. // (such as Node.js), expose a factory as module.exports.
  9490. // This accentuates the need for the creation of a real `window`.
  9491. // e.g. var jQuery = require("jquery")(window);
  9492. // See ticket #14549 for more info.
  9493. module.exports = global.document ?
  9494. factory( global, true ) :
  9495. function( w ) {
  9496. if ( !w.document ) {
  9497. throw new Error( "jQuery requires a window with a document" );
  9498. }
  9499. return factory( w );
  9500. };
  9501. } else {
  9502. factory( global );
  9503. }
  9504. // Pass this if window is not defined yet
  9505. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  9506. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  9507. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  9508. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  9509. // enough that all such attempts are guarded in a try block.
  9510. "use strict";
  9511. var arr = [];
  9512. var document = window.document;
  9513. var getProto = Object.getPrototypeOf;
  9514. var slice = arr.slice;
  9515. var concat = arr.concat;
  9516. var push = arr.push;
  9517. var indexOf = arr.indexOf;
  9518. var class2type = {};
  9519. var toString = class2type.toString;
  9520. var hasOwn = class2type.hasOwnProperty;
  9521. var fnToString = hasOwn.toString;
  9522. var ObjectFunctionString = fnToString.call( Object );
  9523. var support = {};
  9524. var isFunction = function isFunction( obj ) {
  9525. // Support: Chrome <=57, Firefox <=52
  9526. // In some browsers, typeof returns "function" for HTML <object> elements
  9527. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  9528. // We don't want to classify *any* DOM node as a function.
  9529. return typeof obj === "function" && typeof obj.nodeType !== "number";
  9530. };
  9531. var isWindow = function isWindow( obj ) {
  9532. return obj != null && obj === obj.window;
  9533. };
  9534. var preservedScriptAttributes = {
  9535. type: true,
  9536. src: true,
  9537. nonce: true,
  9538. noModule: true
  9539. };
  9540. function DOMEval( code, node, doc ) {
  9541. doc = doc || document;
  9542. var i, val,
  9543. script = doc.createElement( "script" );
  9544. script.text = code;
  9545. if ( node ) {
  9546. for ( i in preservedScriptAttributes ) {
  9547. // Support: Firefox 64+, Edge 18+
  9548. // Some browsers don't support the "nonce" property on scripts.
  9549. // On the other hand, just using `getAttribute` is not enough as
  9550. // the `nonce` attribute is reset to an empty string whenever it
  9551. // becomes browsing-context connected.
  9552. // See https://github.com/whatwg/html/issues/2369
  9553. // See https://html.spec.whatwg.org/#nonce-attributes
  9554. // The `node.getAttribute` check was added for the sake of
  9555. // `jQuery.globalEval` so that it can fake a nonce-containing node
  9556. // via an object.
  9557. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  9558. if ( val ) {
  9559. script.setAttribute( i, val );
  9560. }
  9561. }
  9562. }
  9563. doc.head.appendChild( script ).parentNode.removeChild( script );
  9564. }
  9565. function toType( obj ) {
  9566. if ( obj == null ) {
  9567. return obj + "";
  9568. }
  9569. // Support: Android <=2.3 only (functionish RegExp)
  9570. return typeof obj === "object" || typeof obj === "function" ?
  9571. class2type[ toString.call( obj ) ] || "object" :
  9572. typeof obj;
  9573. }
  9574. /* global Symbol */
  9575. // Defining this global in .eslintrc.json would create a danger of using the global
  9576. // unguarded in another place, it seems safer to define global only for this module
  9577. var
  9578. version = "3.4.1",
  9579. // Define a local copy of jQuery
  9580. jQuery = function( selector, context ) {
  9581. // The jQuery object is actually just the init constructor 'enhanced'
  9582. // Need init if jQuery is called (just allow error to be thrown if not included)
  9583. return new jQuery.fn.init( selector, context );
  9584. },
  9585. // Support: Android <=4.0 only
  9586. // Make sure we trim BOM and NBSP
  9587. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  9588. jQuery.fn = jQuery.prototype = {
  9589. // The current version of jQuery being used
  9590. jquery: version,
  9591. constructor: jQuery,
  9592. // The default length of a jQuery object is 0
  9593. length: 0,
  9594. toArray: function() {
  9595. return slice.call( this );
  9596. },
  9597. // Get the Nth element in the matched element set OR
  9598. // Get the whole matched element set as a clean array
  9599. get: function( num ) {
  9600. // Return all the elements in a clean array
  9601. if ( num == null ) {
  9602. return slice.call( this );
  9603. }
  9604. // Return just the one element from the set
  9605. return num < 0 ? this[ num + this.length ] : this[ num ];
  9606. },
  9607. // Take an array of elements and push it onto the stack
  9608. // (returning the new matched element set)
  9609. pushStack: function( elems ) {
  9610. // Build a new jQuery matched element set
  9611. var ret = jQuery.merge( this.constructor(), elems );
  9612. // Add the old object onto the stack (as a reference)
  9613. ret.prevObject = this;
  9614. // Return the newly-formed element set
  9615. return ret;
  9616. },
  9617. // Execute a callback for every element in the matched set.
  9618. each: function( callback ) {
  9619. return jQuery.each( this, callback );
  9620. },
  9621. map: function( callback ) {
  9622. return this.pushStack( jQuery.map( this, function( elem, i ) {
  9623. return callback.call( elem, i, elem );
  9624. } ) );
  9625. },
  9626. slice: function() {
  9627. return this.pushStack( slice.apply( this, arguments ) );
  9628. },
  9629. first: function() {
  9630. return this.eq( 0 );
  9631. },
  9632. last: function() {
  9633. return this.eq( -1 );
  9634. },
  9635. eq: function( i ) {
  9636. var len = this.length,
  9637. j = +i + ( i < 0 ? len : 0 );
  9638. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  9639. },
  9640. end: function() {
  9641. return this.prevObject || this.constructor();
  9642. },
  9643. // For internal use only.
  9644. // Behaves like an Array's method, not like a jQuery method.
  9645. push: push,
  9646. sort: arr.sort,
  9647. splice: arr.splice
  9648. };
  9649. jQuery.extend = jQuery.fn.extend = function() {
  9650. var options, name, src, copy, copyIsArray, clone,
  9651. target = arguments[ 0 ] || {},
  9652. i = 1,
  9653. length = arguments.length,
  9654. deep = false;
  9655. // Handle a deep copy situation
  9656. if ( typeof target === "boolean" ) {
  9657. deep = target;
  9658. // Skip the boolean and the target
  9659. target = arguments[ i ] || {};
  9660. i++;
  9661. }
  9662. // Handle case when target is a string or something (possible in deep copy)
  9663. if ( typeof target !== "object" && !isFunction( target ) ) {
  9664. target = {};
  9665. }
  9666. // Extend jQuery itself if only one argument is passed
  9667. if ( i === length ) {
  9668. target = this;
  9669. i--;
  9670. }
  9671. for ( ; i < length; i++ ) {
  9672. // Only deal with non-null/undefined values
  9673. if ( ( options = arguments[ i ] ) != null ) {
  9674. // Extend the base object
  9675. for ( name in options ) {
  9676. copy = options[ name ];
  9677. // Prevent Object.prototype pollution
  9678. // Prevent never-ending loop
  9679. if ( name === "__proto__" || target === copy ) {
  9680. continue;
  9681. }
  9682. // Recurse if we're merging plain objects or arrays
  9683. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  9684. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  9685. src = target[ name ];
  9686. // Ensure proper type for the source value
  9687. if ( copyIsArray && !Array.isArray( src ) ) {
  9688. clone = [];
  9689. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  9690. clone = {};
  9691. } else {
  9692. clone = src;
  9693. }
  9694. copyIsArray = false;
  9695. // Never move original objects, clone them
  9696. target[ name ] = jQuery.extend( deep, clone, copy );
  9697. // Don't bring in undefined values
  9698. } else if ( copy !== undefined ) {
  9699. target[ name ] = copy;
  9700. }
  9701. }
  9702. }
  9703. }
  9704. // Return the modified object
  9705. return target;
  9706. };
  9707. jQuery.extend( {
  9708. // Unique for each copy of jQuery on the page
  9709. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  9710. // Assume jQuery is ready without the ready module
  9711. isReady: true,
  9712. error: function( msg ) {
  9713. throw new Error( msg );
  9714. },
  9715. noop: function() {},
  9716. isPlainObject: function( obj ) {
  9717. var proto, Ctor;
  9718. // Detect obvious negatives
  9719. // Use toString instead of jQuery.type to catch host objects
  9720. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  9721. return false;
  9722. }
  9723. proto = getProto( obj );
  9724. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  9725. if ( !proto ) {
  9726. return true;
  9727. }
  9728. // Objects with prototype are plain iff they were constructed by a global Object function
  9729. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  9730. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  9731. },
  9732. isEmptyObject: function( obj ) {
  9733. var name;
  9734. for ( name in obj ) {
  9735. return false;
  9736. }
  9737. return true;
  9738. },
  9739. // Evaluates a script in a global context
  9740. globalEval: function( code, options ) {
  9741. DOMEval( code, { nonce: options && options.nonce } );
  9742. },
  9743. each: function( obj, callback ) {
  9744. var length, i = 0;
  9745. if ( isArrayLike( obj ) ) {
  9746. length = obj.length;
  9747. for ( ; i < length; i++ ) {
  9748. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  9749. break;
  9750. }
  9751. }
  9752. } else {
  9753. for ( i in obj ) {
  9754. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  9755. break;
  9756. }
  9757. }
  9758. }
  9759. return obj;
  9760. },
  9761. // Support: Android <=4.0 only
  9762. trim: function( text ) {
  9763. return text == null ?
  9764. "" :
  9765. ( text + "" ).replace( rtrim, "" );
  9766. },
  9767. // results is for internal usage only
  9768. makeArray: function( arr, results ) {
  9769. var ret = results || [];
  9770. if ( arr != null ) {
  9771. if ( isArrayLike( Object( arr ) ) ) {
  9772. jQuery.merge( ret,
  9773. typeof arr === "string" ?
  9774. [ arr ] : arr
  9775. );
  9776. } else {
  9777. push.call( ret, arr );
  9778. }
  9779. }
  9780. return ret;
  9781. },
  9782. inArray: function( elem, arr, i ) {
  9783. return arr == null ? -1 : indexOf.call( arr, elem, i );
  9784. },
  9785. // Support: Android <=4.0 only, PhantomJS 1 only
  9786. // push.apply(_, arraylike) throws on ancient WebKit
  9787. merge: function( first, second ) {
  9788. var len = +second.length,
  9789. j = 0,
  9790. i = first.length;
  9791. for ( ; j < len; j++ ) {
  9792. first[ i++ ] = second[ j ];
  9793. }
  9794. first.length = i;
  9795. return first;
  9796. },
  9797. grep: function( elems, callback, invert ) {
  9798. var callbackInverse,
  9799. matches = [],
  9800. i = 0,
  9801. length = elems.length,
  9802. callbackExpect = !invert;
  9803. // Go through the array, only saving the items
  9804. // that pass the validator function
  9805. for ( ; i < length; i++ ) {
  9806. callbackInverse = !callback( elems[ i ], i );
  9807. if ( callbackInverse !== callbackExpect ) {
  9808. matches.push( elems[ i ] );
  9809. }
  9810. }
  9811. return matches;
  9812. },
  9813. // arg is for internal usage only
  9814. map: function( elems, callback, arg ) {
  9815. var length, value,
  9816. i = 0,
  9817. ret = [];
  9818. // Go through the array, translating each of the items to their new values
  9819. if ( isArrayLike( elems ) ) {
  9820. length = elems.length;
  9821. for ( ; i < length; i++ ) {
  9822. value = callback( elems[ i ], i, arg );
  9823. if ( value != null ) {
  9824. ret.push( value );
  9825. }
  9826. }
  9827. // Go through every key on the object,
  9828. } else {
  9829. for ( i in elems ) {
  9830. value = callback( elems[ i ], i, arg );
  9831. if ( value != null ) {
  9832. ret.push( value );
  9833. }
  9834. }
  9835. }
  9836. // Flatten any nested arrays
  9837. return concat.apply( [], ret );
  9838. },
  9839. // A global GUID counter for objects
  9840. guid: 1,
  9841. // jQuery.support is not used in Core but other projects attach their
  9842. // properties to it so it needs to exist.
  9843. support: support
  9844. } );
  9845. if ( typeof Symbol === "function" ) {
  9846. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  9847. }
  9848. // Populate the class2type map
  9849. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  9850. function( i, name ) {
  9851. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  9852. } );
  9853. function isArrayLike( obj ) {
  9854. // Support: real iOS 8.2 only (not reproducible in simulator)
  9855. // `in` check used to prevent JIT error (gh-2145)
  9856. // hasOwn isn't used here due to false negatives
  9857. // regarding Nodelist length in IE
  9858. var length = !!obj && "length" in obj && obj.length,
  9859. type = toType( obj );
  9860. if ( isFunction( obj ) || isWindow( obj ) ) {
  9861. return false;
  9862. }
  9863. return type === "array" || length === 0 ||
  9864. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  9865. }
  9866. var Sizzle =
  9867. /*!
  9868. * Sizzle CSS Selector Engine v2.3.4
  9869. * https://sizzlejs.com/
  9870. *
  9871. * Copyright JS Foundation and other contributors
  9872. * Released under the MIT license
  9873. * https://js.foundation/
  9874. *
  9875. * Date: 2019-04-08
  9876. */
  9877. (function( window ) {
  9878. var i,
  9879. support,
  9880. Expr,
  9881. getText,
  9882. isXML,
  9883. tokenize,
  9884. compile,
  9885. select,
  9886. outermostContext,
  9887. sortInput,
  9888. hasDuplicate,
  9889. // Local document vars
  9890. setDocument,
  9891. document,
  9892. docElem,
  9893. documentIsHTML,
  9894. rbuggyQSA,
  9895. rbuggyMatches,
  9896. matches,
  9897. contains,
  9898. // Instance-specific data
  9899. expando = "sizzle" + 1 * new Date(),
  9900. preferredDoc = window.document,
  9901. dirruns = 0,
  9902. done = 0,
  9903. classCache = createCache(),
  9904. tokenCache = createCache(),
  9905. compilerCache = createCache(),
  9906. nonnativeSelectorCache = createCache(),
  9907. sortOrder = function( a, b ) {
  9908. if ( a === b ) {
  9909. hasDuplicate = true;
  9910. }
  9911. return 0;
  9912. },
  9913. // Instance methods
  9914. hasOwn = ({}).hasOwnProperty,
  9915. arr = [],
  9916. pop = arr.pop,
  9917. push_native = arr.push,
  9918. push = arr.push,
  9919. slice = arr.slice,
  9920. // Use a stripped-down indexOf as it's faster than native
  9921. // https://jsperf.com/thor-indexof-vs-for/5
  9922. indexOf = function( list, elem ) {
  9923. var i = 0,
  9924. len = list.length;
  9925. for ( ; i < len; i++ ) {
  9926. if ( list[i] === elem ) {
  9927. return i;
  9928. }
  9929. }
  9930. return -1;
  9931. },
  9932. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  9933. // Regular expressions
  9934. // http://www.w3.org/TR/css3-selectors/#whitespace
  9935. whitespace = "[\\x20\\t\\r\\n\\f]",
  9936. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  9937. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  9938. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  9939. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  9940. // Operator (capture 2)
  9941. "*([*^$|!~]?=)" + whitespace +
  9942. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  9943. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  9944. "*\\]",
  9945. pseudos = ":(" + identifier + ")(?:\\((" +
  9946. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  9947. // 1. quoted (capture 3; capture 4 or capture 5)
  9948. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  9949. // 2. simple (capture 6)
  9950. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  9951. // 3. anything else (capture 2)
  9952. ".*" +
  9953. ")\\)|)",
  9954. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  9955. rwhitespace = new RegExp( whitespace + "+", "g" ),
  9956. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  9957. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  9958. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  9959. rdescend = new RegExp( whitespace + "|>" ),
  9960. rpseudo = new RegExp( pseudos ),
  9961. ridentifier = new RegExp( "^" + identifier + "$" ),
  9962. matchExpr = {
  9963. "ID": new RegExp( "^#(" + identifier + ")" ),
  9964. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  9965. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  9966. "ATTR": new RegExp( "^" + attributes ),
  9967. "PSEUDO": new RegExp( "^" + pseudos ),
  9968. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  9969. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  9970. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  9971. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  9972. // For use in libraries implementing .is()
  9973. // We use this for POS matching in `select`
  9974. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  9975. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  9976. },
  9977. rhtml = /HTML$/i,
  9978. rinputs = /^(?:input|select|textarea|button)$/i,
  9979. rheader = /^h\d$/i,
  9980. rnative = /^[^{]+\{\s*\[native \w/,
  9981. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  9982. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  9983. rsibling = /[+~]/,
  9984. // CSS escapes
  9985. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  9986. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  9987. funescape = function( _, escaped, escapedWhitespace ) {
  9988. var high = "0x" + escaped - 0x10000;
  9989. // NaN means non-codepoint
  9990. // Support: Firefox<24
  9991. // Workaround erroneous numeric interpretation of +"0x"
  9992. return high !== high || escapedWhitespace ?
  9993. escaped :
  9994. high < 0 ?
  9995. // BMP codepoint
  9996. String.fromCharCode( high + 0x10000 ) :
  9997. // Supplemental Plane codepoint (surrogate pair)
  9998. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  9999. },
  10000. // CSS string/identifier serialization
  10001. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  10002. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  10003. fcssescape = function( ch, asCodePoint ) {
  10004. if ( asCodePoint ) {
  10005. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  10006. if ( ch === "\0" ) {
  10007. return "\uFFFD";
  10008. }
  10009. // Control characters and (dependent upon position) numbers get escaped as code points
  10010. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  10011. }
  10012. // Other potentially-special ASCII characters get backslash-escaped
  10013. return "\\" + ch;
  10014. },
  10015. // Used for iframes
  10016. // See setDocument()
  10017. // Removing the function wrapper causes a "Permission Denied"
  10018. // error in IE
  10019. unloadHandler = function() {
  10020. setDocument();
  10021. },
  10022. inDisabledFieldset = addCombinator(
  10023. function( elem ) {
  10024. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  10025. },
  10026. { dir: "parentNode", next: "legend" }
  10027. );
  10028. // Optimize for push.apply( _, NodeList )
  10029. try {
  10030. push.apply(
  10031. (arr = slice.call( preferredDoc.childNodes )),
  10032. preferredDoc.childNodes
  10033. );
  10034. // Support: Android<4.0
  10035. // Detect silently failing push.apply
  10036. arr[ preferredDoc.childNodes.length ].nodeType;
  10037. } catch ( e ) {
  10038. push = { apply: arr.length ?
  10039. // Leverage slice if possible
  10040. function( target, els ) {
  10041. push_native.apply( target, slice.call(els) );
  10042. } :
  10043. // Support: IE<9
  10044. // Otherwise append directly
  10045. function( target, els ) {
  10046. var j = target.length,
  10047. i = 0;
  10048. // Can't trust NodeList.length
  10049. while ( (target[j++] = els[i++]) ) {}
  10050. target.length = j - 1;
  10051. }
  10052. };
  10053. }
  10054. function Sizzle( selector, context, results, seed ) {
  10055. var m, i, elem, nid, match, groups, newSelector,
  10056. newContext = context && context.ownerDocument,
  10057. // nodeType defaults to 9, since context defaults to document
  10058. nodeType = context ? context.nodeType : 9;
  10059. results = results || [];
  10060. // Return early from calls with invalid selector or context
  10061. if ( typeof selector !== "string" || !selector ||
  10062. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  10063. return results;
  10064. }
  10065. // Try to shortcut find operations (as opposed to filters) in HTML documents
  10066. if ( !seed ) {
  10067. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  10068. setDocument( context );
  10069. }
  10070. context = context || document;
  10071. if ( documentIsHTML ) {
  10072. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  10073. // (excepting DocumentFragment context, where the methods don't exist)
  10074. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  10075. // ID selector
  10076. if ( (m = match[1]) ) {
  10077. // Document context
  10078. if ( nodeType === 9 ) {
  10079. if ( (elem = context.getElementById( m )) ) {
  10080. // Support: IE, Opera, Webkit
  10081. // TODO: identify versions
  10082. // getElementById can match elements by name instead of ID
  10083. if ( elem.id === m ) {
  10084. results.push( elem );
  10085. return results;
  10086. }
  10087. } else {
  10088. return results;
  10089. }
  10090. // Element context
  10091. } else {
  10092. // Support: IE, Opera, Webkit
  10093. // TODO: identify versions
  10094. // getElementById can match elements by name instead of ID
  10095. if ( newContext && (elem = newContext.getElementById( m )) &&
  10096. contains( context, elem ) &&
  10097. elem.id === m ) {
  10098. results.push( elem );
  10099. return results;
  10100. }
  10101. }
  10102. // Type selector
  10103. } else if ( match[2] ) {
  10104. push.apply( results, context.getElementsByTagName( selector ) );
  10105. return results;
  10106. // Class selector
  10107. } else if ( (m = match[3]) && support.getElementsByClassName &&
  10108. context.getElementsByClassName ) {
  10109. push.apply( results, context.getElementsByClassName( m ) );
  10110. return results;
  10111. }
  10112. }
  10113. // Take advantage of querySelectorAll
  10114. if ( support.qsa &&
  10115. !nonnativeSelectorCache[ selector + " " ] &&
  10116. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  10117. // Support: IE 8 only
  10118. // Exclude object elements
  10119. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  10120. newSelector = selector;
  10121. newContext = context;
  10122. // qSA considers elements outside a scoping root when evaluating child or
  10123. // descendant combinators, which is not what we want.
  10124. // In such cases, we work around the behavior by prefixing every selector in the
  10125. // list with an ID selector referencing the scope context.
  10126. // Thanks to Andrew Dupont for this technique.
  10127. if ( nodeType === 1 && rdescend.test( selector ) ) {
  10128. // Capture the context ID, setting it first if necessary
  10129. if ( (nid = context.getAttribute( "id" )) ) {
  10130. nid = nid.replace( rcssescape, fcssescape );
  10131. } else {
  10132. context.setAttribute( "id", (nid = expando) );
  10133. }
  10134. // Prefix every selector in the list
  10135. groups = tokenize( selector );
  10136. i = groups.length;
  10137. while ( i-- ) {
  10138. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  10139. }
  10140. newSelector = groups.join( "," );
  10141. // Expand context for sibling selectors
  10142. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  10143. context;
  10144. }
  10145. try {
  10146. push.apply( results,
  10147. newContext.querySelectorAll( newSelector )
  10148. );
  10149. return results;
  10150. } catch ( qsaError ) {
  10151. nonnativeSelectorCache( selector, true );
  10152. } finally {
  10153. if ( nid === expando ) {
  10154. context.removeAttribute( "id" );
  10155. }
  10156. }
  10157. }
  10158. }
  10159. }
  10160. // All others
  10161. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  10162. }
  10163. /**
  10164. * Create key-value caches of limited size
  10165. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  10166. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  10167. * deleting the oldest entry
  10168. */
  10169. function createCache() {
  10170. var keys = [];
  10171. function cache( key, value ) {
  10172. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  10173. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  10174. // Only keep the most recent entries
  10175. delete cache[ keys.shift() ];
  10176. }
  10177. return (cache[ key + " " ] = value);
  10178. }
  10179. return cache;
  10180. }
  10181. /**
  10182. * Mark a function for special use by Sizzle
  10183. * @param {Function} fn The function to mark
  10184. */
  10185. function markFunction( fn ) {
  10186. fn[ expando ] = true;
  10187. return fn;
  10188. }
  10189. /**
  10190. * Support testing using an element
  10191. * @param {Function} fn Passed the created element and returns a boolean result
  10192. */
  10193. function assert( fn ) {
  10194. var el = document.createElement("fieldset");
  10195. try {
  10196. return !!fn( el );
  10197. } catch (e) {
  10198. return false;
  10199. } finally {
  10200. // Remove from its parent by default
  10201. if ( el.parentNode ) {
  10202. el.parentNode.removeChild( el );
  10203. }
  10204. // release memory in IE
  10205. el = null;
  10206. }
  10207. }
  10208. /**
  10209. * Adds the same handler for all of the specified attrs
  10210. * @param {String} attrs Pipe-separated list of attributes
  10211. * @param {Function} handler The method that will be applied
  10212. */
  10213. function addHandle( attrs, handler ) {
  10214. var arr = attrs.split("|"),
  10215. i = arr.length;
  10216. while ( i-- ) {
  10217. Expr.attrHandle[ arr[i] ] = handler;
  10218. }
  10219. }
  10220. /**
  10221. * Checks document order of two siblings
  10222. * @param {Element} a
  10223. * @param {Element} b
  10224. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  10225. */
  10226. function siblingCheck( a, b ) {
  10227. var cur = b && a,
  10228. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  10229. a.sourceIndex - b.sourceIndex;
  10230. // Use IE sourceIndex if available on both nodes
  10231. if ( diff ) {
  10232. return diff;
  10233. }
  10234. // Check if b follows a
  10235. if ( cur ) {
  10236. while ( (cur = cur.nextSibling) ) {
  10237. if ( cur === b ) {
  10238. return -1;
  10239. }
  10240. }
  10241. }
  10242. return a ? 1 : -1;
  10243. }
  10244. /**
  10245. * Returns a function to use in pseudos for input types
  10246. * @param {String} type
  10247. */
  10248. function createInputPseudo( type ) {
  10249. return function( elem ) {
  10250. var name = elem.nodeName.toLowerCase();
  10251. return name === "input" && elem.type === type;
  10252. };
  10253. }
  10254. /**
  10255. * Returns a function to use in pseudos for buttons
  10256. * @param {String} type
  10257. */
  10258. function createButtonPseudo( type ) {
  10259. return function( elem ) {
  10260. var name = elem.nodeName.toLowerCase();
  10261. return (name === "input" || name === "button") && elem.type === type;
  10262. };
  10263. }
  10264. /**
  10265. * Returns a function to use in pseudos for :enabled/:disabled
  10266. * @param {Boolean} disabled true for :disabled; false for :enabled
  10267. */
  10268. function createDisabledPseudo( disabled ) {
  10269. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  10270. return function( elem ) {
  10271. // Only certain elements can match :enabled or :disabled
  10272. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  10273. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  10274. if ( "form" in elem ) {
  10275. // Check for inherited disabledness on relevant non-disabled elements:
  10276. // * listed form-associated elements in a disabled fieldset
  10277. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  10278. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  10279. // * option elements in a disabled optgroup
  10280. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  10281. // All such elements have a "form" property.
  10282. if ( elem.parentNode && elem.disabled === false ) {
  10283. // Option elements defer to a parent optgroup if present
  10284. if ( "label" in elem ) {
  10285. if ( "label" in elem.parentNode ) {
  10286. return elem.parentNode.disabled === disabled;
  10287. } else {
  10288. return elem.disabled === disabled;
  10289. }
  10290. }
  10291. // Support: IE 6 - 11
  10292. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  10293. return elem.isDisabled === disabled ||
  10294. // Where there is no isDisabled, check manually
  10295. /* jshint -W018 */
  10296. elem.isDisabled !== !disabled &&
  10297. inDisabledFieldset( elem ) === disabled;
  10298. }
  10299. return elem.disabled === disabled;
  10300. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  10301. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  10302. // even exist on them, let alone have a boolean value.
  10303. } else if ( "label" in elem ) {
  10304. return elem.disabled === disabled;
  10305. }
  10306. // Remaining elements are neither :enabled nor :disabled
  10307. return false;
  10308. };
  10309. }
  10310. /**
  10311. * Returns a function to use in pseudos for positionals
  10312. * @param {Function} fn
  10313. */
  10314. function createPositionalPseudo( fn ) {
  10315. return markFunction(function( argument ) {
  10316. argument = +argument;
  10317. return markFunction(function( seed, matches ) {
  10318. var j,
  10319. matchIndexes = fn( [], seed.length, argument ),
  10320. i = matchIndexes.length;
  10321. // Match elements found at the specified indexes
  10322. while ( i-- ) {
  10323. if ( seed[ (j = matchIndexes[i]) ] ) {
  10324. seed[j] = !(matches[j] = seed[j]);
  10325. }
  10326. }
  10327. });
  10328. });
  10329. }
  10330. /**
  10331. * Checks a node for validity as a Sizzle context
  10332. * @param {Element|Object=} context
  10333. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  10334. */
  10335. function testContext( context ) {
  10336. return context && typeof context.getElementsByTagName !== "undefined" && context;
  10337. }
  10338. // Expose support vars for convenience
  10339. support = Sizzle.support = {};
  10340. /**
  10341. * Detects XML nodes
  10342. * @param {Element|Object} elem An element or a document
  10343. * @returns {Boolean} True iff elem is a non-HTML XML node
  10344. */
  10345. isXML = Sizzle.isXML = function( elem ) {
  10346. var namespace = elem.namespaceURI,
  10347. docElem = (elem.ownerDocument || elem).documentElement;
  10348. // Support: IE <=8
  10349. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  10350. // https://bugs.jquery.com/ticket/4833
  10351. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  10352. };
  10353. /**
  10354. * Sets document-related variables once based on the current document
  10355. * @param {Element|Object} [doc] An element or document object to use to set the document
  10356. * @returns {Object} Returns the current document
  10357. */
  10358. setDocument = Sizzle.setDocument = function( node ) {
  10359. var hasCompare, subWindow,
  10360. doc = node ? node.ownerDocument || node : preferredDoc;
  10361. // Return early if doc is invalid or already selected
  10362. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  10363. return document;
  10364. }
  10365. // Update global variables
  10366. document = doc;
  10367. docElem = document.documentElement;
  10368. documentIsHTML = !isXML( document );
  10369. // Support: IE 9-11, Edge
  10370. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  10371. if ( preferredDoc !== document &&
  10372. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  10373. // Support: IE 11, Edge
  10374. if ( subWindow.addEventListener ) {
  10375. subWindow.addEventListener( "unload", unloadHandler, false );
  10376. // Support: IE 9 - 10 only
  10377. } else if ( subWindow.attachEvent ) {
  10378. subWindow.attachEvent( "onunload", unloadHandler );
  10379. }
  10380. }
  10381. /* Attributes
  10382. ---------------------------------------------------------------------- */
  10383. // Support: IE<8
  10384. // Verify that getAttribute really returns attributes and not properties
  10385. // (excepting IE8 booleans)
  10386. support.attributes = assert(function( el ) {
  10387. el.className = "i";
  10388. return !el.getAttribute("className");
  10389. });
  10390. /* getElement(s)By*
  10391. ---------------------------------------------------------------------- */
  10392. // Check if getElementsByTagName("*") returns only elements
  10393. support.getElementsByTagName = assert(function( el ) {
  10394. el.appendChild( document.createComment("") );
  10395. return !el.getElementsByTagName("*").length;
  10396. });
  10397. // Support: IE<9
  10398. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  10399. // Support: IE<10
  10400. // Check if getElementById returns elements by name
  10401. // The broken getElementById methods don't pick up programmatically-set names,
  10402. // so use a roundabout getElementsByName test
  10403. support.getById = assert(function( el ) {
  10404. docElem.appendChild( el ).id = expando;
  10405. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  10406. });
  10407. // ID filter and find
  10408. if ( support.getById ) {
  10409. Expr.filter["ID"] = function( id ) {
  10410. var attrId = id.replace( runescape, funescape );
  10411. return function( elem ) {
  10412. return elem.getAttribute("id") === attrId;
  10413. };
  10414. };
  10415. Expr.find["ID"] = function( id, context ) {
  10416. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  10417. var elem = context.getElementById( id );
  10418. return elem ? [ elem ] : [];
  10419. }
  10420. };
  10421. } else {
  10422. Expr.filter["ID"] = function( id ) {
  10423. var attrId = id.replace( runescape, funescape );
  10424. return function( elem ) {
  10425. var node = typeof elem.getAttributeNode !== "undefined" &&
  10426. elem.getAttributeNode("id");
  10427. return node && node.value === attrId;
  10428. };
  10429. };
  10430. // Support: IE 6 - 7 only
  10431. // getElementById is not reliable as a find shortcut
  10432. Expr.find["ID"] = function( id, context ) {
  10433. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  10434. var node, i, elems,
  10435. elem = context.getElementById( id );
  10436. if ( elem ) {
  10437. // Verify the id attribute
  10438. node = elem.getAttributeNode("id");
  10439. if ( node && node.value === id ) {
  10440. return [ elem ];
  10441. }
  10442. // Fall back on getElementsByName
  10443. elems = context.getElementsByName( id );
  10444. i = 0;
  10445. while ( (elem = elems[i++]) ) {
  10446. node = elem.getAttributeNode("id");
  10447. if ( node && node.value === id ) {
  10448. return [ elem ];
  10449. }
  10450. }
  10451. }
  10452. return [];
  10453. }
  10454. };
  10455. }
  10456. // Tag
  10457. Expr.find["TAG"] = support.getElementsByTagName ?
  10458. function( tag, context ) {
  10459. if ( typeof context.getElementsByTagName !== "undefined" ) {
  10460. return context.getElementsByTagName( tag );
  10461. // DocumentFragment nodes don't have gEBTN
  10462. } else if ( support.qsa ) {
  10463. return context.querySelectorAll( tag );
  10464. }
  10465. } :
  10466. function( tag, context ) {
  10467. var elem,
  10468. tmp = [],
  10469. i = 0,
  10470. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  10471. results = context.getElementsByTagName( tag );
  10472. // Filter out possible comments
  10473. if ( tag === "*" ) {
  10474. while ( (elem = results[i++]) ) {
  10475. if ( elem.nodeType === 1 ) {
  10476. tmp.push( elem );
  10477. }
  10478. }
  10479. return tmp;
  10480. }
  10481. return results;
  10482. };
  10483. // Class
  10484. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  10485. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  10486. return context.getElementsByClassName( className );
  10487. }
  10488. };
  10489. /* QSA/matchesSelector
  10490. ---------------------------------------------------------------------- */
  10491. // QSA and matchesSelector support
  10492. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  10493. rbuggyMatches = [];
  10494. // qSa(:focus) reports false when true (Chrome 21)
  10495. // We allow this because of a bug in IE8/9 that throws an error
  10496. // whenever `document.activeElement` is accessed on an iframe
  10497. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  10498. // See https://bugs.jquery.com/ticket/13378
  10499. rbuggyQSA = [];
  10500. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  10501. // Build QSA regex
  10502. // Regex strategy adopted from Diego Perini
  10503. assert(function( el ) {
  10504. // Select is set to empty string on purpose
  10505. // This is to test IE's treatment of not explicitly
  10506. // setting a boolean content attribute,
  10507. // since its presence should be enough
  10508. // https://bugs.jquery.com/ticket/12359
  10509. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  10510. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  10511. "<option selected=''></option></select>";
  10512. // Support: IE8, Opera 11-12.16
  10513. // Nothing should be selected when empty strings follow ^= or $= or *=
  10514. // The test attribute must be unknown in Opera but "safe" for WinRT
  10515. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  10516. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  10517. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  10518. }
  10519. // Support: IE8
  10520. // Boolean attributes and "value" are not treated correctly
  10521. if ( !el.querySelectorAll("[selected]").length ) {
  10522. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  10523. }
  10524. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  10525. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  10526. rbuggyQSA.push("~=");
  10527. }
  10528. // Webkit/Opera - :checked should return selected option elements
  10529. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  10530. // IE8 throws error here and will not see later tests
  10531. if ( !el.querySelectorAll(":checked").length ) {
  10532. rbuggyQSA.push(":checked");
  10533. }
  10534. // Support: Safari 8+, iOS 8+
  10535. // https://bugs.webkit.org/show_bug.cgi?id=136851
  10536. // In-page `selector#id sibling-combinator selector` fails
  10537. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  10538. rbuggyQSA.push(".#.+[+~]");
  10539. }
  10540. });
  10541. assert(function( el ) {
  10542. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  10543. "<select disabled='disabled'><option/></select>";
  10544. // Support: Windows 8 Native Apps
  10545. // The type and name attributes are restricted during .innerHTML assignment
  10546. var input = document.createElement("input");
  10547. input.setAttribute( "type", "hidden" );
  10548. el.appendChild( input ).setAttribute( "name", "D" );
  10549. // Support: IE8
  10550. // Enforce case-sensitivity of name attribute
  10551. if ( el.querySelectorAll("[name=d]").length ) {
  10552. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  10553. }
  10554. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  10555. // IE8 throws error here and will not see later tests
  10556. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  10557. rbuggyQSA.push( ":enabled", ":disabled" );
  10558. }
  10559. // Support: IE9-11+
  10560. // IE's :disabled selector does not pick up the children of disabled fieldsets
  10561. docElem.appendChild( el ).disabled = true;
  10562. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  10563. rbuggyQSA.push( ":enabled", ":disabled" );
  10564. }
  10565. // Opera 10-11 does not throw on post-comma invalid pseudos
  10566. el.querySelectorAll("*,:x");
  10567. rbuggyQSA.push(",.*:");
  10568. });
  10569. }
  10570. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  10571. docElem.webkitMatchesSelector ||
  10572. docElem.mozMatchesSelector ||
  10573. docElem.oMatchesSelector ||
  10574. docElem.msMatchesSelector) )) ) {
  10575. assert(function( el ) {
  10576. // Check to see if it's possible to do matchesSelector
  10577. // on a disconnected node (IE 9)
  10578. support.disconnectedMatch = matches.call( el, "*" );
  10579. // This should fail with an exception
  10580. // Gecko does not error, returns false instead
  10581. matches.call( el, "[s!='']:x" );
  10582. rbuggyMatches.push( "!=", pseudos );
  10583. });
  10584. }
  10585. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  10586. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  10587. /* Contains
  10588. ---------------------------------------------------------------------- */
  10589. hasCompare = rnative.test( docElem.compareDocumentPosition );
  10590. // Element contains another
  10591. // Purposefully self-exclusive
  10592. // As in, an element does not contain itself
  10593. contains = hasCompare || rnative.test( docElem.contains ) ?
  10594. function( a, b ) {
  10595. var adown = a.nodeType === 9 ? a.documentElement : a,
  10596. bup = b && b.parentNode;
  10597. return a === bup || !!( bup && bup.nodeType === 1 && (
  10598. adown.contains ?
  10599. adown.contains( bup ) :
  10600. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  10601. ));
  10602. } :
  10603. function( a, b ) {
  10604. if ( b ) {
  10605. while ( (b = b.parentNode) ) {
  10606. if ( b === a ) {
  10607. return true;
  10608. }
  10609. }
  10610. }
  10611. return false;
  10612. };
  10613. /* Sorting
  10614. ---------------------------------------------------------------------- */
  10615. // Document order sorting
  10616. sortOrder = hasCompare ?
  10617. function( a, b ) {
  10618. // Flag for duplicate removal
  10619. if ( a === b ) {
  10620. hasDuplicate = true;
  10621. return 0;
  10622. }
  10623. // Sort on method existence if only one input has compareDocumentPosition
  10624. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  10625. if ( compare ) {
  10626. return compare;
  10627. }
  10628. // Calculate position if both inputs belong to the same document
  10629. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  10630. a.compareDocumentPosition( b ) :
  10631. // Otherwise we know they are disconnected
  10632. 1;
  10633. // Disconnected nodes
  10634. if ( compare & 1 ||
  10635. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  10636. // Choose the first element that is related to our preferred document
  10637. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  10638. return -1;
  10639. }
  10640. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  10641. return 1;
  10642. }
  10643. // Maintain original order
  10644. return sortInput ?
  10645. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  10646. 0;
  10647. }
  10648. return compare & 4 ? -1 : 1;
  10649. } :
  10650. function( a, b ) {
  10651. // Exit early if the nodes are identical
  10652. if ( a === b ) {
  10653. hasDuplicate = true;
  10654. return 0;
  10655. }
  10656. var cur,
  10657. i = 0,
  10658. aup = a.parentNode,
  10659. bup = b.parentNode,
  10660. ap = [ a ],
  10661. bp = [ b ];
  10662. // Parentless nodes are either documents or disconnected
  10663. if ( !aup || !bup ) {
  10664. return a === document ? -1 :
  10665. b === document ? 1 :
  10666. aup ? -1 :
  10667. bup ? 1 :
  10668. sortInput ?
  10669. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  10670. 0;
  10671. // If the nodes are siblings, we can do a quick check
  10672. } else if ( aup === bup ) {
  10673. return siblingCheck( a, b );
  10674. }
  10675. // Otherwise we need full lists of their ancestors for comparison
  10676. cur = a;
  10677. while ( (cur = cur.parentNode) ) {
  10678. ap.unshift( cur );
  10679. }
  10680. cur = b;
  10681. while ( (cur = cur.parentNode) ) {
  10682. bp.unshift( cur );
  10683. }
  10684. // Walk down the tree looking for a discrepancy
  10685. while ( ap[i] === bp[i] ) {
  10686. i++;
  10687. }
  10688. return i ?
  10689. // Do a sibling check if the nodes have a common ancestor
  10690. siblingCheck( ap[i], bp[i] ) :
  10691. // Otherwise nodes in our document sort first
  10692. ap[i] === preferredDoc ? -1 :
  10693. bp[i] === preferredDoc ? 1 :
  10694. 0;
  10695. };
  10696. return document;
  10697. };
  10698. Sizzle.matches = function( expr, elements ) {
  10699. return Sizzle( expr, null, null, elements );
  10700. };
  10701. Sizzle.matchesSelector = function( elem, expr ) {
  10702. // Set document vars if needed
  10703. if ( ( elem.ownerDocument || elem ) !== document ) {
  10704. setDocument( elem );
  10705. }
  10706. if ( support.matchesSelector && documentIsHTML &&
  10707. !nonnativeSelectorCache[ expr + " " ] &&
  10708. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  10709. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  10710. try {
  10711. var ret = matches.call( elem, expr );
  10712. // IE 9's matchesSelector returns false on disconnected nodes
  10713. if ( ret || support.disconnectedMatch ||
  10714. // As well, disconnected nodes are said to be in a document
  10715. // fragment in IE 9
  10716. elem.document && elem.document.nodeType !== 11 ) {
  10717. return ret;
  10718. }
  10719. } catch (e) {
  10720. nonnativeSelectorCache( expr, true );
  10721. }
  10722. }
  10723. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  10724. };
  10725. Sizzle.contains = function( context, elem ) {
  10726. // Set document vars if needed
  10727. if ( ( context.ownerDocument || context ) !== document ) {
  10728. setDocument( context );
  10729. }
  10730. return contains( context, elem );
  10731. };
  10732. Sizzle.attr = function( elem, name ) {
  10733. // Set document vars if needed
  10734. if ( ( elem.ownerDocument || elem ) !== document ) {
  10735. setDocument( elem );
  10736. }
  10737. var fn = Expr.attrHandle[ name.toLowerCase() ],
  10738. // Don't get fooled by Object.prototype properties (jQuery #13807)
  10739. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  10740. fn( elem, name, !documentIsHTML ) :
  10741. undefined;
  10742. return val !== undefined ?
  10743. val :
  10744. support.attributes || !documentIsHTML ?
  10745. elem.getAttribute( name ) :
  10746. (val = elem.getAttributeNode(name)) && val.specified ?
  10747. val.value :
  10748. null;
  10749. };
  10750. Sizzle.escape = function( sel ) {
  10751. return (sel + "").replace( rcssescape, fcssescape );
  10752. };
  10753. Sizzle.error = function( msg ) {
  10754. throw new Error( "Syntax error, unrecognized expression: " + msg );
  10755. };
  10756. /**
  10757. * Document sorting and removing duplicates
  10758. * @param {ArrayLike} results
  10759. */
  10760. Sizzle.uniqueSort = function( results ) {
  10761. var elem,
  10762. duplicates = [],
  10763. j = 0,
  10764. i = 0;
  10765. // Unless we *know* we can detect duplicates, assume their presence
  10766. hasDuplicate = !support.detectDuplicates;
  10767. sortInput = !support.sortStable && results.slice( 0 );
  10768. results.sort( sortOrder );
  10769. if ( hasDuplicate ) {
  10770. while ( (elem = results[i++]) ) {
  10771. if ( elem === results[ i ] ) {
  10772. j = duplicates.push( i );
  10773. }
  10774. }
  10775. while ( j-- ) {
  10776. results.splice( duplicates[ j ], 1 );
  10777. }
  10778. }
  10779. // Clear input after sorting to release objects
  10780. // See https://github.com/jquery/sizzle/pull/225
  10781. sortInput = null;
  10782. return results;
  10783. };
  10784. /**
  10785. * Utility function for retrieving the text value of an array of DOM nodes
  10786. * @param {Array|Element} elem
  10787. */
  10788. getText = Sizzle.getText = function( elem ) {
  10789. var node,
  10790. ret = "",
  10791. i = 0,
  10792. nodeType = elem.nodeType;
  10793. if ( !nodeType ) {
  10794. // If no nodeType, this is expected to be an array
  10795. while ( (node = elem[i++]) ) {
  10796. // Do not traverse comment nodes
  10797. ret += getText( node );
  10798. }
  10799. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  10800. // Use textContent for elements
  10801. // innerText usage removed for consistency of new lines (jQuery #11153)
  10802. if ( typeof elem.textContent === "string" ) {
  10803. return elem.textContent;
  10804. } else {
  10805. // Traverse its children
  10806. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  10807. ret += getText( elem );
  10808. }
  10809. }
  10810. } else if ( nodeType === 3 || nodeType === 4 ) {
  10811. return elem.nodeValue;
  10812. }
  10813. // Do not include comment or processing instruction nodes
  10814. return ret;
  10815. };
  10816. Expr = Sizzle.selectors = {
  10817. // Can be adjusted by the user
  10818. cacheLength: 50,
  10819. createPseudo: markFunction,
  10820. match: matchExpr,
  10821. attrHandle: {},
  10822. find: {},
  10823. relative: {
  10824. ">": { dir: "parentNode", first: true },
  10825. " ": { dir: "parentNode" },
  10826. "+": { dir: "previousSibling", first: true },
  10827. "~": { dir: "previousSibling" }
  10828. },
  10829. preFilter: {
  10830. "ATTR": function( match ) {
  10831. match[1] = match[1].replace( runescape, funescape );
  10832. // Move the given value to match[3] whether quoted or unquoted
  10833. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  10834. if ( match[2] === "~=" ) {
  10835. match[3] = " " + match[3] + " ";
  10836. }
  10837. return match.slice( 0, 4 );
  10838. },
  10839. "CHILD": function( match ) {
  10840. /* matches from matchExpr["CHILD"]
  10841. 1 type (only|nth|...)
  10842. 2 what (child|of-type)
  10843. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  10844. 4 xn-component of xn+y argument ([+-]?\d*n|)
  10845. 5 sign of xn-component
  10846. 6 x of xn-component
  10847. 7 sign of y-component
  10848. 8 y of y-component
  10849. */
  10850. match[1] = match[1].toLowerCase();
  10851. if ( match[1].slice( 0, 3 ) === "nth" ) {
  10852. // nth-* requires argument
  10853. if ( !match[3] ) {
  10854. Sizzle.error( match[0] );
  10855. }
  10856. // numeric x and y parameters for Expr.filter.CHILD
  10857. // remember that false/true cast respectively to 0/1
  10858. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  10859. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  10860. // other types prohibit arguments
  10861. } else if ( match[3] ) {
  10862. Sizzle.error( match[0] );
  10863. }
  10864. return match;
  10865. },
  10866. "PSEUDO": function( match ) {
  10867. var excess,
  10868. unquoted = !match[6] && match[2];
  10869. if ( matchExpr["CHILD"].test( match[0] ) ) {
  10870. return null;
  10871. }
  10872. // Accept quoted arguments as-is
  10873. if ( match[3] ) {
  10874. match[2] = match[4] || match[5] || "";
  10875. // Strip excess characters from unquoted arguments
  10876. } else if ( unquoted && rpseudo.test( unquoted ) &&
  10877. // Get excess from tokenize (recursively)
  10878. (excess = tokenize( unquoted, true )) &&
  10879. // advance to the next closing parenthesis
  10880. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  10881. // excess is a negative index
  10882. match[0] = match[0].slice( 0, excess );
  10883. match[2] = unquoted.slice( 0, excess );
  10884. }
  10885. // Return only captures needed by the pseudo filter method (type and argument)
  10886. return match.slice( 0, 3 );
  10887. }
  10888. },
  10889. filter: {
  10890. "TAG": function( nodeNameSelector ) {
  10891. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  10892. return nodeNameSelector === "*" ?
  10893. function() { return true; } :
  10894. function( elem ) {
  10895. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  10896. };
  10897. },
  10898. "CLASS": function( className ) {
  10899. var pattern = classCache[ className + " " ];
  10900. return pattern ||
  10901. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  10902. classCache( className, function( elem ) {
  10903. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  10904. });
  10905. },
  10906. "ATTR": function( name, operator, check ) {
  10907. return function( elem ) {
  10908. var result = Sizzle.attr( elem, name );
  10909. if ( result == null ) {
  10910. return operator === "!=";
  10911. }
  10912. if ( !operator ) {
  10913. return true;
  10914. }
  10915. result += "";
  10916. return operator === "=" ? result === check :
  10917. operator === "!=" ? result !== check :
  10918. operator === "^=" ? check && result.indexOf( check ) === 0 :
  10919. operator === "*=" ? check && result.indexOf( check ) > -1 :
  10920. operator === "$=" ? check && result.slice( -check.length ) === check :
  10921. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  10922. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  10923. false;
  10924. };
  10925. },
  10926. "CHILD": function( type, what, argument, first, last ) {
  10927. var simple = type.slice( 0, 3 ) !== "nth",
  10928. forward = type.slice( -4 ) !== "last",
  10929. ofType = what === "of-type";
  10930. return first === 1 && last === 0 ?
  10931. // Shortcut for :nth-*(n)
  10932. function( elem ) {
  10933. return !!elem.parentNode;
  10934. } :
  10935. function( elem, context, xml ) {
  10936. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  10937. dir = simple !== forward ? "nextSibling" : "previousSibling",
  10938. parent = elem.parentNode,
  10939. name = ofType && elem.nodeName.toLowerCase(),
  10940. useCache = !xml && !ofType,
  10941. diff = false;
  10942. if ( parent ) {
  10943. // :(first|last|only)-(child|of-type)
  10944. if ( simple ) {
  10945. while ( dir ) {
  10946. node = elem;
  10947. while ( (node = node[ dir ]) ) {
  10948. if ( ofType ?
  10949. node.nodeName.toLowerCase() === name :
  10950. node.nodeType === 1 ) {
  10951. return false;
  10952. }
  10953. }
  10954. // Reverse direction for :only-* (if we haven't yet done so)
  10955. start = dir = type === "only" && !start && "nextSibling";
  10956. }
  10957. return true;
  10958. }
  10959. start = [ forward ? parent.firstChild : parent.lastChild ];
  10960. // non-xml :nth-child(...) stores cache data on `parent`
  10961. if ( forward && useCache ) {
  10962. // Seek `elem` from a previously-cached index
  10963. // ...in a gzip-friendly way
  10964. node = parent;
  10965. outerCache = node[ expando ] || (node[ expando ] = {});
  10966. // Support: IE <9 only
  10967. // Defend against cloned attroperties (jQuery gh-1709)
  10968. uniqueCache = outerCache[ node.uniqueID ] ||
  10969. (outerCache[ node.uniqueID ] = {});
  10970. cache = uniqueCache[ type ] || [];
  10971. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10972. diff = nodeIndex && cache[ 2 ];
  10973. node = nodeIndex && parent.childNodes[ nodeIndex ];
  10974. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10975. // Fallback to seeking `elem` from the start
  10976. (diff = nodeIndex = 0) || start.pop()) ) {
  10977. // When found, cache indexes on `parent` and break
  10978. if ( node.nodeType === 1 && ++diff && node === elem ) {
  10979. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  10980. break;
  10981. }
  10982. }
  10983. } else {
  10984. // Use previously-cached element index if available
  10985. if ( useCache ) {
  10986. // ...in a gzip-friendly way
  10987. node = elem;
  10988. outerCache = node[ expando ] || (node[ expando ] = {});
  10989. // Support: IE <9 only
  10990. // Defend against cloned attroperties (jQuery gh-1709)
  10991. uniqueCache = outerCache[ node.uniqueID ] ||
  10992. (outerCache[ node.uniqueID ] = {});
  10993. cache = uniqueCache[ type ] || [];
  10994. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10995. diff = nodeIndex;
  10996. }
  10997. // xml :nth-child(...)
  10998. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  10999. if ( diff === false ) {
  11000. // Use the same loop as above to seek `elem` from the start
  11001. while ( (node = ++nodeIndex && node && node[ dir ] ||
  11002. (diff = nodeIndex = 0) || start.pop()) ) {
  11003. if ( ( ofType ?
  11004. node.nodeName.toLowerCase() === name :
  11005. node.nodeType === 1 ) &&
  11006. ++diff ) {
  11007. // Cache the index of each encountered element
  11008. if ( useCache ) {
  11009. outerCache = node[ expando ] || (node[ expando ] = {});
  11010. // Support: IE <9 only
  11011. // Defend against cloned attroperties (jQuery gh-1709)
  11012. uniqueCache = outerCache[ node.uniqueID ] ||
  11013. (outerCache[ node.uniqueID ] = {});
  11014. uniqueCache[ type ] = [ dirruns, diff ];
  11015. }
  11016. if ( node === elem ) {
  11017. break;
  11018. }
  11019. }
  11020. }
  11021. }
  11022. }
  11023. // Incorporate the offset, then check against cycle size
  11024. diff -= last;
  11025. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  11026. }
  11027. };
  11028. },
  11029. "PSEUDO": function( pseudo, argument ) {
  11030. // pseudo-class names are case-insensitive
  11031. // http://www.w3.org/TR/selectors/#pseudo-classes
  11032. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  11033. // Remember that setFilters inherits from pseudos
  11034. var args,
  11035. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  11036. Sizzle.error( "unsupported pseudo: " + pseudo );
  11037. // The user may use createPseudo to indicate that
  11038. // arguments are needed to create the filter function
  11039. // just as Sizzle does
  11040. if ( fn[ expando ] ) {
  11041. return fn( argument );
  11042. }
  11043. // But maintain support for old signatures
  11044. if ( fn.length > 1 ) {
  11045. args = [ pseudo, pseudo, "", argument ];
  11046. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  11047. markFunction(function( seed, matches ) {
  11048. var idx,
  11049. matched = fn( seed, argument ),
  11050. i = matched.length;
  11051. while ( i-- ) {
  11052. idx = indexOf( seed, matched[i] );
  11053. seed[ idx ] = !( matches[ idx ] = matched[i] );
  11054. }
  11055. }) :
  11056. function( elem ) {
  11057. return fn( elem, 0, args );
  11058. };
  11059. }
  11060. return fn;
  11061. }
  11062. },
  11063. pseudos: {
  11064. // Potentially complex pseudos
  11065. "not": markFunction(function( selector ) {
  11066. // Trim the selector passed to compile
  11067. // to avoid treating leading and trailing
  11068. // spaces as combinators
  11069. var input = [],
  11070. results = [],
  11071. matcher = compile( selector.replace( rtrim, "$1" ) );
  11072. return matcher[ expando ] ?
  11073. markFunction(function( seed, matches, context, xml ) {
  11074. var elem,
  11075. unmatched = matcher( seed, null, xml, [] ),
  11076. i = seed.length;
  11077. // Match elements unmatched by `matcher`
  11078. while ( i-- ) {
  11079. if ( (elem = unmatched[i]) ) {
  11080. seed[i] = !(matches[i] = elem);
  11081. }
  11082. }
  11083. }) :
  11084. function( elem, context, xml ) {
  11085. input[0] = elem;
  11086. matcher( input, null, xml, results );
  11087. // Don't keep the element (issue #299)
  11088. input[0] = null;
  11089. return !results.pop();
  11090. };
  11091. }),
  11092. "has": markFunction(function( selector ) {
  11093. return function( elem ) {
  11094. return Sizzle( selector, elem ).length > 0;
  11095. };
  11096. }),
  11097. "contains": markFunction(function( text ) {
  11098. text = text.replace( runescape, funescape );
  11099. return function( elem ) {
  11100. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  11101. };
  11102. }),
  11103. // "Whether an element is represented by a :lang() selector
  11104. // is based solely on the element's language value
  11105. // being equal to the identifier C,
  11106. // or beginning with the identifier C immediately followed by "-".
  11107. // The matching of C against the element's language value is performed case-insensitively.
  11108. // The identifier C does not have to be a valid language name."
  11109. // http://www.w3.org/TR/selectors/#lang-pseudo
  11110. "lang": markFunction( function( lang ) {
  11111. // lang value must be a valid identifier
  11112. if ( !ridentifier.test(lang || "") ) {
  11113. Sizzle.error( "unsupported lang: " + lang );
  11114. }
  11115. lang = lang.replace( runescape, funescape ).toLowerCase();
  11116. return function( elem ) {
  11117. var elemLang;
  11118. do {
  11119. if ( (elemLang = documentIsHTML ?
  11120. elem.lang :
  11121. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  11122. elemLang = elemLang.toLowerCase();
  11123. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  11124. }
  11125. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  11126. return false;
  11127. };
  11128. }),
  11129. // Miscellaneous
  11130. "target": function( elem ) {
  11131. var hash = window.location && window.location.hash;
  11132. return hash && hash.slice( 1 ) === elem.id;
  11133. },
  11134. "root": function( elem ) {
  11135. return elem === docElem;
  11136. },
  11137. "focus": function( elem ) {
  11138. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  11139. },
  11140. // Boolean properties
  11141. "enabled": createDisabledPseudo( false ),
  11142. "disabled": createDisabledPseudo( true ),
  11143. "checked": function( elem ) {
  11144. // In CSS3, :checked should return both checked and selected elements
  11145. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  11146. var nodeName = elem.nodeName.toLowerCase();
  11147. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  11148. },
  11149. "selected": function( elem ) {
  11150. // Accessing this property makes selected-by-default
  11151. // options in Safari work properly
  11152. if ( elem.parentNode ) {
  11153. elem.parentNode.selectedIndex;
  11154. }
  11155. return elem.selected === true;
  11156. },
  11157. // Contents
  11158. "empty": function( elem ) {
  11159. // http://www.w3.org/TR/selectors/#empty-pseudo
  11160. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  11161. // but not by others (comment: 8; processing instruction: 7; etc.)
  11162. // nodeType < 6 works because attributes (2) do not appear as children
  11163. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  11164. if ( elem.nodeType < 6 ) {
  11165. return false;
  11166. }
  11167. }
  11168. return true;
  11169. },
  11170. "parent": function( elem ) {
  11171. return !Expr.pseudos["empty"]( elem );
  11172. },
  11173. // Element/input types
  11174. "header": function( elem ) {
  11175. return rheader.test( elem.nodeName );
  11176. },
  11177. "input": function( elem ) {
  11178. return rinputs.test( elem.nodeName );
  11179. },
  11180. "button": function( elem ) {
  11181. var name = elem.nodeName.toLowerCase();
  11182. return name === "input" && elem.type === "button" || name === "button";
  11183. },
  11184. "text": function( elem ) {
  11185. var attr;
  11186. return elem.nodeName.toLowerCase() === "input" &&
  11187. elem.type === "text" &&
  11188. // Support: IE<8
  11189. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  11190. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  11191. },
  11192. // Position-in-collection
  11193. "first": createPositionalPseudo(function() {
  11194. return [ 0 ];
  11195. }),
  11196. "last": createPositionalPseudo(function( matchIndexes, length ) {
  11197. return [ length - 1 ];
  11198. }),
  11199. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  11200. return [ argument < 0 ? argument + length : argument ];
  11201. }),
  11202. "even": createPositionalPseudo(function( matchIndexes, length ) {
  11203. var i = 0;
  11204. for ( ; i < length; i += 2 ) {
  11205. matchIndexes.push( i );
  11206. }
  11207. return matchIndexes;
  11208. }),
  11209. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  11210. var i = 1;
  11211. for ( ; i < length; i += 2 ) {
  11212. matchIndexes.push( i );
  11213. }
  11214. return matchIndexes;
  11215. }),
  11216. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  11217. var i = argument < 0 ?
  11218. argument + length :
  11219. argument > length ?
  11220. length :
  11221. argument;
  11222. for ( ; --i >= 0; ) {
  11223. matchIndexes.push( i );
  11224. }
  11225. return matchIndexes;
  11226. }),
  11227. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  11228. var i = argument < 0 ? argument + length : argument;
  11229. for ( ; ++i < length; ) {
  11230. matchIndexes.push( i );
  11231. }
  11232. return matchIndexes;
  11233. })
  11234. }
  11235. };
  11236. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  11237. // Add button/input type pseudos
  11238. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  11239. Expr.pseudos[ i ] = createInputPseudo( i );
  11240. }
  11241. for ( i in { submit: true, reset: true } ) {
  11242. Expr.pseudos[ i ] = createButtonPseudo( i );
  11243. }
  11244. // Easy API for creating new setFilters
  11245. function setFilters() {}
  11246. setFilters.prototype = Expr.filters = Expr.pseudos;
  11247. Expr.setFilters = new setFilters();
  11248. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  11249. var matched, match, tokens, type,
  11250. soFar, groups, preFilters,
  11251. cached = tokenCache[ selector + " " ];
  11252. if ( cached ) {
  11253. return parseOnly ? 0 : cached.slice( 0 );
  11254. }
  11255. soFar = selector;
  11256. groups = [];
  11257. preFilters = Expr.preFilter;
  11258. while ( soFar ) {
  11259. // Comma and first run
  11260. if ( !matched || (match = rcomma.exec( soFar )) ) {
  11261. if ( match ) {
  11262. // Don't consume trailing commas as valid
  11263. soFar = soFar.slice( match[0].length ) || soFar;
  11264. }
  11265. groups.push( (tokens = []) );
  11266. }
  11267. matched = false;
  11268. // Combinators
  11269. if ( (match = rcombinators.exec( soFar )) ) {
  11270. matched = match.shift();
  11271. tokens.push({
  11272. value: matched,
  11273. // Cast descendant combinators to space
  11274. type: match[0].replace( rtrim, " " )
  11275. });
  11276. soFar = soFar.slice( matched.length );
  11277. }
  11278. // Filters
  11279. for ( type in Expr.filter ) {
  11280. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  11281. (match = preFilters[ type ]( match ))) ) {
  11282. matched = match.shift();
  11283. tokens.push({
  11284. value: matched,
  11285. type: type,
  11286. matches: match
  11287. });
  11288. soFar = soFar.slice( matched.length );
  11289. }
  11290. }
  11291. if ( !matched ) {
  11292. break;
  11293. }
  11294. }
  11295. // Return the length of the invalid excess
  11296. // if we're just parsing
  11297. // Otherwise, throw an error or return tokens
  11298. return parseOnly ?
  11299. soFar.length :
  11300. soFar ?
  11301. Sizzle.error( selector ) :
  11302. // Cache the tokens
  11303. tokenCache( selector, groups ).slice( 0 );
  11304. };
  11305. function toSelector( tokens ) {
  11306. var i = 0,
  11307. len = tokens.length,
  11308. selector = "";
  11309. for ( ; i < len; i++ ) {
  11310. selector += tokens[i].value;
  11311. }
  11312. return selector;
  11313. }
  11314. function addCombinator( matcher, combinator, base ) {
  11315. var dir = combinator.dir,
  11316. skip = combinator.next,
  11317. key = skip || dir,
  11318. checkNonElements = base && key === "parentNode",
  11319. doneName = done++;
  11320. return combinator.first ?
  11321. // Check against closest ancestor/preceding element
  11322. function( elem, context, xml ) {
  11323. while ( (elem = elem[ dir ]) ) {
  11324. if ( elem.nodeType === 1 || checkNonElements ) {
  11325. return matcher( elem, context, xml );
  11326. }
  11327. }
  11328. return false;
  11329. } :
  11330. // Check against all ancestor/preceding elements
  11331. function( elem, context, xml ) {
  11332. var oldCache, uniqueCache, outerCache,
  11333. newCache = [ dirruns, doneName ];
  11334. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  11335. if ( xml ) {
  11336. while ( (elem = elem[ dir ]) ) {
  11337. if ( elem.nodeType === 1 || checkNonElements ) {
  11338. if ( matcher( elem, context, xml ) ) {
  11339. return true;
  11340. }
  11341. }
  11342. }
  11343. } else {
  11344. while ( (elem = elem[ dir ]) ) {
  11345. if ( elem.nodeType === 1 || checkNonElements ) {
  11346. outerCache = elem[ expando ] || (elem[ expando ] = {});
  11347. // Support: IE <9 only
  11348. // Defend against cloned attroperties (jQuery gh-1709)
  11349. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  11350. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  11351. elem = elem[ dir ] || elem;
  11352. } else if ( (oldCache = uniqueCache[ key ]) &&
  11353. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  11354. // Assign to newCache so results back-propagate to previous elements
  11355. return (newCache[ 2 ] = oldCache[ 2 ]);
  11356. } else {
  11357. // Reuse newcache so results back-propagate to previous elements
  11358. uniqueCache[ key ] = newCache;
  11359. // A match means we're done; a fail means we have to keep checking
  11360. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  11361. return true;
  11362. }
  11363. }
  11364. }
  11365. }
  11366. }
  11367. return false;
  11368. };
  11369. }
  11370. function elementMatcher( matchers ) {
  11371. return matchers.length > 1 ?
  11372. function( elem, context, xml ) {
  11373. var i = matchers.length;
  11374. while ( i-- ) {
  11375. if ( !matchers[i]( elem, context, xml ) ) {
  11376. return false;
  11377. }
  11378. }
  11379. return true;
  11380. } :
  11381. matchers[0];
  11382. }
  11383. function multipleContexts( selector, contexts, results ) {
  11384. var i = 0,
  11385. len = contexts.length;
  11386. for ( ; i < len; i++ ) {
  11387. Sizzle( selector, contexts[i], results );
  11388. }
  11389. return results;
  11390. }
  11391. function condense( unmatched, map, filter, context, xml ) {
  11392. var elem,
  11393. newUnmatched = [],
  11394. i = 0,
  11395. len = unmatched.length,
  11396. mapped = map != null;
  11397. for ( ; i < len; i++ ) {
  11398. if ( (elem = unmatched[i]) ) {
  11399. if ( !filter || filter( elem, context, xml ) ) {
  11400. newUnmatched.push( elem );
  11401. if ( mapped ) {
  11402. map.push( i );
  11403. }
  11404. }
  11405. }
  11406. }
  11407. return newUnmatched;
  11408. }
  11409. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  11410. if ( postFilter && !postFilter[ expando ] ) {
  11411. postFilter = setMatcher( postFilter );
  11412. }
  11413. if ( postFinder && !postFinder[ expando ] ) {
  11414. postFinder = setMatcher( postFinder, postSelector );
  11415. }
  11416. return markFunction(function( seed, results, context, xml ) {
  11417. var temp, i, elem,
  11418. preMap = [],
  11419. postMap = [],
  11420. preexisting = results.length,
  11421. // Get initial elements from seed or context
  11422. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  11423. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  11424. matcherIn = preFilter && ( seed || !selector ) ?
  11425. condense( elems, preMap, preFilter, context, xml ) :
  11426. elems,
  11427. matcherOut = matcher ?
  11428. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  11429. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  11430. // ...intermediate processing is necessary
  11431. [] :
  11432. // ...otherwise use results directly
  11433. results :
  11434. matcherIn;
  11435. // Find primary matches
  11436. if ( matcher ) {
  11437. matcher( matcherIn, matcherOut, context, xml );
  11438. }
  11439. // Apply postFilter
  11440. if ( postFilter ) {
  11441. temp = condense( matcherOut, postMap );
  11442. postFilter( temp, [], context, xml );
  11443. // Un-match failing elements by moving them back to matcherIn
  11444. i = temp.length;
  11445. while ( i-- ) {
  11446. if ( (elem = temp[i]) ) {
  11447. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  11448. }
  11449. }
  11450. }
  11451. if ( seed ) {
  11452. if ( postFinder || preFilter ) {
  11453. if ( postFinder ) {
  11454. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  11455. temp = [];
  11456. i = matcherOut.length;
  11457. while ( i-- ) {
  11458. if ( (elem = matcherOut[i]) ) {
  11459. // Restore matcherIn since elem is not yet a final match
  11460. temp.push( (matcherIn[i] = elem) );
  11461. }
  11462. }
  11463. postFinder( null, (matcherOut = []), temp, xml );
  11464. }
  11465. // Move matched elements from seed to results to keep them synchronized
  11466. i = matcherOut.length;
  11467. while ( i-- ) {
  11468. if ( (elem = matcherOut[i]) &&
  11469. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  11470. seed[temp] = !(results[temp] = elem);
  11471. }
  11472. }
  11473. }
  11474. // Add elements to results, through postFinder if defined
  11475. } else {
  11476. matcherOut = condense(
  11477. matcherOut === results ?
  11478. matcherOut.splice( preexisting, matcherOut.length ) :
  11479. matcherOut
  11480. );
  11481. if ( postFinder ) {
  11482. postFinder( null, results, matcherOut, xml );
  11483. } else {
  11484. push.apply( results, matcherOut );
  11485. }
  11486. }
  11487. });
  11488. }
  11489. function matcherFromTokens( tokens ) {
  11490. var checkContext, matcher, j,
  11491. len = tokens.length,
  11492. leadingRelative = Expr.relative[ tokens[0].type ],
  11493. implicitRelative = leadingRelative || Expr.relative[" "],
  11494. i = leadingRelative ? 1 : 0,
  11495. // The foundational matcher ensures that elements are reachable from top-level context(s)
  11496. matchContext = addCombinator( function( elem ) {
  11497. return elem === checkContext;
  11498. }, implicitRelative, true ),
  11499. matchAnyContext = addCombinator( function( elem ) {
  11500. return indexOf( checkContext, elem ) > -1;
  11501. }, implicitRelative, true ),
  11502. matchers = [ function( elem, context, xml ) {
  11503. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  11504. (checkContext = context).nodeType ?
  11505. matchContext( elem, context, xml ) :
  11506. matchAnyContext( elem, context, xml ) );
  11507. // Avoid hanging onto element (issue #299)
  11508. checkContext = null;
  11509. return ret;
  11510. } ];
  11511. for ( ; i < len; i++ ) {
  11512. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  11513. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  11514. } else {
  11515. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  11516. // Return special upon seeing a positional matcher
  11517. if ( matcher[ expando ] ) {
  11518. // Find the next relative operator (if any) for proper handling
  11519. j = ++i;
  11520. for ( ; j < len; j++ ) {
  11521. if ( Expr.relative[ tokens[j].type ] ) {
  11522. break;
  11523. }
  11524. }
  11525. return setMatcher(
  11526. i > 1 && elementMatcher( matchers ),
  11527. i > 1 && toSelector(
  11528. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  11529. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  11530. ).replace( rtrim, "$1" ),
  11531. matcher,
  11532. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  11533. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  11534. j < len && toSelector( tokens )
  11535. );
  11536. }
  11537. matchers.push( matcher );
  11538. }
  11539. }
  11540. return elementMatcher( matchers );
  11541. }
  11542. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  11543. var bySet = setMatchers.length > 0,
  11544. byElement = elementMatchers.length > 0,
  11545. superMatcher = function( seed, context, xml, results, outermost ) {
  11546. var elem, j, matcher,
  11547. matchedCount = 0,
  11548. i = "0",
  11549. unmatched = seed && [],
  11550. setMatched = [],
  11551. contextBackup = outermostContext,
  11552. // We must always have either seed elements or outermost context
  11553. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  11554. // Use integer dirruns iff this is the outermost matcher
  11555. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  11556. len = elems.length;
  11557. if ( outermost ) {
  11558. outermostContext = context === document || context || outermost;
  11559. }
  11560. // Add elements passing elementMatchers directly to results
  11561. // Support: IE<9, Safari
  11562. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  11563. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  11564. if ( byElement && elem ) {
  11565. j = 0;
  11566. if ( !context && elem.ownerDocument !== document ) {
  11567. setDocument( elem );
  11568. xml = !documentIsHTML;
  11569. }
  11570. while ( (matcher = elementMatchers[j++]) ) {
  11571. if ( matcher( elem, context || document, xml) ) {
  11572. results.push( elem );
  11573. break;
  11574. }
  11575. }
  11576. if ( outermost ) {
  11577. dirruns = dirrunsUnique;
  11578. }
  11579. }
  11580. // Track unmatched elements for set filters
  11581. if ( bySet ) {
  11582. // They will have gone through all possible matchers
  11583. if ( (elem = !matcher && elem) ) {
  11584. matchedCount--;
  11585. }
  11586. // Lengthen the array for every element, matched or not
  11587. if ( seed ) {
  11588. unmatched.push( elem );
  11589. }
  11590. }
  11591. }
  11592. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  11593. // makes the latter nonnegative.
  11594. matchedCount += i;
  11595. // Apply set filters to unmatched elements
  11596. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  11597. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  11598. // no element matchers and no seed.
  11599. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  11600. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  11601. // numerically zero.
  11602. if ( bySet && i !== matchedCount ) {
  11603. j = 0;
  11604. while ( (matcher = setMatchers[j++]) ) {
  11605. matcher( unmatched, setMatched, context, xml );
  11606. }
  11607. if ( seed ) {
  11608. // Reintegrate element matches to eliminate the need for sorting
  11609. if ( matchedCount > 0 ) {
  11610. while ( i-- ) {
  11611. if ( !(unmatched[i] || setMatched[i]) ) {
  11612. setMatched[i] = pop.call( results );
  11613. }
  11614. }
  11615. }
  11616. // Discard index placeholder values to get only actual matches
  11617. setMatched = condense( setMatched );
  11618. }
  11619. // Add matches to results
  11620. push.apply( results, setMatched );
  11621. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  11622. if ( outermost && !seed && setMatched.length > 0 &&
  11623. ( matchedCount + setMatchers.length ) > 1 ) {
  11624. Sizzle.uniqueSort( results );
  11625. }
  11626. }
  11627. // Override manipulation of globals by nested matchers
  11628. if ( outermost ) {
  11629. dirruns = dirrunsUnique;
  11630. outermostContext = contextBackup;
  11631. }
  11632. return unmatched;
  11633. };
  11634. return bySet ?
  11635. markFunction( superMatcher ) :
  11636. superMatcher;
  11637. }
  11638. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  11639. var i,
  11640. setMatchers = [],
  11641. elementMatchers = [],
  11642. cached = compilerCache[ selector + " " ];
  11643. if ( !cached ) {
  11644. // Generate a function of recursive functions that can be used to check each element
  11645. if ( !match ) {
  11646. match = tokenize( selector );
  11647. }
  11648. i = match.length;
  11649. while ( i-- ) {
  11650. cached = matcherFromTokens( match[i] );
  11651. if ( cached[ expando ] ) {
  11652. setMatchers.push( cached );
  11653. } else {
  11654. elementMatchers.push( cached );
  11655. }
  11656. }
  11657. // Cache the compiled function
  11658. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  11659. // Save selector and tokenization
  11660. cached.selector = selector;
  11661. }
  11662. return cached;
  11663. };
  11664. /**
  11665. * A low-level selection function that works with Sizzle's compiled
  11666. * selector functions
  11667. * @param {String|Function} selector A selector or a pre-compiled
  11668. * selector function built with Sizzle.compile
  11669. * @param {Element} context
  11670. * @param {Array} [results]
  11671. * @param {Array} [seed] A set of elements to match against
  11672. */
  11673. select = Sizzle.select = function( selector, context, results, seed ) {
  11674. var i, tokens, token, type, find,
  11675. compiled = typeof selector === "function" && selector,
  11676. match = !seed && tokenize( (selector = compiled.selector || selector) );
  11677. results = results || [];
  11678. // Try to minimize operations if there is only one selector in the list and no seed
  11679. // (the latter of which guarantees us context)
  11680. if ( match.length === 1 ) {
  11681. // Reduce context if the leading compound selector is an ID
  11682. tokens = match[0] = match[0].slice( 0 );
  11683. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  11684. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  11685. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  11686. if ( !context ) {
  11687. return results;
  11688. // Precompiled matchers will still verify ancestry, so step up a level
  11689. } else if ( compiled ) {
  11690. context = context.parentNode;
  11691. }
  11692. selector = selector.slice( tokens.shift().value.length );
  11693. }
  11694. // Fetch a seed set for right-to-left matching
  11695. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  11696. while ( i-- ) {
  11697. token = tokens[i];
  11698. // Abort if we hit a combinator
  11699. if ( Expr.relative[ (type = token.type) ] ) {
  11700. break;
  11701. }
  11702. if ( (find = Expr.find[ type ]) ) {
  11703. // Search, expanding context for leading sibling combinators
  11704. if ( (seed = find(
  11705. token.matches[0].replace( runescape, funescape ),
  11706. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  11707. )) ) {
  11708. // If seed is empty or no tokens remain, we can return early
  11709. tokens.splice( i, 1 );
  11710. selector = seed.length && toSelector( tokens );
  11711. if ( !selector ) {
  11712. push.apply( results, seed );
  11713. return results;
  11714. }
  11715. break;
  11716. }
  11717. }
  11718. }
  11719. }
  11720. // Compile and execute a filtering function if one is not provided
  11721. // Provide `match` to avoid retokenization if we modified the selector above
  11722. ( compiled || compile( selector, match ) )(
  11723. seed,
  11724. context,
  11725. !documentIsHTML,
  11726. results,
  11727. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  11728. );
  11729. return results;
  11730. };
  11731. // One-time assignments
  11732. // Sort stability
  11733. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  11734. // Support: Chrome 14-35+
  11735. // Always assume duplicates if they aren't passed to the comparison function
  11736. support.detectDuplicates = !!hasDuplicate;
  11737. // Initialize against the default document
  11738. setDocument();
  11739. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  11740. // Detached nodes confoundingly follow *each other*
  11741. support.sortDetached = assert(function( el ) {
  11742. // Should return 1, but returns 4 (following)
  11743. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  11744. });
  11745. // Support: IE<8
  11746. // Prevent attribute/property "interpolation"
  11747. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  11748. if ( !assert(function( el ) {
  11749. el.innerHTML = "<a href='#'></a>";
  11750. return el.firstChild.getAttribute("href") === "#" ;
  11751. }) ) {
  11752. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  11753. if ( !isXML ) {
  11754. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  11755. }
  11756. });
  11757. }
  11758. // Support: IE<9
  11759. // Use defaultValue in place of getAttribute("value")
  11760. if ( !support.attributes || !assert(function( el ) {
  11761. el.innerHTML = "<input/>";
  11762. el.firstChild.setAttribute( "value", "" );
  11763. return el.firstChild.getAttribute( "value" ) === "";
  11764. }) ) {
  11765. addHandle( "value", function( elem, name, isXML ) {
  11766. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  11767. return elem.defaultValue;
  11768. }
  11769. });
  11770. }
  11771. // Support: IE<9
  11772. // Use getAttributeNode to fetch booleans when getAttribute lies
  11773. if ( !assert(function( el ) {
  11774. return el.getAttribute("disabled") == null;
  11775. }) ) {
  11776. addHandle( booleans, function( elem, name, isXML ) {
  11777. var val;
  11778. if ( !isXML ) {
  11779. return elem[ name ] === true ? name.toLowerCase() :
  11780. (val = elem.getAttributeNode( name )) && val.specified ?
  11781. val.value :
  11782. null;
  11783. }
  11784. });
  11785. }
  11786. return Sizzle;
  11787. })( window );
  11788. jQuery.find = Sizzle;
  11789. jQuery.expr = Sizzle.selectors;
  11790. // Deprecated
  11791. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  11792. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  11793. jQuery.text = Sizzle.getText;
  11794. jQuery.isXMLDoc = Sizzle.isXML;
  11795. jQuery.contains = Sizzle.contains;
  11796. jQuery.escapeSelector = Sizzle.escape;
  11797. var dir = function( elem, dir, until ) {
  11798. var matched = [],
  11799. truncate = until !== undefined;
  11800. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  11801. if ( elem.nodeType === 1 ) {
  11802. if ( truncate && jQuery( elem ).is( until ) ) {
  11803. break;
  11804. }
  11805. matched.push( elem );
  11806. }
  11807. }
  11808. return matched;
  11809. };
  11810. var siblings = function( n, elem ) {
  11811. var matched = [];
  11812. for ( ; n; n = n.nextSibling ) {
  11813. if ( n.nodeType === 1 && n !== elem ) {
  11814. matched.push( n );
  11815. }
  11816. }
  11817. return matched;
  11818. };
  11819. var rneedsContext = jQuery.expr.match.needsContext;
  11820. function nodeName( elem, name ) {
  11821. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  11822. };
  11823. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  11824. // Implement the identical functionality for filter and not
  11825. function winnow( elements, qualifier, not ) {
  11826. if ( isFunction( qualifier ) ) {
  11827. return jQuery.grep( elements, function( elem, i ) {
  11828. return !!qualifier.call( elem, i, elem ) !== not;
  11829. } );
  11830. }
  11831. // Single element
  11832. if ( qualifier.nodeType ) {
  11833. return jQuery.grep( elements, function( elem ) {
  11834. return ( elem === qualifier ) !== not;
  11835. } );
  11836. }
  11837. // Arraylike of elements (jQuery, arguments, Array)
  11838. if ( typeof qualifier !== "string" ) {
  11839. return jQuery.grep( elements, function( elem ) {
  11840. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  11841. } );
  11842. }
  11843. // Filtered directly for both simple and complex selectors
  11844. return jQuery.filter( qualifier, elements, not );
  11845. }
  11846. jQuery.filter = function( expr, elems, not ) {
  11847. var elem = elems[ 0 ];
  11848. if ( not ) {
  11849. expr = ":not(" + expr + ")";
  11850. }
  11851. if ( elems.length === 1 && elem.nodeType === 1 ) {
  11852. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  11853. }
  11854. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  11855. return elem.nodeType === 1;
  11856. } ) );
  11857. };
  11858. jQuery.fn.extend( {
  11859. find: function( selector ) {
  11860. var i, ret,
  11861. len = this.length,
  11862. self = this;
  11863. if ( typeof selector !== "string" ) {
  11864. return this.pushStack( jQuery( selector ).filter( function() {
  11865. for ( i = 0; i < len; i++ ) {
  11866. if ( jQuery.contains( self[ i ], this ) ) {
  11867. return true;
  11868. }
  11869. }
  11870. } ) );
  11871. }
  11872. ret = this.pushStack( [] );
  11873. for ( i = 0; i < len; i++ ) {
  11874. jQuery.find( selector, self[ i ], ret );
  11875. }
  11876. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  11877. },
  11878. filter: function( selector ) {
  11879. return this.pushStack( winnow( this, selector || [], false ) );
  11880. },
  11881. not: function( selector ) {
  11882. return this.pushStack( winnow( this, selector || [], true ) );
  11883. },
  11884. is: function( selector ) {
  11885. return !!winnow(
  11886. this,
  11887. // If this is a positional/relative selector, check membership in the returned set
  11888. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  11889. typeof selector === "string" && rneedsContext.test( selector ) ?
  11890. jQuery( selector ) :
  11891. selector || [],
  11892. false
  11893. ).length;
  11894. }
  11895. } );
  11896. // Initialize a jQuery object
  11897. // A central reference to the root jQuery(document)
  11898. var rootjQuery,
  11899. // A simple way to check for HTML strings
  11900. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  11901. // Strict HTML recognition (#11290: must start with <)
  11902. // Shortcut simple #id case for speed
  11903. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  11904. init = jQuery.fn.init = function( selector, context, root ) {
  11905. var match, elem;
  11906. // HANDLE: $(""), $(null), $(undefined), $(false)
  11907. if ( !selector ) {
  11908. return this;
  11909. }
  11910. // Method init() accepts an alternate rootjQuery
  11911. // so migrate can support jQuery.sub (gh-2101)
  11912. root = root || rootjQuery;
  11913. // Handle HTML strings
  11914. if ( typeof selector === "string" ) {
  11915. if ( selector[ 0 ] === "<" &&
  11916. selector[ selector.length - 1 ] === ">" &&
  11917. selector.length >= 3 ) {
  11918. // Assume that strings that start and end with <> are HTML and skip the regex check
  11919. match = [ null, selector, null ];
  11920. } else {
  11921. match = rquickExpr.exec( selector );
  11922. }
  11923. // Match html or make sure no context is specified for #id
  11924. if ( match && ( match[ 1 ] || !context ) ) {
  11925. // HANDLE: $(html) -> $(array)
  11926. if ( match[ 1 ] ) {
  11927. context = context instanceof jQuery ? context[ 0 ] : context;
  11928. // Option to run scripts is true for back-compat
  11929. // Intentionally let the error be thrown if parseHTML is not present
  11930. jQuery.merge( this, jQuery.parseHTML(
  11931. match[ 1 ],
  11932. context && context.nodeType ? context.ownerDocument || context : document,
  11933. true
  11934. ) );
  11935. // HANDLE: $(html, props)
  11936. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  11937. for ( match in context ) {
  11938. // Properties of context are called as methods if possible
  11939. if ( isFunction( this[ match ] ) ) {
  11940. this[ match ]( context[ match ] );
  11941. // ...and otherwise set as attributes
  11942. } else {
  11943. this.attr( match, context[ match ] );
  11944. }
  11945. }
  11946. }
  11947. return this;
  11948. // HANDLE: $(#id)
  11949. } else {
  11950. elem = document.getElementById( match[ 2 ] );
  11951. if ( elem ) {
  11952. // Inject the element directly into the jQuery object
  11953. this[ 0 ] = elem;
  11954. this.length = 1;
  11955. }
  11956. return this;
  11957. }
  11958. // HANDLE: $(expr, $(...))
  11959. } else if ( !context || context.jquery ) {
  11960. return ( context || root ).find( selector );
  11961. // HANDLE: $(expr, context)
  11962. // (which is just equivalent to: $(context).find(expr)
  11963. } else {
  11964. return this.constructor( context ).find( selector );
  11965. }
  11966. // HANDLE: $(DOMElement)
  11967. } else if ( selector.nodeType ) {
  11968. this[ 0 ] = selector;
  11969. this.length = 1;
  11970. return this;
  11971. // HANDLE: $(function)
  11972. // Shortcut for document ready
  11973. } else if ( isFunction( selector ) ) {
  11974. return root.ready !== undefined ?
  11975. root.ready( selector ) :
  11976. // Execute immediately if ready is not present
  11977. selector( jQuery );
  11978. }
  11979. return jQuery.makeArray( selector, this );
  11980. };
  11981. // Give the init function the jQuery prototype for later instantiation
  11982. init.prototype = jQuery.fn;
  11983. // Initialize central reference
  11984. rootjQuery = jQuery( document );
  11985. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  11986. // Methods guaranteed to produce a unique set when starting from a unique set
  11987. guaranteedUnique = {
  11988. children: true,
  11989. contents: true,
  11990. next: true,
  11991. prev: true
  11992. };
  11993. jQuery.fn.extend( {
  11994. has: function( target ) {
  11995. var targets = jQuery( target, this ),
  11996. l = targets.length;
  11997. return this.filter( function() {
  11998. var i = 0;
  11999. for ( ; i < l; i++ ) {
  12000. if ( jQuery.contains( this, targets[ i ] ) ) {
  12001. return true;
  12002. }
  12003. }
  12004. } );
  12005. },
  12006. closest: function( selectors, context ) {
  12007. var cur,
  12008. i = 0,
  12009. l = this.length,
  12010. matched = [],
  12011. targets = typeof selectors !== "string" && jQuery( selectors );
  12012. // Positional selectors never match, since there's no _selection_ context
  12013. if ( !rneedsContext.test( selectors ) ) {
  12014. for ( ; i < l; i++ ) {
  12015. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  12016. // Always skip document fragments
  12017. if ( cur.nodeType < 11 && ( targets ?
  12018. targets.index( cur ) > -1 :
  12019. // Don't pass non-elements to Sizzle
  12020. cur.nodeType === 1 &&
  12021. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  12022. matched.push( cur );
  12023. break;
  12024. }
  12025. }
  12026. }
  12027. }
  12028. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  12029. },
  12030. // Determine the position of an element within the set
  12031. index: function( elem ) {
  12032. // No argument, return index in parent
  12033. if ( !elem ) {
  12034. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  12035. }
  12036. // Index in selector
  12037. if ( typeof elem === "string" ) {
  12038. return indexOf.call( jQuery( elem ), this[ 0 ] );
  12039. }
  12040. // Locate the position of the desired element
  12041. return indexOf.call( this,
  12042. // If it receives a jQuery object, the first element is used
  12043. elem.jquery ? elem[ 0 ] : elem
  12044. );
  12045. },
  12046. add: function( selector, context ) {
  12047. return this.pushStack(
  12048. jQuery.uniqueSort(
  12049. jQuery.merge( this.get(), jQuery( selector, context ) )
  12050. )
  12051. );
  12052. },
  12053. addBack: function( selector ) {
  12054. return this.add( selector == null ?
  12055. this.prevObject : this.prevObject.filter( selector )
  12056. );
  12057. }
  12058. } );
  12059. function sibling( cur, dir ) {
  12060. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  12061. return cur;
  12062. }
  12063. jQuery.each( {
  12064. parent: function( elem ) {
  12065. var parent = elem.parentNode;
  12066. return parent && parent.nodeType !== 11 ? parent : null;
  12067. },
  12068. parents: function( elem ) {
  12069. return dir( elem, "parentNode" );
  12070. },
  12071. parentsUntil: function( elem, i, until ) {
  12072. return dir( elem, "parentNode", until );
  12073. },
  12074. next: function( elem ) {
  12075. return sibling( elem, "nextSibling" );
  12076. },
  12077. prev: function( elem ) {
  12078. return sibling( elem, "previousSibling" );
  12079. },
  12080. nextAll: function( elem ) {
  12081. return dir( elem, "nextSibling" );
  12082. },
  12083. prevAll: function( elem ) {
  12084. return dir( elem, "previousSibling" );
  12085. },
  12086. nextUntil: function( elem, i, until ) {
  12087. return dir( elem, "nextSibling", until );
  12088. },
  12089. prevUntil: function( elem, i, until ) {
  12090. return dir( elem, "previousSibling", until );
  12091. },
  12092. siblings: function( elem ) {
  12093. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  12094. },
  12095. children: function( elem ) {
  12096. return siblings( elem.firstChild );
  12097. },
  12098. contents: function( elem ) {
  12099. if ( typeof elem.contentDocument !== "undefined" ) {
  12100. return elem.contentDocument;
  12101. }
  12102. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  12103. // Treat the template element as a regular one in browsers that
  12104. // don't support it.
  12105. if ( nodeName( elem, "template" ) ) {
  12106. elem = elem.content || elem;
  12107. }
  12108. return jQuery.merge( [], elem.childNodes );
  12109. }
  12110. }, function( name, fn ) {
  12111. jQuery.fn[ name ] = function( until, selector ) {
  12112. var matched = jQuery.map( this, fn, until );
  12113. if ( name.slice( -5 ) !== "Until" ) {
  12114. selector = until;
  12115. }
  12116. if ( selector && typeof selector === "string" ) {
  12117. matched = jQuery.filter( selector, matched );
  12118. }
  12119. if ( this.length > 1 ) {
  12120. // Remove duplicates
  12121. if ( !guaranteedUnique[ name ] ) {
  12122. jQuery.uniqueSort( matched );
  12123. }
  12124. // Reverse order for parents* and prev-derivatives
  12125. if ( rparentsprev.test( name ) ) {
  12126. matched.reverse();
  12127. }
  12128. }
  12129. return this.pushStack( matched );
  12130. };
  12131. } );
  12132. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  12133. // Convert String-formatted options into Object-formatted ones
  12134. function createOptions( options ) {
  12135. var object = {};
  12136. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  12137. object[ flag ] = true;
  12138. } );
  12139. return object;
  12140. }
  12141. /*
  12142. * Create a callback list using the following parameters:
  12143. *
  12144. * options: an optional list of space-separated options that will change how
  12145. * the callback list behaves or a more traditional option object
  12146. *
  12147. * By default a callback list will act like an event callback list and can be
  12148. * "fired" multiple times.
  12149. *
  12150. * Possible options:
  12151. *
  12152. * once: will ensure the callback list can only be fired once (like a Deferred)
  12153. *
  12154. * memory: will keep track of previous values and will call any callback added
  12155. * after the list has been fired right away with the latest "memorized"
  12156. * values (like a Deferred)
  12157. *
  12158. * unique: will ensure a callback can only be added once (no duplicate in the list)
  12159. *
  12160. * stopOnFalse: interrupt callings when a callback returns false
  12161. *
  12162. */
  12163. jQuery.Callbacks = function( options ) {
  12164. // Convert options from String-formatted to Object-formatted if needed
  12165. // (we check in cache first)
  12166. options = typeof options === "string" ?
  12167. createOptions( options ) :
  12168. jQuery.extend( {}, options );
  12169. var // Flag to know if list is currently firing
  12170. firing,
  12171. // Last fire value for non-forgettable lists
  12172. memory,
  12173. // Flag to know if list was already fired
  12174. fired,
  12175. // Flag to prevent firing
  12176. locked,
  12177. // Actual callback list
  12178. list = [],
  12179. // Queue of execution data for repeatable lists
  12180. queue = [],
  12181. // Index of currently firing callback (modified by add/remove as needed)
  12182. firingIndex = -1,
  12183. // Fire callbacks
  12184. fire = function() {
  12185. // Enforce single-firing
  12186. locked = locked || options.once;
  12187. // Execute callbacks for all pending executions,
  12188. // respecting firingIndex overrides and runtime changes
  12189. fired = firing = true;
  12190. for ( ; queue.length; firingIndex = -1 ) {
  12191. memory = queue.shift();
  12192. while ( ++firingIndex < list.length ) {
  12193. // Run callback and check for early termination
  12194. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  12195. options.stopOnFalse ) {
  12196. // Jump to end and forget the data so .add doesn't re-fire
  12197. firingIndex = list.length;
  12198. memory = false;
  12199. }
  12200. }
  12201. }
  12202. // Forget the data if we're done with it
  12203. if ( !options.memory ) {
  12204. memory = false;
  12205. }
  12206. firing = false;
  12207. // Clean up if we're done firing for good
  12208. if ( locked ) {
  12209. // Keep an empty list if we have data for future add calls
  12210. if ( memory ) {
  12211. list = [];
  12212. // Otherwise, this object is spent
  12213. } else {
  12214. list = "";
  12215. }
  12216. }
  12217. },
  12218. // Actual Callbacks object
  12219. self = {
  12220. // Add a callback or a collection of callbacks to the list
  12221. add: function() {
  12222. if ( list ) {
  12223. // If we have memory from a past run, we should fire after adding
  12224. if ( memory && !firing ) {
  12225. firingIndex = list.length - 1;
  12226. queue.push( memory );
  12227. }
  12228. ( function add( args ) {
  12229. jQuery.each( args, function( _, arg ) {
  12230. if ( isFunction( arg ) ) {
  12231. if ( !options.unique || !self.has( arg ) ) {
  12232. list.push( arg );
  12233. }
  12234. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  12235. // Inspect recursively
  12236. add( arg );
  12237. }
  12238. } );
  12239. } )( arguments );
  12240. if ( memory && !firing ) {
  12241. fire();
  12242. }
  12243. }
  12244. return this;
  12245. },
  12246. // Remove a callback from the list
  12247. remove: function() {
  12248. jQuery.each( arguments, function( _, arg ) {
  12249. var index;
  12250. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  12251. list.splice( index, 1 );
  12252. // Handle firing indexes
  12253. if ( index <= firingIndex ) {
  12254. firingIndex--;
  12255. }
  12256. }
  12257. } );
  12258. return this;
  12259. },
  12260. // Check if a given callback is in the list.
  12261. // If no argument is given, return whether or not list has callbacks attached.
  12262. has: function( fn ) {
  12263. return fn ?
  12264. jQuery.inArray( fn, list ) > -1 :
  12265. list.length > 0;
  12266. },
  12267. // Remove all callbacks from the list
  12268. empty: function() {
  12269. if ( list ) {
  12270. list = [];
  12271. }
  12272. return this;
  12273. },
  12274. // Disable .fire and .add
  12275. // Abort any current/pending executions
  12276. // Clear all callbacks and values
  12277. disable: function() {
  12278. locked = queue = [];
  12279. list = memory = "";
  12280. return this;
  12281. },
  12282. disabled: function() {
  12283. return !list;
  12284. },
  12285. // Disable .fire
  12286. // Also disable .add unless we have memory (since it would have no effect)
  12287. // Abort any pending executions
  12288. lock: function() {
  12289. locked = queue = [];
  12290. if ( !memory && !firing ) {
  12291. list = memory = "";
  12292. }
  12293. return this;
  12294. },
  12295. locked: function() {
  12296. return !!locked;
  12297. },
  12298. // Call all callbacks with the given context and arguments
  12299. fireWith: function( context, args ) {
  12300. if ( !locked ) {
  12301. args = args || [];
  12302. args = [ context, args.slice ? args.slice() : args ];
  12303. queue.push( args );
  12304. if ( !firing ) {
  12305. fire();
  12306. }
  12307. }
  12308. return this;
  12309. },
  12310. // Call all the callbacks with the given arguments
  12311. fire: function() {
  12312. self.fireWith( this, arguments );
  12313. return this;
  12314. },
  12315. // To know if the callbacks have already been called at least once
  12316. fired: function() {
  12317. return !!fired;
  12318. }
  12319. };
  12320. return self;
  12321. };
  12322. function Identity( v ) {
  12323. return v;
  12324. }
  12325. function Thrower( ex ) {
  12326. throw ex;
  12327. }
  12328. function adoptValue( value, resolve, reject, noValue ) {
  12329. var method;
  12330. try {
  12331. // Check for promise aspect first to privilege synchronous behavior
  12332. if ( value && isFunction( ( method = value.promise ) ) ) {
  12333. method.call( value ).done( resolve ).fail( reject );
  12334. // Other thenables
  12335. } else if ( value && isFunction( ( method = value.then ) ) ) {
  12336. method.call( value, resolve, reject );
  12337. // Other non-thenables
  12338. } else {
  12339. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  12340. // * false: [ value ].slice( 0 ) => resolve( value )
  12341. // * true: [ value ].slice( 1 ) => resolve()
  12342. resolve.apply( undefined, [ value ].slice( noValue ) );
  12343. }
  12344. // For Promises/A+, convert exceptions into rejections
  12345. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  12346. // Deferred#then to conditionally suppress rejection.
  12347. } catch ( value ) {
  12348. // Support: Android 4.0 only
  12349. // Strict mode functions invoked without .call/.apply get global-object context
  12350. reject.apply( undefined, [ value ] );
  12351. }
  12352. }
  12353. jQuery.extend( {
  12354. Deferred: function( func ) {
  12355. var tuples = [
  12356. // action, add listener, callbacks,
  12357. // ... .then handlers, argument index, [final state]
  12358. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  12359. jQuery.Callbacks( "memory" ), 2 ],
  12360. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  12361. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  12362. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  12363. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  12364. ],
  12365. state = "pending",
  12366. promise = {
  12367. state: function() {
  12368. return state;
  12369. },
  12370. always: function() {
  12371. deferred.done( arguments ).fail( arguments );
  12372. return this;
  12373. },
  12374. "catch": function( fn ) {
  12375. return promise.then( null, fn );
  12376. },
  12377. // Keep pipe for back-compat
  12378. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  12379. var fns = arguments;
  12380. return jQuery.Deferred( function( newDefer ) {
  12381. jQuery.each( tuples, function( i, tuple ) {
  12382. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  12383. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  12384. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  12385. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  12386. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  12387. deferred[ tuple[ 1 ] ]( function() {
  12388. var returned = fn && fn.apply( this, arguments );
  12389. if ( returned && isFunction( returned.promise ) ) {
  12390. returned.promise()
  12391. .progress( newDefer.notify )
  12392. .done( newDefer.resolve )
  12393. .fail( newDefer.reject );
  12394. } else {
  12395. newDefer[ tuple[ 0 ] + "With" ](
  12396. this,
  12397. fn ? [ returned ] : arguments
  12398. );
  12399. }
  12400. } );
  12401. } );
  12402. fns = null;
  12403. } ).promise();
  12404. },
  12405. then: function( onFulfilled, onRejected, onProgress ) {
  12406. var maxDepth = 0;
  12407. function resolve( depth, deferred, handler, special ) {
  12408. return function() {
  12409. var that = this,
  12410. args = arguments,
  12411. mightThrow = function() {
  12412. var returned, then;
  12413. // Support: Promises/A+ section 2.3.3.3.3
  12414. // https://promisesaplus.com/#point-59
  12415. // Ignore double-resolution attempts
  12416. if ( depth < maxDepth ) {
  12417. return;
  12418. }
  12419. returned = handler.apply( that, args );
  12420. // Support: Promises/A+ section 2.3.1
  12421. // https://promisesaplus.com/#point-48
  12422. if ( returned === deferred.promise() ) {
  12423. throw new TypeError( "Thenable self-resolution" );
  12424. }
  12425. // Support: Promises/A+ sections 2.3.3.1, 3.5
  12426. // https://promisesaplus.com/#point-54
  12427. // https://promisesaplus.com/#point-75
  12428. // Retrieve `then` only once
  12429. then = returned &&
  12430. // Support: Promises/A+ section 2.3.4
  12431. // https://promisesaplus.com/#point-64
  12432. // Only check objects and functions for thenability
  12433. ( typeof returned === "object" ||
  12434. typeof returned === "function" ) &&
  12435. returned.then;
  12436. // Handle a returned thenable
  12437. if ( isFunction( then ) ) {
  12438. // Special processors (notify) just wait for resolution
  12439. if ( special ) {
  12440. then.call(
  12441. returned,
  12442. resolve( maxDepth, deferred, Identity, special ),
  12443. resolve( maxDepth, deferred, Thrower, special )
  12444. );
  12445. // Normal processors (resolve) also hook into progress
  12446. } else {
  12447. // ...and disregard older resolution values
  12448. maxDepth++;
  12449. then.call(
  12450. returned,
  12451. resolve( maxDepth, deferred, Identity, special ),
  12452. resolve( maxDepth, deferred, Thrower, special ),
  12453. resolve( maxDepth, deferred, Identity,
  12454. deferred.notifyWith )
  12455. );
  12456. }
  12457. // Handle all other returned values
  12458. } else {
  12459. // Only substitute handlers pass on context
  12460. // and multiple values (non-spec behavior)
  12461. if ( handler !== Identity ) {
  12462. that = undefined;
  12463. args = [ returned ];
  12464. }
  12465. // Process the value(s)
  12466. // Default process is resolve
  12467. ( special || deferred.resolveWith )( that, args );
  12468. }
  12469. },
  12470. // Only normal processors (resolve) catch and reject exceptions
  12471. process = special ?
  12472. mightThrow :
  12473. function() {
  12474. try {
  12475. mightThrow();
  12476. } catch ( e ) {
  12477. if ( jQuery.Deferred.exceptionHook ) {
  12478. jQuery.Deferred.exceptionHook( e,
  12479. process.stackTrace );
  12480. }
  12481. // Support: Promises/A+ section 2.3.3.3.4.1
  12482. // https://promisesaplus.com/#point-61
  12483. // Ignore post-resolution exceptions
  12484. if ( depth + 1 >= maxDepth ) {
  12485. // Only substitute handlers pass on context
  12486. // and multiple values (non-spec behavior)
  12487. if ( handler !== Thrower ) {
  12488. that = undefined;
  12489. args = [ e ];
  12490. }
  12491. deferred.rejectWith( that, args );
  12492. }
  12493. }
  12494. };
  12495. // Support: Promises/A+ section 2.3.3.3.1
  12496. // https://promisesaplus.com/#point-57
  12497. // Re-resolve promises immediately to dodge false rejection from
  12498. // subsequent errors
  12499. if ( depth ) {
  12500. process();
  12501. } else {
  12502. // Call an optional hook to record the stack, in case of exception
  12503. // since it's otherwise lost when execution goes async
  12504. if ( jQuery.Deferred.getStackHook ) {
  12505. process.stackTrace = jQuery.Deferred.getStackHook();
  12506. }
  12507. window.setTimeout( process );
  12508. }
  12509. };
  12510. }
  12511. return jQuery.Deferred( function( newDefer ) {
  12512. // progress_handlers.add( ... )
  12513. tuples[ 0 ][ 3 ].add(
  12514. resolve(
  12515. 0,
  12516. newDefer,
  12517. isFunction( onProgress ) ?
  12518. onProgress :
  12519. Identity,
  12520. newDefer.notifyWith
  12521. )
  12522. );
  12523. // fulfilled_handlers.add( ... )
  12524. tuples[ 1 ][ 3 ].add(
  12525. resolve(
  12526. 0,
  12527. newDefer,
  12528. isFunction( onFulfilled ) ?
  12529. onFulfilled :
  12530. Identity
  12531. )
  12532. );
  12533. // rejected_handlers.add( ... )
  12534. tuples[ 2 ][ 3 ].add(
  12535. resolve(
  12536. 0,
  12537. newDefer,
  12538. isFunction( onRejected ) ?
  12539. onRejected :
  12540. Thrower
  12541. )
  12542. );
  12543. } ).promise();
  12544. },
  12545. // Get a promise for this deferred
  12546. // If obj is provided, the promise aspect is added to the object
  12547. promise: function( obj ) {
  12548. return obj != null ? jQuery.extend( obj, promise ) : promise;
  12549. }
  12550. },
  12551. deferred = {};
  12552. // Add list-specific methods
  12553. jQuery.each( tuples, function( i, tuple ) {
  12554. var list = tuple[ 2 ],
  12555. stateString = tuple[ 5 ];
  12556. // promise.progress = list.add
  12557. // promise.done = list.add
  12558. // promise.fail = list.add
  12559. promise[ tuple[ 1 ] ] = list.add;
  12560. // Handle state
  12561. if ( stateString ) {
  12562. list.add(
  12563. function() {
  12564. // state = "resolved" (i.e., fulfilled)
  12565. // state = "rejected"
  12566. state = stateString;
  12567. },
  12568. // rejected_callbacks.disable
  12569. // fulfilled_callbacks.disable
  12570. tuples[ 3 - i ][ 2 ].disable,
  12571. // rejected_handlers.disable
  12572. // fulfilled_handlers.disable
  12573. tuples[ 3 - i ][ 3 ].disable,
  12574. // progress_callbacks.lock
  12575. tuples[ 0 ][ 2 ].lock,
  12576. // progress_handlers.lock
  12577. tuples[ 0 ][ 3 ].lock
  12578. );
  12579. }
  12580. // progress_handlers.fire
  12581. // fulfilled_handlers.fire
  12582. // rejected_handlers.fire
  12583. list.add( tuple[ 3 ].fire );
  12584. // deferred.notify = function() { deferred.notifyWith(...) }
  12585. // deferred.resolve = function() { deferred.resolveWith(...) }
  12586. // deferred.reject = function() { deferred.rejectWith(...) }
  12587. deferred[ tuple[ 0 ] ] = function() {
  12588. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  12589. return this;
  12590. };
  12591. // deferred.notifyWith = list.fireWith
  12592. // deferred.resolveWith = list.fireWith
  12593. // deferred.rejectWith = list.fireWith
  12594. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  12595. } );
  12596. // Make the deferred a promise
  12597. promise.promise( deferred );
  12598. // Call given func if any
  12599. if ( func ) {
  12600. func.call( deferred, deferred );
  12601. }
  12602. // All done!
  12603. return deferred;
  12604. },
  12605. // Deferred helper
  12606. when: function( singleValue ) {
  12607. var
  12608. // count of uncompleted subordinates
  12609. remaining = arguments.length,
  12610. // count of unprocessed arguments
  12611. i = remaining,
  12612. // subordinate fulfillment data
  12613. resolveContexts = Array( i ),
  12614. resolveValues = slice.call( arguments ),
  12615. // the master Deferred
  12616. master = jQuery.Deferred(),
  12617. // subordinate callback factory
  12618. updateFunc = function( i ) {
  12619. return function( value ) {
  12620. resolveContexts[ i ] = this;
  12621. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  12622. if ( !( --remaining ) ) {
  12623. master.resolveWith( resolveContexts, resolveValues );
  12624. }
  12625. };
  12626. };
  12627. // Single- and empty arguments are adopted like Promise.resolve
  12628. if ( remaining <= 1 ) {
  12629. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  12630. !remaining );
  12631. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  12632. if ( master.state() === "pending" ||
  12633. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  12634. return master.then();
  12635. }
  12636. }
  12637. // Multiple arguments are aggregated like Promise.all array elements
  12638. while ( i-- ) {
  12639. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  12640. }
  12641. return master.promise();
  12642. }
  12643. } );
  12644. // These usually indicate a programmer mistake during development,
  12645. // warn about them ASAP rather than swallowing them by default.
  12646. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  12647. jQuery.Deferred.exceptionHook = function( error, stack ) {
  12648. // Support: IE 8 - 9 only
  12649. // Console exists when dev tools are open, which can happen at any time
  12650. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  12651. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  12652. }
  12653. };
  12654. jQuery.readyException = function( error ) {
  12655. window.setTimeout( function() {
  12656. throw error;
  12657. } );
  12658. };
  12659. // The deferred used on DOM ready
  12660. var readyList = jQuery.Deferred();
  12661. jQuery.fn.ready = function( fn ) {
  12662. readyList
  12663. .then( fn )
  12664. // Wrap jQuery.readyException in a function so that the lookup
  12665. // happens at the time of error handling instead of callback
  12666. // registration.
  12667. .catch( function( error ) {
  12668. jQuery.readyException( error );
  12669. } );
  12670. return this;
  12671. };
  12672. jQuery.extend( {
  12673. // Is the DOM ready to be used? Set to true once it occurs.
  12674. isReady: false,
  12675. // A counter to track how many items to wait for before
  12676. // the ready event fires. See #6781
  12677. readyWait: 1,
  12678. // Handle when the DOM is ready
  12679. ready: function( wait ) {
  12680. // Abort if there are pending holds or we're already ready
  12681. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  12682. return;
  12683. }
  12684. // Remember that the DOM is ready
  12685. jQuery.isReady = true;
  12686. // If a normal DOM Ready event fired, decrement, and wait if need be
  12687. if ( wait !== true && --jQuery.readyWait > 0 ) {
  12688. return;
  12689. }
  12690. // If there are functions bound, to execute
  12691. readyList.resolveWith( document, [ jQuery ] );
  12692. }
  12693. } );
  12694. jQuery.ready.then = readyList.then;
  12695. // The ready event handler and self cleanup method
  12696. function completed() {
  12697. document.removeEventListener( "DOMContentLoaded", completed );
  12698. window.removeEventListener( "load", completed );
  12699. jQuery.ready();
  12700. }
  12701. // Catch cases where $(document).ready() is called
  12702. // after the browser event has already occurred.
  12703. // Support: IE <=9 - 10 only
  12704. // Older IE sometimes signals "interactive" too soon
  12705. if ( document.readyState === "complete" ||
  12706. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  12707. // Handle it asynchronously to allow scripts the opportunity to delay ready
  12708. window.setTimeout( jQuery.ready );
  12709. } else {
  12710. // Use the handy event callback
  12711. document.addEventListener( "DOMContentLoaded", completed );
  12712. // A fallback to window.onload, that will always work
  12713. window.addEventListener( "load", completed );
  12714. }
  12715. // Multifunctional method to get and set values of a collection
  12716. // The value/s can optionally be executed if it's a function
  12717. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  12718. var i = 0,
  12719. len = elems.length,
  12720. bulk = key == null;
  12721. // Sets many values
  12722. if ( toType( key ) === "object" ) {
  12723. chainable = true;
  12724. for ( i in key ) {
  12725. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  12726. }
  12727. // Sets one value
  12728. } else if ( value !== undefined ) {
  12729. chainable = true;
  12730. if ( !isFunction( value ) ) {
  12731. raw = true;
  12732. }
  12733. if ( bulk ) {
  12734. // Bulk operations run against the entire set
  12735. if ( raw ) {
  12736. fn.call( elems, value );
  12737. fn = null;
  12738. // ...except when executing function values
  12739. } else {
  12740. bulk = fn;
  12741. fn = function( elem, key, value ) {
  12742. return bulk.call( jQuery( elem ), value );
  12743. };
  12744. }
  12745. }
  12746. if ( fn ) {
  12747. for ( ; i < len; i++ ) {
  12748. fn(
  12749. elems[ i ], key, raw ?
  12750. value :
  12751. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  12752. );
  12753. }
  12754. }
  12755. }
  12756. if ( chainable ) {
  12757. return elems;
  12758. }
  12759. // Gets
  12760. if ( bulk ) {
  12761. return fn.call( elems );
  12762. }
  12763. return len ? fn( elems[ 0 ], key ) : emptyGet;
  12764. };
  12765. // Matches dashed string for camelizing
  12766. var rmsPrefix = /^-ms-/,
  12767. rdashAlpha = /-([a-z])/g;
  12768. // Used by camelCase as callback to replace()
  12769. function fcamelCase( all, letter ) {
  12770. return letter.toUpperCase();
  12771. }
  12772. // Convert dashed to camelCase; used by the css and data modules
  12773. // Support: IE <=9 - 11, Edge 12 - 15
  12774. // Microsoft forgot to hump their vendor prefix (#9572)
  12775. function camelCase( string ) {
  12776. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  12777. }
  12778. var acceptData = function( owner ) {
  12779. // Accepts only:
  12780. // - Node
  12781. // - Node.ELEMENT_NODE
  12782. // - Node.DOCUMENT_NODE
  12783. // - Object
  12784. // - Any
  12785. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  12786. };
  12787. function Data() {
  12788. this.expando = jQuery.expando + Data.uid++;
  12789. }
  12790. Data.uid = 1;
  12791. Data.prototype = {
  12792. cache: function( owner ) {
  12793. // Check if the owner object already has a cache
  12794. var value = owner[ this.expando ];
  12795. // If not, create one
  12796. if ( !value ) {
  12797. value = {};
  12798. // We can accept data for non-element nodes in modern browsers,
  12799. // but we should not, see #8335.
  12800. // Always return an empty object.
  12801. if ( acceptData( owner ) ) {
  12802. // If it is a node unlikely to be stringify-ed or looped over
  12803. // use plain assignment
  12804. if ( owner.nodeType ) {
  12805. owner[ this.expando ] = value;
  12806. // Otherwise secure it in a non-enumerable property
  12807. // configurable must be true to allow the property to be
  12808. // deleted when data is removed
  12809. } else {
  12810. Object.defineProperty( owner, this.expando, {
  12811. value: value,
  12812. configurable: true
  12813. } );
  12814. }
  12815. }
  12816. }
  12817. return value;
  12818. },
  12819. set: function( owner, data, value ) {
  12820. var prop,
  12821. cache = this.cache( owner );
  12822. // Handle: [ owner, key, value ] args
  12823. // Always use camelCase key (gh-2257)
  12824. if ( typeof data === "string" ) {
  12825. cache[ camelCase( data ) ] = value;
  12826. // Handle: [ owner, { properties } ] args
  12827. } else {
  12828. // Copy the properties one-by-one to the cache object
  12829. for ( prop in data ) {
  12830. cache[ camelCase( prop ) ] = data[ prop ];
  12831. }
  12832. }
  12833. return cache;
  12834. },
  12835. get: function( owner, key ) {
  12836. return key === undefined ?
  12837. this.cache( owner ) :
  12838. // Always use camelCase key (gh-2257)
  12839. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  12840. },
  12841. access: function( owner, key, value ) {
  12842. // In cases where either:
  12843. //
  12844. // 1. No key was specified
  12845. // 2. A string key was specified, but no value provided
  12846. //
  12847. // Take the "read" path and allow the get method to determine
  12848. // which value to return, respectively either:
  12849. //
  12850. // 1. The entire cache object
  12851. // 2. The data stored at the key
  12852. //
  12853. if ( key === undefined ||
  12854. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  12855. return this.get( owner, key );
  12856. }
  12857. // When the key is not a string, or both a key and value
  12858. // are specified, set or extend (existing objects) with either:
  12859. //
  12860. // 1. An object of properties
  12861. // 2. A key and value
  12862. //
  12863. this.set( owner, key, value );
  12864. // Since the "set" path can have two possible entry points
  12865. // return the expected data based on which path was taken[*]
  12866. return value !== undefined ? value : key;
  12867. },
  12868. remove: function( owner, key ) {
  12869. var i,
  12870. cache = owner[ this.expando ];
  12871. if ( cache === undefined ) {
  12872. return;
  12873. }
  12874. if ( key !== undefined ) {
  12875. // Support array or space separated string of keys
  12876. if ( Array.isArray( key ) ) {
  12877. // If key is an array of keys...
  12878. // We always set camelCase keys, so remove that.
  12879. key = key.map( camelCase );
  12880. } else {
  12881. key = camelCase( key );
  12882. // If a key with the spaces exists, use it.
  12883. // Otherwise, create an array by matching non-whitespace
  12884. key = key in cache ?
  12885. [ key ] :
  12886. ( key.match( rnothtmlwhite ) || [] );
  12887. }
  12888. i = key.length;
  12889. while ( i-- ) {
  12890. delete cache[ key[ i ] ];
  12891. }
  12892. }
  12893. // Remove the expando if there's no more data
  12894. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  12895. // Support: Chrome <=35 - 45
  12896. // Webkit & Blink performance suffers when deleting properties
  12897. // from DOM nodes, so set to undefined instead
  12898. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  12899. if ( owner.nodeType ) {
  12900. owner[ this.expando ] = undefined;
  12901. } else {
  12902. delete owner[ this.expando ];
  12903. }
  12904. }
  12905. },
  12906. hasData: function( owner ) {
  12907. var cache = owner[ this.expando ];
  12908. return cache !== undefined && !jQuery.isEmptyObject( cache );
  12909. }
  12910. };
  12911. var dataPriv = new Data();
  12912. var dataUser = new Data();
  12913. // Implementation Summary
  12914. //
  12915. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  12916. // 2. Improve the module's maintainability by reducing the storage
  12917. // paths to a single mechanism.
  12918. // 3. Use the same single mechanism to support "private" and "user" data.
  12919. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  12920. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  12921. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  12922. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  12923. rmultiDash = /[A-Z]/g;
  12924. function getData( data ) {
  12925. if ( data === "true" ) {
  12926. return true;
  12927. }
  12928. if ( data === "false" ) {
  12929. return false;
  12930. }
  12931. if ( data === "null" ) {
  12932. return null;
  12933. }
  12934. // Only convert to a number if it doesn't change the string
  12935. if ( data === +data + "" ) {
  12936. return +data;
  12937. }
  12938. if ( rbrace.test( data ) ) {
  12939. return JSON.parse( data );
  12940. }
  12941. return data;
  12942. }
  12943. function dataAttr( elem, key, data ) {
  12944. var name;
  12945. // If nothing was found internally, try to fetch any
  12946. // data from the HTML5 data-* attribute
  12947. if ( data === undefined && elem.nodeType === 1 ) {
  12948. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  12949. data = elem.getAttribute( name );
  12950. if ( typeof data === "string" ) {
  12951. try {
  12952. data = getData( data );
  12953. } catch ( e ) {}
  12954. // Make sure we set the data so it isn't changed later
  12955. dataUser.set( elem, key, data );
  12956. } else {
  12957. data = undefined;
  12958. }
  12959. }
  12960. return data;
  12961. }
  12962. jQuery.extend( {
  12963. hasData: function( elem ) {
  12964. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  12965. },
  12966. data: function( elem, name, data ) {
  12967. return dataUser.access( elem, name, data );
  12968. },
  12969. removeData: function( elem, name ) {
  12970. dataUser.remove( elem, name );
  12971. },
  12972. // TODO: Now that all calls to _data and _removeData have been replaced
  12973. // with direct calls to dataPriv methods, these can be deprecated.
  12974. _data: function( elem, name, data ) {
  12975. return dataPriv.access( elem, name, data );
  12976. },
  12977. _removeData: function( elem, name ) {
  12978. dataPriv.remove( elem, name );
  12979. }
  12980. } );
  12981. jQuery.fn.extend( {
  12982. data: function( key, value ) {
  12983. var i, name, data,
  12984. elem = this[ 0 ],
  12985. attrs = elem && elem.attributes;
  12986. // Gets all values
  12987. if ( key === undefined ) {
  12988. if ( this.length ) {
  12989. data = dataUser.get( elem );
  12990. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  12991. i = attrs.length;
  12992. while ( i-- ) {
  12993. // Support: IE 11 only
  12994. // The attrs elements can be null (#14894)
  12995. if ( attrs[ i ] ) {
  12996. name = attrs[ i ].name;
  12997. if ( name.indexOf( "data-" ) === 0 ) {
  12998. name = camelCase( name.slice( 5 ) );
  12999. dataAttr( elem, name, data[ name ] );
  13000. }
  13001. }
  13002. }
  13003. dataPriv.set( elem, "hasDataAttrs", true );
  13004. }
  13005. }
  13006. return data;
  13007. }
  13008. // Sets multiple values
  13009. if ( typeof key === "object" ) {
  13010. return this.each( function() {
  13011. dataUser.set( this, key );
  13012. } );
  13013. }
  13014. return access( this, function( value ) {
  13015. var data;
  13016. // The calling jQuery object (element matches) is not empty
  13017. // (and therefore has an element appears at this[ 0 ]) and the
  13018. // `value` parameter was not undefined. An empty jQuery object
  13019. // will result in `undefined` for elem = this[ 0 ] which will
  13020. // throw an exception if an attempt to read a data cache is made.
  13021. if ( elem && value === undefined ) {
  13022. // Attempt to get data from the cache
  13023. // The key will always be camelCased in Data
  13024. data = dataUser.get( elem, key );
  13025. if ( data !== undefined ) {
  13026. return data;
  13027. }
  13028. // Attempt to "discover" the data in
  13029. // HTML5 custom data-* attrs
  13030. data = dataAttr( elem, key );
  13031. if ( data !== undefined ) {
  13032. return data;
  13033. }
  13034. // We tried really hard, but the data doesn't exist.
  13035. return;
  13036. }
  13037. // Set the data...
  13038. this.each( function() {
  13039. // We always store the camelCased key
  13040. dataUser.set( this, key, value );
  13041. } );
  13042. }, null, value, arguments.length > 1, null, true );
  13043. },
  13044. removeData: function( key ) {
  13045. return this.each( function() {
  13046. dataUser.remove( this, key );
  13047. } );
  13048. }
  13049. } );
  13050. jQuery.extend( {
  13051. queue: function( elem, type, data ) {
  13052. var queue;
  13053. if ( elem ) {
  13054. type = ( type || "fx" ) + "queue";
  13055. queue = dataPriv.get( elem, type );
  13056. // Speed up dequeue by getting out quickly if this is just a lookup
  13057. if ( data ) {
  13058. if ( !queue || Array.isArray( data ) ) {
  13059. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  13060. } else {
  13061. queue.push( data );
  13062. }
  13063. }
  13064. return queue || [];
  13065. }
  13066. },
  13067. dequeue: function( elem, type ) {
  13068. type = type || "fx";
  13069. var queue = jQuery.queue( elem, type ),
  13070. startLength = queue.length,
  13071. fn = queue.shift(),
  13072. hooks = jQuery._queueHooks( elem, type ),
  13073. next = function() {
  13074. jQuery.dequeue( elem, type );
  13075. };
  13076. // If the fx queue is dequeued, always remove the progress sentinel
  13077. if ( fn === "inprogress" ) {
  13078. fn = queue.shift();
  13079. startLength--;
  13080. }
  13081. if ( fn ) {
  13082. // Add a progress sentinel to prevent the fx queue from being
  13083. // automatically dequeued
  13084. if ( type === "fx" ) {
  13085. queue.unshift( "inprogress" );
  13086. }
  13087. // Clear up the last queue stop function
  13088. delete hooks.stop;
  13089. fn.call( elem, next, hooks );
  13090. }
  13091. if ( !startLength && hooks ) {
  13092. hooks.empty.fire();
  13093. }
  13094. },
  13095. // Not public - generate a queueHooks object, or return the current one
  13096. _queueHooks: function( elem, type ) {
  13097. var key = type + "queueHooks";
  13098. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  13099. empty: jQuery.Callbacks( "once memory" ).add( function() {
  13100. dataPriv.remove( elem, [ type + "queue", key ] );
  13101. } )
  13102. } );
  13103. }
  13104. } );
  13105. jQuery.fn.extend( {
  13106. queue: function( type, data ) {
  13107. var setter = 2;
  13108. if ( typeof type !== "string" ) {
  13109. data = type;
  13110. type = "fx";
  13111. setter--;
  13112. }
  13113. if ( arguments.length < setter ) {
  13114. return jQuery.queue( this[ 0 ], type );
  13115. }
  13116. return data === undefined ?
  13117. this :
  13118. this.each( function() {
  13119. var queue = jQuery.queue( this, type, data );
  13120. // Ensure a hooks for this queue
  13121. jQuery._queueHooks( this, type );
  13122. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  13123. jQuery.dequeue( this, type );
  13124. }
  13125. } );
  13126. },
  13127. dequeue: function( type ) {
  13128. return this.each( function() {
  13129. jQuery.dequeue( this, type );
  13130. } );
  13131. },
  13132. clearQueue: function( type ) {
  13133. return this.queue( type || "fx", [] );
  13134. },
  13135. // Get a promise resolved when queues of a certain type
  13136. // are emptied (fx is the type by default)
  13137. promise: function( type, obj ) {
  13138. var tmp,
  13139. count = 1,
  13140. defer = jQuery.Deferred(),
  13141. elements = this,
  13142. i = this.length,
  13143. resolve = function() {
  13144. if ( !( --count ) ) {
  13145. defer.resolveWith( elements, [ elements ] );
  13146. }
  13147. };
  13148. if ( typeof type !== "string" ) {
  13149. obj = type;
  13150. type = undefined;
  13151. }
  13152. type = type || "fx";
  13153. while ( i-- ) {
  13154. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  13155. if ( tmp && tmp.empty ) {
  13156. count++;
  13157. tmp.empty.add( resolve );
  13158. }
  13159. }
  13160. resolve();
  13161. return defer.promise( obj );
  13162. }
  13163. } );
  13164. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  13165. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  13166. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  13167. var documentElement = document.documentElement;
  13168. var isAttached = function( elem ) {
  13169. return jQuery.contains( elem.ownerDocument, elem );
  13170. },
  13171. composed = { composed: true };
  13172. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  13173. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  13174. // Support: iOS 10.0-10.2 only
  13175. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  13176. // leading to errors. We need to check for `getRootNode`.
  13177. if ( documentElement.getRootNode ) {
  13178. isAttached = function( elem ) {
  13179. return jQuery.contains( elem.ownerDocument, elem ) ||
  13180. elem.getRootNode( composed ) === elem.ownerDocument;
  13181. };
  13182. }
  13183. var isHiddenWithinTree = function( elem, el ) {
  13184. // isHiddenWithinTree might be called from jQuery#filter function;
  13185. // in that case, element will be second argument
  13186. elem = el || elem;
  13187. // Inline style trumps all
  13188. return elem.style.display === "none" ||
  13189. elem.style.display === "" &&
  13190. // Otherwise, check computed style
  13191. // Support: Firefox <=43 - 45
  13192. // Disconnected elements can have computed display: none, so first confirm that elem is
  13193. // in the document.
  13194. isAttached( elem ) &&
  13195. jQuery.css( elem, "display" ) === "none";
  13196. };
  13197. var swap = function( elem, options, callback, args ) {
  13198. var ret, name,
  13199. old = {};
  13200. // Remember the old values, and insert the new ones
  13201. for ( name in options ) {
  13202. old[ name ] = elem.style[ name ];
  13203. elem.style[ name ] = options[ name ];
  13204. }
  13205. ret = callback.apply( elem, args || [] );
  13206. // Revert the old values
  13207. for ( name in options ) {
  13208. elem.style[ name ] = old[ name ];
  13209. }
  13210. return ret;
  13211. };
  13212. function adjustCSS( elem, prop, valueParts, tween ) {
  13213. var adjusted, scale,
  13214. maxIterations = 20,
  13215. currentValue = tween ?
  13216. function() {
  13217. return tween.cur();
  13218. } :
  13219. function() {
  13220. return jQuery.css( elem, prop, "" );
  13221. },
  13222. initial = currentValue(),
  13223. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  13224. // Starting value computation is required for potential unit mismatches
  13225. initialInUnit = elem.nodeType &&
  13226. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  13227. rcssNum.exec( jQuery.css( elem, prop ) );
  13228. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  13229. // Support: Firefox <=54
  13230. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  13231. initial = initial / 2;
  13232. // Trust units reported by jQuery.css
  13233. unit = unit || initialInUnit[ 3 ];
  13234. // Iteratively approximate from a nonzero starting point
  13235. initialInUnit = +initial || 1;
  13236. while ( maxIterations-- ) {
  13237. // Evaluate and update our best guess (doubling guesses that zero out).
  13238. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  13239. jQuery.style( elem, prop, initialInUnit + unit );
  13240. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  13241. maxIterations = 0;
  13242. }
  13243. initialInUnit = initialInUnit / scale;
  13244. }
  13245. initialInUnit = initialInUnit * 2;
  13246. jQuery.style( elem, prop, initialInUnit + unit );
  13247. // Make sure we update the tween properties later on
  13248. valueParts = valueParts || [];
  13249. }
  13250. if ( valueParts ) {
  13251. initialInUnit = +initialInUnit || +initial || 0;
  13252. // Apply relative offset (+=/-=) if specified
  13253. adjusted = valueParts[ 1 ] ?
  13254. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  13255. +valueParts[ 2 ];
  13256. if ( tween ) {
  13257. tween.unit = unit;
  13258. tween.start = initialInUnit;
  13259. tween.end = adjusted;
  13260. }
  13261. }
  13262. return adjusted;
  13263. }
  13264. var defaultDisplayMap = {};
  13265. function getDefaultDisplay( elem ) {
  13266. var temp,
  13267. doc = elem.ownerDocument,
  13268. nodeName = elem.nodeName,
  13269. display = defaultDisplayMap[ nodeName ];
  13270. if ( display ) {
  13271. return display;
  13272. }
  13273. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  13274. display = jQuery.css( temp, "display" );
  13275. temp.parentNode.removeChild( temp );
  13276. if ( display === "none" ) {
  13277. display = "block";
  13278. }
  13279. defaultDisplayMap[ nodeName ] = display;
  13280. return display;
  13281. }
  13282. function showHide( elements, show ) {
  13283. var display, elem,
  13284. values = [],
  13285. index = 0,
  13286. length = elements.length;
  13287. // Determine new display value for elements that need to change
  13288. for ( ; index < length; index++ ) {
  13289. elem = elements[ index ];
  13290. if ( !elem.style ) {
  13291. continue;
  13292. }
  13293. display = elem.style.display;
  13294. if ( show ) {
  13295. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  13296. // check is required in this first loop unless we have a nonempty display value (either
  13297. // inline or about-to-be-restored)
  13298. if ( display === "none" ) {
  13299. values[ index ] = dataPriv.get( elem, "display" ) || null;
  13300. if ( !values[ index ] ) {
  13301. elem.style.display = "";
  13302. }
  13303. }
  13304. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  13305. values[ index ] = getDefaultDisplay( elem );
  13306. }
  13307. } else {
  13308. if ( display !== "none" ) {
  13309. values[ index ] = "none";
  13310. // Remember what we're overwriting
  13311. dataPriv.set( elem, "display", display );
  13312. }
  13313. }
  13314. }
  13315. // Set the display of the elements in a second loop to avoid constant reflow
  13316. for ( index = 0; index < length; index++ ) {
  13317. if ( values[ index ] != null ) {
  13318. elements[ index ].style.display = values[ index ];
  13319. }
  13320. }
  13321. return elements;
  13322. }
  13323. jQuery.fn.extend( {
  13324. show: function() {
  13325. return showHide( this, true );
  13326. },
  13327. hide: function() {
  13328. return showHide( this );
  13329. },
  13330. toggle: function( state ) {
  13331. if ( typeof state === "boolean" ) {
  13332. return state ? this.show() : this.hide();
  13333. }
  13334. return this.each( function() {
  13335. if ( isHiddenWithinTree( this ) ) {
  13336. jQuery( this ).show();
  13337. } else {
  13338. jQuery( this ).hide();
  13339. }
  13340. } );
  13341. }
  13342. } );
  13343. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  13344. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  13345. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  13346. // We have to close these tags to support XHTML (#13200)
  13347. var wrapMap = {
  13348. // Support: IE <=9 only
  13349. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  13350. // XHTML parsers do not magically insert elements in the
  13351. // same way that tag soup parsers do. So we cannot shorten
  13352. // this by omitting <tbody> or other required elements.
  13353. thead: [ 1, "<table>", "</table>" ],
  13354. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  13355. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  13356. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  13357. _default: [ 0, "", "" ]
  13358. };
  13359. // Support: IE <=9 only
  13360. wrapMap.optgroup = wrapMap.option;
  13361. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  13362. wrapMap.th = wrapMap.td;
  13363. function getAll( context, tag ) {
  13364. // Support: IE <=9 - 11 only
  13365. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  13366. var ret;
  13367. if ( typeof context.getElementsByTagName !== "undefined" ) {
  13368. ret = context.getElementsByTagName( tag || "*" );
  13369. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  13370. ret = context.querySelectorAll( tag || "*" );
  13371. } else {
  13372. ret = [];
  13373. }
  13374. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  13375. return jQuery.merge( [ context ], ret );
  13376. }
  13377. return ret;
  13378. }
  13379. // Mark scripts as having already been evaluated
  13380. function setGlobalEval( elems, refElements ) {
  13381. var i = 0,
  13382. l = elems.length;
  13383. for ( ; i < l; i++ ) {
  13384. dataPriv.set(
  13385. elems[ i ],
  13386. "globalEval",
  13387. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  13388. );
  13389. }
  13390. }
  13391. var rhtml = /<|&#?\w+;/;
  13392. function buildFragment( elems, context, scripts, selection, ignored ) {
  13393. var elem, tmp, tag, wrap, attached, j,
  13394. fragment = context.createDocumentFragment(),
  13395. nodes = [],
  13396. i = 0,
  13397. l = elems.length;
  13398. for ( ; i < l; i++ ) {
  13399. elem = elems[ i ];
  13400. if ( elem || elem === 0 ) {
  13401. // Add nodes directly
  13402. if ( toType( elem ) === "object" ) {
  13403. // Support: Android <=4.0 only, PhantomJS 1 only
  13404. // push.apply(_, arraylike) throws on ancient WebKit
  13405. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  13406. // Convert non-html into a text node
  13407. } else if ( !rhtml.test( elem ) ) {
  13408. nodes.push( context.createTextNode( elem ) );
  13409. // Convert html into DOM nodes
  13410. } else {
  13411. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  13412. // Deserialize a standard representation
  13413. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  13414. wrap = wrapMap[ tag ] || wrapMap._default;
  13415. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  13416. // Descend through wrappers to the right content
  13417. j = wrap[ 0 ];
  13418. while ( j-- ) {
  13419. tmp = tmp.lastChild;
  13420. }
  13421. // Support: Android <=4.0 only, PhantomJS 1 only
  13422. // push.apply(_, arraylike) throws on ancient WebKit
  13423. jQuery.merge( nodes, tmp.childNodes );
  13424. // Remember the top-level container
  13425. tmp = fragment.firstChild;
  13426. // Ensure the created nodes are orphaned (#12392)
  13427. tmp.textContent = "";
  13428. }
  13429. }
  13430. }
  13431. // Remove wrapper from fragment
  13432. fragment.textContent = "";
  13433. i = 0;
  13434. while ( ( elem = nodes[ i++ ] ) ) {
  13435. // Skip elements already in the context collection (trac-4087)
  13436. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  13437. if ( ignored ) {
  13438. ignored.push( elem );
  13439. }
  13440. continue;
  13441. }
  13442. attached = isAttached( elem );
  13443. // Append to fragment
  13444. tmp = getAll( fragment.appendChild( elem ), "script" );
  13445. // Preserve script evaluation history
  13446. if ( attached ) {
  13447. setGlobalEval( tmp );
  13448. }
  13449. // Capture executables
  13450. if ( scripts ) {
  13451. j = 0;
  13452. while ( ( elem = tmp[ j++ ] ) ) {
  13453. if ( rscriptType.test( elem.type || "" ) ) {
  13454. scripts.push( elem );
  13455. }
  13456. }
  13457. }
  13458. }
  13459. return fragment;
  13460. }
  13461. ( function() {
  13462. var fragment = document.createDocumentFragment(),
  13463. div = fragment.appendChild( document.createElement( "div" ) ),
  13464. input = document.createElement( "input" );
  13465. // Support: Android 4.0 - 4.3 only
  13466. // Check state lost if the name is set (#11217)
  13467. // Support: Windows Web Apps (WWA)
  13468. // `name` and `type` must use .setAttribute for WWA (#14901)
  13469. input.setAttribute( "type", "radio" );
  13470. input.setAttribute( "checked", "checked" );
  13471. input.setAttribute( "name", "t" );
  13472. div.appendChild( input );
  13473. // Support: Android <=4.1 only
  13474. // Older WebKit doesn't clone checked state correctly in fragments
  13475. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  13476. // Support: IE <=11 only
  13477. // Make sure textarea (and checkbox) defaultValue is properly cloned
  13478. div.innerHTML = "<textarea>x</textarea>";
  13479. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  13480. } )();
  13481. var
  13482. rkeyEvent = /^key/,
  13483. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  13484. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  13485. function returnTrue() {
  13486. return true;
  13487. }
  13488. function returnFalse() {
  13489. return false;
  13490. }
  13491. // Support: IE <=9 - 11+
  13492. // focus() and blur() are asynchronous, except when they are no-op.
  13493. // So expect focus to be synchronous when the element is already active,
  13494. // and blur to be synchronous when the element is not already active.
  13495. // (focus and blur are always synchronous in other supported browsers,
  13496. // this just defines when we can count on it).
  13497. function expectSync( elem, type ) {
  13498. return ( elem === safeActiveElement() ) === ( type === "focus" );
  13499. }
  13500. // Support: IE <=9 only
  13501. // Accessing document.activeElement can throw unexpectedly
  13502. // https://bugs.jquery.com/ticket/13393
  13503. function safeActiveElement() {
  13504. try {
  13505. return document.activeElement;
  13506. } catch ( err ) { }
  13507. }
  13508. function on( elem, types, selector, data, fn, one ) {
  13509. var origFn, type;
  13510. // Types can be a map of types/handlers
  13511. if ( typeof types === "object" ) {
  13512. // ( types-Object, selector, data )
  13513. if ( typeof selector !== "string" ) {
  13514. // ( types-Object, data )
  13515. data = data || selector;
  13516. selector = undefined;
  13517. }
  13518. for ( type in types ) {
  13519. on( elem, type, selector, data, types[ type ], one );
  13520. }
  13521. return elem;
  13522. }
  13523. if ( data == null && fn == null ) {
  13524. // ( types, fn )
  13525. fn = selector;
  13526. data = selector = undefined;
  13527. } else if ( fn == null ) {
  13528. if ( typeof selector === "string" ) {
  13529. // ( types, selector, fn )
  13530. fn = data;
  13531. data = undefined;
  13532. } else {
  13533. // ( types, data, fn )
  13534. fn = data;
  13535. data = selector;
  13536. selector = undefined;
  13537. }
  13538. }
  13539. if ( fn === false ) {
  13540. fn = returnFalse;
  13541. } else if ( !fn ) {
  13542. return elem;
  13543. }
  13544. if ( one === 1 ) {
  13545. origFn = fn;
  13546. fn = function( event ) {
  13547. // Can use an empty set, since event contains the info
  13548. jQuery().off( event );
  13549. return origFn.apply( this, arguments );
  13550. };
  13551. // Use same guid so caller can remove using origFn
  13552. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  13553. }
  13554. return elem.each( function() {
  13555. jQuery.event.add( this, types, fn, data, selector );
  13556. } );
  13557. }
  13558. /*
  13559. * Helper functions for managing events -- not part of the public interface.
  13560. * Props to Dean Edwards' addEvent library for many of the ideas.
  13561. */
  13562. jQuery.event = {
  13563. global: {},
  13564. add: function( elem, types, handler, data, selector ) {
  13565. var handleObjIn, eventHandle, tmp,
  13566. events, t, handleObj,
  13567. special, handlers, type, namespaces, origType,
  13568. elemData = dataPriv.get( elem );
  13569. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  13570. if ( !elemData ) {
  13571. return;
  13572. }
  13573. // Caller can pass in an object of custom data in lieu of the handler
  13574. if ( handler.handler ) {
  13575. handleObjIn = handler;
  13576. handler = handleObjIn.handler;
  13577. selector = handleObjIn.selector;
  13578. }
  13579. // Ensure that invalid selectors throw exceptions at attach time
  13580. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  13581. if ( selector ) {
  13582. jQuery.find.matchesSelector( documentElement, selector );
  13583. }
  13584. // Make sure that the handler has a unique ID, used to find/remove it later
  13585. if ( !handler.guid ) {
  13586. handler.guid = jQuery.guid++;
  13587. }
  13588. // Init the element's event structure and main handler, if this is the first
  13589. if ( !( events = elemData.events ) ) {
  13590. events = elemData.events = {};
  13591. }
  13592. if ( !( eventHandle = elemData.handle ) ) {
  13593. eventHandle = elemData.handle = function( e ) {
  13594. // Discard the second event of a jQuery.event.trigger() and
  13595. // when an event is called after a page has unloaded
  13596. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  13597. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  13598. };
  13599. }
  13600. // Handle multiple events separated by a space
  13601. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  13602. t = types.length;
  13603. while ( t-- ) {
  13604. tmp = rtypenamespace.exec( types[ t ] ) || [];
  13605. type = origType = tmp[ 1 ];
  13606. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  13607. // There *must* be a type, no attaching namespace-only handlers
  13608. if ( !type ) {
  13609. continue;
  13610. }
  13611. // If event changes its type, use the special event handlers for the changed type
  13612. special = jQuery.event.special[ type ] || {};
  13613. // If selector defined, determine special event api type, otherwise given type
  13614. type = ( selector ? special.delegateType : special.bindType ) || type;
  13615. // Update special based on newly reset type
  13616. special = jQuery.event.special[ type ] || {};
  13617. // handleObj is passed to all event handlers
  13618. handleObj = jQuery.extend( {
  13619. type: type,
  13620. origType: origType,
  13621. data: data,
  13622. handler: handler,
  13623. guid: handler.guid,
  13624. selector: selector,
  13625. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  13626. namespace: namespaces.join( "." )
  13627. }, handleObjIn );
  13628. // Init the event handler queue if we're the first
  13629. if ( !( handlers = events[ type ] ) ) {
  13630. handlers = events[ type ] = [];
  13631. handlers.delegateCount = 0;
  13632. // Only use addEventListener if the special events handler returns false
  13633. if ( !special.setup ||
  13634. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  13635. if ( elem.addEventListener ) {
  13636. elem.addEventListener( type, eventHandle );
  13637. }
  13638. }
  13639. }
  13640. if ( special.add ) {
  13641. special.add.call( elem, handleObj );
  13642. if ( !handleObj.handler.guid ) {
  13643. handleObj.handler.guid = handler.guid;
  13644. }
  13645. }
  13646. // Add to the element's handler list, delegates in front
  13647. if ( selector ) {
  13648. handlers.splice( handlers.delegateCount++, 0, handleObj );
  13649. } else {
  13650. handlers.push( handleObj );
  13651. }
  13652. // Keep track of which events have ever been used, for event optimization
  13653. jQuery.event.global[ type ] = true;
  13654. }
  13655. },
  13656. // Detach an event or set of events from an element
  13657. remove: function( elem, types, handler, selector, mappedTypes ) {
  13658. var j, origCount, tmp,
  13659. events, t, handleObj,
  13660. special, handlers, type, namespaces, origType,
  13661. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  13662. if ( !elemData || !( events = elemData.events ) ) {
  13663. return;
  13664. }
  13665. // Once for each type.namespace in types; type may be omitted
  13666. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  13667. t = types.length;
  13668. while ( t-- ) {
  13669. tmp = rtypenamespace.exec( types[ t ] ) || [];
  13670. type = origType = tmp[ 1 ];
  13671. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  13672. // Unbind all events (on this namespace, if provided) for the element
  13673. if ( !type ) {
  13674. for ( type in events ) {
  13675. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  13676. }
  13677. continue;
  13678. }
  13679. special = jQuery.event.special[ type ] || {};
  13680. type = ( selector ? special.delegateType : special.bindType ) || type;
  13681. handlers = events[ type ] || [];
  13682. tmp = tmp[ 2 ] &&
  13683. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  13684. // Remove matching events
  13685. origCount = j = handlers.length;
  13686. while ( j-- ) {
  13687. handleObj = handlers[ j ];
  13688. if ( ( mappedTypes || origType === handleObj.origType ) &&
  13689. ( !handler || handler.guid === handleObj.guid ) &&
  13690. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  13691. ( !selector || selector === handleObj.selector ||
  13692. selector === "**" && handleObj.selector ) ) {
  13693. handlers.splice( j, 1 );
  13694. if ( handleObj.selector ) {
  13695. handlers.delegateCount--;
  13696. }
  13697. if ( special.remove ) {
  13698. special.remove.call( elem, handleObj );
  13699. }
  13700. }
  13701. }
  13702. // Remove generic event handler if we removed something and no more handlers exist
  13703. // (avoids potential for endless recursion during removal of special event handlers)
  13704. if ( origCount && !handlers.length ) {
  13705. if ( !special.teardown ||
  13706. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  13707. jQuery.removeEvent( elem, type, elemData.handle );
  13708. }
  13709. delete events[ type ];
  13710. }
  13711. }
  13712. // Remove data and the expando if it's no longer used
  13713. if ( jQuery.isEmptyObject( events ) ) {
  13714. dataPriv.remove( elem, "handle events" );
  13715. }
  13716. },
  13717. dispatch: function( nativeEvent ) {
  13718. // Make a writable jQuery.Event from the native event object
  13719. var event = jQuery.event.fix( nativeEvent );
  13720. var i, j, ret, matched, handleObj, handlerQueue,
  13721. args = new Array( arguments.length ),
  13722. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  13723. special = jQuery.event.special[ event.type ] || {};
  13724. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  13725. args[ 0 ] = event;
  13726. for ( i = 1; i < arguments.length; i++ ) {
  13727. args[ i ] = arguments[ i ];
  13728. }
  13729. event.delegateTarget = this;
  13730. // Call the preDispatch hook for the mapped type, and let it bail if desired
  13731. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  13732. return;
  13733. }
  13734. // Determine handlers
  13735. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  13736. // Run delegates first; they may want to stop propagation beneath us
  13737. i = 0;
  13738. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  13739. event.currentTarget = matched.elem;
  13740. j = 0;
  13741. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  13742. !event.isImmediatePropagationStopped() ) {
  13743. // If the event is namespaced, then each handler is only invoked if it is
  13744. // specially universal or its namespaces are a superset of the event's.
  13745. if ( !event.rnamespace || handleObj.namespace === false ||
  13746. event.rnamespace.test( handleObj.namespace ) ) {
  13747. event.handleObj = handleObj;
  13748. event.data = handleObj.data;
  13749. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  13750. handleObj.handler ).apply( matched.elem, args );
  13751. if ( ret !== undefined ) {
  13752. if ( ( event.result = ret ) === false ) {
  13753. event.preventDefault();
  13754. event.stopPropagation();
  13755. }
  13756. }
  13757. }
  13758. }
  13759. }
  13760. // Call the postDispatch hook for the mapped type
  13761. if ( special.postDispatch ) {
  13762. special.postDispatch.call( this, event );
  13763. }
  13764. return event.result;
  13765. },
  13766. handlers: function( event, handlers ) {
  13767. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  13768. handlerQueue = [],
  13769. delegateCount = handlers.delegateCount,
  13770. cur = event.target;
  13771. // Find delegate handlers
  13772. if ( delegateCount &&
  13773. // Support: IE <=9
  13774. // Black-hole SVG <use> instance trees (trac-13180)
  13775. cur.nodeType &&
  13776. // Support: Firefox <=42
  13777. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  13778. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  13779. // Support: IE 11 only
  13780. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  13781. !( event.type === "click" && event.button >= 1 ) ) {
  13782. for ( ; cur !== this; cur = cur.parentNode || this ) {
  13783. // Don't check non-elements (#13208)
  13784. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  13785. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  13786. matchedHandlers = [];
  13787. matchedSelectors = {};
  13788. for ( i = 0; i < delegateCount; i++ ) {
  13789. handleObj = handlers[ i ];
  13790. // Don't conflict with Object.prototype properties (#13203)
  13791. sel = handleObj.selector + " ";
  13792. if ( matchedSelectors[ sel ] === undefined ) {
  13793. matchedSelectors[ sel ] = handleObj.needsContext ?
  13794. jQuery( sel, this ).index( cur ) > -1 :
  13795. jQuery.find( sel, this, null, [ cur ] ).length;
  13796. }
  13797. if ( matchedSelectors[ sel ] ) {
  13798. matchedHandlers.push( handleObj );
  13799. }
  13800. }
  13801. if ( matchedHandlers.length ) {
  13802. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  13803. }
  13804. }
  13805. }
  13806. }
  13807. // Add the remaining (directly-bound) handlers
  13808. cur = this;
  13809. if ( delegateCount < handlers.length ) {
  13810. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  13811. }
  13812. return handlerQueue;
  13813. },
  13814. addProp: function( name, hook ) {
  13815. Object.defineProperty( jQuery.Event.prototype, name, {
  13816. enumerable: true,
  13817. configurable: true,
  13818. get: isFunction( hook ) ?
  13819. function() {
  13820. if ( this.originalEvent ) {
  13821. return hook( this.originalEvent );
  13822. }
  13823. } :
  13824. function() {
  13825. if ( this.originalEvent ) {
  13826. return this.originalEvent[ name ];
  13827. }
  13828. },
  13829. set: function( value ) {
  13830. Object.defineProperty( this, name, {
  13831. enumerable: true,
  13832. configurable: true,
  13833. writable: true,
  13834. value: value
  13835. } );
  13836. }
  13837. } );
  13838. },
  13839. fix: function( originalEvent ) {
  13840. return originalEvent[ jQuery.expando ] ?
  13841. originalEvent :
  13842. new jQuery.Event( originalEvent );
  13843. },
  13844. special: {
  13845. load: {
  13846. // Prevent triggered image.load events from bubbling to window.load
  13847. noBubble: true
  13848. },
  13849. click: {
  13850. // Utilize native event to ensure correct state for checkable inputs
  13851. setup: function( data ) {
  13852. // For mutual compressibility with _default, replace `this` access with a local var.
  13853. // `|| data` is dead code meant only to preserve the variable through minification.
  13854. var el = this || data;
  13855. // Claim the first handler
  13856. if ( rcheckableType.test( el.type ) &&
  13857. el.click && nodeName( el, "input" ) ) {
  13858. // dataPriv.set( el, "click", ... )
  13859. leverageNative( el, "click", returnTrue );
  13860. }
  13861. // Return false to allow normal processing in the caller
  13862. return false;
  13863. },
  13864. trigger: function( data ) {
  13865. // For mutual compressibility with _default, replace `this` access with a local var.
  13866. // `|| data` is dead code meant only to preserve the variable through minification.
  13867. var el = this || data;
  13868. // Force setup before triggering a click
  13869. if ( rcheckableType.test( el.type ) &&
  13870. el.click && nodeName( el, "input" ) ) {
  13871. leverageNative( el, "click" );
  13872. }
  13873. // Return non-false to allow normal event-path propagation
  13874. return true;
  13875. },
  13876. // For cross-browser consistency, suppress native .click() on links
  13877. // Also prevent it if we're currently inside a leveraged native-event stack
  13878. _default: function( event ) {
  13879. var target = event.target;
  13880. return rcheckableType.test( target.type ) &&
  13881. target.click && nodeName( target, "input" ) &&
  13882. dataPriv.get( target, "click" ) ||
  13883. nodeName( target, "a" );
  13884. }
  13885. },
  13886. beforeunload: {
  13887. postDispatch: function( event ) {
  13888. // Support: Firefox 20+
  13889. // Firefox doesn't alert if the returnValue field is not set.
  13890. if ( event.result !== undefined && event.originalEvent ) {
  13891. event.originalEvent.returnValue = event.result;
  13892. }
  13893. }
  13894. }
  13895. }
  13896. };
  13897. // Ensure the presence of an event listener that handles manually-triggered
  13898. // synthetic events by interrupting progress until reinvoked in response to
  13899. // *native* events that it fires directly, ensuring that state changes have
  13900. // already occurred before other listeners are invoked.
  13901. function leverageNative( el, type, expectSync ) {
  13902. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  13903. if ( !expectSync ) {
  13904. if ( dataPriv.get( el, type ) === undefined ) {
  13905. jQuery.event.add( el, type, returnTrue );
  13906. }
  13907. return;
  13908. }
  13909. // Register the controller as a special universal handler for all event namespaces
  13910. dataPriv.set( el, type, false );
  13911. jQuery.event.add( el, type, {
  13912. namespace: false,
  13913. handler: function( event ) {
  13914. var notAsync, result,
  13915. saved = dataPriv.get( this, type );
  13916. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  13917. // Interrupt processing of the outer synthetic .trigger()ed event
  13918. // Saved data should be false in such cases, but might be a leftover capture object
  13919. // from an async native handler (gh-4350)
  13920. if ( !saved.length ) {
  13921. // Store arguments for use when handling the inner native event
  13922. // There will always be at least one argument (an event object), so this array
  13923. // will not be confused with a leftover capture object.
  13924. saved = slice.call( arguments );
  13925. dataPriv.set( this, type, saved );
  13926. // Trigger the native event and capture its result
  13927. // Support: IE <=9 - 11+
  13928. // focus() and blur() are asynchronous
  13929. notAsync = expectSync( this, type );
  13930. this[ type ]();
  13931. result = dataPriv.get( this, type );
  13932. if ( saved !== result || notAsync ) {
  13933. dataPriv.set( this, type, false );
  13934. } else {
  13935. result = {};
  13936. }
  13937. if ( saved !== result ) {
  13938. // Cancel the outer synthetic event
  13939. event.stopImmediatePropagation();
  13940. event.preventDefault();
  13941. return result.value;
  13942. }
  13943. // If this is an inner synthetic event for an event with a bubbling surrogate
  13944. // (focus or blur), assume that the surrogate already propagated from triggering the
  13945. // native event and prevent that from happening again here.
  13946. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  13947. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  13948. // less bad than duplication.
  13949. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  13950. event.stopPropagation();
  13951. }
  13952. // If this is a native event triggered above, everything is now in order
  13953. // Fire an inner synthetic event with the original arguments
  13954. } else if ( saved.length ) {
  13955. // ...and capture the result
  13956. dataPriv.set( this, type, {
  13957. value: jQuery.event.trigger(
  13958. // Support: IE <=9 - 11+
  13959. // Extend with the prototype to reset the above stopImmediatePropagation()
  13960. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  13961. saved.slice( 1 ),
  13962. this
  13963. )
  13964. } );
  13965. // Abort handling of the native event
  13966. event.stopImmediatePropagation();
  13967. }
  13968. }
  13969. } );
  13970. }
  13971. jQuery.removeEvent = function( elem, type, handle ) {
  13972. // This "if" is needed for plain objects
  13973. if ( elem.removeEventListener ) {
  13974. elem.removeEventListener( type, handle );
  13975. }
  13976. };
  13977. jQuery.Event = function( src, props ) {
  13978. // Allow instantiation without the 'new' keyword
  13979. if ( !( this instanceof jQuery.Event ) ) {
  13980. return new jQuery.Event( src, props );
  13981. }
  13982. // Event object
  13983. if ( src && src.type ) {
  13984. this.originalEvent = src;
  13985. this.type = src.type;
  13986. // Events bubbling up the document may have been marked as prevented
  13987. // by a handler lower down the tree; reflect the correct value.
  13988. this.isDefaultPrevented = src.defaultPrevented ||
  13989. src.defaultPrevented === undefined &&
  13990. // Support: Android <=2.3 only
  13991. src.returnValue === false ?
  13992. returnTrue :
  13993. returnFalse;
  13994. // Create target properties
  13995. // Support: Safari <=6 - 7 only
  13996. // Target should not be a text node (#504, #13143)
  13997. this.target = ( src.target && src.target.nodeType === 3 ) ?
  13998. src.target.parentNode :
  13999. src.target;
  14000. this.currentTarget = src.currentTarget;
  14001. this.relatedTarget = src.relatedTarget;
  14002. // Event type
  14003. } else {
  14004. this.type = src;
  14005. }
  14006. // Put explicitly provided properties onto the event object
  14007. if ( props ) {
  14008. jQuery.extend( this, props );
  14009. }
  14010. // Create a timestamp if incoming event doesn't have one
  14011. this.timeStamp = src && src.timeStamp || Date.now();
  14012. // Mark it as fixed
  14013. this[ jQuery.expando ] = true;
  14014. };
  14015. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  14016. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  14017. jQuery.Event.prototype = {
  14018. constructor: jQuery.Event,
  14019. isDefaultPrevented: returnFalse,
  14020. isPropagationStopped: returnFalse,
  14021. isImmediatePropagationStopped: returnFalse,
  14022. isSimulated: false,
  14023. preventDefault: function() {
  14024. var e = this.originalEvent;
  14025. this.isDefaultPrevented = returnTrue;
  14026. if ( e && !this.isSimulated ) {
  14027. e.preventDefault();
  14028. }
  14029. },
  14030. stopPropagation: function() {
  14031. var e = this.originalEvent;
  14032. this.isPropagationStopped = returnTrue;
  14033. if ( e && !this.isSimulated ) {
  14034. e.stopPropagation();
  14035. }
  14036. },
  14037. stopImmediatePropagation: function() {
  14038. var e = this.originalEvent;
  14039. this.isImmediatePropagationStopped = returnTrue;
  14040. if ( e && !this.isSimulated ) {
  14041. e.stopImmediatePropagation();
  14042. }
  14043. this.stopPropagation();
  14044. }
  14045. };
  14046. // Includes all common event props including KeyEvent and MouseEvent specific props
  14047. jQuery.each( {
  14048. altKey: true,
  14049. bubbles: true,
  14050. cancelable: true,
  14051. changedTouches: true,
  14052. ctrlKey: true,
  14053. detail: true,
  14054. eventPhase: true,
  14055. metaKey: true,
  14056. pageX: true,
  14057. pageY: true,
  14058. shiftKey: true,
  14059. view: true,
  14060. "char": true,
  14061. code: true,
  14062. charCode: true,
  14063. key: true,
  14064. keyCode: true,
  14065. button: true,
  14066. buttons: true,
  14067. clientX: true,
  14068. clientY: true,
  14069. offsetX: true,
  14070. offsetY: true,
  14071. pointerId: true,
  14072. pointerType: true,
  14073. screenX: true,
  14074. screenY: true,
  14075. targetTouches: true,
  14076. toElement: true,
  14077. touches: true,
  14078. which: function( event ) {
  14079. var button = event.button;
  14080. // Add which for key events
  14081. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  14082. return event.charCode != null ? event.charCode : event.keyCode;
  14083. }
  14084. // Add which for click: 1 === left; 2 === middle; 3 === right
  14085. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  14086. if ( button & 1 ) {
  14087. return 1;
  14088. }
  14089. if ( button & 2 ) {
  14090. return 3;
  14091. }
  14092. if ( button & 4 ) {
  14093. return 2;
  14094. }
  14095. return 0;
  14096. }
  14097. return event.which;
  14098. }
  14099. }, jQuery.event.addProp );
  14100. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  14101. jQuery.event.special[ type ] = {
  14102. // Utilize native event if possible so blur/focus sequence is correct
  14103. setup: function() {
  14104. // Claim the first handler
  14105. // dataPriv.set( this, "focus", ... )
  14106. // dataPriv.set( this, "blur", ... )
  14107. leverageNative( this, type, expectSync );
  14108. // Return false to allow normal processing in the caller
  14109. return false;
  14110. },
  14111. trigger: function() {
  14112. // Force setup before trigger
  14113. leverageNative( this, type );
  14114. // Return non-false to allow normal event-path propagation
  14115. return true;
  14116. },
  14117. delegateType: delegateType
  14118. };
  14119. } );
  14120. // Create mouseenter/leave events using mouseover/out and event-time checks
  14121. // so that event delegation works in jQuery.
  14122. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  14123. //
  14124. // Support: Safari 7 only
  14125. // Safari sends mouseenter too often; see:
  14126. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  14127. // for the description of the bug (it existed in older Chrome versions as well).
  14128. jQuery.each( {
  14129. mouseenter: "mouseover",
  14130. mouseleave: "mouseout",
  14131. pointerenter: "pointerover",
  14132. pointerleave: "pointerout"
  14133. }, function( orig, fix ) {
  14134. jQuery.event.special[ orig ] = {
  14135. delegateType: fix,
  14136. bindType: fix,
  14137. handle: function( event ) {
  14138. var ret,
  14139. target = this,
  14140. related = event.relatedTarget,
  14141. handleObj = event.handleObj;
  14142. // For mouseenter/leave call the handler if related is outside the target.
  14143. // NB: No relatedTarget if the mouse left/entered the browser window
  14144. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  14145. event.type = handleObj.origType;
  14146. ret = handleObj.handler.apply( this, arguments );
  14147. event.type = fix;
  14148. }
  14149. return ret;
  14150. }
  14151. };
  14152. } );
  14153. jQuery.fn.extend( {
  14154. on: function( types, selector, data, fn ) {
  14155. return on( this, types, selector, data, fn );
  14156. },
  14157. one: function( types, selector, data, fn ) {
  14158. return on( this, types, selector, data, fn, 1 );
  14159. },
  14160. off: function( types, selector, fn ) {
  14161. var handleObj, type;
  14162. if ( types && types.preventDefault && types.handleObj ) {
  14163. // ( event ) dispatched jQuery.Event
  14164. handleObj = types.handleObj;
  14165. jQuery( types.delegateTarget ).off(
  14166. handleObj.namespace ?
  14167. handleObj.origType + "." + handleObj.namespace :
  14168. handleObj.origType,
  14169. handleObj.selector,
  14170. handleObj.handler
  14171. );
  14172. return this;
  14173. }
  14174. if ( typeof types === "object" ) {
  14175. // ( types-object [, selector] )
  14176. for ( type in types ) {
  14177. this.off( type, selector, types[ type ] );
  14178. }
  14179. return this;
  14180. }
  14181. if ( selector === false || typeof selector === "function" ) {
  14182. // ( types [, fn] )
  14183. fn = selector;
  14184. selector = undefined;
  14185. }
  14186. if ( fn === false ) {
  14187. fn = returnFalse;
  14188. }
  14189. return this.each( function() {
  14190. jQuery.event.remove( this, types, fn, selector );
  14191. } );
  14192. }
  14193. } );
  14194. var
  14195. /* eslint-disable max-len */
  14196. // See https://github.com/eslint/eslint/issues/3229
  14197. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  14198. /* eslint-enable */
  14199. // Support: IE <=10 - 11, Edge 12 - 13 only
  14200. // In IE/Edge using regex groups here causes severe slowdowns.
  14201. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  14202. rnoInnerhtml = /<script|<style|<link/i,
  14203. // checked="checked" or checked
  14204. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  14205. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  14206. // Prefer a tbody over its parent table for containing new rows
  14207. function manipulationTarget( elem, content ) {
  14208. if ( nodeName( elem, "table" ) &&
  14209. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  14210. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  14211. }
  14212. return elem;
  14213. }
  14214. // Replace/restore the type attribute of script elements for safe DOM manipulation
  14215. function disableScript( elem ) {
  14216. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  14217. return elem;
  14218. }
  14219. function restoreScript( elem ) {
  14220. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  14221. elem.type = elem.type.slice( 5 );
  14222. } else {
  14223. elem.removeAttribute( "type" );
  14224. }
  14225. return elem;
  14226. }
  14227. function cloneCopyEvent( src, dest ) {
  14228. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  14229. if ( dest.nodeType !== 1 ) {
  14230. return;
  14231. }
  14232. // 1. Copy private data: events, handlers, etc.
  14233. if ( dataPriv.hasData( src ) ) {
  14234. pdataOld = dataPriv.access( src );
  14235. pdataCur = dataPriv.set( dest, pdataOld );
  14236. events = pdataOld.events;
  14237. if ( events ) {
  14238. delete pdataCur.handle;
  14239. pdataCur.events = {};
  14240. for ( type in events ) {
  14241. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  14242. jQuery.event.add( dest, type, events[ type ][ i ] );
  14243. }
  14244. }
  14245. }
  14246. }
  14247. // 2. Copy user data
  14248. if ( dataUser.hasData( src ) ) {
  14249. udataOld = dataUser.access( src );
  14250. udataCur = jQuery.extend( {}, udataOld );
  14251. dataUser.set( dest, udataCur );
  14252. }
  14253. }
  14254. // Fix IE bugs, see support tests
  14255. function fixInput( src, dest ) {
  14256. var nodeName = dest.nodeName.toLowerCase();
  14257. // Fails to persist the checked state of a cloned checkbox or radio button.
  14258. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  14259. dest.checked = src.checked;
  14260. // Fails to return the selected option to the default selected state when cloning options
  14261. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  14262. dest.defaultValue = src.defaultValue;
  14263. }
  14264. }
  14265. function domManip( collection, args, callback, ignored ) {
  14266. // Flatten any nested arrays
  14267. args = concat.apply( [], args );
  14268. var fragment, first, scripts, hasScripts, node, doc,
  14269. i = 0,
  14270. l = collection.length,
  14271. iNoClone = l - 1,
  14272. value = args[ 0 ],
  14273. valueIsFunction = isFunction( value );
  14274. // We can't cloneNode fragments that contain checked, in WebKit
  14275. if ( valueIsFunction ||
  14276. ( l > 1 && typeof value === "string" &&
  14277. !support.checkClone && rchecked.test( value ) ) ) {
  14278. return collection.each( function( index ) {
  14279. var self = collection.eq( index );
  14280. if ( valueIsFunction ) {
  14281. args[ 0 ] = value.call( this, index, self.html() );
  14282. }
  14283. domManip( self, args, callback, ignored );
  14284. } );
  14285. }
  14286. if ( l ) {
  14287. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  14288. first = fragment.firstChild;
  14289. if ( fragment.childNodes.length === 1 ) {
  14290. fragment = first;
  14291. }
  14292. // Require either new content or an interest in ignored elements to invoke the callback
  14293. if ( first || ignored ) {
  14294. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  14295. hasScripts = scripts.length;
  14296. // Use the original fragment for the last item
  14297. // instead of the first because it can end up
  14298. // being emptied incorrectly in certain situations (#8070).
  14299. for ( ; i < l; i++ ) {
  14300. node = fragment;
  14301. if ( i !== iNoClone ) {
  14302. node = jQuery.clone( node, true, true );
  14303. // Keep references to cloned scripts for later restoration
  14304. if ( hasScripts ) {
  14305. // Support: Android <=4.0 only, PhantomJS 1 only
  14306. // push.apply(_, arraylike) throws on ancient WebKit
  14307. jQuery.merge( scripts, getAll( node, "script" ) );
  14308. }
  14309. }
  14310. callback.call( collection[ i ], node, i );
  14311. }
  14312. if ( hasScripts ) {
  14313. doc = scripts[ scripts.length - 1 ].ownerDocument;
  14314. // Reenable scripts
  14315. jQuery.map( scripts, restoreScript );
  14316. // Evaluate executable scripts on first document insertion
  14317. for ( i = 0; i < hasScripts; i++ ) {
  14318. node = scripts[ i ];
  14319. if ( rscriptType.test( node.type || "" ) &&
  14320. !dataPriv.access( node, "globalEval" ) &&
  14321. jQuery.contains( doc, node ) ) {
  14322. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  14323. // Optional AJAX dependency, but won't run scripts if not present
  14324. if ( jQuery._evalUrl && !node.noModule ) {
  14325. jQuery._evalUrl( node.src, {
  14326. nonce: node.nonce || node.getAttribute( "nonce" )
  14327. } );
  14328. }
  14329. } else {
  14330. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  14331. }
  14332. }
  14333. }
  14334. }
  14335. }
  14336. }
  14337. return collection;
  14338. }
  14339. function remove( elem, selector, keepData ) {
  14340. var node,
  14341. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  14342. i = 0;
  14343. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  14344. if ( !keepData && node.nodeType === 1 ) {
  14345. jQuery.cleanData( getAll( node ) );
  14346. }
  14347. if ( node.parentNode ) {
  14348. if ( keepData && isAttached( node ) ) {
  14349. setGlobalEval( getAll( node, "script" ) );
  14350. }
  14351. node.parentNode.removeChild( node );
  14352. }
  14353. }
  14354. return elem;
  14355. }
  14356. jQuery.extend( {
  14357. htmlPrefilter: function( html ) {
  14358. return html.replace( rxhtmlTag, "<$1></$2>" );
  14359. },
  14360. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  14361. var i, l, srcElements, destElements,
  14362. clone = elem.cloneNode( true ),
  14363. inPage = isAttached( elem );
  14364. // Fix IE cloning issues
  14365. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  14366. !jQuery.isXMLDoc( elem ) ) {
  14367. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  14368. destElements = getAll( clone );
  14369. srcElements = getAll( elem );
  14370. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  14371. fixInput( srcElements[ i ], destElements[ i ] );
  14372. }
  14373. }
  14374. // Copy the events from the original to the clone
  14375. if ( dataAndEvents ) {
  14376. if ( deepDataAndEvents ) {
  14377. srcElements = srcElements || getAll( elem );
  14378. destElements = destElements || getAll( clone );
  14379. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  14380. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  14381. }
  14382. } else {
  14383. cloneCopyEvent( elem, clone );
  14384. }
  14385. }
  14386. // Preserve script evaluation history
  14387. destElements = getAll( clone, "script" );
  14388. if ( destElements.length > 0 ) {
  14389. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  14390. }
  14391. // Return the cloned set
  14392. return clone;
  14393. },
  14394. cleanData: function( elems ) {
  14395. var data, elem, type,
  14396. special = jQuery.event.special,
  14397. i = 0;
  14398. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  14399. if ( acceptData( elem ) ) {
  14400. if ( ( data = elem[ dataPriv.expando ] ) ) {
  14401. if ( data.events ) {
  14402. for ( type in data.events ) {
  14403. if ( special[ type ] ) {
  14404. jQuery.event.remove( elem, type );
  14405. // This is a shortcut to avoid jQuery.event.remove's overhead
  14406. } else {
  14407. jQuery.removeEvent( elem, type, data.handle );
  14408. }
  14409. }
  14410. }
  14411. // Support: Chrome <=35 - 45+
  14412. // Assign undefined instead of using delete, see Data#remove
  14413. elem[ dataPriv.expando ] = undefined;
  14414. }
  14415. if ( elem[ dataUser.expando ] ) {
  14416. // Support: Chrome <=35 - 45+
  14417. // Assign undefined instead of using delete, see Data#remove
  14418. elem[ dataUser.expando ] = undefined;
  14419. }
  14420. }
  14421. }
  14422. }
  14423. } );
  14424. jQuery.fn.extend( {
  14425. detach: function( selector ) {
  14426. return remove( this, selector, true );
  14427. },
  14428. remove: function( selector ) {
  14429. return remove( this, selector );
  14430. },
  14431. text: function( value ) {
  14432. return access( this, function( value ) {
  14433. return value === undefined ?
  14434. jQuery.text( this ) :
  14435. this.empty().each( function() {
  14436. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  14437. this.textContent = value;
  14438. }
  14439. } );
  14440. }, null, value, arguments.length );
  14441. },
  14442. append: function() {
  14443. return domManip( this, arguments, function( elem ) {
  14444. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  14445. var target = manipulationTarget( this, elem );
  14446. target.appendChild( elem );
  14447. }
  14448. } );
  14449. },
  14450. prepend: function() {
  14451. return domManip( this, arguments, function( elem ) {
  14452. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  14453. var target = manipulationTarget( this, elem );
  14454. target.insertBefore( elem, target.firstChild );
  14455. }
  14456. } );
  14457. },
  14458. before: function() {
  14459. return domManip( this, arguments, function( elem ) {
  14460. if ( this.parentNode ) {
  14461. this.parentNode.insertBefore( elem, this );
  14462. }
  14463. } );
  14464. },
  14465. after: function() {
  14466. return domManip( this, arguments, function( elem ) {
  14467. if ( this.parentNode ) {
  14468. this.parentNode.insertBefore( elem, this.nextSibling );
  14469. }
  14470. } );
  14471. },
  14472. empty: function() {
  14473. var elem,
  14474. i = 0;
  14475. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  14476. if ( elem.nodeType === 1 ) {
  14477. // Prevent memory leaks
  14478. jQuery.cleanData( getAll( elem, false ) );
  14479. // Remove any remaining nodes
  14480. elem.textContent = "";
  14481. }
  14482. }
  14483. return this;
  14484. },
  14485. clone: function( dataAndEvents, deepDataAndEvents ) {
  14486. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  14487. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  14488. return this.map( function() {
  14489. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  14490. } );
  14491. },
  14492. html: function( value ) {
  14493. return access( this, function( value ) {
  14494. var elem = this[ 0 ] || {},
  14495. i = 0,
  14496. l = this.length;
  14497. if ( value === undefined && elem.nodeType === 1 ) {
  14498. return elem.innerHTML;
  14499. }
  14500. // See if we can take a shortcut and just use innerHTML
  14501. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  14502. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  14503. value = jQuery.htmlPrefilter( value );
  14504. try {
  14505. for ( ; i < l; i++ ) {
  14506. elem = this[ i ] || {};
  14507. // Remove element nodes and prevent memory leaks
  14508. if ( elem.nodeType === 1 ) {
  14509. jQuery.cleanData( getAll( elem, false ) );
  14510. elem.innerHTML = value;
  14511. }
  14512. }
  14513. elem = 0;
  14514. // If using innerHTML throws an exception, use the fallback method
  14515. } catch ( e ) {}
  14516. }
  14517. if ( elem ) {
  14518. this.empty().append( value );
  14519. }
  14520. }, null, value, arguments.length );
  14521. },
  14522. replaceWith: function() {
  14523. var ignored = [];
  14524. // Make the changes, replacing each non-ignored context element with the new content
  14525. return domManip( this, arguments, function( elem ) {
  14526. var parent = this.parentNode;
  14527. if ( jQuery.inArray( this, ignored ) < 0 ) {
  14528. jQuery.cleanData( getAll( this ) );
  14529. if ( parent ) {
  14530. parent.replaceChild( elem, this );
  14531. }
  14532. }
  14533. // Force callback invocation
  14534. }, ignored );
  14535. }
  14536. } );
  14537. jQuery.each( {
  14538. appendTo: "append",
  14539. prependTo: "prepend",
  14540. insertBefore: "before",
  14541. insertAfter: "after",
  14542. replaceAll: "replaceWith"
  14543. }, function( name, original ) {
  14544. jQuery.fn[ name ] = function( selector ) {
  14545. var elems,
  14546. ret = [],
  14547. insert = jQuery( selector ),
  14548. last = insert.length - 1,
  14549. i = 0;
  14550. for ( ; i <= last; i++ ) {
  14551. elems = i === last ? this : this.clone( true );
  14552. jQuery( insert[ i ] )[ original ]( elems );
  14553. // Support: Android <=4.0 only, PhantomJS 1 only
  14554. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  14555. push.apply( ret, elems.get() );
  14556. }
  14557. return this.pushStack( ret );
  14558. };
  14559. } );
  14560. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  14561. var getStyles = function( elem ) {
  14562. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  14563. // IE throws on elements created in popups
  14564. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  14565. var view = elem.ownerDocument.defaultView;
  14566. if ( !view || !view.opener ) {
  14567. view = window;
  14568. }
  14569. return view.getComputedStyle( elem );
  14570. };
  14571. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  14572. ( function() {
  14573. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  14574. // so they're executed at the same time to save the second computation.
  14575. function computeStyleTests() {
  14576. // This is a singleton, we need to execute it only once
  14577. if ( !div ) {
  14578. return;
  14579. }
  14580. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  14581. "margin-top:1px;padding:0;border:0";
  14582. div.style.cssText =
  14583. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  14584. "margin:auto;border:1px;padding:1px;" +
  14585. "width:60%;top:1%";
  14586. documentElement.appendChild( container ).appendChild( div );
  14587. var divStyle = window.getComputedStyle( div );
  14588. pixelPositionVal = divStyle.top !== "1%";
  14589. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  14590. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  14591. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  14592. // Some styles come back with percentage values, even though they shouldn't
  14593. div.style.right = "60%";
  14594. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  14595. // Support: IE 9 - 11 only
  14596. // Detect misreporting of content dimensions for box-sizing:border-box elements
  14597. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  14598. // Support: IE 9 only
  14599. // Detect overflow:scroll screwiness (gh-3699)
  14600. // Support: Chrome <=64
  14601. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  14602. div.style.position = "absolute";
  14603. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  14604. documentElement.removeChild( container );
  14605. // Nullify the div so it wouldn't be stored in the memory and
  14606. // it will also be a sign that checks already performed
  14607. div = null;
  14608. }
  14609. function roundPixelMeasures( measure ) {
  14610. return Math.round( parseFloat( measure ) );
  14611. }
  14612. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  14613. reliableMarginLeftVal,
  14614. container = document.createElement( "div" ),
  14615. div = document.createElement( "div" );
  14616. // Finish early in limited (non-browser) environments
  14617. if ( !div.style ) {
  14618. return;
  14619. }
  14620. // Support: IE <=9 - 11 only
  14621. // Style of cloned element affects source element cloned (#8908)
  14622. div.style.backgroundClip = "content-box";
  14623. div.cloneNode( true ).style.backgroundClip = "";
  14624. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  14625. jQuery.extend( support, {
  14626. boxSizingReliable: function() {
  14627. computeStyleTests();
  14628. return boxSizingReliableVal;
  14629. },
  14630. pixelBoxStyles: function() {
  14631. computeStyleTests();
  14632. return pixelBoxStylesVal;
  14633. },
  14634. pixelPosition: function() {
  14635. computeStyleTests();
  14636. return pixelPositionVal;
  14637. },
  14638. reliableMarginLeft: function() {
  14639. computeStyleTests();
  14640. return reliableMarginLeftVal;
  14641. },
  14642. scrollboxSize: function() {
  14643. computeStyleTests();
  14644. return scrollboxSizeVal;
  14645. }
  14646. } );
  14647. } )();
  14648. function curCSS( elem, name, computed ) {
  14649. var width, minWidth, maxWidth, ret,
  14650. // Support: Firefox 51+
  14651. // Retrieving style before computed somehow
  14652. // fixes an issue with getting wrong values
  14653. // on detached elements
  14654. style = elem.style;
  14655. computed = computed || getStyles( elem );
  14656. // getPropertyValue is needed for:
  14657. // .css('filter') (IE 9 only, #12537)
  14658. // .css('--customProperty) (#3144)
  14659. if ( computed ) {
  14660. ret = computed.getPropertyValue( name ) || computed[ name ];
  14661. if ( ret === "" && !isAttached( elem ) ) {
  14662. ret = jQuery.style( elem, name );
  14663. }
  14664. // A tribute to the "awesome hack by Dean Edwards"
  14665. // Android Browser returns percentage for some values,
  14666. // but width seems to be reliably pixels.
  14667. // This is against the CSSOM draft spec:
  14668. // https://drafts.csswg.org/cssom/#resolved-values
  14669. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  14670. // Remember the original values
  14671. width = style.width;
  14672. minWidth = style.minWidth;
  14673. maxWidth = style.maxWidth;
  14674. // Put in the new values to get a computed value out
  14675. style.minWidth = style.maxWidth = style.width = ret;
  14676. ret = computed.width;
  14677. // Revert the changed values
  14678. style.width = width;
  14679. style.minWidth = minWidth;
  14680. style.maxWidth = maxWidth;
  14681. }
  14682. }
  14683. return ret !== undefined ?
  14684. // Support: IE <=9 - 11 only
  14685. // IE returns zIndex value as an integer.
  14686. ret + "" :
  14687. ret;
  14688. }
  14689. function addGetHookIf( conditionFn, hookFn ) {
  14690. // Define the hook, we'll check on the first run if it's really needed.
  14691. return {
  14692. get: function() {
  14693. if ( conditionFn() ) {
  14694. // Hook not needed (or it's not possible to use it due
  14695. // to missing dependency), remove it.
  14696. delete this.get;
  14697. return;
  14698. }
  14699. // Hook needed; redefine it so that the support test is not executed again.
  14700. return ( this.get = hookFn ).apply( this, arguments );
  14701. }
  14702. };
  14703. }
  14704. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  14705. emptyStyle = document.createElement( "div" ).style,
  14706. vendorProps = {};
  14707. // Return a vendor-prefixed property or undefined
  14708. function vendorPropName( name ) {
  14709. // Check for vendor prefixed names
  14710. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  14711. i = cssPrefixes.length;
  14712. while ( i-- ) {
  14713. name = cssPrefixes[ i ] + capName;
  14714. if ( name in emptyStyle ) {
  14715. return name;
  14716. }
  14717. }
  14718. }
  14719. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  14720. function finalPropName( name ) {
  14721. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  14722. if ( final ) {
  14723. return final;
  14724. }
  14725. if ( name in emptyStyle ) {
  14726. return name;
  14727. }
  14728. return vendorProps[ name ] = vendorPropName( name ) || name;
  14729. }
  14730. var
  14731. // Swappable if display is none or starts with table
  14732. // except "table", "table-cell", or "table-caption"
  14733. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  14734. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  14735. rcustomProp = /^--/,
  14736. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  14737. cssNormalTransform = {
  14738. letterSpacing: "0",
  14739. fontWeight: "400"
  14740. };
  14741. function setPositiveNumber( elem, value, subtract ) {
  14742. // Any relative (+/-) values have already been
  14743. // normalized at this point
  14744. var matches = rcssNum.exec( value );
  14745. return matches ?
  14746. // Guard against undefined "subtract", e.g., when used as in cssHooks
  14747. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  14748. value;
  14749. }
  14750. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  14751. var i = dimension === "width" ? 1 : 0,
  14752. extra = 0,
  14753. delta = 0;
  14754. // Adjustment may not be necessary
  14755. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  14756. return 0;
  14757. }
  14758. for ( ; i < 4; i += 2 ) {
  14759. // Both box models exclude margin
  14760. if ( box === "margin" ) {
  14761. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  14762. }
  14763. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  14764. if ( !isBorderBox ) {
  14765. // Add padding
  14766. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  14767. // For "border" or "margin", add border
  14768. if ( box !== "padding" ) {
  14769. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  14770. // But still keep track of it otherwise
  14771. } else {
  14772. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  14773. }
  14774. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  14775. // "padding" or "margin"
  14776. } else {
  14777. // For "content", subtract padding
  14778. if ( box === "content" ) {
  14779. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  14780. }
  14781. // For "content" or "padding", subtract border
  14782. if ( box !== "margin" ) {
  14783. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  14784. }
  14785. }
  14786. }
  14787. // Account for positive content-box scroll gutter when requested by providing computedVal
  14788. if ( !isBorderBox && computedVal >= 0 ) {
  14789. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  14790. // Assuming integer scroll gutter, subtract the rest and round down
  14791. delta += Math.max( 0, Math.ceil(
  14792. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  14793. computedVal -
  14794. delta -
  14795. extra -
  14796. 0.5
  14797. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  14798. // Use an explicit zero to avoid NaN (gh-3964)
  14799. ) ) || 0;
  14800. }
  14801. return delta;
  14802. }
  14803. function getWidthOrHeight( elem, dimension, extra ) {
  14804. // Start with computed style
  14805. var styles = getStyles( elem ),
  14806. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  14807. // Fake content-box until we know it's needed to know the true value.
  14808. boxSizingNeeded = !support.boxSizingReliable() || extra,
  14809. isBorderBox = boxSizingNeeded &&
  14810. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14811. valueIsBorderBox = isBorderBox,
  14812. val = curCSS( elem, dimension, styles ),
  14813. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  14814. // Support: Firefox <=54
  14815. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  14816. if ( rnumnonpx.test( val ) ) {
  14817. if ( !extra ) {
  14818. return val;
  14819. }
  14820. val = "auto";
  14821. }
  14822. // Fall back to offsetWidth/offsetHeight when value is "auto"
  14823. // This happens for inline elements with no explicit setting (gh-3571)
  14824. // Support: Android <=4.1 - 4.3 only
  14825. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  14826. // Support: IE 9-11 only
  14827. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  14828. // We use getClientRects() to check for hidden/disconnected.
  14829. // In those cases, the computed value can be trusted to be border-box
  14830. if ( ( !support.boxSizingReliable() && isBorderBox ||
  14831. val === "auto" ||
  14832. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  14833. elem.getClientRects().length ) {
  14834. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  14835. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  14836. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  14837. // retrieved value as a content box dimension.
  14838. valueIsBorderBox = offsetProp in elem;
  14839. if ( valueIsBorderBox ) {
  14840. val = elem[ offsetProp ];
  14841. }
  14842. }
  14843. // Normalize "" and auto
  14844. val = parseFloat( val ) || 0;
  14845. // Adjust for the element's box model
  14846. return ( val +
  14847. boxModelAdjustment(
  14848. elem,
  14849. dimension,
  14850. extra || ( isBorderBox ? "border" : "content" ),
  14851. valueIsBorderBox,
  14852. styles,
  14853. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  14854. val
  14855. )
  14856. ) + "px";
  14857. }
  14858. jQuery.extend( {
  14859. // Add in style property hooks for overriding the default
  14860. // behavior of getting and setting a style property
  14861. cssHooks: {
  14862. opacity: {
  14863. get: function( elem, computed ) {
  14864. if ( computed ) {
  14865. // We should always get a number back from opacity
  14866. var ret = curCSS( elem, "opacity" );
  14867. return ret === "" ? "1" : ret;
  14868. }
  14869. }
  14870. }
  14871. },
  14872. // Don't automatically add "px" to these possibly-unitless properties
  14873. cssNumber: {
  14874. "animationIterationCount": true,
  14875. "columnCount": true,
  14876. "fillOpacity": true,
  14877. "flexGrow": true,
  14878. "flexShrink": true,
  14879. "fontWeight": true,
  14880. "gridArea": true,
  14881. "gridColumn": true,
  14882. "gridColumnEnd": true,
  14883. "gridColumnStart": true,
  14884. "gridRow": true,
  14885. "gridRowEnd": true,
  14886. "gridRowStart": true,
  14887. "lineHeight": true,
  14888. "opacity": true,
  14889. "order": true,
  14890. "orphans": true,
  14891. "widows": true,
  14892. "zIndex": true,
  14893. "zoom": true
  14894. },
  14895. // Add in properties whose names you wish to fix before
  14896. // setting or getting the value
  14897. cssProps: {},
  14898. // Get and set the style property on a DOM Node
  14899. style: function( elem, name, value, extra ) {
  14900. // Don't set styles on text and comment nodes
  14901. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  14902. return;
  14903. }
  14904. // Make sure that we're working with the right name
  14905. var ret, type, hooks,
  14906. origName = camelCase( name ),
  14907. isCustomProp = rcustomProp.test( name ),
  14908. style = elem.style;
  14909. // Make sure that we're working with the right name. We don't
  14910. // want to query the value if it is a CSS custom property
  14911. // since they are user-defined.
  14912. if ( !isCustomProp ) {
  14913. name = finalPropName( origName );
  14914. }
  14915. // Gets hook for the prefixed version, then unprefixed version
  14916. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14917. // Check if we're setting a value
  14918. if ( value !== undefined ) {
  14919. type = typeof value;
  14920. // Convert "+=" or "-=" to relative numbers (#7345)
  14921. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  14922. value = adjustCSS( elem, name, ret );
  14923. // Fixes bug #9237
  14924. type = "number";
  14925. }
  14926. // Make sure that null and NaN values aren't set (#7116)
  14927. if ( value == null || value !== value ) {
  14928. return;
  14929. }
  14930. // If a number was passed in, add the unit (except for certain CSS properties)
  14931. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  14932. // "px" to a few hardcoded values.
  14933. if ( type === "number" && !isCustomProp ) {
  14934. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  14935. }
  14936. // background-* props affect original clone's values
  14937. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  14938. style[ name ] = "inherit";
  14939. }
  14940. // If a hook was provided, use that value, otherwise just set the specified value
  14941. if ( !hooks || !( "set" in hooks ) ||
  14942. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  14943. if ( isCustomProp ) {
  14944. style.setProperty( name, value );
  14945. } else {
  14946. style[ name ] = value;
  14947. }
  14948. }
  14949. } else {
  14950. // If a hook was provided get the non-computed value from there
  14951. if ( hooks && "get" in hooks &&
  14952. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  14953. return ret;
  14954. }
  14955. // Otherwise just get the value from the style object
  14956. return style[ name ];
  14957. }
  14958. },
  14959. css: function( elem, name, extra, styles ) {
  14960. var val, num, hooks,
  14961. origName = camelCase( name ),
  14962. isCustomProp = rcustomProp.test( name );
  14963. // Make sure that we're working with the right name. We don't
  14964. // want to modify the value if it is a CSS custom property
  14965. // since they are user-defined.
  14966. if ( !isCustomProp ) {
  14967. name = finalPropName( origName );
  14968. }
  14969. // Try prefixed name followed by the unprefixed name
  14970. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14971. // If a hook was provided get the computed value from there
  14972. if ( hooks && "get" in hooks ) {
  14973. val = hooks.get( elem, true, extra );
  14974. }
  14975. // Otherwise, if a way to get the computed value exists, use that
  14976. if ( val === undefined ) {
  14977. val = curCSS( elem, name, styles );
  14978. }
  14979. // Convert "normal" to computed value
  14980. if ( val === "normal" && name in cssNormalTransform ) {
  14981. val = cssNormalTransform[ name ];
  14982. }
  14983. // Make numeric if forced or a qualifier was provided and val looks numeric
  14984. if ( extra === "" || extra ) {
  14985. num = parseFloat( val );
  14986. return extra === true || isFinite( num ) ? num || 0 : val;
  14987. }
  14988. return val;
  14989. }
  14990. } );
  14991. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  14992. jQuery.cssHooks[ dimension ] = {
  14993. get: function( elem, computed, extra ) {
  14994. if ( computed ) {
  14995. // Certain elements can have dimension info if we invisibly show them
  14996. // but it must have a current display style that would benefit
  14997. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  14998. // Support: Safari 8+
  14999. // Table columns in Safari have non-zero offsetWidth & zero
  15000. // getBoundingClientRect().width unless display is changed.
  15001. // Support: IE <=11 only
  15002. // Running getBoundingClientRect on a disconnected node
  15003. // in IE throws an error.
  15004. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  15005. swap( elem, cssShow, function() {
  15006. return getWidthOrHeight( elem, dimension, extra );
  15007. } ) :
  15008. getWidthOrHeight( elem, dimension, extra );
  15009. }
  15010. },
  15011. set: function( elem, value, extra ) {
  15012. var matches,
  15013. styles = getStyles( elem ),
  15014. // Only read styles.position if the test has a chance to fail
  15015. // to avoid forcing a reflow.
  15016. scrollboxSizeBuggy = !support.scrollboxSize() &&
  15017. styles.position === "absolute",
  15018. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  15019. boxSizingNeeded = scrollboxSizeBuggy || extra,
  15020. isBorderBox = boxSizingNeeded &&
  15021. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  15022. subtract = extra ?
  15023. boxModelAdjustment(
  15024. elem,
  15025. dimension,
  15026. extra,
  15027. isBorderBox,
  15028. styles
  15029. ) :
  15030. 0;
  15031. // Account for unreliable border-box dimensions by comparing offset* to computed and
  15032. // faking a content-box to get border and padding (gh-3699)
  15033. if ( isBorderBox && scrollboxSizeBuggy ) {
  15034. subtract -= Math.ceil(
  15035. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  15036. parseFloat( styles[ dimension ] ) -
  15037. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  15038. 0.5
  15039. );
  15040. }
  15041. // Convert to pixels if value adjustment is needed
  15042. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  15043. ( matches[ 3 ] || "px" ) !== "px" ) {
  15044. elem.style[ dimension ] = value;
  15045. value = jQuery.css( elem, dimension );
  15046. }
  15047. return setPositiveNumber( elem, value, subtract );
  15048. }
  15049. };
  15050. } );
  15051. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  15052. function( elem, computed ) {
  15053. if ( computed ) {
  15054. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  15055. elem.getBoundingClientRect().left -
  15056. swap( elem, { marginLeft: 0 }, function() {
  15057. return elem.getBoundingClientRect().left;
  15058. } )
  15059. ) + "px";
  15060. }
  15061. }
  15062. );
  15063. // These hooks are used by animate to expand properties
  15064. jQuery.each( {
  15065. margin: "",
  15066. padding: "",
  15067. border: "Width"
  15068. }, function( prefix, suffix ) {
  15069. jQuery.cssHooks[ prefix + suffix ] = {
  15070. expand: function( value ) {
  15071. var i = 0,
  15072. expanded = {},
  15073. // Assumes a single number if not a string
  15074. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  15075. for ( ; i < 4; i++ ) {
  15076. expanded[ prefix + cssExpand[ i ] + suffix ] =
  15077. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  15078. }
  15079. return expanded;
  15080. }
  15081. };
  15082. if ( prefix !== "margin" ) {
  15083. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  15084. }
  15085. } );
  15086. jQuery.fn.extend( {
  15087. css: function( name, value ) {
  15088. return access( this, function( elem, name, value ) {
  15089. var styles, len,
  15090. map = {},
  15091. i = 0;
  15092. if ( Array.isArray( name ) ) {
  15093. styles = getStyles( elem );
  15094. len = name.length;
  15095. for ( ; i < len; i++ ) {
  15096. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  15097. }
  15098. return map;
  15099. }
  15100. return value !== undefined ?
  15101. jQuery.style( elem, name, value ) :
  15102. jQuery.css( elem, name );
  15103. }, name, value, arguments.length > 1 );
  15104. }
  15105. } );
  15106. function Tween( elem, options, prop, end, easing ) {
  15107. return new Tween.prototype.init( elem, options, prop, end, easing );
  15108. }
  15109. jQuery.Tween = Tween;
  15110. Tween.prototype = {
  15111. constructor: Tween,
  15112. init: function( elem, options, prop, end, easing, unit ) {
  15113. this.elem = elem;
  15114. this.prop = prop;
  15115. this.easing = easing || jQuery.easing._default;
  15116. this.options = options;
  15117. this.start = this.now = this.cur();
  15118. this.end = end;
  15119. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  15120. },
  15121. cur: function() {
  15122. var hooks = Tween.propHooks[ this.prop ];
  15123. return hooks && hooks.get ?
  15124. hooks.get( this ) :
  15125. Tween.propHooks._default.get( this );
  15126. },
  15127. run: function( percent ) {
  15128. var eased,
  15129. hooks = Tween.propHooks[ this.prop ];
  15130. if ( this.options.duration ) {
  15131. this.pos = eased = jQuery.easing[ this.easing ](
  15132. percent, this.options.duration * percent, 0, 1, this.options.duration
  15133. );
  15134. } else {
  15135. this.pos = eased = percent;
  15136. }
  15137. this.now = ( this.end - this.start ) * eased + this.start;
  15138. if ( this.options.step ) {
  15139. this.options.step.call( this.elem, this.now, this );
  15140. }
  15141. if ( hooks && hooks.set ) {
  15142. hooks.set( this );
  15143. } else {
  15144. Tween.propHooks._default.set( this );
  15145. }
  15146. return this;
  15147. }
  15148. };
  15149. Tween.prototype.init.prototype = Tween.prototype;
  15150. Tween.propHooks = {
  15151. _default: {
  15152. get: function( tween ) {
  15153. var result;
  15154. // Use a property on the element directly when it is not a DOM element,
  15155. // or when there is no matching style property that exists.
  15156. if ( tween.elem.nodeType !== 1 ||
  15157. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  15158. return tween.elem[ tween.prop ];
  15159. }
  15160. // Passing an empty string as a 3rd parameter to .css will automatically
  15161. // attempt a parseFloat and fallback to a string if the parse fails.
  15162. // Simple values such as "10px" are parsed to Float;
  15163. // complex values such as "rotate(1rad)" are returned as-is.
  15164. result = jQuery.css( tween.elem, tween.prop, "" );
  15165. // Empty strings, null, undefined and "auto" are converted to 0.
  15166. return !result || result === "auto" ? 0 : result;
  15167. },
  15168. set: function( tween ) {
  15169. // Use step hook for back compat.
  15170. // Use cssHook if its there.
  15171. // Use .style if available and use plain properties where available.
  15172. if ( jQuery.fx.step[ tween.prop ] ) {
  15173. jQuery.fx.step[ tween.prop ]( tween );
  15174. } else if ( tween.elem.nodeType === 1 && (
  15175. jQuery.cssHooks[ tween.prop ] ||
  15176. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  15177. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  15178. } else {
  15179. tween.elem[ tween.prop ] = tween.now;
  15180. }
  15181. }
  15182. }
  15183. };
  15184. // Support: IE <=9 only
  15185. // Panic based approach to setting things on disconnected nodes
  15186. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  15187. set: function( tween ) {
  15188. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  15189. tween.elem[ tween.prop ] = tween.now;
  15190. }
  15191. }
  15192. };
  15193. jQuery.easing = {
  15194. linear: function( p ) {
  15195. return p;
  15196. },
  15197. swing: function( p ) {
  15198. return 0.5 - Math.cos( p * Math.PI ) / 2;
  15199. },
  15200. _default: "swing"
  15201. };
  15202. jQuery.fx = Tween.prototype.init;
  15203. // Back compat <1.8 extension point
  15204. jQuery.fx.step = {};
  15205. var
  15206. fxNow, inProgress,
  15207. rfxtypes = /^(?:toggle|show|hide)$/,
  15208. rrun = /queueHooks$/;
  15209. function schedule() {
  15210. if ( inProgress ) {
  15211. if ( document.hidden === false && window.requestAnimationFrame ) {
  15212. window.requestAnimationFrame( schedule );
  15213. } else {
  15214. window.setTimeout( schedule, jQuery.fx.interval );
  15215. }
  15216. jQuery.fx.tick();
  15217. }
  15218. }
  15219. // Animations created synchronously will run synchronously
  15220. function createFxNow() {
  15221. window.setTimeout( function() {
  15222. fxNow = undefined;
  15223. } );
  15224. return ( fxNow = Date.now() );
  15225. }
  15226. // Generate parameters to create a standard animation
  15227. function genFx( type, includeWidth ) {
  15228. var which,
  15229. i = 0,
  15230. attrs = { height: type };
  15231. // If we include width, step value is 1 to do all cssExpand values,
  15232. // otherwise step value is 2 to skip over Left and Right
  15233. includeWidth = includeWidth ? 1 : 0;
  15234. for ( ; i < 4; i += 2 - includeWidth ) {
  15235. which = cssExpand[ i ];
  15236. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  15237. }
  15238. if ( includeWidth ) {
  15239. attrs.opacity = attrs.width = type;
  15240. }
  15241. return attrs;
  15242. }
  15243. function createTween( value, prop, animation ) {
  15244. var tween,
  15245. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  15246. index = 0,
  15247. length = collection.length;
  15248. for ( ; index < length; index++ ) {
  15249. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  15250. // We're done with this property
  15251. return tween;
  15252. }
  15253. }
  15254. }
  15255. function defaultPrefilter( elem, props, opts ) {
  15256. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  15257. isBox = "width" in props || "height" in props,
  15258. anim = this,
  15259. orig = {},
  15260. style = elem.style,
  15261. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  15262. dataShow = dataPriv.get( elem, "fxshow" );
  15263. // Queue-skipping animations hijack the fx hooks
  15264. if ( !opts.queue ) {
  15265. hooks = jQuery._queueHooks( elem, "fx" );
  15266. if ( hooks.unqueued == null ) {
  15267. hooks.unqueued = 0;
  15268. oldfire = hooks.empty.fire;
  15269. hooks.empty.fire = function() {
  15270. if ( !hooks.unqueued ) {
  15271. oldfire();
  15272. }
  15273. };
  15274. }
  15275. hooks.unqueued++;
  15276. anim.always( function() {
  15277. // Ensure the complete handler is called before this completes
  15278. anim.always( function() {
  15279. hooks.unqueued--;
  15280. if ( !jQuery.queue( elem, "fx" ).length ) {
  15281. hooks.empty.fire();
  15282. }
  15283. } );
  15284. } );
  15285. }
  15286. // Detect show/hide animations
  15287. for ( prop in props ) {
  15288. value = props[ prop ];
  15289. if ( rfxtypes.test( value ) ) {
  15290. delete props[ prop ];
  15291. toggle = toggle || value === "toggle";
  15292. if ( value === ( hidden ? "hide" : "show" ) ) {
  15293. // Pretend to be hidden if this is a "show" and
  15294. // there is still data from a stopped show/hide
  15295. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  15296. hidden = true;
  15297. // Ignore all other no-op show/hide data
  15298. } else {
  15299. continue;
  15300. }
  15301. }
  15302. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  15303. }
  15304. }
  15305. // Bail out if this is a no-op like .hide().hide()
  15306. propTween = !jQuery.isEmptyObject( props );
  15307. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  15308. return;
  15309. }
  15310. // Restrict "overflow" and "display" styles during box animations
  15311. if ( isBox && elem.nodeType === 1 ) {
  15312. // Support: IE <=9 - 11, Edge 12 - 15
  15313. // Record all 3 overflow attributes because IE does not infer the shorthand
  15314. // from identically-valued overflowX and overflowY and Edge just mirrors
  15315. // the overflowX value there.
  15316. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  15317. // Identify a display type, preferring old show/hide data over the CSS cascade
  15318. restoreDisplay = dataShow && dataShow.display;
  15319. if ( restoreDisplay == null ) {
  15320. restoreDisplay = dataPriv.get( elem, "display" );
  15321. }
  15322. display = jQuery.css( elem, "display" );
  15323. if ( display === "none" ) {
  15324. if ( restoreDisplay ) {
  15325. display = restoreDisplay;
  15326. } else {
  15327. // Get nonempty value(s) by temporarily forcing visibility
  15328. showHide( [ elem ], true );
  15329. restoreDisplay = elem.style.display || restoreDisplay;
  15330. display = jQuery.css( elem, "display" );
  15331. showHide( [ elem ] );
  15332. }
  15333. }
  15334. // Animate inline elements as inline-block
  15335. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  15336. if ( jQuery.css( elem, "float" ) === "none" ) {
  15337. // Restore the original display value at the end of pure show/hide animations
  15338. if ( !propTween ) {
  15339. anim.done( function() {
  15340. style.display = restoreDisplay;
  15341. } );
  15342. if ( restoreDisplay == null ) {
  15343. display = style.display;
  15344. restoreDisplay = display === "none" ? "" : display;
  15345. }
  15346. }
  15347. style.display = "inline-block";
  15348. }
  15349. }
  15350. }
  15351. if ( opts.overflow ) {
  15352. style.overflow = "hidden";
  15353. anim.always( function() {
  15354. style.overflow = opts.overflow[ 0 ];
  15355. style.overflowX = opts.overflow[ 1 ];
  15356. style.overflowY = opts.overflow[ 2 ];
  15357. } );
  15358. }
  15359. // Implement show/hide animations
  15360. propTween = false;
  15361. for ( prop in orig ) {
  15362. // General show/hide setup for this element animation
  15363. if ( !propTween ) {
  15364. if ( dataShow ) {
  15365. if ( "hidden" in dataShow ) {
  15366. hidden = dataShow.hidden;
  15367. }
  15368. } else {
  15369. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  15370. }
  15371. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  15372. if ( toggle ) {
  15373. dataShow.hidden = !hidden;
  15374. }
  15375. // Show elements before animating them
  15376. if ( hidden ) {
  15377. showHide( [ elem ], true );
  15378. }
  15379. /* eslint-disable no-loop-func */
  15380. anim.done( function() {
  15381. /* eslint-enable no-loop-func */
  15382. // The final step of a "hide" animation is actually hiding the element
  15383. if ( !hidden ) {
  15384. showHide( [ elem ] );
  15385. }
  15386. dataPriv.remove( elem, "fxshow" );
  15387. for ( prop in orig ) {
  15388. jQuery.style( elem, prop, orig[ prop ] );
  15389. }
  15390. } );
  15391. }
  15392. // Per-property setup
  15393. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  15394. if ( !( prop in dataShow ) ) {
  15395. dataShow[ prop ] = propTween.start;
  15396. if ( hidden ) {
  15397. propTween.end = propTween.start;
  15398. propTween.start = 0;
  15399. }
  15400. }
  15401. }
  15402. }
  15403. function propFilter( props, specialEasing ) {
  15404. var index, name, easing, value, hooks;
  15405. // camelCase, specialEasing and expand cssHook pass
  15406. for ( index in props ) {
  15407. name = camelCase( index );
  15408. easing = specialEasing[ name ];
  15409. value = props[ index ];
  15410. if ( Array.isArray( value ) ) {
  15411. easing = value[ 1 ];
  15412. value = props[ index ] = value[ 0 ];
  15413. }
  15414. if ( index !== name ) {
  15415. props[ name ] = value;
  15416. delete props[ index ];
  15417. }
  15418. hooks = jQuery.cssHooks[ name ];
  15419. if ( hooks && "expand" in hooks ) {
  15420. value = hooks.expand( value );
  15421. delete props[ name ];
  15422. // Not quite $.extend, this won't overwrite existing keys.
  15423. // Reusing 'index' because we have the correct "name"
  15424. for ( index in value ) {
  15425. if ( !( index in props ) ) {
  15426. props[ index ] = value[ index ];
  15427. specialEasing[ index ] = easing;
  15428. }
  15429. }
  15430. } else {
  15431. specialEasing[ name ] = easing;
  15432. }
  15433. }
  15434. }
  15435. function Animation( elem, properties, options ) {
  15436. var result,
  15437. stopped,
  15438. index = 0,
  15439. length = Animation.prefilters.length,
  15440. deferred = jQuery.Deferred().always( function() {
  15441. // Don't match elem in the :animated selector
  15442. delete tick.elem;
  15443. } ),
  15444. tick = function() {
  15445. if ( stopped ) {
  15446. return false;
  15447. }
  15448. var currentTime = fxNow || createFxNow(),
  15449. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  15450. // Support: Android 2.3 only
  15451. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  15452. temp = remaining / animation.duration || 0,
  15453. percent = 1 - temp,
  15454. index = 0,
  15455. length = animation.tweens.length;
  15456. for ( ; index < length; index++ ) {
  15457. animation.tweens[ index ].run( percent );
  15458. }
  15459. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  15460. // If there's more to do, yield
  15461. if ( percent < 1 && length ) {
  15462. return remaining;
  15463. }
  15464. // If this was an empty animation, synthesize a final progress notification
  15465. if ( !length ) {
  15466. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  15467. }
  15468. // Resolve the animation and report its conclusion
  15469. deferred.resolveWith( elem, [ animation ] );
  15470. return false;
  15471. },
  15472. animation = deferred.promise( {
  15473. elem: elem,
  15474. props: jQuery.extend( {}, properties ),
  15475. opts: jQuery.extend( true, {
  15476. specialEasing: {},
  15477. easing: jQuery.easing._default
  15478. }, options ),
  15479. originalProperties: properties,
  15480. originalOptions: options,
  15481. startTime: fxNow || createFxNow(),
  15482. duration: options.duration,
  15483. tweens: [],
  15484. createTween: function( prop, end ) {
  15485. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  15486. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  15487. animation.tweens.push( tween );
  15488. return tween;
  15489. },
  15490. stop: function( gotoEnd ) {
  15491. var index = 0,
  15492. // If we are going to the end, we want to run all the tweens
  15493. // otherwise we skip this part
  15494. length = gotoEnd ? animation.tweens.length : 0;
  15495. if ( stopped ) {
  15496. return this;
  15497. }
  15498. stopped = true;
  15499. for ( ; index < length; index++ ) {
  15500. animation.tweens[ index ].run( 1 );
  15501. }
  15502. // Resolve when we played the last frame; otherwise, reject
  15503. if ( gotoEnd ) {
  15504. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  15505. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  15506. } else {
  15507. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  15508. }
  15509. return this;
  15510. }
  15511. } ),
  15512. props = animation.props;
  15513. propFilter( props, animation.opts.specialEasing );
  15514. for ( ; index < length; index++ ) {
  15515. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  15516. if ( result ) {
  15517. if ( isFunction( result.stop ) ) {
  15518. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  15519. result.stop.bind( result );
  15520. }
  15521. return result;
  15522. }
  15523. }
  15524. jQuery.map( props, createTween, animation );
  15525. if ( isFunction( animation.opts.start ) ) {
  15526. animation.opts.start.call( elem, animation );
  15527. }
  15528. // Attach callbacks from options
  15529. animation
  15530. .progress( animation.opts.progress )
  15531. .done( animation.opts.done, animation.opts.complete )
  15532. .fail( animation.opts.fail )
  15533. .always( animation.opts.always );
  15534. jQuery.fx.timer(
  15535. jQuery.extend( tick, {
  15536. elem: elem,
  15537. anim: animation,
  15538. queue: animation.opts.queue
  15539. } )
  15540. );
  15541. return animation;
  15542. }
  15543. jQuery.Animation = jQuery.extend( Animation, {
  15544. tweeners: {
  15545. "*": [ function( prop, value ) {
  15546. var tween = this.createTween( prop, value );
  15547. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  15548. return tween;
  15549. } ]
  15550. },
  15551. tweener: function( props, callback ) {
  15552. if ( isFunction( props ) ) {
  15553. callback = props;
  15554. props = [ "*" ];
  15555. } else {
  15556. props = props.match( rnothtmlwhite );
  15557. }
  15558. var prop,
  15559. index = 0,
  15560. length = props.length;
  15561. for ( ; index < length; index++ ) {
  15562. prop = props[ index ];
  15563. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  15564. Animation.tweeners[ prop ].unshift( callback );
  15565. }
  15566. },
  15567. prefilters: [ defaultPrefilter ],
  15568. prefilter: function( callback, prepend ) {
  15569. if ( prepend ) {
  15570. Animation.prefilters.unshift( callback );
  15571. } else {
  15572. Animation.prefilters.push( callback );
  15573. }
  15574. }
  15575. } );
  15576. jQuery.speed = function( speed, easing, fn ) {
  15577. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  15578. complete: fn || !fn && easing ||
  15579. isFunction( speed ) && speed,
  15580. duration: speed,
  15581. easing: fn && easing || easing && !isFunction( easing ) && easing
  15582. };
  15583. // Go to the end state if fx are off
  15584. if ( jQuery.fx.off ) {
  15585. opt.duration = 0;
  15586. } else {
  15587. if ( typeof opt.duration !== "number" ) {
  15588. if ( opt.duration in jQuery.fx.speeds ) {
  15589. opt.duration = jQuery.fx.speeds[ opt.duration ];
  15590. } else {
  15591. opt.duration = jQuery.fx.speeds._default;
  15592. }
  15593. }
  15594. }
  15595. // Normalize opt.queue - true/undefined/null -> "fx"
  15596. if ( opt.queue == null || opt.queue === true ) {
  15597. opt.queue = "fx";
  15598. }
  15599. // Queueing
  15600. opt.old = opt.complete;
  15601. opt.complete = function() {
  15602. if ( isFunction( opt.old ) ) {
  15603. opt.old.call( this );
  15604. }
  15605. if ( opt.queue ) {
  15606. jQuery.dequeue( this, opt.queue );
  15607. }
  15608. };
  15609. return opt;
  15610. };
  15611. jQuery.fn.extend( {
  15612. fadeTo: function( speed, to, easing, callback ) {
  15613. // Show any hidden elements after setting opacity to 0
  15614. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  15615. // Animate to the value specified
  15616. .end().animate( { opacity: to }, speed, easing, callback );
  15617. },
  15618. animate: function( prop, speed, easing, callback ) {
  15619. var empty = jQuery.isEmptyObject( prop ),
  15620. optall = jQuery.speed( speed, easing, callback ),
  15621. doAnimation = function() {
  15622. // Operate on a copy of prop so per-property easing won't be lost
  15623. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  15624. // Empty animations, or finishing resolves immediately
  15625. if ( empty || dataPriv.get( this, "finish" ) ) {
  15626. anim.stop( true );
  15627. }
  15628. };
  15629. doAnimation.finish = doAnimation;
  15630. return empty || optall.queue === false ?
  15631. this.each( doAnimation ) :
  15632. this.queue( optall.queue, doAnimation );
  15633. },
  15634. stop: function( type, clearQueue, gotoEnd ) {
  15635. var stopQueue = function( hooks ) {
  15636. var stop = hooks.stop;
  15637. delete hooks.stop;
  15638. stop( gotoEnd );
  15639. };
  15640. if ( typeof type !== "string" ) {
  15641. gotoEnd = clearQueue;
  15642. clearQueue = type;
  15643. type = undefined;
  15644. }
  15645. if ( clearQueue && type !== false ) {
  15646. this.queue( type || "fx", [] );
  15647. }
  15648. return this.each( function() {
  15649. var dequeue = true,
  15650. index = type != null && type + "queueHooks",
  15651. timers = jQuery.timers,
  15652. data = dataPriv.get( this );
  15653. if ( index ) {
  15654. if ( data[ index ] && data[ index ].stop ) {
  15655. stopQueue( data[ index ] );
  15656. }
  15657. } else {
  15658. for ( index in data ) {
  15659. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  15660. stopQueue( data[ index ] );
  15661. }
  15662. }
  15663. }
  15664. for ( index = timers.length; index--; ) {
  15665. if ( timers[ index ].elem === this &&
  15666. ( type == null || timers[ index ].queue === type ) ) {
  15667. timers[ index ].anim.stop( gotoEnd );
  15668. dequeue = false;
  15669. timers.splice( index, 1 );
  15670. }
  15671. }
  15672. // Start the next in the queue if the last step wasn't forced.
  15673. // Timers currently will call their complete callbacks, which
  15674. // will dequeue but only if they were gotoEnd.
  15675. if ( dequeue || !gotoEnd ) {
  15676. jQuery.dequeue( this, type );
  15677. }
  15678. } );
  15679. },
  15680. finish: function( type ) {
  15681. if ( type !== false ) {
  15682. type = type || "fx";
  15683. }
  15684. return this.each( function() {
  15685. var index,
  15686. data = dataPriv.get( this ),
  15687. queue = data[ type + "queue" ],
  15688. hooks = data[ type + "queueHooks" ],
  15689. timers = jQuery.timers,
  15690. length = queue ? queue.length : 0;
  15691. // Enable finishing flag on private data
  15692. data.finish = true;
  15693. // Empty the queue first
  15694. jQuery.queue( this, type, [] );
  15695. if ( hooks && hooks.stop ) {
  15696. hooks.stop.call( this, true );
  15697. }
  15698. // Look for any active animations, and finish them
  15699. for ( index = timers.length; index--; ) {
  15700. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  15701. timers[ index ].anim.stop( true );
  15702. timers.splice( index, 1 );
  15703. }
  15704. }
  15705. // Look for any animations in the old queue and finish them
  15706. for ( index = 0; index < length; index++ ) {
  15707. if ( queue[ index ] && queue[ index ].finish ) {
  15708. queue[ index ].finish.call( this );
  15709. }
  15710. }
  15711. // Turn off finishing flag
  15712. delete data.finish;
  15713. } );
  15714. }
  15715. } );
  15716. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  15717. var cssFn = jQuery.fn[ name ];
  15718. jQuery.fn[ name ] = function( speed, easing, callback ) {
  15719. return speed == null || typeof speed === "boolean" ?
  15720. cssFn.apply( this, arguments ) :
  15721. this.animate( genFx( name, true ), speed, easing, callback );
  15722. };
  15723. } );
  15724. // Generate shortcuts for custom animations
  15725. jQuery.each( {
  15726. slideDown: genFx( "show" ),
  15727. slideUp: genFx( "hide" ),
  15728. slideToggle: genFx( "toggle" ),
  15729. fadeIn: { opacity: "show" },
  15730. fadeOut: { opacity: "hide" },
  15731. fadeToggle: { opacity: "toggle" }
  15732. }, function( name, props ) {
  15733. jQuery.fn[ name ] = function( speed, easing, callback ) {
  15734. return this.animate( props, speed, easing, callback );
  15735. };
  15736. } );
  15737. jQuery.timers = [];
  15738. jQuery.fx.tick = function() {
  15739. var timer,
  15740. i = 0,
  15741. timers = jQuery.timers;
  15742. fxNow = Date.now();
  15743. for ( ; i < timers.length; i++ ) {
  15744. timer = timers[ i ];
  15745. // Run the timer and safely remove it when done (allowing for external removal)
  15746. if ( !timer() && timers[ i ] === timer ) {
  15747. timers.splice( i--, 1 );
  15748. }
  15749. }
  15750. if ( !timers.length ) {
  15751. jQuery.fx.stop();
  15752. }
  15753. fxNow = undefined;
  15754. };
  15755. jQuery.fx.timer = function( timer ) {
  15756. jQuery.timers.push( timer );
  15757. jQuery.fx.start();
  15758. };
  15759. jQuery.fx.interval = 13;
  15760. jQuery.fx.start = function() {
  15761. if ( inProgress ) {
  15762. return;
  15763. }
  15764. inProgress = true;
  15765. schedule();
  15766. };
  15767. jQuery.fx.stop = function() {
  15768. inProgress = null;
  15769. };
  15770. jQuery.fx.speeds = {
  15771. slow: 600,
  15772. fast: 200,
  15773. // Default speed
  15774. _default: 400
  15775. };
  15776. // Based off of the plugin by Clint Helfers, with permission.
  15777. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  15778. jQuery.fn.delay = function( time, type ) {
  15779. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  15780. type = type || "fx";
  15781. return this.queue( type, function( next, hooks ) {
  15782. var timeout = window.setTimeout( next, time );
  15783. hooks.stop = function() {
  15784. window.clearTimeout( timeout );
  15785. };
  15786. } );
  15787. };
  15788. ( function() {
  15789. var input = document.createElement( "input" ),
  15790. select = document.createElement( "select" ),
  15791. opt = select.appendChild( document.createElement( "option" ) );
  15792. input.type = "checkbox";
  15793. // Support: Android <=4.3 only
  15794. // Default value for a checkbox should be "on"
  15795. support.checkOn = input.value !== "";
  15796. // Support: IE <=11 only
  15797. // Must access selectedIndex to make default options select
  15798. support.optSelected = opt.selected;
  15799. // Support: IE <=11 only
  15800. // An input loses its value after becoming a radio
  15801. input = document.createElement( "input" );
  15802. input.value = "t";
  15803. input.type = "radio";
  15804. support.radioValue = input.value === "t";
  15805. } )();
  15806. var boolHook,
  15807. attrHandle = jQuery.expr.attrHandle;
  15808. jQuery.fn.extend( {
  15809. attr: function( name, value ) {
  15810. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  15811. },
  15812. removeAttr: function( name ) {
  15813. return this.each( function() {
  15814. jQuery.removeAttr( this, name );
  15815. } );
  15816. }
  15817. } );
  15818. jQuery.extend( {
  15819. attr: function( elem, name, value ) {
  15820. var ret, hooks,
  15821. nType = elem.nodeType;
  15822. // Don't get/set attributes on text, comment and attribute nodes
  15823. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15824. return;
  15825. }
  15826. // Fallback to prop when attributes are not supported
  15827. if ( typeof elem.getAttribute === "undefined" ) {
  15828. return jQuery.prop( elem, name, value );
  15829. }
  15830. // Attribute hooks are determined by the lowercase version
  15831. // Grab necessary hook if one is defined
  15832. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15833. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  15834. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  15835. }
  15836. if ( value !== undefined ) {
  15837. if ( value === null ) {
  15838. jQuery.removeAttr( elem, name );
  15839. return;
  15840. }
  15841. if ( hooks && "set" in hooks &&
  15842. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15843. return ret;
  15844. }
  15845. elem.setAttribute( name, value + "" );
  15846. return value;
  15847. }
  15848. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15849. return ret;
  15850. }
  15851. ret = jQuery.find.attr( elem, name );
  15852. // Non-existent attributes return null, we normalize to undefined
  15853. return ret == null ? undefined : ret;
  15854. },
  15855. attrHooks: {
  15856. type: {
  15857. set: function( elem, value ) {
  15858. if ( !support.radioValue && value === "radio" &&
  15859. nodeName( elem, "input" ) ) {
  15860. var val = elem.value;
  15861. elem.setAttribute( "type", value );
  15862. if ( val ) {
  15863. elem.value = val;
  15864. }
  15865. return value;
  15866. }
  15867. }
  15868. }
  15869. },
  15870. removeAttr: function( elem, value ) {
  15871. var name,
  15872. i = 0,
  15873. // Attribute names can contain non-HTML whitespace characters
  15874. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  15875. attrNames = value && value.match( rnothtmlwhite );
  15876. if ( attrNames && elem.nodeType === 1 ) {
  15877. while ( ( name = attrNames[ i++ ] ) ) {
  15878. elem.removeAttribute( name );
  15879. }
  15880. }
  15881. }
  15882. } );
  15883. // Hooks for boolean attributes
  15884. boolHook = {
  15885. set: function( elem, value, name ) {
  15886. if ( value === false ) {
  15887. // Remove boolean attributes when set to false
  15888. jQuery.removeAttr( elem, name );
  15889. } else {
  15890. elem.setAttribute( name, name );
  15891. }
  15892. return name;
  15893. }
  15894. };
  15895. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  15896. var getter = attrHandle[ name ] || jQuery.find.attr;
  15897. attrHandle[ name ] = function( elem, name, isXML ) {
  15898. var ret, handle,
  15899. lowercaseName = name.toLowerCase();
  15900. if ( !isXML ) {
  15901. // Avoid an infinite loop by temporarily removing this function from the getter
  15902. handle = attrHandle[ lowercaseName ];
  15903. attrHandle[ lowercaseName ] = ret;
  15904. ret = getter( elem, name, isXML ) != null ?
  15905. lowercaseName :
  15906. null;
  15907. attrHandle[ lowercaseName ] = handle;
  15908. }
  15909. return ret;
  15910. };
  15911. } );
  15912. var rfocusable = /^(?:input|select|textarea|button)$/i,
  15913. rclickable = /^(?:a|area)$/i;
  15914. jQuery.fn.extend( {
  15915. prop: function( name, value ) {
  15916. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  15917. },
  15918. removeProp: function( name ) {
  15919. return this.each( function() {
  15920. delete this[ jQuery.propFix[ name ] || name ];
  15921. } );
  15922. }
  15923. } );
  15924. jQuery.extend( {
  15925. prop: function( elem, name, value ) {
  15926. var ret, hooks,
  15927. nType = elem.nodeType;
  15928. // Don't get/set properties on text, comment and attribute nodes
  15929. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15930. return;
  15931. }
  15932. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15933. // Fix name and attach hooks
  15934. name = jQuery.propFix[ name ] || name;
  15935. hooks = jQuery.propHooks[ name ];
  15936. }
  15937. if ( value !== undefined ) {
  15938. if ( hooks && "set" in hooks &&
  15939. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15940. return ret;
  15941. }
  15942. return ( elem[ name ] = value );
  15943. }
  15944. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15945. return ret;
  15946. }
  15947. return elem[ name ];
  15948. },
  15949. propHooks: {
  15950. tabIndex: {
  15951. get: function( elem ) {
  15952. // Support: IE <=9 - 11 only
  15953. // elem.tabIndex doesn't always return the
  15954. // correct value when it hasn't been explicitly set
  15955. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  15956. // Use proper attribute retrieval(#12072)
  15957. var tabindex = jQuery.find.attr( elem, "tabindex" );
  15958. if ( tabindex ) {
  15959. return parseInt( tabindex, 10 );
  15960. }
  15961. if (
  15962. rfocusable.test( elem.nodeName ) ||
  15963. rclickable.test( elem.nodeName ) &&
  15964. elem.href
  15965. ) {
  15966. return 0;
  15967. }
  15968. return -1;
  15969. }
  15970. }
  15971. },
  15972. propFix: {
  15973. "for": "htmlFor",
  15974. "class": "className"
  15975. }
  15976. } );
  15977. // Support: IE <=11 only
  15978. // Accessing the selectedIndex property
  15979. // forces the browser to respect setting selected
  15980. // on the option
  15981. // The getter ensures a default option is selected
  15982. // when in an optgroup
  15983. // eslint rule "no-unused-expressions" is disabled for this code
  15984. // since it considers such accessions noop
  15985. if ( !support.optSelected ) {
  15986. jQuery.propHooks.selected = {
  15987. get: function( elem ) {
  15988. /* eslint no-unused-expressions: "off" */
  15989. var parent = elem.parentNode;
  15990. if ( parent && parent.parentNode ) {
  15991. parent.parentNode.selectedIndex;
  15992. }
  15993. return null;
  15994. },
  15995. set: function( elem ) {
  15996. /* eslint no-unused-expressions: "off" */
  15997. var parent = elem.parentNode;
  15998. if ( parent ) {
  15999. parent.selectedIndex;
  16000. if ( parent.parentNode ) {
  16001. parent.parentNode.selectedIndex;
  16002. }
  16003. }
  16004. }
  16005. };
  16006. }
  16007. jQuery.each( [
  16008. "tabIndex",
  16009. "readOnly",
  16010. "maxLength",
  16011. "cellSpacing",
  16012. "cellPadding",
  16013. "rowSpan",
  16014. "colSpan",
  16015. "useMap",
  16016. "frameBorder",
  16017. "contentEditable"
  16018. ], function() {
  16019. jQuery.propFix[ this.toLowerCase() ] = this;
  16020. } );
  16021. // Strip and collapse whitespace according to HTML spec
  16022. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  16023. function stripAndCollapse( value ) {
  16024. var tokens = value.match( rnothtmlwhite ) || [];
  16025. return tokens.join( " " );
  16026. }
  16027. function getClass( elem ) {
  16028. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  16029. }
  16030. function classesToArray( value ) {
  16031. if ( Array.isArray( value ) ) {
  16032. return value;
  16033. }
  16034. if ( typeof value === "string" ) {
  16035. return value.match( rnothtmlwhite ) || [];
  16036. }
  16037. return [];
  16038. }
  16039. jQuery.fn.extend( {
  16040. addClass: function( value ) {
  16041. var classes, elem, cur, curValue, clazz, j, finalValue,
  16042. i = 0;
  16043. if ( isFunction( value ) ) {
  16044. return this.each( function( j ) {
  16045. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  16046. } );
  16047. }
  16048. classes = classesToArray( value );
  16049. if ( classes.length ) {
  16050. while ( ( elem = this[ i++ ] ) ) {
  16051. curValue = getClass( elem );
  16052. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  16053. if ( cur ) {
  16054. j = 0;
  16055. while ( ( clazz = classes[ j++ ] ) ) {
  16056. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  16057. cur += clazz + " ";
  16058. }
  16059. }
  16060. // Only assign if different to avoid unneeded rendering.
  16061. finalValue = stripAndCollapse( cur );
  16062. if ( curValue !== finalValue ) {
  16063. elem.setAttribute( "class", finalValue );
  16064. }
  16065. }
  16066. }
  16067. }
  16068. return this;
  16069. },
  16070. removeClass: function( value ) {
  16071. var classes, elem, cur, curValue, clazz, j, finalValue,
  16072. i = 0;
  16073. if ( isFunction( value ) ) {
  16074. return this.each( function( j ) {
  16075. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  16076. } );
  16077. }
  16078. if ( !arguments.length ) {
  16079. return this.attr( "class", "" );
  16080. }
  16081. classes = classesToArray( value );
  16082. if ( classes.length ) {
  16083. while ( ( elem = this[ i++ ] ) ) {
  16084. curValue = getClass( elem );
  16085. // This expression is here for better compressibility (see addClass)
  16086. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  16087. if ( cur ) {
  16088. j = 0;
  16089. while ( ( clazz = classes[ j++ ] ) ) {
  16090. // Remove *all* instances
  16091. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  16092. cur = cur.replace( " " + clazz + " ", " " );
  16093. }
  16094. }
  16095. // Only assign if different to avoid unneeded rendering.
  16096. finalValue = stripAndCollapse( cur );
  16097. if ( curValue !== finalValue ) {
  16098. elem.setAttribute( "class", finalValue );
  16099. }
  16100. }
  16101. }
  16102. }
  16103. return this;
  16104. },
  16105. toggleClass: function( value, stateVal ) {
  16106. var type = typeof value,
  16107. isValidValue = type === "string" || Array.isArray( value );
  16108. if ( typeof stateVal === "boolean" && isValidValue ) {
  16109. return stateVal ? this.addClass( value ) : this.removeClass( value );
  16110. }
  16111. if ( isFunction( value ) ) {
  16112. return this.each( function( i ) {
  16113. jQuery( this ).toggleClass(
  16114. value.call( this, i, getClass( this ), stateVal ),
  16115. stateVal
  16116. );
  16117. } );
  16118. }
  16119. return this.each( function() {
  16120. var className, i, self, classNames;
  16121. if ( isValidValue ) {
  16122. // Toggle individual class names
  16123. i = 0;
  16124. self = jQuery( this );
  16125. classNames = classesToArray( value );
  16126. while ( ( className = classNames[ i++ ] ) ) {
  16127. // Check each className given, space separated list
  16128. if ( self.hasClass( className ) ) {
  16129. self.removeClass( className );
  16130. } else {
  16131. self.addClass( className );
  16132. }
  16133. }
  16134. // Toggle whole class name
  16135. } else if ( value === undefined || type === "boolean" ) {
  16136. className = getClass( this );
  16137. if ( className ) {
  16138. // Store className if set
  16139. dataPriv.set( this, "__className__", className );
  16140. }
  16141. // If the element has a class name or if we're passed `false`,
  16142. // then remove the whole classname (if there was one, the above saved it).
  16143. // Otherwise bring back whatever was previously saved (if anything),
  16144. // falling back to the empty string if nothing was stored.
  16145. if ( this.setAttribute ) {
  16146. this.setAttribute( "class",
  16147. className || value === false ?
  16148. "" :
  16149. dataPriv.get( this, "__className__" ) || ""
  16150. );
  16151. }
  16152. }
  16153. } );
  16154. },
  16155. hasClass: function( selector ) {
  16156. var className, elem,
  16157. i = 0;
  16158. className = " " + selector + " ";
  16159. while ( ( elem = this[ i++ ] ) ) {
  16160. if ( elem.nodeType === 1 &&
  16161. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  16162. return true;
  16163. }
  16164. }
  16165. return false;
  16166. }
  16167. } );
  16168. var rreturn = /\r/g;
  16169. jQuery.fn.extend( {
  16170. val: function( value ) {
  16171. var hooks, ret, valueIsFunction,
  16172. elem = this[ 0 ];
  16173. if ( !arguments.length ) {
  16174. if ( elem ) {
  16175. hooks = jQuery.valHooks[ elem.type ] ||
  16176. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  16177. if ( hooks &&
  16178. "get" in hooks &&
  16179. ( ret = hooks.get( elem, "value" ) ) !== undefined
  16180. ) {
  16181. return ret;
  16182. }
  16183. ret = elem.value;
  16184. // Handle most common string cases
  16185. if ( typeof ret === "string" ) {
  16186. return ret.replace( rreturn, "" );
  16187. }
  16188. // Handle cases where value is null/undef or number
  16189. return ret == null ? "" : ret;
  16190. }
  16191. return;
  16192. }
  16193. valueIsFunction = isFunction( value );
  16194. return this.each( function( i ) {
  16195. var val;
  16196. if ( this.nodeType !== 1 ) {
  16197. return;
  16198. }
  16199. if ( valueIsFunction ) {
  16200. val = value.call( this, i, jQuery( this ).val() );
  16201. } else {
  16202. val = value;
  16203. }
  16204. // Treat null/undefined as ""; convert numbers to string
  16205. if ( val == null ) {
  16206. val = "";
  16207. } else if ( typeof val === "number" ) {
  16208. val += "";
  16209. } else if ( Array.isArray( val ) ) {
  16210. val = jQuery.map( val, function( value ) {
  16211. return value == null ? "" : value + "";
  16212. } );
  16213. }
  16214. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  16215. // If set returns undefined, fall back to normal setting
  16216. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  16217. this.value = val;
  16218. }
  16219. } );
  16220. }
  16221. } );
  16222. jQuery.extend( {
  16223. valHooks: {
  16224. option: {
  16225. get: function( elem ) {
  16226. var val = jQuery.find.attr( elem, "value" );
  16227. return val != null ?
  16228. val :
  16229. // Support: IE <=10 - 11 only
  16230. // option.text throws exceptions (#14686, #14858)
  16231. // Strip and collapse whitespace
  16232. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  16233. stripAndCollapse( jQuery.text( elem ) );
  16234. }
  16235. },
  16236. select: {
  16237. get: function( elem ) {
  16238. var value, option, i,
  16239. options = elem.options,
  16240. index = elem.selectedIndex,
  16241. one = elem.type === "select-one",
  16242. values = one ? null : [],
  16243. max = one ? index + 1 : options.length;
  16244. if ( index < 0 ) {
  16245. i = max;
  16246. } else {
  16247. i = one ? index : 0;
  16248. }
  16249. // Loop through all the selected options
  16250. for ( ; i < max; i++ ) {
  16251. option = options[ i ];
  16252. // Support: IE <=9 only
  16253. // IE8-9 doesn't update selected after form reset (#2551)
  16254. if ( ( option.selected || i === index ) &&
  16255. // Don't return options that are disabled or in a disabled optgroup
  16256. !option.disabled &&
  16257. ( !option.parentNode.disabled ||
  16258. !nodeName( option.parentNode, "optgroup" ) ) ) {
  16259. // Get the specific value for the option
  16260. value = jQuery( option ).val();
  16261. // We don't need an array for one selects
  16262. if ( one ) {
  16263. return value;
  16264. }
  16265. // Multi-Selects return an array
  16266. values.push( value );
  16267. }
  16268. }
  16269. return values;
  16270. },
  16271. set: function( elem, value ) {
  16272. var optionSet, option,
  16273. options = elem.options,
  16274. values = jQuery.makeArray( value ),
  16275. i = options.length;
  16276. while ( i-- ) {
  16277. option = options[ i ];
  16278. /* eslint-disable no-cond-assign */
  16279. if ( option.selected =
  16280. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  16281. ) {
  16282. optionSet = true;
  16283. }
  16284. /* eslint-enable no-cond-assign */
  16285. }
  16286. // Force browsers to behave consistently when non-matching value is set
  16287. if ( !optionSet ) {
  16288. elem.selectedIndex = -1;
  16289. }
  16290. return values;
  16291. }
  16292. }
  16293. }
  16294. } );
  16295. // Radios and checkboxes getter/setter
  16296. jQuery.each( [ "radio", "checkbox" ], function() {
  16297. jQuery.valHooks[ this ] = {
  16298. set: function( elem, value ) {
  16299. if ( Array.isArray( value ) ) {
  16300. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  16301. }
  16302. }
  16303. };
  16304. if ( !support.checkOn ) {
  16305. jQuery.valHooks[ this ].get = function( elem ) {
  16306. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  16307. };
  16308. }
  16309. } );
  16310. // Return jQuery for attributes-only inclusion
  16311. support.focusin = "onfocusin" in window;
  16312. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  16313. stopPropagationCallback = function( e ) {
  16314. e.stopPropagation();
  16315. };
  16316. jQuery.extend( jQuery.event, {
  16317. trigger: function( event, data, elem, onlyHandlers ) {
  16318. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  16319. eventPath = [ elem || document ],
  16320. type = hasOwn.call( event, "type" ) ? event.type : event,
  16321. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  16322. cur = lastElement = tmp = elem = elem || document;
  16323. // Don't do events on text and comment nodes
  16324. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  16325. return;
  16326. }
  16327. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  16328. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  16329. return;
  16330. }
  16331. if ( type.indexOf( "." ) > -1 ) {
  16332. // Namespaced trigger; create a regexp to match event type in handle()
  16333. namespaces = type.split( "." );
  16334. type = namespaces.shift();
  16335. namespaces.sort();
  16336. }
  16337. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  16338. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  16339. event = event[ jQuery.expando ] ?
  16340. event :
  16341. new jQuery.Event( type, typeof event === "object" && event );
  16342. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  16343. event.isTrigger = onlyHandlers ? 2 : 3;
  16344. event.namespace = namespaces.join( "." );
  16345. event.rnamespace = event.namespace ?
  16346. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  16347. null;
  16348. // Clean up the event in case it is being reused
  16349. event.result = undefined;
  16350. if ( !event.target ) {
  16351. event.target = elem;
  16352. }
  16353. // Clone any incoming data and prepend the event, creating the handler arg list
  16354. data = data == null ?
  16355. [ event ] :
  16356. jQuery.makeArray( data, [ event ] );
  16357. // Allow special events to draw outside the lines
  16358. special = jQuery.event.special[ type ] || {};
  16359. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  16360. return;
  16361. }
  16362. // Determine event propagation path in advance, per W3C events spec (#9951)
  16363. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  16364. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  16365. bubbleType = special.delegateType || type;
  16366. if ( !rfocusMorph.test( bubbleType + type ) ) {
  16367. cur = cur.parentNode;
  16368. }
  16369. for ( ; cur; cur = cur.parentNode ) {
  16370. eventPath.push( cur );
  16371. tmp = cur;
  16372. }
  16373. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  16374. if ( tmp === ( elem.ownerDocument || document ) ) {
  16375. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  16376. }
  16377. }
  16378. // Fire handlers on the event path
  16379. i = 0;
  16380. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  16381. lastElement = cur;
  16382. event.type = i > 1 ?
  16383. bubbleType :
  16384. special.bindType || type;
  16385. // jQuery handler
  16386. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  16387. dataPriv.get( cur, "handle" );
  16388. if ( handle ) {
  16389. handle.apply( cur, data );
  16390. }
  16391. // Native handler
  16392. handle = ontype && cur[ ontype ];
  16393. if ( handle && handle.apply && acceptData( cur ) ) {
  16394. event.result = handle.apply( cur, data );
  16395. if ( event.result === false ) {
  16396. event.preventDefault();
  16397. }
  16398. }
  16399. }
  16400. event.type = type;
  16401. // If nobody prevented the default action, do it now
  16402. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  16403. if ( ( !special._default ||
  16404. special._default.apply( eventPath.pop(), data ) === false ) &&
  16405. acceptData( elem ) ) {
  16406. // Call a native DOM method on the target with the same name as the event.
  16407. // Don't do default actions on window, that's where global variables be (#6170)
  16408. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  16409. // Don't re-trigger an onFOO event when we call its FOO() method
  16410. tmp = elem[ ontype ];
  16411. if ( tmp ) {
  16412. elem[ ontype ] = null;
  16413. }
  16414. // Prevent re-triggering of the same event, since we already bubbled it above
  16415. jQuery.event.triggered = type;
  16416. if ( event.isPropagationStopped() ) {
  16417. lastElement.addEventListener( type, stopPropagationCallback );
  16418. }
  16419. elem[ type ]();
  16420. if ( event.isPropagationStopped() ) {
  16421. lastElement.removeEventListener( type, stopPropagationCallback );
  16422. }
  16423. jQuery.event.triggered = undefined;
  16424. if ( tmp ) {
  16425. elem[ ontype ] = tmp;
  16426. }
  16427. }
  16428. }
  16429. }
  16430. return event.result;
  16431. },
  16432. // Piggyback on a donor event to simulate a different one
  16433. // Used only for `focus(in | out)` events
  16434. simulate: function( type, elem, event ) {
  16435. var e = jQuery.extend(
  16436. new jQuery.Event(),
  16437. event,
  16438. {
  16439. type: type,
  16440. isSimulated: true
  16441. }
  16442. );
  16443. jQuery.event.trigger( e, null, elem );
  16444. }
  16445. } );
  16446. jQuery.fn.extend( {
  16447. trigger: function( type, data ) {
  16448. return this.each( function() {
  16449. jQuery.event.trigger( type, data, this );
  16450. } );
  16451. },
  16452. triggerHandler: function( type, data ) {
  16453. var elem = this[ 0 ];
  16454. if ( elem ) {
  16455. return jQuery.event.trigger( type, data, elem, true );
  16456. }
  16457. }
  16458. } );
  16459. // Support: Firefox <=44
  16460. // Firefox doesn't have focus(in | out) events
  16461. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  16462. //
  16463. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  16464. // focus(in | out) events fire after focus & blur events,
  16465. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  16466. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  16467. if ( !support.focusin ) {
  16468. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  16469. // Attach a single capturing handler on the document while someone wants focusin/focusout
  16470. var handler = function( event ) {
  16471. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  16472. };
  16473. jQuery.event.special[ fix ] = {
  16474. setup: function() {
  16475. var doc = this.ownerDocument || this,
  16476. attaches = dataPriv.access( doc, fix );
  16477. if ( !attaches ) {
  16478. doc.addEventListener( orig, handler, true );
  16479. }
  16480. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  16481. },
  16482. teardown: function() {
  16483. var doc = this.ownerDocument || this,
  16484. attaches = dataPriv.access( doc, fix ) - 1;
  16485. if ( !attaches ) {
  16486. doc.removeEventListener( orig, handler, true );
  16487. dataPriv.remove( doc, fix );
  16488. } else {
  16489. dataPriv.access( doc, fix, attaches );
  16490. }
  16491. }
  16492. };
  16493. } );
  16494. }
  16495. var location = window.location;
  16496. var nonce = Date.now();
  16497. var rquery = ( /\?/ );
  16498. // Cross-browser xml parsing
  16499. jQuery.parseXML = function( data ) {
  16500. var xml;
  16501. if ( !data || typeof data !== "string" ) {
  16502. return null;
  16503. }
  16504. // Support: IE 9 - 11 only
  16505. // IE throws on parseFromString with invalid input.
  16506. try {
  16507. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  16508. } catch ( e ) {
  16509. xml = undefined;
  16510. }
  16511. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  16512. jQuery.error( "Invalid XML: " + data );
  16513. }
  16514. return xml;
  16515. };
  16516. var
  16517. rbracket = /\[\]$/,
  16518. rCRLF = /\r?\n/g,
  16519. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  16520. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  16521. function buildParams( prefix, obj, traditional, add ) {
  16522. var name;
  16523. if ( Array.isArray( obj ) ) {
  16524. // Serialize array item.
  16525. jQuery.each( obj, function( i, v ) {
  16526. if ( traditional || rbracket.test( prefix ) ) {
  16527. // Treat each array item as a scalar.
  16528. add( prefix, v );
  16529. } else {
  16530. // Item is non-scalar (array or object), encode its numeric index.
  16531. buildParams(
  16532. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  16533. v,
  16534. traditional,
  16535. add
  16536. );
  16537. }
  16538. } );
  16539. } else if ( !traditional && toType( obj ) === "object" ) {
  16540. // Serialize object item.
  16541. for ( name in obj ) {
  16542. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  16543. }
  16544. } else {
  16545. // Serialize scalar item.
  16546. add( prefix, obj );
  16547. }
  16548. }
  16549. // Serialize an array of form elements or a set of
  16550. // key/values into a query string
  16551. jQuery.param = function( a, traditional ) {
  16552. var prefix,
  16553. s = [],
  16554. add = function( key, valueOrFunction ) {
  16555. // If value is a function, invoke it and use its return value
  16556. var value = isFunction( valueOrFunction ) ?
  16557. valueOrFunction() :
  16558. valueOrFunction;
  16559. s[ s.length ] = encodeURIComponent( key ) + "=" +
  16560. encodeURIComponent( value == null ? "" : value );
  16561. };
  16562. if ( a == null ) {
  16563. return "";
  16564. }
  16565. // If an array was passed in, assume that it is an array of form elements.
  16566. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  16567. // Serialize the form elements
  16568. jQuery.each( a, function() {
  16569. add( this.name, this.value );
  16570. } );
  16571. } else {
  16572. // If traditional, encode the "old" way (the way 1.3.2 or older
  16573. // did it), otherwise encode params recursively.
  16574. for ( prefix in a ) {
  16575. buildParams( prefix, a[ prefix ], traditional, add );
  16576. }
  16577. }
  16578. // Return the resulting serialization
  16579. return s.join( "&" );
  16580. };
  16581. jQuery.fn.extend( {
  16582. serialize: function() {
  16583. return jQuery.param( this.serializeArray() );
  16584. },
  16585. serializeArray: function() {
  16586. return this.map( function() {
  16587. // Can add propHook for "elements" to filter or add form elements
  16588. var elements = jQuery.prop( this, "elements" );
  16589. return elements ? jQuery.makeArray( elements ) : this;
  16590. } )
  16591. .filter( function() {
  16592. var type = this.type;
  16593. // Use .is( ":disabled" ) so that fieldset[disabled] works
  16594. return this.name && !jQuery( this ).is( ":disabled" ) &&
  16595. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  16596. ( this.checked || !rcheckableType.test( type ) );
  16597. } )
  16598. .map( function( i, elem ) {
  16599. var val = jQuery( this ).val();
  16600. if ( val == null ) {
  16601. return null;
  16602. }
  16603. if ( Array.isArray( val ) ) {
  16604. return jQuery.map( val, function( val ) {
  16605. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  16606. } );
  16607. }
  16608. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  16609. } ).get();
  16610. }
  16611. } );
  16612. var
  16613. r20 = /%20/g,
  16614. rhash = /#.*$/,
  16615. rantiCache = /([?&])_=[^&]*/,
  16616. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  16617. // #7653, #8125, #8152: local protocol detection
  16618. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  16619. rnoContent = /^(?:GET|HEAD)$/,
  16620. rprotocol = /^\/\//,
  16621. /* Prefilters
  16622. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  16623. * 2) These are called:
  16624. * - BEFORE asking for a transport
  16625. * - AFTER param serialization (s.data is a string if s.processData is true)
  16626. * 3) key is the dataType
  16627. * 4) the catchall symbol "*" can be used
  16628. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  16629. */
  16630. prefilters = {},
  16631. /* Transports bindings
  16632. * 1) key is the dataType
  16633. * 2) the catchall symbol "*" can be used
  16634. * 3) selection will start with transport dataType and THEN go to "*" if needed
  16635. */
  16636. transports = {},
  16637. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  16638. allTypes = "*/".concat( "*" ),
  16639. // Anchor tag for parsing the document origin
  16640. originAnchor = document.createElement( "a" );
  16641. originAnchor.href = location.href;
  16642. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  16643. function addToPrefiltersOrTransports( structure ) {
  16644. // dataTypeExpression is optional and defaults to "*"
  16645. return function( dataTypeExpression, func ) {
  16646. if ( typeof dataTypeExpression !== "string" ) {
  16647. func = dataTypeExpression;
  16648. dataTypeExpression = "*";
  16649. }
  16650. var dataType,
  16651. i = 0,
  16652. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  16653. if ( isFunction( func ) ) {
  16654. // For each dataType in the dataTypeExpression
  16655. while ( ( dataType = dataTypes[ i++ ] ) ) {
  16656. // Prepend if requested
  16657. if ( dataType[ 0 ] === "+" ) {
  16658. dataType = dataType.slice( 1 ) || "*";
  16659. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  16660. // Otherwise append
  16661. } else {
  16662. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  16663. }
  16664. }
  16665. }
  16666. };
  16667. }
  16668. // Base inspection function for prefilters and transports
  16669. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  16670. var inspected = {},
  16671. seekingTransport = ( structure === transports );
  16672. function inspect( dataType ) {
  16673. var selected;
  16674. inspected[ dataType ] = true;
  16675. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  16676. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  16677. if ( typeof dataTypeOrTransport === "string" &&
  16678. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  16679. options.dataTypes.unshift( dataTypeOrTransport );
  16680. inspect( dataTypeOrTransport );
  16681. return false;
  16682. } else if ( seekingTransport ) {
  16683. return !( selected = dataTypeOrTransport );
  16684. }
  16685. } );
  16686. return selected;
  16687. }
  16688. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  16689. }
  16690. // A special extend for ajax options
  16691. // that takes "flat" options (not to be deep extended)
  16692. // Fixes #9887
  16693. function ajaxExtend( target, src ) {
  16694. var key, deep,
  16695. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  16696. for ( key in src ) {
  16697. if ( src[ key ] !== undefined ) {
  16698. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  16699. }
  16700. }
  16701. if ( deep ) {
  16702. jQuery.extend( true, target, deep );
  16703. }
  16704. return target;
  16705. }
  16706. /* Handles responses to an ajax request:
  16707. * - finds the right dataType (mediates between content-type and expected dataType)
  16708. * - returns the corresponding response
  16709. */
  16710. function ajaxHandleResponses( s, jqXHR, responses ) {
  16711. var ct, type, finalDataType, firstDataType,
  16712. contents = s.contents,
  16713. dataTypes = s.dataTypes;
  16714. // Remove auto dataType and get content-type in the process
  16715. while ( dataTypes[ 0 ] === "*" ) {
  16716. dataTypes.shift();
  16717. if ( ct === undefined ) {
  16718. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  16719. }
  16720. }
  16721. // Check if we're dealing with a known content-type
  16722. if ( ct ) {
  16723. for ( type in contents ) {
  16724. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  16725. dataTypes.unshift( type );
  16726. break;
  16727. }
  16728. }
  16729. }
  16730. // Check to see if we have a response for the expected dataType
  16731. if ( dataTypes[ 0 ] in responses ) {
  16732. finalDataType = dataTypes[ 0 ];
  16733. } else {
  16734. // Try convertible dataTypes
  16735. for ( type in responses ) {
  16736. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  16737. finalDataType = type;
  16738. break;
  16739. }
  16740. if ( !firstDataType ) {
  16741. firstDataType = type;
  16742. }
  16743. }
  16744. // Or just use first one
  16745. finalDataType = finalDataType || firstDataType;
  16746. }
  16747. // If we found a dataType
  16748. // We add the dataType to the list if needed
  16749. // and return the corresponding response
  16750. if ( finalDataType ) {
  16751. if ( finalDataType !== dataTypes[ 0 ] ) {
  16752. dataTypes.unshift( finalDataType );
  16753. }
  16754. return responses[ finalDataType ];
  16755. }
  16756. }
  16757. /* Chain conversions given the request and the original response
  16758. * Also sets the responseXXX fields on the jqXHR instance
  16759. */
  16760. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  16761. var conv2, current, conv, tmp, prev,
  16762. converters = {},
  16763. // Work with a copy of dataTypes in case we need to modify it for conversion
  16764. dataTypes = s.dataTypes.slice();
  16765. // Create converters map with lowercased keys
  16766. if ( dataTypes[ 1 ] ) {
  16767. for ( conv in s.converters ) {
  16768. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  16769. }
  16770. }
  16771. current = dataTypes.shift();
  16772. // Convert to each sequential dataType
  16773. while ( current ) {
  16774. if ( s.responseFields[ current ] ) {
  16775. jqXHR[ s.responseFields[ current ] ] = response;
  16776. }
  16777. // Apply the dataFilter if provided
  16778. if ( !prev && isSuccess && s.dataFilter ) {
  16779. response = s.dataFilter( response, s.dataType );
  16780. }
  16781. prev = current;
  16782. current = dataTypes.shift();
  16783. if ( current ) {
  16784. // There's only work to do if current dataType is non-auto
  16785. if ( current === "*" ) {
  16786. current = prev;
  16787. // Convert response if prev dataType is non-auto and differs from current
  16788. } else if ( prev !== "*" && prev !== current ) {
  16789. // Seek a direct converter
  16790. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  16791. // If none found, seek a pair
  16792. if ( !conv ) {
  16793. for ( conv2 in converters ) {
  16794. // If conv2 outputs current
  16795. tmp = conv2.split( " " );
  16796. if ( tmp[ 1 ] === current ) {
  16797. // If prev can be converted to accepted input
  16798. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  16799. converters[ "* " + tmp[ 0 ] ];
  16800. if ( conv ) {
  16801. // Condense equivalence converters
  16802. if ( conv === true ) {
  16803. conv = converters[ conv2 ];
  16804. // Otherwise, insert the intermediate dataType
  16805. } else if ( converters[ conv2 ] !== true ) {
  16806. current = tmp[ 0 ];
  16807. dataTypes.unshift( tmp[ 1 ] );
  16808. }
  16809. break;
  16810. }
  16811. }
  16812. }
  16813. }
  16814. // Apply converter (if not an equivalence)
  16815. if ( conv !== true ) {
  16816. // Unless errors are allowed to bubble, catch and return them
  16817. if ( conv && s.throws ) {
  16818. response = conv( response );
  16819. } else {
  16820. try {
  16821. response = conv( response );
  16822. } catch ( e ) {
  16823. return {
  16824. state: "parsererror",
  16825. error: conv ? e : "No conversion from " + prev + " to " + current
  16826. };
  16827. }
  16828. }
  16829. }
  16830. }
  16831. }
  16832. }
  16833. return { state: "success", data: response };
  16834. }
  16835. jQuery.extend( {
  16836. // Counter for holding the number of active queries
  16837. active: 0,
  16838. // Last-Modified header cache for next request
  16839. lastModified: {},
  16840. etag: {},
  16841. ajaxSettings: {
  16842. url: location.href,
  16843. type: "GET",
  16844. isLocal: rlocalProtocol.test( location.protocol ),
  16845. global: true,
  16846. processData: true,
  16847. async: true,
  16848. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  16849. /*
  16850. timeout: 0,
  16851. data: null,
  16852. dataType: null,
  16853. username: null,
  16854. password: null,
  16855. cache: null,
  16856. throws: false,
  16857. traditional: false,
  16858. headers: {},
  16859. */
  16860. accepts: {
  16861. "*": allTypes,
  16862. text: "text/plain",
  16863. html: "text/html",
  16864. xml: "application/xml, text/xml",
  16865. json: "application/json, text/javascript"
  16866. },
  16867. contents: {
  16868. xml: /\bxml\b/,
  16869. html: /\bhtml/,
  16870. json: /\bjson\b/
  16871. },
  16872. responseFields: {
  16873. xml: "responseXML",
  16874. text: "responseText",
  16875. json: "responseJSON"
  16876. },
  16877. // Data converters
  16878. // Keys separate source (or catchall "*") and destination types with a single space
  16879. converters: {
  16880. // Convert anything to text
  16881. "* text": String,
  16882. // Text to html (true = no transformation)
  16883. "text html": true,
  16884. // Evaluate text as a json expression
  16885. "text json": JSON.parse,
  16886. // Parse text as xml
  16887. "text xml": jQuery.parseXML
  16888. },
  16889. // For options that shouldn't be deep extended:
  16890. // you can add your own custom options here if
  16891. // and when you create one that shouldn't be
  16892. // deep extended (see ajaxExtend)
  16893. flatOptions: {
  16894. url: true,
  16895. context: true
  16896. }
  16897. },
  16898. // Creates a full fledged settings object into target
  16899. // with both ajaxSettings and settings fields.
  16900. // If target is omitted, writes into ajaxSettings.
  16901. ajaxSetup: function( target, settings ) {
  16902. return settings ?
  16903. // Building a settings object
  16904. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  16905. // Extending ajaxSettings
  16906. ajaxExtend( jQuery.ajaxSettings, target );
  16907. },
  16908. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  16909. ajaxTransport: addToPrefiltersOrTransports( transports ),
  16910. // Main method
  16911. ajax: function( url, options ) {
  16912. // If url is an object, simulate pre-1.5 signature
  16913. if ( typeof url === "object" ) {
  16914. options = url;
  16915. url = undefined;
  16916. }
  16917. // Force options to be an object
  16918. options = options || {};
  16919. var transport,
  16920. // URL without anti-cache param
  16921. cacheURL,
  16922. // Response headers
  16923. responseHeadersString,
  16924. responseHeaders,
  16925. // timeout handle
  16926. timeoutTimer,
  16927. // Url cleanup var
  16928. urlAnchor,
  16929. // Request state (becomes false upon send and true upon completion)
  16930. completed,
  16931. // To know if global events are to be dispatched
  16932. fireGlobals,
  16933. // Loop variable
  16934. i,
  16935. // uncached part of the url
  16936. uncached,
  16937. // Create the final options object
  16938. s = jQuery.ajaxSetup( {}, options ),
  16939. // Callbacks context
  16940. callbackContext = s.context || s,
  16941. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  16942. globalEventContext = s.context &&
  16943. ( callbackContext.nodeType || callbackContext.jquery ) ?
  16944. jQuery( callbackContext ) :
  16945. jQuery.event,
  16946. // Deferreds
  16947. deferred = jQuery.Deferred(),
  16948. completeDeferred = jQuery.Callbacks( "once memory" ),
  16949. // Status-dependent callbacks
  16950. statusCode = s.statusCode || {},
  16951. // Headers (they are sent all at once)
  16952. requestHeaders = {},
  16953. requestHeadersNames = {},
  16954. // Default abort message
  16955. strAbort = "canceled",
  16956. // Fake xhr
  16957. jqXHR = {
  16958. readyState: 0,
  16959. // Builds headers hashtable if needed
  16960. getResponseHeader: function( key ) {
  16961. var match;
  16962. if ( completed ) {
  16963. if ( !responseHeaders ) {
  16964. responseHeaders = {};
  16965. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  16966. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  16967. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  16968. .concat( match[ 2 ] );
  16969. }
  16970. }
  16971. match = responseHeaders[ key.toLowerCase() + " " ];
  16972. }
  16973. return match == null ? null : match.join( ", " );
  16974. },
  16975. // Raw string
  16976. getAllResponseHeaders: function() {
  16977. return completed ? responseHeadersString : null;
  16978. },
  16979. // Caches the header
  16980. setRequestHeader: function( name, value ) {
  16981. if ( completed == null ) {
  16982. name = requestHeadersNames[ name.toLowerCase() ] =
  16983. requestHeadersNames[ name.toLowerCase() ] || name;
  16984. requestHeaders[ name ] = value;
  16985. }
  16986. return this;
  16987. },
  16988. // Overrides response content-type header
  16989. overrideMimeType: function( type ) {
  16990. if ( completed == null ) {
  16991. s.mimeType = type;
  16992. }
  16993. return this;
  16994. },
  16995. // Status-dependent callbacks
  16996. statusCode: function( map ) {
  16997. var code;
  16998. if ( map ) {
  16999. if ( completed ) {
  17000. // Execute the appropriate callbacks
  17001. jqXHR.always( map[ jqXHR.status ] );
  17002. } else {
  17003. // Lazy-add the new callbacks in a way that preserves old ones
  17004. for ( code in map ) {
  17005. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  17006. }
  17007. }
  17008. }
  17009. return this;
  17010. },
  17011. // Cancel the request
  17012. abort: function( statusText ) {
  17013. var finalText = statusText || strAbort;
  17014. if ( transport ) {
  17015. transport.abort( finalText );
  17016. }
  17017. done( 0, finalText );
  17018. return this;
  17019. }
  17020. };
  17021. // Attach deferreds
  17022. deferred.promise( jqXHR );
  17023. // Add protocol if not provided (prefilters might expect it)
  17024. // Handle falsy url in the settings object (#10093: consistency with old signature)
  17025. // We also use the url parameter if available
  17026. s.url = ( ( url || s.url || location.href ) + "" )
  17027. .replace( rprotocol, location.protocol + "//" );
  17028. // Alias method option to type as per ticket #12004
  17029. s.type = options.method || options.type || s.method || s.type;
  17030. // Extract dataTypes list
  17031. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  17032. // A cross-domain request is in order when the origin doesn't match the current origin.
  17033. if ( s.crossDomain == null ) {
  17034. urlAnchor = document.createElement( "a" );
  17035. // Support: IE <=8 - 11, Edge 12 - 15
  17036. // IE throws exception on accessing the href property if url is malformed,
  17037. // e.g. http://example.com:80x/
  17038. try {
  17039. urlAnchor.href = s.url;
  17040. // Support: IE <=8 - 11 only
  17041. // Anchor's host property isn't correctly set when s.url is relative
  17042. urlAnchor.href = urlAnchor.href;
  17043. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  17044. urlAnchor.protocol + "//" + urlAnchor.host;
  17045. } catch ( e ) {
  17046. // If there is an error parsing the URL, assume it is crossDomain,
  17047. // it can be rejected by the transport if it is invalid
  17048. s.crossDomain = true;
  17049. }
  17050. }
  17051. // Convert data if not already a string
  17052. if ( s.data && s.processData && typeof s.data !== "string" ) {
  17053. s.data = jQuery.param( s.data, s.traditional );
  17054. }
  17055. // Apply prefilters
  17056. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  17057. // If request was aborted inside a prefilter, stop there
  17058. if ( completed ) {
  17059. return jqXHR;
  17060. }
  17061. // We can fire global events as of now if asked to
  17062. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  17063. fireGlobals = jQuery.event && s.global;
  17064. // Watch for a new set of requests
  17065. if ( fireGlobals && jQuery.active++ === 0 ) {
  17066. jQuery.event.trigger( "ajaxStart" );
  17067. }
  17068. // Uppercase the type
  17069. s.type = s.type.toUpperCase();
  17070. // Determine if request has content
  17071. s.hasContent = !rnoContent.test( s.type );
  17072. // Save the URL in case we're toying with the If-Modified-Since
  17073. // and/or If-None-Match header later on
  17074. // Remove hash to simplify url manipulation
  17075. cacheURL = s.url.replace( rhash, "" );
  17076. // More options handling for requests with no content
  17077. if ( !s.hasContent ) {
  17078. // Remember the hash so we can put it back
  17079. uncached = s.url.slice( cacheURL.length );
  17080. // If data is available and should be processed, append data to url
  17081. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  17082. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  17083. // #9682: remove data so that it's not used in an eventual retry
  17084. delete s.data;
  17085. }
  17086. // Add or update anti-cache param if needed
  17087. if ( s.cache === false ) {
  17088. cacheURL = cacheURL.replace( rantiCache, "$1" );
  17089. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  17090. }
  17091. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  17092. s.url = cacheURL + uncached;
  17093. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  17094. } else if ( s.data && s.processData &&
  17095. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  17096. s.data = s.data.replace( r20, "+" );
  17097. }
  17098. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  17099. if ( s.ifModified ) {
  17100. if ( jQuery.lastModified[ cacheURL ] ) {
  17101. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  17102. }
  17103. if ( jQuery.etag[ cacheURL ] ) {
  17104. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  17105. }
  17106. }
  17107. // Set the correct header, if data is being sent
  17108. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  17109. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  17110. }
  17111. // Set the Accepts header for the server, depending on the dataType
  17112. jqXHR.setRequestHeader(
  17113. "Accept",
  17114. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  17115. s.accepts[ s.dataTypes[ 0 ] ] +
  17116. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  17117. s.accepts[ "*" ]
  17118. );
  17119. // Check for headers option
  17120. for ( i in s.headers ) {
  17121. jqXHR.setRequestHeader( i, s.headers[ i ] );
  17122. }
  17123. // Allow custom headers/mimetypes and early abort
  17124. if ( s.beforeSend &&
  17125. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  17126. // Abort if not done already and return
  17127. return jqXHR.abort();
  17128. }
  17129. // Aborting is no longer a cancellation
  17130. strAbort = "abort";
  17131. // Install callbacks on deferreds
  17132. completeDeferred.add( s.complete );
  17133. jqXHR.done( s.success );
  17134. jqXHR.fail( s.error );
  17135. // Get transport
  17136. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  17137. // If no transport, we auto-abort
  17138. if ( !transport ) {
  17139. done( -1, "No Transport" );
  17140. } else {
  17141. jqXHR.readyState = 1;
  17142. // Send global event
  17143. if ( fireGlobals ) {
  17144. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  17145. }
  17146. // If request was aborted inside ajaxSend, stop there
  17147. if ( completed ) {
  17148. return jqXHR;
  17149. }
  17150. // Timeout
  17151. if ( s.async && s.timeout > 0 ) {
  17152. timeoutTimer = window.setTimeout( function() {
  17153. jqXHR.abort( "timeout" );
  17154. }, s.timeout );
  17155. }
  17156. try {
  17157. completed = false;
  17158. transport.send( requestHeaders, done );
  17159. } catch ( e ) {
  17160. // Rethrow post-completion exceptions
  17161. if ( completed ) {
  17162. throw e;
  17163. }
  17164. // Propagate others as results
  17165. done( -1, e );
  17166. }
  17167. }
  17168. // Callback for when everything is done
  17169. function done( status, nativeStatusText, responses, headers ) {
  17170. var isSuccess, success, error, response, modified,
  17171. statusText = nativeStatusText;
  17172. // Ignore repeat invocations
  17173. if ( completed ) {
  17174. return;
  17175. }
  17176. completed = true;
  17177. // Clear timeout if it exists
  17178. if ( timeoutTimer ) {
  17179. window.clearTimeout( timeoutTimer );
  17180. }
  17181. // Dereference transport for early garbage collection
  17182. // (no matter how long the jqXHR object will be used)
  17183. transport = undefined;
  17184. // Cache response headers
  17185. responseHeadersString = headers || "";
  17186. // Set readyState
  17187. jqXHR.readyState = status > 0 ? 4 : 0;
  17188. // Determine if successful
  17189. isSuccess = status >= 200 && status < 300 || status === 304;
  17190. // Get response data
  17191. if ( responses ) {
  17192. response = ajaxHandleResponses( s, jqXHR, responses );
  17193. }
  17194. // Convert no matter what (that way responseXXX fields are always set)
  17195. response = ajaxConvert( s, response, jqXHR, isSuccess );
  17196. // If successful, handle type chaining
  17197. if ( isSuccess ) {
  17198. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  17199. if ( s.ifModified ) {
  17200. modified = jqXHR.getResponseHeader( "Last-Modified" );
  17201. if ( modified ) {
  17202. jQuery.lastModified[ cacheURL ] = modified;
  17203. }
  17204. modified = jqXHR.getResponseHeader( "etag" );
  17205. if ( modified ) {
  17206. jQuery.etag[ cacheURL ] = modified;
  17207. }
  17208. }
  17209. // if no content
  17210. if ( status === 204 || s.type === "HEAD" ) {
  17211. statusText = "nocontent";
  17212. // if not modified
  17213. } else if ( status === 304 ) {
  17214. statusText = "notmodified";
  17215. // If we have data, let's convert it
  17216. } else {
  17217. statusText = response.state;
  17218. success = response.data;
  17219. error = response.error;
  17220. isSuccess = !error;
  17221. }
  17222. } else {
  17223. // Extract error from statusText and normalize for non-aborts
  17224. error = statusText;
  17225. if ( status || !statusText ) {
  17226. statusText = "error";
  17227. if ( status < 0 ) {
  17228. status = 0;
  17229. }
  17230. }
  17231. }
  17232. // Set data for the fake xhr object
  17233. jqXHR.status = status;
  17234. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  17235. // Success/Error
  17236. if ( isSuccess ) {
  17237. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  17238. } else {
  17239. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  17240. }
  17241. // Status-dependent callbacks
  17242. jqXHR.statusCode( statusCode );
  17243. statusCode = undefined;
  17244. if ( fireGlobals ) {
  17245. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  17246. [ jqXHR, s, isSuccess ? success : error ] );
  17247. }
  17248. // Complete
  17249. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  17250. if ( fireGlobals ) {
  17251. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  17252. // Handle the global AJAX counter
  17253. if ( !( --jQuery.active ) ) {
  17254. jQuery.event.trigger( "ajaxStop" );
  17255. }
  17256. }
  17257. }
  17258. return jqXHR;
  17259. },
  17260. getJSON: function( url, data, callback ) {
  17261. return jQuery.get( url, data, callback, "json" );
  17262. },
  17263. getScript: function( url, callback ) {
  17264. return jQuery.get( url, undefined, callback, "script" );
  17265. }
  17266. } );
  17267. jQuery.each( [ "get", "post" ], function( i, method ) {
  17268. jQuery[ method ] = function( url, data, callback, type ) {
  17269. // Shift arguments if data argument was omitted
  17270. if ( isFunction( data ) ) {
  17271. type = type || callback;
  17272. callback = data;
  17273. data = undefined;
  17274. }
  17275. // The url can be an options object (which then must have .url)
  17276. return jQuery.ajax( jQuery.extend( {
  17277. url: url,
  17278. type: method,
  17279. dataType: type,
  17280. data: data,
  17281. success: callback
  17282. }, jQuery.isPlainObject( url ) && url ) );
  17283. };
  17284. } );
  17285. jQuery._evalUrl = function( url, options ) {
  17286. return jQuery.ajax( {
  17287. url: url,
  17288. // Make this explicit, since user can override this through ajaxSetup (#11264)
  17289. type: "GET",
  17290. dataType: "script",
  17291. cache: true,
  17292. async: false,
  17293. global: false,
  17294. // Only evaluate the response if it is successful (gh-4126)
  17295. // dataFilter is not invoked for failure responses, so using it instead
  17296. // of the default converter is kludgy but it works.
  17297. converters: {
  17298. "text script": function() {}
  17299. },
  17300. dataFilter: function( response ) {
  17301. jQuery.globalEval( response, options );
  17302. }
  17303. } );
  17304. };
  17305. jQuery.fn.extend( {
  17306. wrapAll: function( html ) {
  17307. var wrap;
  17308. if ( this[ 0 ] ) {
  17309. if ( isFunction( html ) ) {
  17310. html = html.call( this[ 0 ] );
  17311. }
  17312. // The elements to wrap the target around
  17313. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  17314. if ( this[ 0 ].parentNode ) {
  17315. wrap.insertBefore( this[ 0 ] );
  17316. }
  17317. wrap.map( function() {
  17318. var elem = this;
  17319. while ( elem.firstElementChild ) {
  17320. elem = elem.firstElementChild;
  17321. }
  17322. return elem;
  17323. } ).append( this );
  17324. }
  17325. return this;
  17326. },
  17327. wrapInner: function( html ) {
  17328. if ( isFunction( html ) ) {
  17329. return this.each( function( i ) {
  17330. jQuery( this ).wrapInner( html.call( this, i ) );
  17331. } );
  17332. }
  17333. return this.each( function() {
  17334. var self = jQuery( this ),
  17335. contents = self.contents();
  17336. if ( contents.length ) {
  17337. contents.wrapAll( html );
  17338. } else {
  17339. self.append( html );
  17340. }
  17341. } );
  17342. },
  17343. wrap: function( html ) {
  17344. var htmlIsFunction = isFunction( html );
  17345. return this.each( function( i ) {
  17346. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  17347. } );
  17348. },
  17349. unwrap: function( selector ) {
  17350. this.parent( selector ).not( "body" ).each( function() {
  17351. jQuery( this ).replaceWith( this.childNodes );
  17352. } );
  17353. return this;
  17354. }
  17355. } );
  17356. jQuery.expr.pseudos.hidden = function( elem ) {
  17357. return !jQuery.expr.pseudos.visible( elem );
  17358. };
  17359. jQuery.expr.pseudos.visible = function( elem ) {
  17360. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  17361. };
  17362. jQuery.ajaxSettings.xhr = function() {
  17363. try {
  17364. return new window.XMLHttpRequest();
  17365. } catch ( e ) {}
  17366. };
  17367. var xhrSuccessStatus = {
  17368. // File protocol always yields status code 0, assume 200
  17369. 0: 200,
  17370. // Support: IE <=9 only
  17371. // #1450: sometimes IE returns 1223 when it should be 204
  17372. 1223: 204
  17373. },
  17374. xhrSupported = jQuery.ajaxSettings.xhr();
  17375. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  17376. support.ajax = xhrSupported = !!xhrSupported;
  17377. jQuery.ajaxTransport( function( options ) {
  17378. var callback, errorCallback;
  17379. // Cross domain only allowed if supported through XMLHttpRequest
  17380. if ( support.cors || xhrSupported && !options.crossDomain ) {
  17381. return {
  17382. send: function( headers, complete ) {
  17383. var i,
  17384. xhr = options.xhr();
  17385. xhr.open(
  17386. options.type,
  17387. options.url,
  17388. options.async,
  17389. options.username,
  17390. options.password
  17391. );
  17392. // Apply custom fields if provided
  17393. if ( options.xhrFields ) {
  17394. for ( i in options.xhrFields ) {
  17395. xhr[ i ] = options.xhrFields[ i ];
  17396. }
  17397. }
  17398. // Override mime type if needed
  17399. if ( options.mimeType && xhr.overrideMimeType ) {
  17400. xhr.overrideMimeType( options.mimeType );
  17401. }
  17402. // X-Requested-With header
  17403. // For cross-domain requests, seeing as conditions for a preflight are
  17404. // akin to a jigsaw puzzle, we simply never set it to be sure.
  17405. // (it can always be set on a per-request basis or even using ajaxSetup)
  17406. // For same-domain requests, won't change header if already provided.
  17407. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  17408. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  17409. }
  17410. // Set headers
  17411. for ( i in headers ) {
  17412. xhr.setRequestHeader( i, headers[ i ] );
  17413. }
  17414. // Callback
  17415. callback = function( type ) {
  17416. return function() {
  17417. if ( callback ) {
  17418. callback = errorCallback = xhr.onload =
  17419. xhr.onerror = xhr.onabort = xhr.ontimeout =
  17420. xhr.onreadystatechange = null;
  17421. if ( type === "abort" ) {
  17422. xhr.abort();
  17423. } else if ( type === "error" ) {
  17424. // Support: IE <=9 only
  17425. // On a manual native abort, IE9 throws
  17426. // errors on any property access that is not readyState
  17427. if ( typeof xhr.status !== "number" ) {
  17428. complete( 0, "error" );
  17429. } else {
  17430. complete(
  17431. // File: protocol always yields status 0; see #8605, #14207
  17432. xhr.status,
  17433. xhr.statusText
  17434. );
  17435. }
  17436. } else {
  17437. complete(
  17438. xhrSuccessStatus[ xhr.status ] || xhr.status,
  17439. xhr.statusText,
  17440. // Support: IE <=9 only
  17441. // IE9 has no XHR2 but throws on binary (trac-11426)
  17442. // For XHR2 non-text, let the caller handle it (gh-2498)
  17443. ( xhr.responseType || "text" ) !== "text" ||
  17444. typeof xhr.responseText !== "string" ?
  17445. { binary: xhr.response } :
  17446. { text: xhr.responseText },
  17447. xhr.getAllResponseHeaders()
  17448. );
  17449. }
  17450. }
  17451. };
  17452. };
  17453. // Listen to events
  17454. xhr.onload = callback();
  17455. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  17456. // Support: IE 9 only
  17457. // Use onreadystatechange to replace onabort
  17458. // to handle uncaught aborts
  17459. if ( xhr.onabort !== undefined ) {
  17460. xhr.onabort = errorCallback;
  17461. } else {
  17462. xhr.onreadystatechange = function() {
  17463. // Check readyState before timeout as it changes
  17464. if ( xhr.readyState === 4 ) {
  17465. // Allow onerror to be called first,
  17466. // but that will not handle a native abort
  17467. // Also, save errorCallback to a variable
  17468. // as xhr.onerror cannot be accessed
  17469. window.setTimeout( function() {
  17470. if ( callback ) {
  17471. errorCallback();
  17472. }
  17473. } );
  17474. }
  17475. };
  17476. }
  17477. // Create the abort callback
  17478. callback = callback( "abort" );
  17479. try {
  17480. // Do send the request (this may raise an exception)
  17481. xhr.send( options.hasContent && options.data || null );
  17482. } catch ( e ) {
  17483. // #14683: Only rethrow if this hasn't been notified as an error yet
  17484. if ( callback ) {
  17485. throw e;
  17486. }
  17487. }
  17488. },
  17489. abort: function() {
  17490. if ( callback ) {
  17491. callback();
  17492. }
  17493. }
  17494. };
  17495. }
  17496. } );
  17497. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  17498. jQuery.ajaxPrefilter( function( s ) {
  17499. if ( s.crossDomain ) {
  17500. s.contents.script = false;
  17501. }
  17502. } );
  17503. // Install script dataType
  17504. jQuery.ajaxSetup( {
  17505. accepts: {
  17506. script: "text/javascript, application/javascript, " +
  17507. "application/ecmascript, application/x-ecmascript"
  17508. },
  17509. contents: {
  17510. script: /\b(?:java|ecma)script\b/
  17511. },
  17512. converters: {
  17513. "text script": function( text ) {
  17514. jQuery.globalEval( text );
  17515. return text;
  17516. }
  17517. }
  17518. } );
  17519. // Handle cache's special case and crossDomain
  17520. jQuery.ajaxPrefilter( "script", function( s ) {
  17521. if ( s.cache === undefined ) {
  17522. s.cache = false;
  17523. }
  17524. if ( s.crossDomain ) {
  17525. s.type = "GET";
  17526. }
  17527. } );
  17528. // Bind script tag hack transport
  17529. jQuery.ajaxTransport( "script", function( s ) {
  17530. // This transport only deals with cross domain or forced-by-attrs requests
  17531. if ( s.crossDomain || s.scriptAttrs ) {
  17532. var script, callback;
  17533. return {
  17534. send: function( _, complete ) {
  17535. script = jQuery( "<script>" )
  17536. .attr( s.scriptAttrs || {} )
  17537. .prop( { charset: s.scriptCharset, src: s.url } )
  17538. .on( "load error", callback = function( evt ) {
  17539. script.remove();
  17540. callback = null;
  17541. if ( evt ) {
  17542. complete( evt.type === "error" ? 404 : 200, evt.type );
  17543. }
  17544. } );
  17545. // Use native DOM manipulation to avoid our domManip AJAX trickery
  17546. document.head.appendChild( script[ 0 ] );
  17547. },
  17548. abort: function() {
  17549. if ( callback ) {
  17550. callback();
  17551. }
  17552. }
  17553. };
  17554. }
  17555. } );
  17556. var oldCallbacks = [],
  17557. rjsonp = /(=)\?(?=&|$)|\?\?/;
  17558. // Default jsonp settings
  17559. jQuery.ajaxSetup( {
  17560. jsonp: "callback",
  17561. jsonpCallback: function() {
  17562. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  17563. this[ callback ] = true;
  17564. return callback;
  17565. }
  17566. } );
  17567. // Detect, normalize options and install callbacks for jsonp requests
  17568. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  17569. var callbackName, overwritten, responseContainer,
  17570. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  17571. "url" :
  17572. typeof s.data === "string" &&
  17573. ( s.contentType || "" )
  17574. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  17575. rjsonp.test( s.data ) && "data"
  17576. );
  17577. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  17578. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  17579. // Get callback name, remembering preexisting value associated with it
  17580. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  17581. s.jsonpCallback() :
  17582. s.jsonpCallback;
  17583. // Insert callback into url or form data
  17584. if ( jsonProp ) {
  17585. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  17586. } else if ( s.jsonp !== false ) {
  17587. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  17588. }
  17589. // Use data converter to retrieve json after script execution
  17590. s.converters[ "script json" ] = function() {
  17591. if ( !responseContainer ) {
  17592. jQuery.error( callbackName + " was not called" );
  17593. }
  17594. return responseContainer[ 0 ];
  17595. };
  17596. // Force json dataType
  17597. s.dataTypes[ 0 ] = "json";
  17598. // Install callback
  17599. overwritten = window[ callbackName ];
  17600. window[ callbackName ] = function() {
  17601. responseContainer = arguments;
  17602. };
  17603. // Clean-up function (fires after converters)
  17604. jqXHR.always( function() {
  17605. // If previous value didn't exist - remove it
  17606. if ( overwritten === undefined ) {
  17607. jQuery( window ).removeProp( callbackName );
  17608. // Otherwise restore preexisting value
  17609. } else {
  17610. window[ callbackName ] = overwritten;
  17611. }
  17612. // Save back as free
  17613. if ( s[ callbackName ] ) {
  17614. // Make sure that re-using the options doesn't screw things around
  17615. s.jsonpCallback = originalSettings.jsonpCallback;
  17616. // Save the callback name for future use
  17617. oldCallbacks.push( callbackName );
  17618. }
  17619. // Call if it was a function and we have a response
  17620. if ( responseContainer && isFunction( overwritten ) ) {
  17621. overwritten( responseContainer[ 0 ] );
  17622. }
  17623. responseContainer = overwritten = undefined;
  17624. } );
  17625. // Delegate to script
  17626. return "script";
  17627. }
  17628. } );
  17629. // Support: Safari 8 only
  17630. // In Safari 8 documents created via document.implementation.createHTMLDocument
  17631. // collapse sibling forms: the second one becomes a child of the first one.
  17632. // Because of that, this security measure has to be disabled in Safari 8.
  17633. // https://bugs.webkit.org/show_bug.cgi?id=137337
  17634. support.createHTMLDocument = ( function() {
  17635. var body = document.implementation.createHTMLDocument( "" ).body;
  17636. body.innerHTML = "<form></form><form></form>";
  17637. return body.childNodes.length === 2;
  17638. } )();
  17639. // Argument "data" should be string of html
  17640. // context (optional): If specified, the fragment will be created in this context,
  17641. // defaults to document
  17642. // keepScripts (optional): If true, will include scripts passed in the html string
  17643. jQuery.parseHTML = function( data, context, keepScripts ) {
  17644. if ( typeof data !== "string" ) {
  17645. return [];
  17646. }
  17647. if ( typeof context === "boolean" ) {
  17648. keepScripts = context;
  17649. context = false;
  17650. }
  17651. var base, parsed, scripts;
  17652. if ( !context ) {
  17653. // Stop scripts or inline event handlers from being executed immediately
  17654. // by using document.implementation
  17655. if ( support.createHTMLDocument ) {
  17656. context = document.implementation.createHTMLDocument( "" );
  17657. // Set the base href for the created document
  17658. // so any parsed elements with URLs
  17659. // are based on the document's URL (gh-2965)
  17660. base = context.createElement( "base" );
  17661. base.href = document.location.href;
  17662. context.head.appendChild( base );
  17663. } else {
  17664. context = document;
  17665. }
  17666. }
  17667. parsed = rsingleTag.exec( data );
  17668. scripts = !keepScripts && [];
  17669. // Single tag
  17670. if ( parsed ) {
  17671. return [ context.createElement( parsed[ 1 ] ) ];
  17672. }
  17673. parsed = buildFragment( [ data ], context, scripts );
  17674. if ( scripts && scripts.length ) {
  17675. jQuery( scripts ).remove();
  17676. }
  17677. return jQuery.merge( [], parsed.childNodes );
  17678. };
  17679. /**
  17680. * Load a url into a page
  17681. */
  17682. jQuery.fn.load = function( url, params, callback ) {
  17683. var selector, type, response,
  17684. self = this,
  17685. off = url.indexOf( " " );
  17686. if ( off > -1 ) {
  17687. selector = stripAndCollapse( url.slice( off ) );
  17688. url = url.slice( 0, off );
  17689. }
  17690. // If it's a function
  17691. if ( isFunction( params ) ) {
  17692. // We assume that it's the callback
  17693. callback = params;
  17694. params = undefined;
  17695. // Otherwise, build a param string
  17696. } else if ( params && typeof params === "object" ) {
  17697. type = "POST";
  17698. }
  17699. // If we have elements to modify, make the request
  17700. if ( self.length > 0 ) {
  17701. jQuery.ajax( {
  17702. url: url,
  17703. // If "type" variable is undefined, then "GET" method will be used.
  17704. // Make value of this field explicit since
  17705. // user can override it through ajaxSetup method
  17706. type: type || "GET",
  17707. dataType: "html",
  17708. data: params
  17709. } ).done( function( responseText ) {
  17710. // Save response for use in complete callback
  17711. response = arguments;
  17712. self.html( selector ?
  17713. // If a selector was specified, locate the right elements in a dummy div
  17714. // Exclude scripts to avoid IE 'Permission Denied' errors
  17715. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  17716. // Otherwise use the full result
  17717. responseText );
  17718. // If the request succeeds, this function gets "data", "status", "jqXHR"
  17719. // but they are ignored because response was set above.
  17720. // If it fails, this function gets "jqXHR", "status", "error"
  17721. } ).always( callback && function( jqXHR, status ) {
  17722. self.each( function() {
  17723. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  17724. } );
  17725. } );
  17726. }
  17727. return this;
  17728. };
  17729. // Attach a bunch of functions for handling common AJAX events
  17730. jQuery.each( [
  17731. "ajaxStart",
  17732. "ajaxStop",
  17733. "ajaxComplete",
  17734. "ajaxError",
  17735. "ajaxSuccess",
  17736. "ajaxSend"
  17737. ], function( i, type ) {
  17738. jQuery.fn[ type ] = function( fn ) {
  17739. return this.on( type, fn );
  17740. };
  17741. } );
  17742. jQuery.expr.pseudos.animated = function( elem ) {
  17743. return jQuery.grep( jQuery.timers, function( fn ) {
  17744. return elem === fn.elem;
  17745. } ).length;
  17746. };
  17747. jQuery.offset = {
  17748. setOffset: function( elem, options, i ) {
  17749. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  17750. position = jQuery.css( elem, "position" ),
  17751. curElem = jQuery( elem ),
  17752. props = {};
  17753. // Set position first, in-case top/left are set even on static elem
  17754. if ( position === "static" ) {
  17755. elem.style.position = "relative";
  17756. }
  17757. curOffset = curElem.offset();
  17758. curCSSTop = jQuery.css( elem, "top" );
  17759. curCSSLeft = jQuery.css( elem, "left" );
  17760. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  17761. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  17762. // Need to be able to calculate position if either
  17763. // top or left is auto and position is either absolute or fixed
  17764. if ( calculatePosition ) {
  17765. curPosition = curElem.position();
  17766. curTop = curPosition.top;
  17767. curLeft = curPosition.left;
  17768. } else {
  17769. curTop = parseFloat( curCSSTop ) || 0;
  17770. curLeft = parseFloat( curCSSLeft ) || 0;
  17771. }
  17772. if ( isFunction( options ) ) {
  17773. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  17774. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  17775. }
  17776. if ( options.top != null ) {
  17777. props.top = ( options.top - curOffset.top ) + curTop;
  17778. }
  17779. if ( options.left != null ) {
  17780. props.left = ( options.left - curOffset.left ) + curLeft;
  17781. }
  17782. if ( "using" in options ) {
  17783. options.using.call( elem, props );
  17784. } else {
  17785. curElem.css( props );
  17786. }
  17787. }
  17788. };
  17789. jQuery.fn.extend( {
  17790. // offset() relates an element's border box to the document origin
  17791. offset: function( options ) {
  17792. // Preserve chaining for setter
  17793. if ( arguments.length ) {
  17794. return options === undefined ?
  17795. this :
  17796. this.each( function( i ) {
  17797. jQuery.offset.setOffset( this, options, i );
  17798. } );
  17799. }
  17800. var rect, win,
  17801. elem = this[ 0 ];
  17802. if ( !elem ) {
  17803. return;
  17804. }
  17805. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  17806. // Support: IE <=11 only
  17807. // Running getBoundingClientRect on a
  17808. // disconnected node in IE throws an error
  17809. if ( !elem.getClientRects().length ) {
  17810. return { top: 0, left: 0 };
  17811. }
  17812. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  17813. rect = elem.getBoundingClientRect();
  17814. win = elem.ownerDocument.defaultView;
  17815. return {
  17816. top: rect.top + win.pageYOffset,
  17817. left: rect.left + win.pageXOffset
  17818. };
  17819. },
  17820. // position() relates an element's margin box to its offset parent's padding box
  17821. // This corresponds to the behavior of CSS absolute positioning
  17822. position: function() {
  17823. if ( !this[ 0 ] ) {
  17824. return;
  17825. }
  17826. var offsetParent, offset, doc,
  17827. elem = this[ 0 ],
  17828. parentOffset = { top: 0, left: 0 };
  17829. // position:fixed elements are offset from the viewport, which itself always has zero offset
  17830. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  17831. // Assume position:fixed implies availability of getBoundingClientRect
  17832. offset = elem.getBoundingClientRect();
  17833. } else {
  17834. offset = this.offset();
  17835. // Account for the *real* offset parent, which can be the document or its root element
  17836. // when a statically positioned element is identified
  17837. doc = elem.ownerDocument;
  17838. offsetParent = elem.offsetParent || doc.documentElement;
  17839. while ( offsetParent &&
  17840. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  17841. jQuery.css( offsetParent, "position" ) === "static" ) {
  17842. offsetParent = offsetParent.parentNode;
  17843. }
  17844. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  17845. // Incorporate borders into its offset, since they are outside its content origin
  17846. parentOffset = jQuery( offsetParent ).offset();
  17847. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  17848. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  17849. }
  17850. }
  17851. // Subtract parent offsets and element margins
  17852. return {
  17853. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  17854. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  17855. };
  17856. },
  17857. // This method will return documentElement in the following cases:
  17858. // 1) For the element inside the iframe without offsetParent, this method will return
  17859. // documentElement of the parent window
  17860. // 2) For the hidden or detached element
  17861. // 3) For body or html element, i.e. in case of the html node - it will return itself
  17862. //
  17863. // but those exceptions were never presented as a real life use-cases
  17864. // and might be considered as more preferable results.
  17865. //
  17866. // This logic, however, is not guaranteed and can change at any point in the future
  17867. offsetParent: function() {
  17868. return this.map( function() {
  17869. var offsetParent = this.offsetParent;
  17870. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  17871. offsetParent = offsetParent.offsetParent;
  17872. }
  17873. return offsetParent || documentElement;
  17874. } );
  17875. }
  17876. } );
  17877. // Create scrollLeft and scrollTop methods
  17878. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  17879. var top = "pageYOffset" === prop;
  17880. jQuery.fn[ method ] = function( val ) {
  17881. return access( this, function( elem, method, val ) {
  17882. // Coalesce documents and windows
  17883. var win;
  17884. if ( isWindow( elem ) ) {
  17885. win = elem;
  17886. } else if ( elem.nodeType === 9 ) {
  17887. win = elem.defaultView;
  17888. }
  17889. if ( val === undefined ) {
  17890. return win ? win[ prop ] : elem[ method ];
  17891. }
  17892. if ( win ) {
  17893. win.scrollTo(
  17894. !top ? val : win.pageXOffset,
  17895. top ? val : win.pageYOffset
  17896. );
  17897. } else {
  17898. elem[ method ] = val;
  17899. }
  17900. }, method, val, arguments.length );
  17901. };
  17902. } );
  17903. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  17904. // Add the top/left cssHooks using jQuery.fn.position
  17905. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  17906. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  17907. // getComputedStyle returns percent when specified for top/left/bottom/right;
  17908. // rather than make the css module depend on the offset module, just check for it here
  17909. jQuery.each( [ "top", "left" ], function( i, prop ) {
  17910. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  17911. function( elem, computed ) {
  17912. if ( computed ) {
  17913. computed = curCSS( elem, prop );
  17914. // If curCSS returns percentage, fallback to offset
  17915. return rnumnonpx.test( computed ) ?
  17916. jQuery( elem ).position()[ prop ] + "px" :
  17917. computed;
  17918. }
  17919. }
  17920. );
  17921. } );
  17922. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  17923. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  17924. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  17925. function( defaultExtra, funcName ) {
  17926. // Margin is only for outerHeight, outerWidth
  17927. jQuery.fn[ funcName ] = function( margin, value ) {
  17928. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  17929. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  17930. return access( this, function( elem, type, value ) {
  17931. var doc;
  17932. if ( isWindow( elem ) ) {
  17933. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  17934. return funcName.indexOf( "outer" ) === 0 ?
  17935. elem[ "inner" + name ] :
  17936. elem.document.documentElement[ "client" + name ];
  17937. }
  17938. // Get document width or height
  17939. if ( elem.nodeType === 9 ) {
  17940. doc = elem.documentElement;
  17941. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  17942. // whichever is greatest
  17943. return Math.max(
  17944. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  17945. elem.body[ "offset" + name ], doc[ "offset" + name ],
  17946. doc[ "client" + name ]
  17947. );
  17948. }
  17949. return value === undefined ?
  17950. // Get width or height on the element, requesting but not forcing parseFloat
  17951. jQuery.css( elem, type, extra ) :
  17952. // Set width or height on the element
  17953. jQuery.style( elem, type, value, extra );
  17954. }, type, chainable ? margin : undefined, chainable );
  17955. };
  17956. } );
  17957. } );
  17958. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  17959. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  17960. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  17961. function( i, name ) {
  17962. // Handle event binding
  17963. jQuery.fn[ name ] = function( data, fn ) {
  17964. return arguments.length > 0 ?
  17965. this.on( name, null, data, fn ) :
  17966. this.trigger( name );
  17967. };
  17968. } );
  17969. jQuery.fn.extend( {
  17970. hover: function( fnOver, fnOut ) {
  17971. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  17972. }
  17973. } );
  17974. jQuery.fn.extend( {
  17975. bind: function( types, data, fn ) {
  17976. return this.on( types, null, data, fn );
  17977. },
  17978. unbind: function( types, fn ) {
  17979. return this.off( types, null, fn );
  17980. },
  17981. delegate: function( selector, types, data, fn ) {
  17982. return this.on( types, selector, data, fn );
  17983. },
  17984. undelegate: function( selector, types, fn ) {
  17985. // ( namespace ) or ( selector, types [, fn] )
  17986. return arguments.length === 1 ?
  17987. this.off( selector, "**" ) :
  17988. this.off( types, selector || "**", fn );
  17989. }
  17990. } );
  17991. // Bind a function to a context, optionally partially applying any
  17992. // arguments.
  17993. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  17994. // However, it is not slated for removal any time soon
  17995. jQuery.proxy = function( fn, context ) {
  17996. var tmp, args, proxy;
  17997. if ( typeof context === "string" ) {
  17998. tmp = fn[ context ];
  17999. context = fn;
  18000. fn = tmp;
  18001. }
  18002. // Quick check to determine if target is callable, in the spec
  18003. // this throws a TypeError, but we will just return undefined.
  18004. if ( !isFunction( fn ) ) {
  18005. return undefined;
  18006. }
  18007. // Simulated bind
  18008. args = slice.call( arguments, 2 );
  18009. proxy = function() {
  18010. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  18011. };
  18012. // Set the guid of unique handler to the same of original handler, so it can be removed
  18013. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  18014. return proxy;
  18015. };
  18016. jQuery.holdReady = function( hold ) {
  18017. if ( hold ) {
  18018. jQuery.readyWait++;
  18019. } else {
  18020. jQuery.ready( true );
  18021. }
  18022. };
  18023. jQuery.isArray = Array.isArray;
  18024. jQuery.parseJSON = JSON.parse;
  18025. jQuery.nodeName = nodeName;
  18026. jQuery.isFunction = isFunction;
  18027. jQuery.isWindow = isWindow;
  18028. jQuery.camelCase = camelCase;
  18029. jQuery.type = toType;
  18030. jQuery.now = Date.now;
  18031. jQuery.isNumeric = function( obj ) {
  18032. // As of jQuery 3.0, isNumeric is limited to
  18033. // strings and numbers (primitives or objects)
  18034. // that can be coerced to finite numbers (gh-2662)
  18035. var type = jQuery.type( obj );
  18036. return ( type === "number" || type === "string" ) &&
  18037. // parseFloat NaNs numeric-cast false positives ("")
  18038. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  18039. // subtraction forces infinities to NaN
  18040. !isNaN( obj - parseFloat( obj ) );
  18041. };
  18042. // Register as a named AMD module, since jQuery can be concatenated with other
  18043. // files that may use define, but not via a proper concatenation script that
  18044. // understands anonymous AMD modules. A named AMD is safest and most robust
  18045. // way to register. Lowercase jquery is used because AMD module names are
  18046. // derived from file names, and jQuery is normally delivered in a lowercase
  18047. // file name. Do this after creating the global so that if an AMD module wants
  18048. // to call noConflict to hide this version of jQuery, it will work.
  18049. // Note that for maximum portability, libraries that are not jQuery should
  18050. // declare themselves as anonymous modules, and avoid setting a global if an
  18051. // AMD loader is present. jQuery is a special case. For more information, see
  18052. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  18053. if ( true ) {
  18054. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  18055. return jQuery;
  18056. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  18057. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  18058. }
  18059. var
  18060. // Map over jQuery in case of overwrite
  18061. _jQuery = window.jQuery,
  18062. // Map over the $ in case of overwrite
  18063. _$ = window.$;
  18064. jQuery.noConflict = function( deep ) {
  18065. if ( window.$ === jQuery ) {
  18066. window.$ = _$;
  18067. }
  18068. if ( deep && window.jQuery === jQuery ) {
  18069. window.jQuery = _jQuery;
  18070. }
  18071. return jQuery;
  18072. };
  18073. // Expose jQuery and $ identifiers, even in AMD
  18074. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  18075. // and CommonJS for browser emulators (#13566)
  18076. if ( !noGlobal ) {
  18077. window.jQuery = window.$ = jQuery;
  18078. }
  18079. return jQuery;
  18080. } );
  18081. /***/ }),
  18082. /***/ "./node_modules/laravel-echo/dist/echo.js":
  18083. /*!************************************************!*\
  18084. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  18085. \************************************************/
  18086. /*! exports provided: default */
  18087. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  18088. "use strict";
  18089. __webpack_require__.r(__webpack_exports__);
  18090. var classCallCheck = function (instance, Constructor) {
  18091. if (!(instance instanceof Constructor)) {
  18092. throw new TypeError("Cannot call a class as a function");
  18093. }
  18094. };
  18095. var createClass = function () {
  18096. function defineProperties(target, props) {
  18097. for (var i = 0; i < props.length; i++) {
  18098. var descriptor = props[i];
  18099. descriptor.enumerable = descriptor.enumerable || false;
  18100. descriptor.configurable = true;
  18101. if ("value" in descriptor) descriptor.writable = true;
  18102. Object.defineProperty(target, descriptor.key, descriptor);
  18103. }
  18104. }
  18105. return function (Constructor, protoProps, staticProps) {
  18106. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  18107. if (staticProps) defineProperties(Constructor, staticProps);
  18108. return Constructor;
  18109. };
  18110. }();
  18111. var _extends = Object.assign || function (target) {
  18112. for (var i = 1; i < arguments.length; i++) {
  18113. var source = arguments[i];
  18114. for (var key in source) {
  18115. if (Object.prototype.hasOwnProperty.call(source, key)) {
  18116. target[key] = source[key];
  18117. }
  18118. }
  18119. }
  18120. return target;
  18121. };
  18122. var inherits = function (subClass, superClass) {
  18123. if (typeof superClass !== "function" && superClass !== null) {
  18124. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  18125. }
  18126. subClass.prototype = Object.create(superClass && superClass.prototype, {
  18127. constructor: {
  18128. value: subClass,
  18129. enumerable: false,
  18130. writable: true,
  18131. configurable: true
  18132. }
  18133. });
  18134. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  18135. };
  18136. var possibleConstructorReturn = function (self, call) {
  18137. if (!self) {
  18138. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  18139. }
  18140. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  18141. };
  18142. var Connector = function () {
  18143. /**
  18144. * Create a new class instance.
  18145. */
  18146. function Connector(options) {
  18147. classCallCheck(this, Connector);
  18148. /**
  18149. * Default connector options.
  18150. */
  18151. this._defaultOptions = {
  18152. auth: {
  18153. headers: {}
  18154. },
  18155. authEndpoint: '/broadcasting/auth',
  18156. broadcaster: 'pusher',
  18157. csrfToken: null,
  18158. host: null,
  18159. key: null,
  18160. namespace: 'App.Events'
  18161. };
  18162. this.setOptions(options);
  18163. this.connect();
  18164. }
  18165. /**
  18166. * Merge the custom options with the defaults.
  18167. */
  18168. createClass(Connector, [{
  18169. key: 'setOptions',
  18170. value: function setOptions(options) {
  18171. this.options = _extends(this._defaultOptions, options);
  18172. if (this.csrfToken()) {
  18173. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  18174. }
  18175. return options;
  18176. }
  18177. /**
  18178. * Extract the CSRF token from the page.
  18179. */
  18180. }, {
  18181. key: 'csrfToken',
  18182. value: function csrfToken() {
  18183. var selector = void 0;
  18184. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  18185. return window['Laravel'].csrfToken;
  18186. } else if (this.options.csrfToken) {
  18187. return this.options.csrfToken;
  18188. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  18189. return selector.getAttribute('content');
  18190. }
  18191. return null;
  18192. }
  18193. }]);
  18194. return Connector;
  18195. }();
  18196. /**
  18197. * This class represents a basic channel.
  18198. */
  18199. var Channel = function () {
  18200. function Channel() {
  18201. classCallCheck(this, Channel);
  18202. }
  18203. createClass(Channel, [{
  18204. key: 'listenForWhisper',
  18205. /**
  18206. * Listen for a whisper event on the channel instance.
  18207. */
  18208. value: function listenForWhisper(event, callback) {
  18209. return this.listen('.client-' + event, callback);
  18210. }
  18211. /**
  18212. * Listen for an event on the channel instance.
  18213. */
  18214. }, {
  18215. key: 'notification',
  18216. value: function notification(callback) {
  18217. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  18218. }
  18219. /**
  18220. * Stop listening for a whispser event on the channel instance.
  18221. */
  18222. }, {
  18223. key: 'stopListeningForWhisper',
  18224. value: function stopListeningForWhisper(event) {
  18225. return this.stopListening('.client-' + event);
  18226. }
  18227. }]);
  18228. return Channel;
  18229. }();
  18230. /**
  18231. * Event name formatter
  18232. */
  18233. var EventFormatter = function () {
  18234. /**
  18235. * Create a new class instance.
  18236. */
  18237. function EventFormatter(namespace) {
  18238. classCallCheck(this, EventFormatter);
  18239. this.setNamespace(namespace);
  18240. }
  18241. /**
  18242. * Format the given event name.
  18243. */
  18244. createClass(EventFormatter, [{
  18245. key: 'format',
  18246. value: function format(event) {
  18247. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  18248. return event.substr(1);
  18249. } else if (this.namespace) {
  18250. event = this.namespace + '.' + event;
  18251. }
  18252. return event.replace(/\./g, '\\');
  18253. }
  18254. /**
  18255. * Set the event namespace.
  18256. */
  18257. }, {
  18258. key: 'setNamespace',
  18259. value: function setNamespace(value) {
  18260. this.namespace = value;
  18261. }
  18262. }]);
  18263. return EventFormatter;
  18264. }();
  18265. /**
  18266. * This class represents a Pusher channel.
  18267. */
  18268. var PusherChannel = function (_Channel) {
  18269. inherits(PusherChannel, _Channel);
  18270. /**
  18271. * Create a new class instance.
  18272. */
  18273. function PusherChannel(pusher, name, options) {
  18274. classCallCheck(this, PusherChannel);
  18275. var _this = possibleConstructorReturn(this, (PusherChannel.__proto__ || Object.getPrototypeOf(PusherChannel)).call(this));
  18276. _this.name = name;
  18277. _this.pusher = pusher;
  18278. _this.options = options;
  18279. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  18280. _this.subscribe();
  18281. return _this;
  18282. }
  18283. /**
  18284. * Subscribe to a Pusher channel.
  18285. */
  18286. createClass(PusherChannel, [{
  18287. key: 'subscribe',
  18288. value: function subscribe() {
  18289. this.subscription = this.pusher.subscribe(this.name);
  18290. }
  18291. /**
  18292. * Unsubscribe from a Pusher channel.
  18293. */
  18294. }, {
  18295. key: 'unsubscribe',
  18296. value: function unsubscribe() {
  18297. this.pusher.unsubscribe(this.name);
  18298. }
  18299. /**
  18300. * Listen for an event on the channel instance.
  18301. */
  18302. }, {
  18303. key: 'listen',
  18304. value: function listen(event, callback) {
  18305. this.on(this.eventFormatter.format(event), callback);
  18306. return this;
  18307. }
  18308. /**
  18309. * Stop listening for an event on the channel instance.
  18310. */
  18311. }, {
  18312. key: 'stopListening',
  18313. value: function stopListening(event) {
  18314. this.subscription.unbind(this.eventFormatter.format(event));
  18315. return this;
  18316. }
  18317. /**
  18318. * Bind a channel to an event.
  18319. */
  18320. }, {
  18321. key: 'on',
  18322. value: function on(event, callback) {
  18323. this.subscription.bind(event, callback);
  18324. return this;
  18325. }
  18326. }]);
  18327. return PusherChannel;
  18328. }(Channel);
  18329. /**
  18330. * This class represents a Pusher private channel.
  18331. */
  18332. var PusherPrivateChannel = function (_PusherChannel) {
  18333. inherits(PusherPrivateChannel, _PusherChannel);
  18334. function PusherPrivateChannel() {
  18335. classCallCheck(this, PusherPrivateChannel);
  18336. return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments));
  18337. }
  18338. createClass(PusherPrivateChannel, [{
  18339. key: 'whisper',
  18340. /**
  18341. * Trigger client event on the channel.
  18342. */
  18343. value: function whisper(eventName, data) {
  18344. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  18345. return this;
  18346. }
  18347. }]);
  18348. return PusherPrivateChannel;
  18349. }(PusherChannel);
  18350. /**
  18351. * This class represents a Pusher presence channel.
  18352. */
  18353. var PusherPresenceChannel = function (_PusherChannel) {
  18354. inherits(PusherPresenceChannel, _PusherChannel);
  18355. function PusherPresenceChannel() {
  18356. classCallCheck(this, PusherPresenceChannel);
  18357. return possibleConstructorReturn(this, (PusherPresenceChannel.__proto__ || Object.getPrototypeOf(PusherPresenceChannel)).apply(this, arguments));
  18358. }
  18359. createClass(PusherPresenceChannel, [{
  18360. key: 'here',
  18361. /**
  18362. * Register a callback to be called anytime the member list changes.
  18363. */
  18364. value: function here(callback) {
  18365. this.on('pusher:subscription_succeeded', function (data) {
  18366. callback(Object.keys(data.members).map(function (k) {
  18367. return data.members[k];
  18368. }));
  18369. });
  18370. return this;
  18371. }
  18372. /**
  18373. * Listen for someone joining the channel.
  18374. */
  18375. }, {
  18376. key: 'joining',
  18377. value: function joining(callback) {
  18378. this.on('pusher:member_added', function (member) {
  18379. callback(member.info);
  18380. });
  18381. return this;
  18382. }
  18383. /**
  18384. * Listen for someone leaving the channel.
  18385. */
  18386. }, {
  18387. key: 'leaving',
  18388. value: function leaving(callback) {
  18389. this.on('pusher:member_removed', function (member) {
  18390. callback(member.info);
  18391. });
  18392. return this;
  18393. }
  18394. /**
  18395. * Trigger client event on the channel.
  18396. */
  18397. }, {
  18398. key: 'whisper',
  18399. value: function whisper(eventName, data) {
  18400. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  18401. return this;
  18402. }
  18403. }]);
  18404. return PusherPresenceChannel;
  18405. }(PusherChannel);
  18406. /**
  18407. * This class represents a Socket.io channel.
  18408. */
  18409. var SocketIoChannel = function (_Channel) {
  18410. inherits(SocketIoChannel, _Channel);
  18411. /**
  18412. * Create a new class instance.
  18413. */
  18414. function SocketIoChannel(socket, name, options) {
  18415. classCallCheck(this, SocketIoChannel);
  18416. /**
  18417. * The event callbacks applied to the channel.
  18418. */
  18419. var _this = possibleConstructorReturn(this, (SocketIoChannel.__proto__ || Object.getPrototypeOf(SocketIoChannel)).call(this));
  18420. _this.events = {};
  18421. _this.name = name;
  18422. _this.socket = socket;
  18423. _this.options = options;
  18424. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  18425. _this.subscribe();
  18426. _this.configureReconnector();
  18427. return _this;
  18428. }
  18429. /**
  18430. * Subscribe to a Socket.io channel.
  18431. */
  18432. createClass(SocketIoChannel, [{
  18433. key: 'subscribe',
  18434. value: function subscribe() {
  18435. this.socket.emit('subscribe', {
  18436. channel: this.name,
  18437. auth: this.options.auth || {}
  18438. });
  18439. }
  18440. /**
  18441. * Unsubscribe from channel and ubind event callbacks.
  18442. */
  18443. }, {
  18444. key: 'unsubscribe',
  18445. value: function unsubscribe() {
  18446. this.unbind();
  18447. this.socket.emit('unsubscribe', {
  18448. channel: this.name,
  18449. auth: this.options.auth || {}
  18450. });
  18451. }
  18452. /**
  18453. * Listen for an event on the channel instance.
  18454. */
  18455. }, {
  18456. key: 'listen',
  18457. value: function listen(event, callback) {
  18458. this.on(this.eventFormatter.format(event), callback);
  18459. return this;
  18460. }
  18461. /**
  18462. * Stop listening for an event on the channel instance.
  18463. */
  18464. }, {
  18465. key: 'stopListening',
  18466. value: function stopListening(event) {
  18467. var name = this.eventFormatter.format(event);
  18468. this.socket.removeListener(name);
  18469. delete this.events[name];
  18470. return this;
  18471. }
  18472. /**
  18473. * Bind the channel's socket to an event and store the callback.
  18474. */
  18475. }, {
  18476. key: 'on',
  18477. value: function on(event, callback) {
  18478. var _this2 = this;
  18479. var listener = function listener(channel, data) {
  18480. if (_this2.name == channel) {
  18481. callback(data);
  18482. }
  18483. };
  18484. this.socket.on(event, listener);
  18485. this.bind(event, listener);
  18486. }
  18487. /**
  18488. * Attach a 'reconnect' listener and bind the event.
  18489. */
  18490. }, {
  18491. key: 'configureReconnector',
  18492. value: function configureReconnector() {
  18493. var _this3 = this;
  18494. var listener = function listener() {
  18495. _this3.subscribe();
  18496. };
  18497. this.socket.on('reconnect', listener);
  18498. this.bind('reconnect', listener);
  18499. }
  18500. /**
  18501. * Bind the channel's socket to an event and store the callback.
  18502. */
  18503. }, {
  18504. key: 'bind',
  18505. value: function bind(event, callback) {
  18506. this.events[event] = this.events[event] || [];
  18507. this.events[event].push(callback);
  18508. }
  18509. /**
  18510. * Unbind the channel's socket from all stored event callbacks.
  18511. */
  18512. }, {
  18513. key: 'unbind',
  18514. value: function unbind() {
  18515. var _this4 = this;
  18516. Object.keys(this.events).forEach(function (event) {
  18517. _this4.events[event].forEach(function (callback) {
  18518. _this4.socket.removeListener(event, callback);
  18519. });
  18520. delete _this4.events[event];
  18521. });
  18522. }
  18523. }]);
  18524. return SocketIoChannel;
  18525. }(Channel);
  18526. /**
  18527. * This class represents a Socket.io presence channel.
  18528. */
  18529. var SocketIoPrivateChannel = function (_SocketIoChannel) {
  18530. inherits(SocketIoPrivateChannel, _SocketIoChannel);
  18531. function SocketIoPrivateChannel() {
  18532. classCallCheck(this, SocketIoPrivateChannel);
  18533. return possibleConstructorReturn(this, (SocketIoPrivateChannel.__proto__ || Object.getPrototypeOf(SocketIoPrivateChannel)).apply(this, arguments));
  18534. }
  18535. createClass(SocketIoPrivateChannel, [{
  18536. key: 'whisper',
  18537. /**
  18538. * Trigger client event on the channel.
  18539. */
  18540. value: function whisper(eventName, data) {
  18541. this.socket.emit('client event', {
  18542. channel: this.name,
  18543. event: 'client-' + eventName,
  18544. data: data
  18545. });
  18546. return this;
  18547. }
  18548. }]);
  18549. return SocketIoPrivateChannel;
  18550. }(SocketIoChannel);
  18551. /**
  18552. * This class represents a Socket.io presence channel.
  18553. */
  18554. var SocketIoPresenceChannel = function (_SocketIoPrivateChann) {
  18555. inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  18556. function SocketIoPresenceChannel() {
  18557. classCallCheck(this, SocketIoPresenceChannel);
  18558. return possibleConstructorReturn(this, (SocketIoPresenceChannel.__proto__ || Object.getPrototypeOf(SocketIoPresenceChannel)).apply(this, arguments));
  18559. }
  18560. createClass(SocketIoPresenceChannel, [{
  18561. key: 'here',
  18562. /**
  18563. * Register a callback to be called anytime the member list changes.
  18564. */
  18565. value: function here(callback) {
  18566. this.on('presence:subscribed', function (members) {
  18567. callback(members.map(function (m) {
  18568. return m.user_info;
  18569. }));
  18570. });
  18571. return this;
  18572. }
  18573. /**
  18574. * Listen for someone joining the channel.
  18575. */
  18576. }, {
  18577. key: 'joining',
  18578. value: function joining(callback) {
  18579. this.on('presence:joining', function (member) {
  18580. return callback(member.user_info);
  18581. });
  18582. return this;
  18583. }
  18584. /**
  18585. * Listen for someone leaving the channel.
  18586. */
  18587. }, {
  18588. key: 'leaving',
  18589. value: function leaving(callback) {
  18590. this.on('presence:leaving', function (member) {
  18591. return callback(member.user_info);
  18592. });
  18593. return this;
  18594. }
  18595. }]);
  18596. return SocketIoPresenceChannel;
  18597. }(SocketIoPrivateChannel);
  18598. /**
  18599. * This class represents a null channel.
  18600. */
  18601. var NullChannel = function (_Channel) {
  18602. inherits(NullChannel, _Channel);
  18603. function NullChannel() {
  18604. classCallCheck(this, NullChannel);
  18605. return possibleConstructorReturn(this, (NullChannel.__proto__ || Object.getPrototypeOf(NullChannel)).apply(this, arguments));
  18606. }
  18607. createClass(NullChannel, [{
  18608. key: 'subscribe',
  18609. /**
  18610. * Subscribe to a channel.
  18611. */
  18612. value: function subscribe() {}
  18613. //
  18614. /**
  18615. * Unsubscribe from a channel.
  18616. */
  18617. }, {
  18618. key: 'unsubscribe',
  18619. value: function unsubscribe() {}
  18620. //
  18621. /**
  18622. * Listen for an event on the channel instance.
  18623. */
  18624. }, {
  18625. key: 'listen',
  18626. value: function listen(event, callback) {
  18627. return this;
  18628. }
  18629. /**
  18630. * Stop listening for an event on the channel instance.
  18631. */
  18632. }, {
  18633. key: 'stopListening',
  18634. value: function stopListening(event) {
  18635. return this;
  18636. }
  18637. /**
  18638. * Bind a channel to an event.
  18639. */
  18640. }, {
  18641. key: 'on',
  18642. value: function on(event, callback) {
  18643. return this;
  18644. }
  18645. }]);
  18646. return NullChannel;
  18647. }(Channel);
  18648. /**
  18649. * This class represents a null private channel.
  18650. */
  18651. var NullPrivateChannel = function (_NullChannel) {
  18652. inherits(NullPrivateChannel, _NullChannel);
  18653. function NullPrivateChannel() {
  18654. classCallCheck(this, NullPrivateChannel);
  18655. return possibleConstructorReturn(this, (NullPrivateChannel.__proto__ || Object.getPrototypeOf(NullPrivateChannel)).apply(this, arguments));
  18656. }
  18657. createClass(NullPrivateChannel, [{
  18658. key: 'whisper',
  18659. /**
  18660. * Trigger client event on the channel.
  18661. */
  18662. value: function whisper(eventName, data) {
  18663. return this;
  18664. }
  18665. }]);
  18666. return NullPrivateChannel;
  18667. }(NullChannel);
  18668. /**
  18669. * This class represents a null presence channel.
  18670. */
  18671. var NullPresenceChannel = function (_NullChannel) {
  18672. inherits(NullPresenceChannel, _NullChannel);
  18673. function NullPresenceChannel() {
  18674. classCallCheck(this, NullPresenceChannel);
  18675. return possibleConstructorReturn(this, (NullPresenceChannel.__proto__ || Object.getPrototypeOf(NullPresenceChannel)).apply(this, arguments));
  18676. }
  18677. createClass(NullPresenceChannel, [{
  18678. key: 'here',
  18679. /**
  18680. * Register a callback to be called anytime the member list changes.
  18681. */
  18682. value: function here(callback) {
  18683. return this;
  18684. }
  18685. /**
  18686. * Listen for someone joining the channel.
  18687. */
  18688. }, {
  18689. key: 'joining',
  18690. value: function joining(callback) {
  18691. return this;
  18692. }
  18693. /**
  18694. * Listen for someone leaving the channel.
  18695. */
  18696. }, {
  18697. key: 'leaving',
  18698. value: function leaving(callback) {
  18699. return this;
  18700. }
  18701. /**
  18702. * Trigger client event on the channel.
  18703. */
  18704. }, {
  18705. key: 'whisper',
  18706. value: function whisper(eventName, data) {
  18707. return this;
  18708. }
  18709. }]);
  18710. return NullPresenceChannel;
  18711. }(NullChannel);
  18712. /**
  18713. * This class creates a connector to Pusher.
  18714. */
  18715. var PusherConnector = function (_Connector) {
  18716. inherits(PusherConnector, _Connector);
  18717. function PusherConnector() {
  18718. classCallCheck(this, PusherConnector);
  18719. /**
  18720. * All of the subscribed channel names.
  18721. */
  18722. var _this = possibleConstructorReturn(this, (PusherConnector.__proto__ || Object.getPrototypeOf(PusherConnector)).apply(this, arguments));
  18723. _this.channels = {};
  18724. return _this;
  18725. }
  18726. /**
  18727. * Create a fresh Pusher connection.
  18728. */
  18729. createClass(PusherConnector, [{
  18730. key: 'connect',
  18731. value: function connect() {
  18732. if (typeof this.options.client !== 'undefined') {
  18733. this.pusher = this.options.client;
  18734. } else {
  18735. this.pusher = new Pusher(this.options.key, this.options);
  18736. }
  18737. }
  18738. /**
  18739. * Listen for an event on a channel instance.
  18740. */
  18741. }, {
  18742. key: 'listen',
  18743. value: function listen(name, event, callback) {
  18744. return this.channel(name).listen(event, callback);
  18745. }
  18746. /**
  18747. * Get a channel instance by name.
  18748. */
  18749. }, {
  18750. key: 'channel',
  18751. value: function channel(name) {
  18752. if (!this.channels[name]) {
  18753. this.channels[name] = new PusherChannel(this.pusher, name, this.options);
  18754. }
  18755. return this.channels[name];
  18756. }
  18757. /**
  18758. * Get a private channel instance by name.
  18759. */
  18760. }, {
  18761. key: 'privateChannel',
  18762. value: function privateChannel(name) {
  18763. if (!this.channels['private-' + name]) {
  18764. this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options);
  18765. }
  18766. return this.channels['private-' + name];
  18767. }
  18768. /**
  18769. * Get a presence channel instance by name.
  18770. */
  18771. }, {
  18772. key: 'presenceChannel',
  18773. value: function presenceChannel(name) {
  18774. if (!this.channels['presence-' + name]) {
  18775. this.channels['presence-' + name] = new PusherPresenceChannel(this.pusher, 'presence-' + name, this.options);
  18776. }
  18777. return this.channels['presence-' + name];
  18778. }
  18779. /**
  18780. * Leave the given channel, as well as its private and presence variants.
  18781. */
  18782. }, {
  18783. key: 'leave',
  18784. value: function leave(name) {
  18785. var _this2 = this;
  18786. var channels = [name, 'private-' + name, 'presence-' + name];
  18787. channels.forEach(function (name, index) {
  18788. _this2.leaveChannel(name);
  18789. });
  18790. }
  18791. /**
  18792. * Leave the given channel.
  18793. */
  18794. }, {
  18795. key: 'leaveChannel',
  18796. value: function leaveChannel(name) {
  18797. if (this.channels[name]) {
  18798. this.channels[name].unsubscribe();
  18799. delete this.channels[name];
  18800. }
  18801. }
  18802. /**
  18803. * Get the socket ID for the connection.
  18804. */
  18805. }, {
  18806. key: 'socketId',
  18807. value: function socketId() {
  18808. return this.pusher.connection.socket_id;
  18809. }
  18810. /**
  18811. * Disconnect Pusher connection.
  18812. */
  18813. }, {
  18814. key: 'disconnect',
  18815. value: function disconnect() {
  18816. this.pusher.disconnect();
  18817. }
  18818. }]);
  18819. return PusherConnector;
  18820. }(Connector);
  18821. /**
  18822. * This class creates a connnector to a Socket.io server.
  18823. */
  18824. var SocketIoConnector = function (_Connector) {
  18825. inherits(SocketIoConnector, _Connector);
  18826. function SocketIoConnector() {
  18827. classCallCheck(this, SocketIoConnector);
  18828. /**
  18829. * All of the subscribed channel names.
  18830. */
  18831. var _this = possibleConstructorReturn(this, (SocketIoConnector.__proto__ || Object.getPrototypeOf(SocketIoConnector)).apply(this, arguments));
  18832. _this.channels = {};
  18833. return _this;
  18834. }
  18835. /**
  18836. * Create a fresh Socket.io connection.
  18837. */
  18838. createClass(SocketIoConnector, [{
  18839. key: 'connect',
  18840. value: function connect() {
  18841. var io = this.getSocketIO();
  18842. this.socket = io(this.options.host, this.options);
  18843. return this.socket;
  18844. }
  18845. /**
  18846. * Get socket.io module from global scope or options.
  18847. */
  18848. }, {
  18849. key: 'getSocketIO',
  18850. value: function getSocketIO() {
  18851. if (typeof this.options.client !== 'undefined') {
  18852. return this.options.client;
  18853. }
  18854. if (typeof io !== 'undefined') {
  18855. return io;
  18856. }
  18857. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  18858. }
  18859. /**
  18860. * Listen for an event on a channel instance.
  18861. */
  18862. }, {
  18863. key: 'listen',
  18864. value: function listen(name, event, callback) {
  18865. return this.channel(name).listen(event, callback);
  18866. }
  18867. /**
  18868. * Get a channel instance by name.
  18869. */
  18870. }, {
  18871. key: 'channel',
  18872. value: function channel(name) {
  18873. if (!this.channels[name]) {
  18874. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  18875. }
  18876. return this.channels[name];
  18877. }
  18878. /**
  18879. * Get a private channel instance by name.
  18880. */
  18881. }, {
  18882. key: 'privateChannel',
  18883. value: function privateChannel(name) {
  18884. if (!this.channels['private-' + name]) {
  18885. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  18886. }
  18887. return this.channels['private-' + name];
  18888. }
  18889. /**
  18890. * Get a presence channel instance by name.
  18891. */
  18892. }, {
  18893. key: 'presenceChannel',
  18894. value: function presenceChannel(name) {
  18895. if (!this.channels['presence-' + name]) {
  18896. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  18897. }
  18898. return this.channels['presence-' + name];
  18899. }
  18900. /**
  18901. * Leave the given channel, as well as its private and presence variants.
  18902. */
  18903. }, {
  18904. key: 'leave',
  18905. value: function leave(name) {
  18906. var _this2 = this;
  18907. var channels = [name, 'private-' + name, 'presence-' + name];
  18908. channels.forEach(function (name) {
  18909. _this2.leaveChannel(name);
  18910. });
  18911. }
  18912. /**
  18913. * Leave the given channel.
  18914. */
  18915. }, {
  18916. key: 'leaveChannel',
  18917. value: function leaveChannel(name) {
  18918. if (this.channels[name]) {
  18919. this.channels[name].unsubscribe();
  18920. delete this.channels[name];
  18921. }
  18922. }
  18923. /**
  18924. * Get the socket ID for the connection.
  18925. */
  18926. }, {
  18927. key: 'socketId',
  18928. value: function socketId() {
  18929. return this.socket.id;
  18930. }
  18931. /**
  18932. * Disconnect Socketio connection.
  18933. */
  18934. }, {
  18935. key: 'disconnect',
  18936. value: function disconnect() {
  18937. this.socket.disconnect();
  18938. }
  18939. }]);
  18940. return SocketIoConnector;
  18941. }(Connector);
  18942. /**
  18943. * This class creates a null connector.
  18944. */
  18945. var NullConnector = function (_Connector) {
  18946. inherits(NullConnector, _Connector);
  18947. function NullConnector() {
  18948. classCallCheck(this, NullConnector);
  18949. /**
  18950. * All of the subscribed channel names.
  18951. */
  18952. var _this = possibleConstructorReturn(this, (NullConnector.__proto__ || Object.getPrototypeOf(NullConnector)).apply(this, arguments));
  18953. _this.channels = {};
  18954. return _this;
  18955. }
  18956. /**
  18957. * Create a fresh connection.
  18958. */
  18959. createClass(NullConnector, [{
  18960. key: 'connect',
  18961. value: function connect() {}
  18962. //
  18963. /**
  18964. * Listen for an event on a channel instance.
  18965. */
  18966. }, {
  18967. key: 'listen',
  18968. value: function listen(name, event, callback) {
  18969. return new NullChannel();
  18970. }
  18971. /**
  18972. * Get a channel instance by name.
  18973. */
  18974. }, {
  18975. key: 'channel',
  18976. value: function channel(name) {
  18977. return new NullChannel();
  18978. }
  18979. /**
  18980. * Get a private channel instance by name.
  18981. */
  18982. }, {
  18983. key: 'privateChannel',
  18984. value: function privateChannel(name) {
  18985. return new NullPrivateChannel();
  18986. }
  18987. /**
  18988. * Get a presence channel instance by name.
  18989. */
  18990. }, {
  18991. key: 'presenceChannel',
  18992. value: function presenceChannel(name) {
  18993. return new NullPresenceChannel();
  18994. }
  18995. /**
  18996. * Leave the given channel, as well as its private and presence variants.
  18997. */
  18998. }, {
  18999. key: 'leave',
  19000. value: function leave(name) {}
  19001. //
  19002. /**
  19003. * Leave the given channel.
  19004. */
  19005. }, {
  19006. key: 'leaveChannel',
  19007. value: function leaveChannel(name) {}
  19008. //
  19009. /**
  19010. * Get the socket ID for the connection.
  19011. */
  19012. }, {
  19013. key: 'socketId',
  19014. value: function socketId() {
  19015. return 'fake-socket-id';
  19016. }
  19017. /**
  19018. * Disconnect the connection.
  19019. */
  19020. }, {
  19021. key: 'disconnect',
  19022. value: function disconnect() {
  19023. //
  19024. }
  19025. }]);
  19026. return NullConnector;
  19027. }(Connector);
  19028. /**
  19029. * This class is the primary API for interacting with broadcasting.
  19030. */
  19031. var Echo = function () {
  19032. /**
  19033. * Create a new class instance.
  19034. */
  19035. function Echo(options) {
  19036. classCallCheck(this, Echo);
  19037. this.options = options;
  19038. this.connect();
  19039. if (!this.options.withoutInterceptors) {
  19040. this.registerInterceptors();
  19041. }
  19042. }
  19043. /**
  19044. * Get a channel instance by name.
  19045. */
  19046. createClass(Echo, [{
  19047. key: 'channel',
  19048. value: function channel(_channel) {
  19049. return this.connector.channel(_channel);
  19050. }
  19051. /**
  19052. * Create a new connection.
  19053. */
  19054. }, {
  19055. key: 'connect',
  19056. value: function connect() {
  19057. if (this.options.broadcaster == 'pusher') {
  19058. this.connector = new PusherConnector(this.options);
  19059. } else if (this.options.broadcaster == 'socket.io') {
  19060. this.connector = new SocketIoConnector(this.options);
  19061. } else if (this.options.broadcaster == 'null') {
  19062. this.connector = new NullConnector(this.options);
  19063. } else if (typeof this.options.broadcaster == 'function') {
  19064. this.connector = new this.options.broadcaster(this.options);
  19065. }
  19066. }
  19067. /**
  19068. * Disconnect from the Echo server.
  19069. */
  19070. }, {
  19071. key: 'disconnect',
  19072. value: function disconnect() {
  19073. this.connector.disconnect();
  19074. }
  19075. /**
  19076. * Get a presence channel instance by name.
  19077. */
  19078. }, {
  19079. key: 'join',
  19080. value: function join(channel) {
  19081. return this.connector.presenceChannel(channel);
  19082. }
  19083. /**
  19084. * Leave the given channel, as well as its private and presence variants.
  19085. */
  19086. }, {
  19087. key: 'leave',
  19088. value: function leave(channel) {
  19089. this.connector.leave(channel);
  19090. }
  19091. /**
  19092. * Leave the given channel.
  19093. */
  19094. }, {
  19095. key: 'leaveChannel',
  19096. value: function leaveChannel(channel) {
  19097. this.connector.leaveChannel(channel);
  19098. }
  19099. /**
  19100. * Listen for an event on a channel instance.
  19101. */
  19102. }, {
  19103. key: 'listen',
  19104. value: function listen(channel, event, callback) {
  19105. return this.connector.listen(channel, event, callback);
  19106. }
  19107. /**
  19108. * Get a private channel instance by name.
  19109. */
  19110. }, {
  19111. key: 'private',
  19112. value: function _private(channel) {
  19113. return this.connector.privateChannel(channel);
  19114. }
  19115. /**
  19116. * Get the Socket ID for the connection.
  19117. */
  19118. }, {
  19119. key: 'socketId',
  19120. value: function socketId() {
  19121. return this.connector.socketId();
  19122. }
  19123. /**
  19124. * Register 3rd party request interceptiors. These are used to automatically
  19125. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  19126. */
  19127. }, {
  19128. key: 'registerInterceptors',
  19129. value: function registerInterceptors() {
  19130. if (typeof Vue === 'function' && Vue.http) {
  19131. this.registerVueRequestInterceptor();
  19132. }
  19133. if (typeof axios === 'function') {
  19134. this.registerAxiosRequestInterceptor();
  19135. }
  19136. if (typeof jQuery === 'function') {
  19137. this.registerjQueryAjaxSetup();
  19138. }
  19139. }
  19140. /**
  19141. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  19142. */
  19143. }, {
  19144. key: 'registerVueRequestInterceptor',
  19145. value: function registerVueRequestInterceptor() {
  19146. var _this = this;
  19147. Vue.http.interceptors.push(function (request, next) {
  19148. if (_this.socketId()) {
  19149. request.headers.set('X-Socket-ID', _this.socketId());
  19150. }
  19151. next();
  19152. });
  19153. }
  19154. /**
  19155. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  19156. */
  19157. }, {
  19158. key: 'registerAxiosRequestInterceptor',
  19159. value: function registerAxiosRequestInterceptor() {
  19160. var _this2 = this;
  19161. axios.interceptors.request.use(function (config) {
  19162. if (_this2.socketId()) {
  19163. config.headers['X-Socket-Id'] = _this2.socketId();
  19164. }
  19165. return config;
  19166. });
  19167. }
  19168. /**
  19169. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  19170. */
  19171. }, {
  19172. key: 'registerjQueryAjaxSetup',
  19173. value: function registerjQueryAjaxSetup() {
  19174. var _this3 = this;
  19175. if (typeof jQuery.ajax != 'undefined') {
  19176. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  19177. if (_this3.socketId()) {
  19178. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  19179. }
  19180. });
  19181. }
  19182. }
  19183. }]);
  19184. return Echo;
  19185. }();
  19186. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  19187. /***/ }),
  19188. /***/ "./node_modules/lodash/lodash.js":
  19189. /*!***************************************!*\
  19190. !*** ./node_modules/lodash/lodash.js ***!
  19191. \***************************************/
  19192. /*! no static exports found */
  19193. /***/ (function(module, exports, __webpack_require__) {
  19194. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  19195. * @license
  19196. * Lodash <https://lodash.com/>
  19197. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  19198. * Released under MIT license <https://lodash.com/license>
  19199. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  19200. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  19201. */
  19202. ;(function() {
  19203. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  19204. var undefined;
  19205. /** Used as the semantic version number. */
  19206. var VERSION = '4.17.15';
  19207. /** Used as the size to enable large array optimizations. */
  19208. var LARGE_ARRAY_SIZE = 200;
  19209. /** Error message constants. */
  19210. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  19211. FUNC_ERROR_TEXT = 'Expected a function';
  19212. /** Used to stand-in for `undefined` hash values. */
  19213. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  19214. /** Used as the maximum memoize cache size. */
  19215. var MAX_MEMOIZE_SIZE = 500;
  19216. /** Used as the internal argument placeholder. */
  19217. var PLACEHOLDER = '__lodash_placeholder__';
  19218. /** Used to compose bitmasks for cloning. */
  19219. var CLONE_DEEP_FLAG = 1,
  19220. CLONE_FLAT_FLAG = 2,
  19221. CLONE_SYMBOLS_FLAG = 4;
  19222. /** Used to compose bitmasks for value comparisons. */
  19223. var COMPARE_PARTIAL_FLAG = 1,
  19224. COMPARE_UNORDERED_FLAG = 2;
  19225. /** Used to compose bitmasks for function metadata. */
  19226. var WRAP_BIND_FLAG = 1,
  19227. WRAP_BIND_KEY_FLAG = 2,
  19228. WRAP_CURRY_BOUND_FLAG = 4,
  19229. WRAP_CURRY_FLAG = 8,
  19230. WRAP_CURRY_RIGHT_FLAG = 16,
  19231. WRAP_PARTIAL_FLAG = 32,
  19232. WRAP_PARTIAL_RIGHT_FLAG = 64,
  19233. WRAP_ARY_FLAG = 128,
  19234. WRAP_REARG_FLAG = 256,
  19235. WRAP_FLIP_FLAG = 512;
  19236. /** Used as default options for `_.truncate`. */
  19237. var DEFAULT_TRUNC_LENGTH = 30,
  19238. DEFAULT_TRUNC_OMISSION = '...';
  19239. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  19240. var HOT_COUNT = 800,
  19241. HOT_SPAN = 16;
  19242. /** Used to indicate the type of lazy iteratees. */
  19243. var LAZY_FILTER_FLAG = 1,
  19244. LAZY_MAP_FLAG = 2,
  19245. LAZY_WHILE_FLAG = 3;
  19246. /** Used as references for various `Number` constants. */
  19247. var INFINITY = 1 / 0,
  19248. MAX_SAFE_INTEGER = 9007199254740991,
  19249. MAX_INTEGER = 1.7976931348623157e+308,
  19250. NAN = 0 / 0;
  19251. /** Used as references for the maximum length and index of an array. */
  19252. var MAX_ARRAY_LENGTH = 4294967295,
  19253. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  19254. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  19255. /** Used to associate wrap methods with their bit flags. */
  19256. var wrapFlags = [
  19257. ['ary', WRAP_ARY_FLAG],
  19258. ['bind', WRAP_BIND_FLAG],
  19259. ['bindKey', WRAP_BIND_KEY_FLAG],
  19260. ['curry', WRAP_CURRY_FLAG],
  19261. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  19262. ['flip', WRAP_FLIP_FLAG],
  19263. ['partial', WRAP_PARTIAL_FLAG],
  19264. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  19265. ['rearg', WRAP_REARG_FLAG]
  19266. ];
  19267. /** `Object#toString` result references. */
  19268. var argsTag = '[object Arguments]',
  19269. arrayTag = '[object Array]',
  19270. asyncTag = '[object AsyncFunction]',
  19271. boolTag = '[object Boolean]',
  19272. dateTag = '[object Date]',
  19273. domExcTag = '[object DOMException]',
  19274. errorTag = '[object Error]',
  19275. funcTag = '[object Function]',
  19276. genTag = '[object GeneratorFunction]',
  19277. mapTag = '[object Map]',
  19278. numberTag = '[object Number]',
  19279. nullTag = '[object Null]',
  19280. objectTag = '[object Object]',
  19281. promiseTag = '[object Promise]',
  19282. proxyTag = '[object Proxy]',
  19283. regexpTag = '[object RegExp]',
  19284. setTag = '[object Set]',
  19285. stringTag = '[object String]',
  19286. symbolTag = '[object Symbol]',
  19287. undefinedTag = '[object Undefined]',
  19288. weakMapTag = '[object WeakMap]',
  19289. weakSetTag = '[object WeakSet]';
  19290. var arrayBufferTag = '[object ArrayBuffer]',
  19291. dataViewTag = '[object DataView]',
  19292. float32Tag = '[object Float32Array]',
  19293. float64Tag = '[object Float64Array]',
  19294. int8Tag = '[object Int8Array]',
  19295. int16Tag = '[object Int16Array]',
  19296. int32Tag = '[object Int32Array]',
  19297. uint8Tag = '[object Uint8Array]',
  19298. uint8ClampedTag = '[object Uint8ClampedArray]',
  19299. uint16Tag = '[object Uint16Array]',
  19300. uint32Tag = '[object Uint32Array]';
  19301. /** Used to match empty string literals in compiled template source. */
  19302. var reEmptyStringLeading = /\b__p \+= '';/g,
  19303. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  19304. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  19305. /** Used to match HTML entities and HTML characters. */
  19306. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  19307. reUnescapedHtml = /[&<>"']/g,
  19308. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  19309. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  19310. /** Used to match template delimiters. */
  19311. var reEscape = /<%-([\s\S]+?)%>/g,
  19312. reEvaluate = /<%([\s\S]+?)%>/g,
  19313. reInterpolate = /<%=([\s\S]+?)%>/g;
  19314. /** Used to match property names within property paths. */
  19315. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  19316. reIsPlainProp = /^\w*$/,
  19317. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  19318. /**
  19319. * Used to match `RegExp`
  19320. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  19321. */
  19322. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  19323. reHasRegExpChar = RegExp(reRegExpChar.source);
  19324. /** Used to match leading and trailing whitespace. */
  19325. var reTrim = /^\s+|\s+$/g,
  19326. reTrimStart = /^\s+/,
  19327. reTrimEnd = /\s+$/;
  19328. /** Used to match wrap detail comments. */
  19329. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  19330. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  19331. reSplitDetails = /,? & /;
  19332. /** Used to match words composed of alphanumeric characters. */
  19333. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  19334. /** Used to match backslashes in property paths. */
  19335. var reEscapeChar = /\\(\\)?/g;
  19336. /**
  19337. * Used to match
  19338. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  19339. */
  19340. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  19341. /** Used to match `RegExp` flags from their coerced string values. */
  19342. var reFlags = /\w*$/;
  19343. /** Used to detect bad signed hexadecimal string values. */
  19344. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  19345. /** Used to detect binary string values. */
  19346. var reIsBinary = /^0b[01]+$/i;
  19347. /** Used to detect host constructors (Safari). */
  19348. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  19349. /** Used to detect octal string values. */
  19350. var reIsOctal = /^0o[0-7]+$/i;
  19351. /** Used to detect unsigned integer values. */
  19352. var reIsUint = /^(?:0|[1-9]\d*)$/;
  19353. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  19354. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  19355. /** Used to ensure capturing order of template delimiters. */
  19356. var reNoMatch = /($^)/;
  19357. /** Used to match unescaped characters in compiled string literals. */
  19358. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  19359. /** Used to compose unicode character classes. */
  19360. var rsAstralRange = '\\ud800-\\udfff',
  19361. rsComboMarksRange = '\\u0300-\\u036f',
  19362. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  19363. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  19364. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  19365. rsDingbatRange = '\\u2700-\\u27bf',
  19366. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  19367. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  19368. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  19369. rsPunctuationRange = '\\u2000-\\u206f',
  19370. 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',
  19371. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  19372. rsVarRange = '\\ufe0e\\ufe0f',
  19373. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  19374. /** Used to compose unicode capture groups. */
  19375. var rsApos = "['\u2019]",
  19376. rsAstral = '[' + rsAstralRange + ']',
  19377. rsBreak = '[' + rsBreakRange + ']',
  19378. rsCombo = '[' + rsComboRange + ']',
  19379. rsDigits = '\\d+',
  19380. rsDingbat = '[' + rsDingbatRange + ']',
  19381. rsLower = '[' + rsLowerRange + ']',
  19382. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  19383. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  19384. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  19385. rsNonAstral = '[^' + rsAstralRange + ']',
  19386. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  19387. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  19388. rsUpper = '[' + rsUpperRange + ']',
  19389. rsZWJ = '\\u200d';
  19390. /** Used to compose unicode regexes. */
  19391. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  19392. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  19393. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  19394. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  19395. reOptMod = rsModifier + '?',
  19396. rsOptVar = '[' + rsVarRange + ']?',
  19397. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  19398. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  19399. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  19400. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  19401. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  19402. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  19403. /** Used to match apostrophes. */
  19404. var reApos = RegExp(rsApos, 'g');
  19405. /**
  19406. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  19407. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  19408. */
  19409. var reComboMark = RegExp(rsCombo, 'g');
  19410. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  19411. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  19412. /** Used to match complex or compound words. */
  19413. var reUnicodeWord = RegExp([
  19414. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  19415. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  19416. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  19417. rsUpper + '+' + rsOptContrUpper,
  19418. rsOrdUpper,
  19419. rsOrdLower,
  19420. rsDigits,
  19421. rsEmoji
  19422. ].join('|'), 'g');
  19423. /** 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/). */
  19424. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  19425. /** Used to detect strings that need a more robust regexp to match words. */
  19426. 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 ]/;
  19427. /** Used to assign default `context` object properties. */
  19428. var contextProps = [
  19429. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  19430. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  19431. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  19432. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  19433. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  19434. ];
  19435. /** Used to make template sourceURLs easier to identify. */
  19436. var templateCounter = -1;
  19437. /** Used to identify `toStringTag` values of typed arrays. */
  19438. var typedArrayTags = {};
  19439. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  19440. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  19441. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  19442. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  19443. typedArrayTags[uint32Tag] = true;
  19444. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  19445. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  19446. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  19447. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  19448. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  19449. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  19450. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  19451. typedArrayTags[weakMapTag] = false;
  19452. /** Used to identify `toStringTag` values supported by `_.clone`. */
  19453. var cloneableTags = {};
  19454. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  19455. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  19456. cloneableTags[boolTag] = cloneableTags[dateTag] =
  19457. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  19458. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  19459. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  19460. cloneableTags[numberTag] = cloneableTags[objectTag] =
  19461. cloneableTags[regexpTag] = cloneableTags[setTag] =
  19462. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  19463. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  19464. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  19465. cloneableTags[errorTag] = cloneableTags[funcTag] =
  19466. cloneableTags[weakMapTag] = false;
  19467. /** Used to map Latin Unicode letters to basic Latin letters. */
  19468. var deburredLetters = {
  19469. // Latin-1 Supplement block.
  19470. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  19471. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  19472. '\xc7': 'C', '\xe7': 'c',
  19473. '\xd0': 'D', '\xf0': 'd',
  19474. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  19475. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  19476. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  19477. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  19478. '\xd1': 'N', '\xf1': 'n',
  19479. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  19480. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  19481. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  19482. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  19483. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  19484. '\xc6': 'Ae', '\xe6': 'ae',
  19485. '\xde': 'Th', '\xfe': 'th',
  19486. '\xdf': 'ss',
  19487. // Latin Extended-A block.
  19488. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  19489. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  19490. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  19491. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  19492. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  19493. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  19494. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  19495. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  19496. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  19497. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  19498. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  19499. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  19500. '\u0134': 'J', '\u0135': 'j',
  19501. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  19502. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  19503. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  19504. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  19505. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  19506. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  19507. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  19508. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  19509. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  19510. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  19511. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  19512. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  19513. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  19514. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  19515. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  19516. '\u0174': 'W', '\u0175': 'w',
  19517. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  19518. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  19519. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  19520. '\u0132': 'IJ', '\u0133': 'ij',
  19521. '\u0152': 'Oe', '\u0153': 'oe',
  19522. '\u0149': "'n", '\u017f': 's'
  19523. };
  19524. /** Used to map characters to HTML entities. */
  19525. var htmlEscapes = {
  19526. '&': '&amp;',
  19527. '<': '&lt;',
  19528. '>': '&gt;',
  19529. '"': '&quot;',
  19530. "'": '&#39;'
  19531. };
  19532. /** Used to map HTML entities to characters. */
  19533. var htmlUnescapes = {
  19534. '&amp;': '&',
  19535. '&lt;': '<',
  19536. '&gt;': '>',
  19537. '&quot;': '"',
  19538. '&#39;': "'"
  19539. };
  19540. /** Used to escape characters for inclusion in compiled string literals. */
  19541. var stringEscapes = {
  19542. '\\': '\\',
  19543. "'": "'",
  19544. '\n': 'n',
  19545. '\r': 'r',
  19546. '\u2028': 'u2028',
  19547. '\u2029': 'u2029'
  19548. };
  19549. /** Built-in method references without a dependency on `root`. */
  19550. var freeParseFloat = parseFloat,
  19551. freeParseInt = parseInt;
  19552. /** Detect free variable `global` from Node.js. */
  19553. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  19554. /** Detect free variable `self`. */
  19555. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  19556. /** Used as a reference to the global object. */
  19557. var root = freeGlobal || freeSelf || Function('return this')();
  19558. /** Detect free variable `exports`. */
  19559. var freeExports = true && exports && !exports.nodeType && exports;
  19560. /** Detect free variable `module`. */
  19561. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  19562. /** Detect the popular CommonJS extension `module.exports`. */
  19563. var moduleExports = freeModule && freeModule.exports === freeExports;
  19564. /** Detect free variable `process` from Node.js. */
  19565. var freeProcess = moduleExports && freeGlobal.process;
  19566. /** Used to access faster Node.js helpers. */
  19567. var nodeUtil = (function() {
  19568. try {
  19569. // Use `util.types` for Node.js 10+.
  19570. var types = freeModule && freeModule.require && freeModule.require('util').types;
  19571. if (types) {
  19572. return types;
  19573. }
  19574. // Legacy `process.binding('util')` for Node.js < 10.
  19575. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  19576. } catch (e) {}
  19577. }());
  19578. /* Node.js helper references. */
  19579. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  19580. nodeIsDate = nodeUtil && nodeUtil.isDate,
  19581. nodeIsMap = nodeUtil && nodeUtil.isMap,
  19582. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  19583. nodeIsSet = nodeUtil && nodeUtil.isSet,
  19584. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  19585. /*--------------------------------------------------------------------------*/
  19586. /**
  19587. * A faster alternative to `Function#apply`, this function invokes `func`
  19588. * with the `this` binding of `thisArg` and the arguments of `args`.
  19589. *
  19590. * @private
  19591. * @param {Function} func The function to invoke.
  19592. * @param {*} thisArg The `this` binding of `func`.
  19593. * @param {Array} args The arguments to invoke `func` with.
  19594. * @returns {*} Returns the result of `func`.
  19595. */
  19596. function apply(func, thisArg, args) {
  19597. switch (args.length) {
  19598. case 0: return func.call(thisArg);
  19599. case 1: return func.call(thisArg, args[0]);
  19600. case 2: return func.call(thisArg, args[0], args[1]);
  19601. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  19602. }
  19603. return func.apply(thisArg, args);
  19604. }
  19605. /**
  19606. * A specialized version of `baseAggregator` for arrays.
  19607. *
  19608. * @private
  19609. * @param {Array} [array] The array to iterate over.
  19610. * @param {Function} setter The function to set `accumulator` values.
  19611. * @param {Function} iteratee The iteratee to transform keys.
  19612. * @param {Object} accumulator The initial aggregated object.
  19613. * @returns {Function} Returns `accumulator`.
  19614. */
  19615. function arrayAggregator(array, setter, iteratee, accumulator) {
  19616. var index = -1,
  19617. length = array == null ? 0 : array.length;
  19618. while (++index < length) {
  19619. var value = array[index];
  19620. setter(accumulator, value, iteratee(value), array);
  19621. }
  19622. return accumulator;
  19623. }
  19624. /**
  19625. * A specialized version of `_.forEach` for arrays without support for
  19626. * iteratee shorthands.
  19627. *
  19628. * @private
  19629. * @param {Array} [array] The array to iterate over.
  19630. * @param {Function} iteratee The function invoked per iteration.
  19631. * @returns {Array} Returns `array`.
  19632. */
  19633. function arrayEach(array, iteratee) {
  19634. var index = -1,
  19635. length = array == null ? 0 : array.length;
  19636. while (++index < length) {
  19637. if (iteratee(array[index], index, array) === false) {
  19638. break;
  19639. }
  19640. }
  19641. return array;
  19642. }
  19643. /**
  19644. * A specialized version of `_.forEachRight` for arrays without support for
  19645. * iteratee shorthands.
  19646. *
  19647. * @private
  19648. * @param {Array} [array] The array to iterate over.
  19649. * @param {Function} iteratee The function invoked per iteration.
  19650. * @returns {Array} Returns `array`.
  19651. */
  19652. function arrayEachRight(array, iteratee) {
  19653. var length = array == null ? 0 : array.length;
  19654. while (length--) {
  19655. if (iteratee(array[length], length, array) === false) {
  19656. break;
  19657. }
  19658. }
  19659. return array;
  19660. }
  19661. /**
  19662. * A specialized version of `_.every` for arrays without support for
  19663. * iteratee shorthands.
  19664. *
  19665. * @private
  19666. * @param {Array} [array] The array to iterate over.
  19667. * @param {Function} predicate The function invoked per iteration.
  19668. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  19669. * else `false`.
  19670. */
  19671. function arrayEvery(array, predicate) {
  19672. var index = -1,
  19673. length = array == null ? 0 : array.length;
  19674. while (++index < length) {
  19675. if (!predicate(array[index], index, array)) {
  19676. return false;
  19677. }
  19678. }
  19679. return true;
  19680. }
  19681. /**
  19682. * A specialized version of `_.filter` for arrays without support for
  19683. * iteratee shorthands.
  19684. *
  19685. * @private
  19686. * @param {Array} [array] The array to iterate over.
  19687. * @param {Function} predicate The function invoked per iteration.
  19688. * @returns {Array} Returns the new filtered array.
  19689. */
  19690. function arrayFilter(array, predicate) {
  19691. var index = -1,
  19692. length = array == null ? 0 : array.length,
  19693. resIndex = 0,
  19694. result = [];
  19695. while (++index < length) {
  19696. var value = array[index];
  19697. if (predicate(value, index, array)) {
  19698. result[resIndex++] = value;
  19699. }
  19700. }
  19701. return result;
  19702. }
  19703. /**
  19704. * A specialized version of `_.includes` for arrays without support for
  19705. * specifying an index to search from.
  19706. *
  19707. * @private
  19708. * @param {Array} [array] The array to inspect.
  19709. * @param {*} target The value to search for.
  19710. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  19711. */
  19712. function arrayIncludes(array, value) {
  19713. var length = array == null ? 0 : array.length;
  19714. return !!length && baseIndexOf(array, value, 0) > -1;
  19715. }
  19716. /**
  19717. * This function is like `arrayIncludes` except that it accepts a comparator.
  19718. *
  19719. * @private
  19720. * @param {Array} [array] The array to inspect.
  19721. * @param {*} target The value to search for.
  19722. * @param {Function} comparator The comparator invoked per element.
  19723. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  19724. */
  19725. function arrayIncludesWith(array, value, comparator) {
  19726. var index = -1,
  19727. length = array == null ? 0 : array.length;
  19728. while (++index < length) {
  19729. if (comparator(value, array[index])) {
  19730. return true;
  19731. }
  19732. }
  19733. return false;
  19734. }
  19735. /**
  19736. * A specialized version of `_.map` for arrays without support for iteratee
  19737. * shorthands.
  19738. *
  19739. * @private
  19740. * @param {Array} [array] The array to iterate over.
  19741. * @param {Function} iteratee The function invoked per iteration.
  19742. * @returns {Array} Returns the new mapped array.
  19743. */
  19744. function arrayMap(array, iteratee) {
  19745. var index = -1,
  19746. length = array == null ? 0 : array.length,
  19747. result = Array(length);
  19748. while (++index < length) {
  19749. result[index] = iteratee(array[index], index, array);
  19750. }
  19751. return result;
  19752. }
  19753. /**
  19754. * Appends the elements of `values` to `array`.
  19755. *
  19756. * @private
  19757. * @param {Array} array The array to modify.
  19758. * @param {Array} values The values to append.
  19759. * @returns {Array} Returns `array`.
  19760. */
  19761. function arrayPush(array, values) {
  19762. var index = -1,
  19763. length = values.length,
  19764. offset = array.length;
  19765. while (++index < length) {
  19766. array[offset + index] = values[index];
  19767. }
  19768. return array;
  19769. }
  19770. /**
  19771. * A specialized version of `_.reduce` for arrays without support for
  19772. * iteratee shorthands.
  19773. *
  19774. * @private
  19775. * @param {Array} [array] The array to iterate over.
  19776. * @param {Function} iteratee The function invoked per iteration.
  19777. * @param {*} [accumulator] The initial value.
  19778. * @param {boolean} [initAccum] Specify using the first element of `array` as
  19779. * the initial value.
  19780. * @returns {*} Returns the accumulated value.
  19781. */
  19782. function arrayReduce(array, iteratee, accumulator, initAccum) {
  19783. var index = -1,
  19784. length = array == null ? 0 : array.length;
  19785. if (initAccum && length) {
  19786. accumulator = array[++index];
  19787. }
  19788. while (++index < length) {
  19789. accumulator = iteratee(accumulator, array[index], index, array);
  19790. }
  19791. return accumulator;
  19792. }
  19793. /**
  19794. * A specialized version of `_.reduceRight` for arrays without support for
  19795. * iteratee shorthands.
  19796. *
  19797. * @private
  19798. * @param {Array} [array] The array to iterate over.
  19799. * @param {Function} iteratee The function invoked per iteration.
  19800. * @param {*} [accumulator] The initial value.
  19801. * @param {boolean} [initAccum] Specify using the last element of `array` as
  19802. * the initial value.
  19803. * @returns {*} Returns the accumulated value.
  19804. */
  19805. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  19806. var length = array == null ? 0 : array.length;
  19807. if (initAccum && length) {
  19808. accumulator = array[--length];
  19809. }
  19810. while (length--) {
  19811. accumulator = iteratee(accumulator, array[length], length, array);
  19812. }
  19813. return accumulator;
  19814. }
  19815. /**
  19816. * A specialized version of `_.some` for arrays without support for iteratee
  19817. * shorthands.
  19818. *
  19819. * @private
  19820. * @param {Array} [array] The array to iterate over.
  19821. * @param {Function} predicate The function invoked per iteration.
  19822. * @returns {boolean} Returns `true` if any element passes the predicate check,
  19823. * else `false`.
  19824. */
  19825. function arraySome(array, predicate) {
  19826. var index = -1,
  19827. length = array == null ? 0 : array.length;
  19828. while (++index < length) {
  19829. if (predicate(array[index], index, array)) {
  19830. return true;
  19831. }
  19832. }
  19833. return false;
  19834. }
  19835. /**
  19836. * Gets the size of an ASCII `string`.
  19837. *
  19838. * @private
  19839. * @param {string} string The string inspect.
  19840. * @returns {number} Returns the string size.
  19841. */
  19842. var asciiSize = baseProperty('length');
  19843. /**
  19844. * Converts an ASCII `string` to an array.
  19845. *
  19846. * @private
  19847. * @param {string} string The string to convert.
  19848. * @returns {Array} Returns the converted array.
  19849. */
  19850. function asciiToArray(string) {
  19851. return string.split('');
  19852. }
  19853. /**
  19854. * Splits an ASCII `string` into an array of its words.
  19855. *
  19856. * @private
  19857. * @param {string} The string to inspect.
  19858. * @returns {Array} Returns the words of `string`.
  19859. */
  19860. function asciiWords(string) {
  19861. return string.match(reAsciiWord) || [];
  19862. }
  19863. /**
  19864. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  19865. * without support for iteratee shorthands, which iterates over `collection`
  19866. * using `eachFunc`.
  19867. *
  19868. * @private
  19869. * @param {Array|Object} collection The collection to inspect.
  19870. * @param {Function} predicate The function invoked per iteration.
  19871. * @param {Function} eachFunc The function to iterate over `collection`.
  19872. * @returns {*} Returns the found element or its key, else `undefined`.
  19873. */
  19874. function baseFindKey(collection, predicate, eachFunc) {
  19875. var result;
  19876. eachFunc(collection, function(value, key, collection) {
  19877. if (predicate(value, key, collection)) {
  19878. result = key;
  19879. return false;
  19880. }
  19881. });
  19882. return result;
  19883. }
  19884. /**
  19885. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  19886. * support for iteratee shorthands.
  19887. *
  19888. * @private
  19889. * @param {Array} array The array to inspect.
  19890. * @param {Function} predicate The function invoked per iteration.
  19891. * @param {number} fromIndex The index to search from.
  19892. * @param {boolean} [fromRight] Specify iterating from right to left.
  19893. * @returns {number} Returns the index of the matched value, else `-1`.
  19894. */
  19895. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  19896. var length = array.length,
  19897. index = fromIndex + (fromRight ? 1 : -1);
  19898. while ((fromRight ? index-- : ++index < length)) {
  19899. if (predicate(array[index], index, array)) {
  19900. return index;
  19901. }
  19902. }
  19903. return -1;
  19904. }
  19905. /**
  19906. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  19907. *
  19908. * @private
  19909. * @param {Array} array The array to inspect.
  19910. * @param {*} value The value to search for.
  19911. * @param {number} fromIndex The index to search from.
  19912. * @returns {number} Returns the index of the matched value, else `-1`.
  19913. */
  19914. function baseIndexOf(array, value, fromIndex) {
  19915. return value === value
  19916. ? strictIndexOf(array, value, fromIndex)
  19917. : baseFindIndex(array, baseIsNaN, fromIndex);
  19918. }
  19919. /**
  19920. * This function is like `baseIndexOf` except that it accepts a comparator.
  19921. *
  19922. * @private
  19923. * @param {Array} array The array to inspect.
  19924. * @param {*} value The value to search for.
  19925. * @param {number} fromIndex The index to search from.
  19926. * @param {Function} comparator The comparator invoked per element.
  19927. * @returns {number} Returns the index of the matched value, else `-1`.
  19928. */
  19929. function baseIndexOfWith(array, value, fromIndex, comparator) {
  19930. var index = fromIndex - 1,
  19931. length = array.length;
  19932. while (++index < length) {
  19933. if (comparator(array[index], value)) {
  19934. return index;
  19935. }
  19936. }
  19937. return -1;
  19938. }
  19939. /**
  19940. * The base implementation of `_.isNaN` without support for number objects.
  19941. *
  19942. * @private
  19943. * @param {*} value The value to check.
  19944. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  19945. */
  19946. function baseIsNaN(value) {
  19947. return value !== value;
  19948. }
  19949. /**
  19950. * The base implementation of `_.mean` and `_.meanBy` without support for
  19951. * iteratee shorthands.
  19952. *
  19953. * @private
  19954. * @param {Array} array The array to iterate over.
  19955. * @param {Function} iteratee The function invoked per iteration.
  19956. * @returns {number} Returns the mean.
  19957. */
  19958. function baseMean(array, iteratee) {
  19959. var length = array == null ? 0 : array.length;
  19960. return length ? (baseSum(array, iteratee) / length) : NAN;
  19961. }
  19962. /**
  19963. * The base implementation of `_.property` without support for deep paths.
  19964. *
  19965. * @private
  19966. * @param {string} key The key of the property to get.
  19967. * @returns {Function} Returns the new accessor function.
  19968. */
  19969. function baseProperty(key) {
  19970. return function(object) {
  19971. return object == null ? undefined : object[key];
  19972. };
  19973. }
  19974. /**
  19975. * The base implementation of `_.propertyOf` without support for deep paths.
  19976. *
  19977. * @private
  19978. * @param {Object} object The object to query.
  19979. * @returns {Function} Returns the new accessor function.
  19980. */
  19981. function basePropertyOf(object) {
  19982. return function(key) {
  19983. return object == null ? undefined : object[key];
  19984. };
  19985. }
  19986. /**
  19987. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  19988. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  19989. *
  19990. * @private
  19991. * @param {Array|Object} collection The collection to iterate over.
  19992. * @param {Function} iteratee The function invoked per iteration.
  19993. * @param {*} accumulator The initial value.
  19994. * @param {boolean} initAccum Specify using the first or last element of
  19995. * `collection` as the initial value.
  19996. * @param {Function} eachFunc The function to iterate over `collection`.
  19997. * @returns {*} Returns the accumulated value.
  19998. */
  19999. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  20000. eachFunc(collection, function(value, index, collection) {
  20001. accumulator = initAccum
  20002. ? (initAccum = false, value)
  20003. : iteratee(accumulator, value, index, collection);
  20004. });
  20005. return accumulator;
  20006. }
  20007. /**
  20008. * The base implementation of `_.sortBy` which uses `comparer` to define the
  20009. * sort order of `array` and replaces criteria objects with their corresponding
  20010. * values.
  20011. *
  20012. * @private
  20013. * @param {Array} array The array to sort.
  20014. * @param {Function} comparer The function to define sort order.
  20015. * @returns {Array} Returns `array`.
  20016. */
  20017. function baseSortBy(array, comparer) {
  20018. var length = array.length;
  20019. array.sort(comparer);
  20020. while (length--) {
  20021. array[length] = array[length].value;
  20022. }
  20023. return array;
  20024. }
  20025. /**
  20026. * The base implementation of `_.sum` and `_.sumBy` without support for
  20027. * iteratee shorthands.
  20028. *
  20029. * @private
  20030. * @param {Array} array The array to iterate over.
  20031. * @param {Function} iteratee The function invoked per iteration.
  20032. * @returns {number} Returns the sum.
  20033. */
  20034. function baseSum(array, iteratee) {
  20035. var result,
  20036. index = -1,
  20037. length = array.length;
  20038. while (++index < length) {
  20039. var current = iteratee(array[index]);
  20040. if (current !== undefined) {
  20041. result = result === undefined ? current : (result + current);
  20042. }
  20043. }
  20044. return result;
  20045. }
  20046. /**
  20047. * The base implementation of `_.times` without support for iteratee shorthands
  20048. * or max array length checks.
  20049. *
  20050. * @private
  20051. * @param {number} n The number of times to invoke `iteratee`.
  20052. * @param {Function} iteratee The function invoked per iteration.
  20053. * @returns {Array} Returns the array of results.
  20054. */
  20055. function baseTimes(n, iteratee) {
  20056. var index = -1,
  20057. result = Array(n);
  20058. while (++index < n) {
  20059. result[index] = iteratee(index);
  20060. }
  20061. return result;
  20062. }
  20063. /**
  20064. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  20065. * of key-value pairs for `object` corresponding to the property names of `props`.
  20066. *
  20067. * @private
  20068. * @param {Object} object The object to query.
  20069. * @param {Array} props The property names to get values for.
  20070. * @returns {Object} Returns the key-value pairs.
  20071. */
  20072. function baseToPairs(object, props) {
  20073. return arrayMap(props, function(key) {
  20074. return [key, object[key]];
  20075. });
  20076. }
  20077. /**
  20078. * The base implementation of `_.unary` without support for storing metadata.
  20079. *
  20080. * @private
  20081. * @param {Function} func The function to cap arguments for.
  20082. * @returns {Function} Returns the new capped function.
  20083. */
  20084. function baseUnary(func) {
  20085. return function(value) {
  20086. return func(value);
  20087. };
  20088. }
  20089. /**
  20090. * The base implementation of `_.values` and `_.valuesIn` which creates an
  20091. * array of `object` property values corresponding to the property names
  20092. * of `props`.
  20093. *
  20094. * @private
  20095. * @param {Object} object The object to query.
  20096. * @param {Array} props The property names to get values for.
  20097. * @returns {Object} Returns the array of property values.
  20098. */
  20099. function baseValues(object, props) {
  20100. return arrayMap(props, function(key) {
  20101. return object[key];
  20102. });
  20103. }
  20104. /**
  20105. * Checks if a `cache` value for `key` exists.
  20106. *
  20107. * @private
  20108. * @param {Object} cache The cache to query.
  20109. * @param {string} key The key of the entry to check.
  20110. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20111. */
  20112. function cacheHas(cache, key) {
  20113. return cache.has(key);
  20114. }
  20115. /**
  20116. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  20117. * that is not found in the character symbols.
  20118. *
  20119. * @private
  20120. * @param {Array} strSymbols The string symbols to inspect.
  20121. * @param {Array} chrSymbols The character symbols to find.
  20122. * @returns {number} Returns the index of the first unmatched string symbol.
  20123. */
  20124. function charsStartIndex(strSymbols, chrSymbols) {
  20125. var index = -1,
  20126. length = strSymbols.length;
  20127. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  20128. return index;
  20129. }
  20130. /**
  20131. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  20132. * that is not found in the character symbols.
  20133. *
  20134. * @private
  20135. * @param {Array} strSymbols The string symbols to inspect.
  20136. * @param {Array} chrSymbols The character symbols to find.
  20137. * @returns {number} Returns the index of the last unmatched string symbol.
  20138. */
  20139. function charsEndIndex(strSymbols, chrSymbols) {
  20140. var index = strSymbols.length;
  20141. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  20142. return index;
  20143. }
  20144. /**
  20145. * Gets the number of `placeholder` occurrences in `array`.
  20146. *
  20147. * @private
  20148. * @param {Array} array The array to inspect.
  20149. * @param {*} placeholder The placeholder to search for.
  20150. * @returns {number} Returns the placeholder count.
  20151. */
  20152. function countHolders(array, placeholder) {
  20153. var length = array.length,
  20154. result = 0;
  20155. while (length--) {
  20156. if (array[length] === placeholder) {
  20157. ++result;
  20158. }
  20159. }
  20160. return result;
  20161. }
  20162. /**
  20163. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  20164. * letters to basic Latin letters.
  20165. *
  20166. * @private
  20167. * @param {string} letter The matched letter to deburr.
  20168. * @returns {string} Returns the deburred letter.
  20169. */
  20170. var deburrLetter = basePropertyOf(deburredLetters);
  20171. /**
  20172. * Used by `_.escape` to convert characters to HTML entities.
  20173. *
  20174. * @private
  20175. * @param {string} chr The matched character to escape.
  20176. * @returns {string} Returns the escaped character.
  20177. */
  20178. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  20179. /**
  20180. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  20181. *
  20182. * @private
  20183. * @param {string} chr The matched character to escape.
  20184. * @returns {string} Returns the escaped character.
  20185. */
  20186. function escapeStringChar(chr) {
  20187. return '\\' + stringEscapes[chr];
  20188. }
  20189. /**
  20190. * Gets the value at `key` of `object`.
  20191. *
  20192. * @private
  20193. * @param {Object} [object] The object to query.
  20194. * @param {string} key The key of the property to get.
  20195. * @returns {*} Returns the property value.
  20196. */
  20197. function getValue(object, key) {
  20198. return object == null ? undefined : object[key];
  20199. }
  20200. /**
  20201. * Checks if `string` contains Unicode symbols.
  20202. *
  20203. * @private
  20204. * @param {string} string The string to inspect.
  20205. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  20206. */
  20207. function hasUnicode(string) {
  20208. return reHasUnicode.test(string);
  20209. }
  20210. /**
  20211. * Checks if `string` contains a word composed of Unicode symbols.
  20212. *
  20213. * @private
  20214. * @param {string} string The string to inspect.
  20215. * @returns {boolean} Returns `true` if a word is found, else `false`.
  20216. */
  20217. function hasUnicodeWord(string) {
  20218. return reHasUnicodeWord.test(string);
  20219. }
  20220. /**
  20221. * Converts `iterator` to an array.
  20222. *
  20223. * @private
  20224. * @param {Object} iterator The iterator to convert.
  20225. * @returns {Array} Returns the converted array.
  20226. */
  20227. function iteratorToArray(iterator) {
  20228. var data,
  20229. result = [];
  20230. while (!(data = iterator.next()).done) {
  20231. result.push(data.value);
  20232. }
  20233. return result;
  20234. }
  20235. /**
  20236. * Converts `map` to its key-value pairs.
  20237. *
  20238. * @private
  20239. * @param {Object} map The map to convert.
  20240. * @returns {Array} Returns the key-value pairs.
  20241. */
  20242. function mapToArray(map) {
  20243. var index = -1,
  20244. result = Array(map.size);
  20245. map.forEach(function(value, key) {
  20246. result[++index] = [key, value];
  20247. });
  20248. return result;
  20249. }
  20250. /**
  20251. * Creates a unary function that invokes `func` with its argument transformed.
  20252. *
  20253. * @private
  20254. * @param {Function} func The function to wrap.
  20255. * @param {Function} transform The argument transform.
  20256. * @returns {Function} Returns the new function.
  20257. */
  20258. function overArg(func, transform) {
  20259. return function(arg) {
  20260. return func(transform(arg));
  20261. };
  20262. }
  20263. /**
  20264. * Replaces all `placeholder` elements in `array` with an internal placeholder
  20265. * and returns an array of their indexes.
  20266. *
  20267. * @private
  20268. * @param {Array} array The array to modify.
  20269. * @param {*} placeholder The placeholder to replace.
  20270. * @returns {Array} Returns the new array of placeholder indexes.
  20271. */
  20272. function replaceHolders(array, placeholder) {
  20273. var index = -1,
  20274. length = array.length,
  20275. resIndex = 0,
  20276. result = [];
  20277. while (++index < length) {
  20278. var value = array[index];
  20279. if (value === placeholder || value === PLACEHOLDER) {
  20280. array[index] = PLACEHOLDER;
  20281. result[resIndex++] = index;
  20282. }
  20283. }
  20284. return result;
  20285. }
  20286. /**
  20287. * Converts `set` to an array of its values.
  20288. *
  20289. * @private
  20290. * @param {Object} set The set to convert.
  20291. * @returns {Array} Returns the values.
  20292. */
  20293. function setToArray(set) {
  20294. var index = -1,
  20295. result = Array(set.size);
  20296. set.forEach(function(value) {
  20297. result[++index] = value;
  20298. });
  20299. return result;
  20300. }
  20301. /**
  20302. * Converts `set` to its value-value pairs.
  20303. *
  20304. * @private
  20305. * @param {Object} set The set to convert.
  20306. * @returns {Array} Returns the value-value pairs.
  20307. */
  20308. function setToPairs(set) {
  20309. var index = -1,
  20310. result = Array(set.size);
  20311. set.forEach(function(value) {
  20312. result[++index] = [value, value];
  20313. });
  20314. return result;
  20315. }
  20316. /**
  20317. * A specialized version of `_.indexOf` which performs strict equality
  20318. * comparisons of values, i.e. `===`.
  20319. *
  20320. * @private
  20321. * @param {Array} array The array to inspect.
  20322. * @param {*} value The value to search for.
  20323. * @param {number} fromIndex The index to search from.
  20324. * @returns {number} Returns the index of the matched value, else `-1`.
  20325. */
  20326. function strictIndexOf(array, value, fromIndex) {
  20327. var index = fromIndex - 1,
  20328. length = array.length;
  20329. while (++index < length) {
  20330. if (array[index] === value) {
  20331. return index;
  20332. }
  20333. }
  20334. return -1;
  20335. }
  20336. /**
  20337. * A specialized version of `_.lastIndexOf` which performs strict equality
  20338. * comparisons of values, i.e. `===`.
  20339. *
  20340. * @private
  20341. * @param {Array} array The array to inspect.
  20342. * @param {*} value The value to search for.
  20343. * @param {number} fromIndex The index to search from.
  20344. * @returns {number} Returns the index of the matched value, else `-1`.
  20345. */
  20346. function strictLastIndexOf(array, value, fromIndex) {
  20347. var index = fromIndex + 1;
  20348. while (index--) {
  20349. if (array[index] === value) {
  20350. return index;
  20351. }
  20352. }
  20353. return index;
  20354. }
  20355. /**
  20356. * Gets the number of symbols in `string`.
  20357. *
  20358. * @private
  20359. * @param {string} string The string to inspect.
  20360. * @returns {number} Returns the string size.
  20361. */
  20362. function stringSize(string) {
  20363. return hasUnicode(string)
  20364. ? unicodeSize(string)
  20365. : asciiSize(string);
  20366. }
  20367. /**
  20368. * Converts `string` to an array.
  20369. *
  20370. * @private
  20371. * @param {string} string The string to convert.
  20372. * @returns {Array} Returns the converted array.
  20373. */
  20374. function stringToArray(string) {
  20375. return hasUnicode(string)
  20376. ? unicodeToArray(string)
  20377. : asciiToArray(string);
  20378. }
  20379. /**
  20380. * Used by `_.unescape` to convert HTML entities to characters.
  20381. *
  20382. * @private
  20383. * @param {string} chr The matched character to unescape.
  20384. * @returns {string} Returns the unescaped character.
  20385. */
  20386. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  20387. /**
  20388. * Gets the size of a Unicode `string`.
  20389. *
  20390. * @private
  20391. * @param {string} string The string inspect.
  20392. * @returns {number} Returns the string size.
  20393. */
  20394. function unicodeSize(string) {
  20395. var result = reUnicode.lastIndex = 0;
  20396. while (reUnicode.test(string)) {
  20397. ++result;
  20398. }
  20399. return result;
  20400. }
  20401. /**
  20402. * Converts a Unicode `string` to an array.
  20403. *
  20404. * @private
  20405. * @param {string} string The string to convert.
  20406. * @returns {Array} Returns the converted array.
  20407. */
  20408. function unicodeToArray(string) {
  20409. return string.match(reUnicode) || [];
  20410. }
  20411. /**
  20412. * Splits a Unicode `string` into an array of its words.
  20413. *
  20414. * @private
  20415. * @param {string} The string to inspect.
  20416. * @returns {Array} Returns the words of `string`.
  20417. */
  20418. function unicodeWords(string) {
  20419. return string.match(reUnicodeWord) || [];
  20420. }
  20421. /*--------------------------------------------------------------------------*/
  20422. /**
  20423. * Create a new pristine `lodash` function using the `context` object.
  20424. *
  20425. * @static
  20426. * @memberOf _
  20427. * @since 1.1.0
  20428. * @category Util
  20429. * @param {Object} [context=root] The context object.
  20430. * @returns {Function} Returns a new `lodash` function.
  20431. * @example
  20432. *
  20433. * _.mixin({ 'foo': _.constant('foo') });
  20434. *
  20435. * var lodash = _.runInContext();
  20436. * lodash.mixin({ 'bar': lodash.constant('bar') });
  20437. *
  20438. * _.isFunction(_.foo);
  20439. * // => true
  20440. * _.isFunction(_.bar);
  20441. * // => false
  20442. *
  20443. * lodash.isFunction(lodash.foo);
  20444. * // => false
  20445. * lodash.isFunction(lodash.bar);
  20446. * // => true
  20447. *
  20448. * // Create a suped-up `defer` in Node.js.
  20449. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  20450. */
  20451. var runInContext = (function runInContext(context) {
  20452. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  20453. /** Built-in constructor references. */
  20454. var Array = context.Array,
  20455. Date = context.Date,
  20456. Error = context.Error,
  20457. Function = context.Function,
  20458. Math = context.Math,
  20459. Object = context.Object,
  20460. RegExp = context.RegExp,
  20461. String = context.String,
  20462. TypeError = context.TypeError;
  20463. /** Used for built-in method references. */
  20464. var arrayProto = Array.prototype,
  20465. funcProto = Function.prototype,
  20466. objectProto = Object.prototype;
  20467. /** Used to detect overreaching core-js shims. */
  20468. var coreJsData = context['__core-js_shared__'];
  20469. /** Used to resolve the decompiled source of functions. */
  20470. var funcToString = funcProto.toString;
  20471. /** Used to check objects for own properties. */
  20472. var hasOwnProperty = objectProto.hasOwnProperty;
  20473. /** Used to generate unique IDs. */
  20474. var idCounter = 0;
  20475. /** Used to detect methods masquerading as native. */
  20476. var maskSrcKey = (function() {
  20477. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  20478. return uid ? ('Symbol(src)_1.' + uid) : '';
  20479. }());
  20480. /**
  20481. * Used to resolve the
  20482. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  20483. * of values.
  20484. */
  20485. var nativeObjectToString = objectProto.toString;
  20486. /** Used to infer the `Object` constructor. */
  20487. var objectCtorString = funcToString.call(Object);
  20488. /** Used to restore the original `_` reference in `_.noConflict`. */
  20489. var oldDash = root._;
  20490. /** Used to detect if a method is native. */
  20491. var reIsNative = RegExp('^' +
  20492. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  20493. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  20494. );
  20495. /** Built-in value references. */
  20496. var Buffer = moduleExports ? context.Buffer : undefined,
  20497. Symbol = context.Symbol,
  20498. Uint8Array = context.Uint8Array,
  20499. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  20500. getPrototype = overArg(Object.getPrototypeOf, Object),
  20501. objectCreate = Object.create,
  20502. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  20503. splice = arrayProto.splice,
  20504. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  20505. symIterator = Symbol ? Symbol.iterator : undefined,
  20506. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  20507. var defineProperty = (function() {
  20508. try {
  20509. var func = getNative(Object, 'defineProperty');
  20510. func({}, '', {});
  20511. return func;
  20512. } catch (e) {}
  20513. }());
  20514. /** Mocked built-ins. */
  20515. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  20516. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  20517. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  20518. /* Built-in method references for those with the same name as other `lodash` methods. */
  20519. var nativeCeil = Math.ceil,
  20520. nativeFloor = Math.floor,
  20521. nativeGetSymbols = Object.getOwnPropertySymbols,
  20522. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  20523. nativeIsFinite = context.isFinite,
  20524. nativeJoin = arrayProto.join,
  20525. nativeKeys = overArg(Object.keys, Object),
  20526. nativeMax = Math.max,
  20527. nativeMin = Math.min,
  20528. nativeNow = Date.now,
  20529. nativeParseInt = context.parseInt,
  20530. nativeRandom = Math.random,
  20531. nativeReverse = arrayProto.reverse;
  20532. /* Built-in method references that are verified to be native. */
  20533. var DataView = getNative(context, 'DataView'),
  20534. Map = getNative(context, 'Map'),
  20535. Promise = getNative(context, 'Promise'),
  20536. Set = getNative(context, 'Set'),
  20537. WeakMap = getNative(context, 'WeakMap'),
  20538. nativeCreate = getNative(Object, 'create');
  20539. /** Used to store function metadata. */
  20540. var metaMap = WeakMap && new WeakMap;
  20541. /** Used to lookup unminified function names. */
  20542. var realNames = {};
  20543. /** Used to detect maps, sets, and weakmaps. */
  20544. var dataViewCtorString = toSource(DataView),
  20545. mapCtorString = toSource(Map),
  20546. promiseCtorString = toSource(Promise),
  20547. setCtorString = toSource(Set),
  20548. weakMapCtorString = toSource(WeakMap);
  20549. /** Used to convert symbols to primitives and strings. */
  20550. var symbolProto = Symbol ? Symbol.prototype : undefined,
  20551. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  20552. symbolToString = symbolProto ? symbolProto.toString : undefined;
  20553. /*------------------------------------------------------------------------*/
  20554. /**
  20555. * Creates a `lodash` object which wraps `value` to enable implicit method
  20556. * chain sequences. Methods that operate on and return arrays, collections,
  20557. * and functions can be chained together. Methods that retrieve a single value
  20558. * or may return a primitive value will automatically end the chain sequence
  20559. * and return the unwrapped value. Otherwise, the value must be unwrapped
  20560. * with `_#value`.
  20561. *
  20562. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  20563. * enabled using `_.chain`.
  20564. *
  20565. * The execution of chained methods is lazy, that is, it's deferred until
  20566. * `_#value` is implicitly or explicitly called.
  20567. *
  20568. * Lazy evaluation allows several methods to support shortcut fusion.
  20569. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  20570. * the creation of intermediate arrays and can greatly reduce the number of
  20571. * iteratee executions. Sections of a chain sequence qualify for shortcut
  20572. * fusion if the section is applied to an array and iteratees accept only
  20573. * one argument. The heuristic for whether a section qualifies for shortcut
  20574. * fusion is subject to change.
  20575. *
  20576. * Chaining is supported in custom builds as long as the `_#value` method is
  20577. * directly or indirectly included in the build.
  20578. *
  20579. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  20580. *
  20581. * The wrapper `Array` methods are:
  20582. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  20583. *
  20584. * The wrapper `String` methods are:
  20585. * `replace` and `split`
  20586. *
  20587. * The wrapper methods that support shortcut fusion are:
  20588. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  20589. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  20590. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  20591. *
  20592. * The chainable wrapper methods are:
  20593. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  20594. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  20595. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  20596. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  20597. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  20598. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  20599. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  20600. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  20601. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  20602. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  20603. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  20604. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  20605. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  20606. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  20607. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  20608. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  20609. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  20610. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  20611. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  20612. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  20613. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  20614. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  20615. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  20616. * `zipObject`, `zipObjectDeep`, and `zipWith`
  20617. *
  20618. * The wrapper methods that are **not** chainable by default are:
  20619. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  20620. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  20621. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  20622. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  20623. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  20624. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  20625. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  20626. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  20627. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  20628. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  20629. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  20630. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  20631. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  20632. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  20633. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  20634. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  20635. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  20636. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  20637. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  20638. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  20639. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  20640. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  20641. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  20642. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  20643. * `upperFirst`, `value`, and `words`
  20644. *
  20645. * @name _
  20646. * @constructor
  20647. * @category Seq
  20648. * @param {*} value The value to wrap in a `lodash` instance.
  20649. * @returns {Object} Returns the new `lodash` wrapper instance.
  20650. * @example
  20651. *
  20652. * function square(n) {
  20653. * return n * n;
  20654. * }
  20655. *
  20656. * var wrapped = _([1, 2, 3]);
  20657. *
  20658. * // Returns an unwrapped value.
  20659. * wrapped.reduce(_.add);
  20660. * // => 6
  20661. *
  20662. * // Returns a wrapped value.
  20663. * var squares = wrapped.map(square);
  20664. *
  20665. * _.isArray(squares);
  20666. * // => false
  20667. *
  20668. * _.isArray(squares.value());
  20669. * // => true
  20670. */
  20671. function lodash(value) {
  20672. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  20673. if (value instanceof LodashWrapper) {
  20674. return value;
  20675. }
  20676. if (hasOwnProperty.call(value, '__wrapped__')) {
  20677. return wrapperClone(value);
  20678. }
  20679. }
  20680. return new LodashWrapper(value);
  20681. }
  20682. /**
  20683. * The base implementation of `_.create` without support for assigning
  20684. * properties to the created object.
  20685. *
  20686. * @private
  20687. * @param {Object} proto The object to inherit from.
  20688. * @returns {Object} Returns the new object.
  20689. */
  20690. var baseCreate = (function() {
  20691. function object() {}
  20692. return function(proto) {
  20693. if (!isObject(proto)) {
  20694. return {};
  20695. }
  20696. if (objectCreate) {
  20697. return objectCreate(proto);
  20698. }
  20699. object.prototype = proto;
  20700. var result = new object;
  20701. object.prototype = undefined;
  20702. return result;
  20703. };
  20704. }());
  20705. /**
  20706. * The function whose prototype chain sequence wrappers inherit from.
  20707. *
  20708. * @private
  20709. */
  20710. function baseLodash() {
  20711. // No operation performed.
  20712. }
  20713. /**
  20714. * The base constructor for creating `lodash` wrapper objects.
  20715. *
  20716. * @private
  20717. * @param {*} value The value to wrap.
  20718. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  20719. */
  20720. function LodashWrapper(value, chainAll) {
  20721. this.__wrapped__ = value;
  20722. this.__actions__ = [];
  20723. this.__chain__ = !!chainAll;
  20724. this.__index__ = 0;
  20725. this.__values__ = undefined;
  20726. }
  20727. /**
  20728. * By default, the template delimiters used by lodash are like those in
  20729. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  20730. * following template settings to use alternative delimiters.
  20731. *
  20732. * @static
  20733. * @memberOf _
  20734. * @type {Object}
  20735. */
  20736. lodash.templateSettings = {
  20737. /**
  20738. * Used to detect `data` property values to be HTML-escaped.
  20739. *
  20740. * @memberOf _.templateSettings
  20741. * @type {RegExp}
  20742. */
  20743. 'escape': reEscape,
  20744. /**
  20745. * Used to detect code to be evaluated.
  20746. *
  20747. * @memberOf _.templateSettings
  20748. * @type {RegExp}
  20749. */
  20750. 'evaluate': reEvaluate,
  20751. /**
  20752. * Used to detect `data` property values to inject.
  20753. *
  20754. * @memberOf _.templateSettings
  20755. * @type {RegExp}
  20756. */
  20757. 'interpolate': reInterpolate,
  20758. /**
  20759. * Used to reference the data object in the template text.
  20760. *
  20761. * @memberOf _.templateSettings
  20762. * @type {string}
  20763. */
  20764. 'variable': '',
  20765. /**
  20766. * Used to import variables into the compiled template.
  20767. *
  20768. * @memberOf _.templateSettings
  20769. * @type {Object}
  20770. */
  20771. 'imports': {
  20772. /**
  20773. * A reference to the `lodash` function.
  20774. *
  20775. * @memberOf _.templateSettings.imports
  20776. * @type {Function}
  20777. */
  20778. '_': lodash
  20779. }
  20780. };
  20781. // Ensure wrappers are instances of `baseLodash`.
  20782. lodash.prototype = baseLodash.prototype;
  20783. lodash.prototype.constructor = lodash;
  20784. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  20785. LodashWrapper.prototype.constructor = LodashWrapper;
  20786. /*------------------------------------------------------------------------*/
  20787. /**
  20788. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  20789. *
  20790. * @private
  20791. * @constructor
  20792. * @param {*} value The value to wrap.
  20793. */
  20794. function LazyWrapper(value) {
  20795. this.__wrapped__ = value;
  20796. this.__actions__ = [];
  20797. this.__dir__ = 1;
  20798. this.__filtered__ = false;
  20799. this.__iteratees__ = [];
  20800. this.__takeCount__ = MAX_ARRAY_LENGTH;
  20801. this.__views__ = [];
  20802. }
  20803. /**
  20804. * Creates a clone of the lazy wrapper object.
  20805. *
  20806. * @private
  20807. * @name clone
  20808. * @memberOf LazyWrapper
  20809. * @returns {Object} Returns the cloned `LazyWrapper` object.
  20810. */
  20811. function lazyClone() {
  20812. var result = new LazyWrapper(this.__wrapped__);
  20813. result.__actions__ = copyArray(this.__actions__);
  20814. result.__dir__ = this.__dir__;
  20815. result.__filtered__ = this.__filtered__;
  20816. result.__iteratees__ = copyArray(this.__iteratees__);
  20817. result.__takeCount__ = this.__takeCount__;
  20818. result.__views__ = copyArray(this.__views__);
  20819. return result;
  20820. }
  20821. /**
  20822. * Reverses the direction of lazy iteration.
  20823. *
  20824. * @private
  20825. * @name reverse
  20826. * @memberOf LazyWrapper
  20827. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  20828. */
  20829. function lazyReverse() {
  20830. if (this.__filtered__) {
  20831. var result = new LazyWrapper(this);
  20832. result.__dir__ = -1;
  20833. result.__filtered__ = true;
  20834. } else {
  20835. result = this.clone();
  20836. result.__dir__ *= -1;
  20837. }
  20838. return result;
  20839. }
  20840. /**
  20841. * Extracts the unwrapped value from its lazy wrapper.
  20842. *
  20843. * @private
  20844. * @name value
  20845. * @memberOf LazyWrapper
  20846. * @returns {*} Returns the unwrapped value.
  20847. */
  20848. function lazyValue() {
  20849. var array = this.__wrapped__.value(),
  20850. dir = this.__dir__,
  20851. isArr = isArray(array),
  20852. isRight = dir < 0,
  20853. arrLength = isArr ? array.length : 0,
  20854. view = getView(0, arrLength, this.__views__),
  20855. start = view.start,
  20856. end = view.end,
  20857. length = end - start,
  20858. index = isRight ? end : (start - 1),
  20859. iteratees = this.__iteratees__,
  20860. iterLength = iteratees.length,
  20861. resIndex = 0,
  20862. takeCount = nativeMin(length, this.__takeCount__);
  20863. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  20864. return baseWrapperValue(array, this.__actions__);
  20865. }
  20866. var result = [];
  20867. outer:
  20868. while (length-- && resIndex < takeCount) {
  20869. index += dir;
  20870. var iterIndex = -1,
  20871. value = array[index];
  20872. while (++iterIndex < iterLength) {
  20873. var data = iteratees[iterIndex],
  20874. iteratee = data.iteratee,
  20875. type = data.type,
  20876. computed = iteratee(value);
  20877. if (type == LAZY_MAP_FLAG) {
  20878. value = computed;
  20879. } else if (!computed) {
  20880. if (type == LAZY_FILTER_FLAG) {
  20881. continue outer;
  20882. } else {
  20883. break outer;
  20884. }
  20885. }
  20886. }
  20887. result[resIndex++] = value;
  20888. }
  20889. return result;
  20890. }
  20891. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  20892. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  20893. LazyWrapper.prototype.constructor = LazyWrapper;
  20894. /*------------------------------------------------------------------------*/
  20895. /**
  20896. * Creates a hash object.
  20897. *
  20898. * @private
  20899. * @constructor
  20900. * @param {Array} [entries] The key-value pairs to cache.
  20901. */
  20902. function Hash(entries) {
  20903. var index = -1,
  20904. length = entries == null ? 0 : entries.length;
  20905. this.clear();
  20906. while (++index < length) {
  20907. var entry = entries[index];
  20908. this.set(entry[0], entry[1]);
  20909. }
  20910. }
  20911. /**
  20912. * Removes all key-value entries from the hash.
  20913. *
  20914. * @private
  20915. * @name clear
  20916. * @memberOf Hash
  20917. */
  20918. function hashClear() {
  20919. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  20920. this.size = 0;
  20921. }
  20922. /**
  20923. * Removes `key` and its value from the hash.
  20924. *
  20925. * @private
  20926. * @name delete
  20927. * @memberOf Hash
  20928. * @param {Object} hash The hash to modify.
  20929. * @param {string} key The key of the value to remove.
  20930. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20931. */
  20932. function hashDelete(key) {
  20933. var result = this.has(key) && delete this.__data__[key];
  20934. this.size -= result ? 1 : 0;
  20935. return result;
  20936. }
  20937. /**
  20938. * Gets the hash value for `key`.
  20939. *
  20940. * @private
  20941. * @name get
  20942. * @memberOf Hash
  20943. * @param {string} key The key of the value to get.
  20944. * @returns {*} Returns the entry value.
  20945. */
  20946. function hashGet(key) {
  20947. var data = this.__data__;
  20948. if (nativeCreate) {
  20949. var result = data[key];
  20950. return result === HASH_UNDEFINED ? undefined : result;
  20951. }
  20952. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  20953. }
  20954. /**
  20955. * Checks if a hash value for `key` exists.
  20956. *
  20957. * @private
  20958. * @name has
  20959. * @memberOf Hash
  20960. * @param {string} key The key of the entry to check.
  20961. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20962. */
  20963. function hashHas(key) {
  20964. var data = this.__data__;
  20965. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  20966. }
  20967. /**
  20968. * Sets the hash `key` to `value`.
  20969. *
  20970. * @private
  20971. * @name set
  20972. * @memberOf Hash
  20973. * @param {string} key The key of the value to set.
  20974. * @param {*} value The value to set.
  20975. * @returns {Object} Returns the hash instance.
  20976. */
  20977. function hashSet(key, value) {
  20978. var data = this.__data__;
  20979. this.size += this.has(key) ? 0 : 1;
  20980. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  20981. return this;
  20982. }
  20983. // Add methods to `Hash`.
  20984. Hash.prototype.clear = hashClear;
  20985. Hash.prototype['delete'] = hashDelete;
  20986. Hash.prototype.get = hashGet;
  20987. Hash.prototype.has = hashHas;
  20988. Hash.prototype.set = hashSet;
  20989. /*------------------------------------------------------------------------*/
  20990. /**
  20991. * Creates an list cache object.
  20992. *
  20993. * @private
  20994. * @constructor
  20995. * @param {Array} [entries] The key-value pairs to cache.
  20996. */
  20997. function ListCache(entries) {
  20998. var index = -1,
  20999. length = entries == null ? 0 : entries.length;
  21000. this.clear();
  21001. while (++index < length) {
  21002. var entry = entries[index];
  21003. this.set(entry[0], entry[1]);
  21004. }
  21005. }
  21006. /**
  21007. * Removes all key-value entries from the list cache.
  21008. *
  21009. * @private
  21010. * @name clear
  21011. * @memberOf ListCache
  21012. */
  21013. function listCacheClear() {
  21014. this.__data__ = [];
  21015. this.size = 0;
  21016. }
  21017. /**
  21018. * Removes `key` and its value from the list cache.
  21019. *
  21020. * @private
  21021. * @name delete
  21022. * @memberOf ListCache
  21023. * @param {string} key The key of the value to remove.
  21024. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  21025. */
  21026. function listCacheDelete(key) {
  21027. var data = this.__data__,
  21028. index = assocIndexOf(data, key);
  21029. if (index < 0) {
  21030. return false;
  21031. }
  21032. var lastIndex = data.length - 1;
  21033. if (index == lastIndex) {
  21034. data.pop();
  21035. } else {
  21036. splice.call(data, index, 1);
  21037. }
  21038. --this.size;
  21039. return true;
  21040. }
  21041. /**
  21042. * Gets the list cache value for `key`.
  21043. *
  21044. * @private
  21045. * @name get
  21046. * @memberOf ListCache
  21047. * @param {string} key The key of the value to get.
  21048. * @returns {*} Returns the entry value.
  21049. */
  21050. function listCacheGet(key) {
  21051. var data = this.__data__,
  21052. index = assocIndexOf(data, key);
  21053. return index < 0 ? undefined : data[index][1];
  21054. }
  21055. /**
  21056. * Checks if a list cache value for `key` exists.
  21057. *
  21058. * @private
  21059. * @name has
  21060. * @memberOf ListCache
  21061. * @param {string} key The key of the entry to check.
  21062. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  21063. */
  21064. function listCacheHas(key) {
  21065. return assocIndexOf(this.__data__, key) > -1;
  21066. }
  21067. /**
  21068. * Sets the list cache `key` to `value`.
  21069. *
  21070. * @private
  21071. * @name set
  21072. * @memberOf ListCache
  21073. * @param {string} key The key of the value to set.
  21074. * @param {*} value The value to set.
  21075. * @returns {Object} Returns the list cache instance.
  21076. */
  21077. function listCacheSet(key, value) {
  21078. var data = this.__data__,
  21079. index = assocIndexOf(data, key);
  21080. if (index < 0) {
  21081. ++this.size;
  21082. data.push([key, value]);
  21083. } else {
  21084. data[index][1] = value;
  21085. }
  21086. return this;
  21087. }
  21088. // Add methods to `ListCache`.
  21089. ListCache.prototype.clear = listCacheClear;
  21090. ListCache.prototype['delete'] = listCacheDelete;
  21091. ListCache.prototype.get = listCacheGet;
  21092. ListCache.prototype.has = listCacheHas;
  21093. ListCache.prototype.set = listCacheSet;
  21094. /*------------------------------------------------------------------------*/
  21095. /**
  21096. * Creates a map cache object to store key-value pairs.
  21097. *
  21098. * @private
  21099. * @constructor
  21100. * @param {Array} [entries] The key-value pairs to cache.
  21101. */
  21102. function MapCache(entries) {
  21103. var index = -1,
  21104. length = entries == null ? 0 : entries.length;
  21105. this.clear();
  21106. while (++index < length) {
  21107. var entry = entries[index];
  21108. this.set(entry[0], entry[1]);
  21109. }
  21110. }
  21111. /**
  21112. * Removes all key-value entries from the map.
  21113. *
  21114. * @private
  21115. * @name clear
  21116. * @memberOf MapCache
  21117. */
  21118. function mapCacheClear() {
  21119. this.size = 0;
  21120. this.__data__ = {
  21121. 'hash': new Hash,
  21122. 'map': new (Map || ListCache),
  21123. 'string': new Hash
  21124. };
  21125. }
  21126. /**
  21127. * Removes `key` and its value from the map.
  21128. *
  21129. * @private
  21130. * @name delete
  21131. * @memberOf MapCache
  21132. * @param {string} key The key of the value to remove.
  21133. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  21134. */
  21135. function mapCacheDelete(key) {
  21136. var result = getMapData(this, key)['delete'](key);
  21137. this.size -= result ? 1 : 0;
  21138. return result;
  21139. }
  21140. /**
  21141. * Gets the map value for `key`.
  21142. *
  21143. * @private
  21144. * @name get
  21145. * @memberOf MapCache
  21146. * @param {string} key The key of the value to get.
  21147. * @returns {*} Returns the entry value.
  21148. */
  21149. function mapCacheGet(key) {
  21150. return getMapData(this, key).get(key);
  21151. }
  21152. /**
  21153. * Checks if a map value for `key` exists.
  21154. *
  21155. * @private
  21156. * @name has
  21157. * @memberOf MapCache
  21158. * @param {string} key The key of the entry to check.
  21159. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  21160. */
  21161. function mapCacheHas(key) {
  21162. return getMapData(this, key).has(key);
  21163. }
  21164. /**
  21165. * Sets the map `key` to `value`.
  21166. *
  21167. * @private
  21168. * @name set
  21169. * @memberOf MapCache
  21170. * @param {string} key The key of the value to set.
  21171. * @param {*} value The value to set.
  21172. * @returns {Object} Returns the map cache instance.
  21173. */
  21174. function mapCacheSet(key, value) {
  21175. var data = getMapData(this, key),
  21176. size = data.size;
  21177. data.set(key, value);
  21178. this.size += data.size == size ? 0 : 1;
  21179. return this;
  21180. }
  21181. // Add methods to `MapCache`.
  21182. MapCache.prototype.clear = mapCacheClear;
  21183. MapCache.prototype['delete'] = mapCacheDelete;
  21184. MapCache.prototype.get = mapCacheGet;
  21185. MapCache.prototype.has = mapCacheHas;
  21186. MapCache.prototype.set = mapCacheSet;
  21187. /*------------------------------------------------------------------------*/
  21188. /**
  21189. *
  21190. * Creates an array cache object to store unique values.
  21191. *
  21192. * @private
  21193. * @constructor
  21194. * @param {Array} [values] The values to cache.
  21195. */
  21196. function SetCache(values) {
  21197. var index = -1,
  21198. length = values == null ? 0 : values.length;
  21199. this.__data__ = new MapCache;
  21200. while (++index < length) {
  21201. this.add(values[index]);
  21202. }
  21203. }
  21204. /**
  21205. * Adds `value` to the array cache.
  21206. *
  21207. * @private
  21208. * @name add
  21209. * @memberOf SetCache
  21210. * @alias push
  21211. * @param {*} value The value to cache.
  21212. * @returns {Object} Returns the cache instance.
  21213. */
  21214. function setCacheAdd(value) {
  21215. this.__data__.set(value, HASH_UNDEFINED);
  21216. return this;
  21217. }
  21218. /**
  21219. * Checks if `value` is in the array cache.
  21220. *
  21221. * @private
  21222. * @name has
  21223. * @memberOf SetCache
  21224. * @param {*} value The value to search for.
  21225. * @returns {number} Returns `true` if `value` is found, else `false`.
  21226. */
  21227. function setCacheHas(value) {
  21228. return this.__data__.has(value);
  21229. }
  21230. // Add methods to `SetCache`.
  21231. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  21232. SetCache.prototype.has = setCacheHas;
  21233. /*------------------------------------------------------------------------*/
  21234. /**
  21235. * Creates a stack cache object to store key-value pairs.
  21236. *
  21237. * @private
  21238. * @constructor
  21239. * @param {Array} [entries] The key-value pairs to cache.
  21240. */
  21241. function Stack(entries) {
  21242. var data = this.__data__ = new ListCache(entries);
  21243. this.size = data.size;
  21244. }
  21245. /**
  21246. * Removes all key-value entries from the stack.
  21247. *
  21248. * @private
  21249. * @name clear
  21250. * @memberOf Stack
  21251. */
  21252. function stackClear() {
  21253. this.__data__ = new ListCache;
  21254. this.size = 0;
  21255. }
  21256. /**
  21257. * Removes `key` and its value from the stack.
  21258. *
  21259. * @private
  21260. * @name delete
  21261. * @memberOf Stack
  21262. * @param {string} key The key of the value to remove.
  21263. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  21264. */
  21265. function stackDelete(key) {
  21266. var data = this.__data__,
  21267. result = data['delete'](key);
  21268. this.size = data.size;
  21269. return result;
  21270. }
  21271. /**
  21272. * Gets the stack value for `key`.
  21273. *
  21274. * @private
  21275. * @name get
  21276. * @memberOf Stack
  21277. * @param {string} key The key of the value to get.
  21278. * @returns {*} Returns the entry value.
  21279. */
  21280. function stackGet(key) {
  21281. return this.__data__.get(key);
  21282. }
  21283. /**
  21284. * Checks if a stack value for `key` exists.
  21285. *
  21286. * @private
  21287. * @name has
  21288. * @memberOf Stack
  21289. * @param {string} key The key of the entry to check.
  21290. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  21291. */
  21292. function stackHas(key) {
  21293. return this.__data__.has(key);
  21294. }
  21295. /**
  21296. * Sets the stack `key` to `value`.
  21297. *
  21298. * @private
  21299. * @name set
  21300. * @memberOf Stack
  21301. * @param {string} key The key of the value to set.
  21302. * @param {*} value The value to set.
  21303. * @returns {Object} Returns the stack cache instance.
  21304. */
  21305. function stackSet(key, value) {
  21306. var data = this.__data__;
  21307. if (data instanceof ListCache) {
  21308. var pairs = data.__data__;
  21309. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  21310. pairs.push([key, value]);
  21311. this.size = ++data.size;
  21312. return this;
  21313. }
  21314. data = this.__data__ = new MapCache(pairs);
  21315. }
  21316. data.set(key, value);
  21317. this.size = data.size;
  21318. return this;
  21319. }
  21320. // Add methods to `Stack`.
  21321. Stack.prototype.clear = stackClear;
  21322. Stack.prototype['delete'] = stackDelete;
  21323. Stack.prototype.get = stackGet;
  21324. Stack.prototype.has = stackHas;
  21325. Stack.prototype.set = stackSet;
  21326. /*------------------------------------------------------------------------*/
  21327. /**
  21328. * Creates an array of the enumerable property names of the array-like `value`.
  21329. *
  21330. * @private
  21331. * @param {*} value The value to query.
  21332. * @param {boolean} inherited Specify returning inherited property names.
  21333. * @returns {Array} Returns the array of property names.
  21334. */
  21335. function arrayLikeKeys(value, inherited) {
  21336. var isArr = isArray(value),
  21337. isArg = !isArr && isArguments(value),
  21338. isBuff = !isArr && !isArg && isBuffer(value),
  21339. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  21340. skipIndexes = isArr || isArg || isBuff || isType,
  21341. result = skipIndexes ? baseTimes(value.length, String) : [],
  21342. length = result.length;
  21343. for (var key in value) {
  21344. if ((inherited || hasOwnProperty.call(value, key)) &&
  21345. !(skipIndexes && (
  21346. // Safari 9 has enumerable `arguments.length` in strict mode.
  21347. key == 'length' ||
  21348. // Node.js 0.10 has enumerable non-index properties on buffers.
  21349. (isBuff && (key == 'offset' || key == 'parent')) ||
  21350. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  21351. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  21352. // Skip index properties.
  21353. isIndex(key, length)
  21354. ))) {
  21355. result.push(key);
  21356. }
  21357. }
  21358. return result;
  21359. }
  21360. /**
  21361. * A specialized version of `_.sample` for arrays.
  21362. *
  21363. * @private
  21364. * @param {Array} array The array to sample.
  21365. * @returns {*} Returns the random element.
  21366. */
  21367. function arraySample(array) {
  21368. var length = array.length;
  21369. return length ? array[baseRandom(0, length - 1)] : undefined;
  21370. }
  21371. /**
  21372. * A specialized version of `_.sampleSize` for arrays.
  21373. *
  21374. * @private
  21375. * @param {Array} array The array to sample.
  21376. * @param {number} n The number of elements to sample.
  21377. * @returns {Array} Returns the random elements.
  21378. */
  21379. function arraySampleSize(array, n) {
  21380. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  21381. }
  21382. /**
  21383. * A specialized version of `_.shuffle` for arrays.
  21384. *
  21385. * @private
  21386. * @param {Array} array The array to shuffle.
  21387. * @returns {Array} Returns the new shuffled array.
  21388. */
  21389. function arrayShuffle(array) {
  21390. return shuffleSelf(copyArray(array));
  21391. }
  21392. /**
  21393. * This function is like `assignValue` except that it doesn't assign
  21394. * `undefined` values.
  21395. *
  21396. * @private
  21397. * @param {Object} object The object to modify.
  21398. * @param {string} key The key of the property to assign.
  21399. * @param {*} value The value to assign.
  21400. */
  21401. function assignMergeValue(object, key, value) {
  21402. if ((value !== undefined && !eq(object[key], value)) ||
  21403. (value === undefined && !(key in object))) {
  21404. baseAssignValue(object, key, value);
  21405. }
  21406. }
  21407. /**
  21408. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  21409. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  21410. * for equality comparisons.
  21411. *
  21412. * @private
  21413. * @param {Object} object The object to modify.
  21414. * @param {string} key The key of the property to assign.
  21415. * @param {*} value The value to assign.
  21416. */
  21417. function assignValue(object, key, value) {
  21418. var objValue = object[key];
  21419. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  21420. (value === undefined && !(key in object))) {
  21421. baseAssignValue(object, key, value);
  21422. }
  21423. }
  21424. /**
  21425. * Gets the index at which the `key` is found in `array` of key-value pairs.
  21426. *
  21427. * @private
  21428. * @param {Array} array The array to inspect.
  21429. * @param {*} key The key to search for.
  21430. * @returns {number} Returns the index of the matched value, else `-1`.
  21431. */
  21432. function assocIndexOf(array, key) {
  21433. var length = array.length;
  21434. while (length--) {
  21435. if (eq(array[length][0], key)) {
  21436. return length;
  21437. }
  21438. }
  21439. return -1;
  21440. }
  21441. /**
  21442. * Aggregates elements of `collection` on `accumulator` with keys transformed
  21443. * by `iteratee` and values set by `setter`.
  21444. *
  21445. * @private
  21446. * @param {Array|Object} collection The collection to iterate over.
  21447. * @param {Function} setter The function to set `accumulator` values.
  21448. * @param {Function} iteratee The iteratee to transform keys.
  21449. * @param {Object} accumulator The initial aggregated object.
  21450. * @returns {Function} Returns `accumulator`.
  21451. */
  21452. function baseAggregator(collection, setter, iteratee, accumulator) {
  21453. baseEach(collection, function(value, key, collection) {
  21454. setter(accumulator, value, iteratee(value), collection);
  21455. });
  21456. return accumulator;
  21457. }
  21458. /**
  21459. * The base implementation of `_.assign` without support for multiple sources
  21460. * or `customizer` functions.
  21461. *
  21462. * @private
  21463. * @param {Object} object The destination object.
  21464. * @param {Object} source The source object.
  21465. * @returns {Object} Returns `object`.
  21466. */
  21467. function baseAssign(object, source) {
  21468. return object && copyObject(source, keys(source), object);
  21469. }
  21470. /**
  21471. * The base implementation of `_.assignIn` without support for multiple sources
  21472. * or `customizer` functions.
  21473. *
  21474. * @private
  21475. * @param {Object} object The destination object.
  21476. * @param {Object} source The source object.
  21477. * @returns {Object} Returns `object`.
  21478. */
  21479. function baseAssignIn(object, source) {
  21480. return object && copyObject(source, keysIn(source), object);
  21481. }
  21482. /**
  21483. * The base implementation of `assignValue` and `assignMergeValue` without
  21484. * value checks.
  21485. *
  21486. * @private
  21487. * @param {Object} object The object to modify.
  21488. * @param {string} key The key of the property to assign.
  21489. * @param {*} value The value to assign.
  21490. */
  21491. function baseAssignValue(object, key, value) {
  21492. if (key == '__proto__' && defineProperty) {
  21493. defineProperty(object, key, {
  21494. 'configurable': true,
  21495. 'enumerable': true,
  21496. 'value': value,
  21497. 'writable': true
  21498. });
  21499. } else {
  21500. object[key] = value;
  21501. }
  21502. }
  21503. /**
  21504. * The base implementation of `_.at` without support for individual paths.
  21505. *
  21506. * @private
  21507. * @param {Object} object The object to iterate over.
  21508. * @param {string[]} paths The property paths to pick.
  21509. * @returns {Array} Returns the picked elements.
  21510. */
  21511. function baseAt(object, paths) {
  21512. var index = -1,
  21513. length = paths.length,
  21514. result = Array(length),
  21515. skip = object == null;
  21516. while (++index < length) {
  21517. result[index] = skip ? undefined : get(object, paths[index]);
  21518. }
  21519. return result;
  21520. }
  21521. /**
  21522. * The base implementation of `_.clamp` which doesn't coerce arguments.
  21523. *
  21524. * @private
  21525. * @param {number} number The number to clamp.
  21526. * @param {number} [lower] The lower bound.
  21527. * @param {number} upper The upper bound.
  21528. * @returns {number} Returns the clamped number.
  21529. */
  21530. function baseClamp(number, lower, upper) {
  21531. if (number === number) {
  21532. if (upper !== undefined) {
  21533. number = number <= upper ? number : upper;
  21534. }
  21535. if (lower !== undefined) {
  21536. number = number >= lower ? number : lower;
  21537. }
  21538. }
  21539. return number;
  21540. }
  21541. /**
  21542. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  21543. * traversed objects.
  21544. *
  21545. * @private
  21546. * @param {*} value The value to clone.
  21547. * @param {boolean} bitmask The bitmask flags.
  21548. * 1 - Deep clone
  21549. * 2 - Flatten inherited properties
  21550. * 4 - Clone symbols
  21551. * @param {Function} [customizer] The function to customize cloning.
  21552. * @param {string} [key] The key of `value`.
  21553. * @param {Object} [object] The parent object of `value`.
  21554. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  21555. * @returns {*} Returns the cloned value.
  21556. */
  21557. function baseClone(value, bitmask, customizer, key, object, stack) {
  21558. var result,
  21559. isDeep = bitmask & CLONE_DEEP_FLAG,
  21560. isFlat = bitmask & CLONE_FLAT_FLAG,
  21561. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  21562. if (customizer) {
  21563. result = object ? customizer(value, key, object, stack) : customizer(value);
  21564. }
  21565. if (result !== undefined) {
  21566. return result;
  21567. }
  21568. if (!isObject(value)) {
  21569. return value;
  21570. }
  21571. var isArr = isArray(value);
  21572. if (isArr) {
  21573. result = initCloneArray(value);
  21574. if (!isDeep) {
  21575. return copyArray(value, result);
  21576. }
  21577. } else {
  21578. var tag = getTag(value),
  21579. isFunc = tag == funcTag || tag == genTag;
  21580. if (isBuffer(value)) {
  21581. return cloneBuffer(value, isDeep);
  21582. }
  21583. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  21584. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  21585. if (!isDeep) {
  21586. return isFlat
  21587. ? copySymbolsIn(value, baseAssignIn(result, value))
  21588. : copySymbols(value, baseAssign(result, value));
  21589. }
  21590. } else {
  21591. if (!cloneableTags[tag]) {
  21592. return object ? value : {};
  21593. }
  21594. result = initCloneByTag(value, tag, isDeep);
  21595. }
  21596. }
  21597. // Check for circular references and return its corresponding clone.
  21598. stack || (stack = new Stack);
  21599. var stacked = stack.get(value);
  21600. if (stacked) {
  21601. return stacked;
  21602. }
  21603. stack.set(value, result);
  21604. if (isSet(value)) {
  21605. value.forEach(function(subValue) {
  21606. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  21607. });
  21608. } else if (isMap(value)) {
  21609. value.forEach(function(subValue, key) {
  21610. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  21611. });
  21612. }
  21613. var keysFunc = isFull
  21614. ? (isFlat ? getAllKeysIn : getAllKeys)
  21615. : (isFlat ? keysIn : keys);
  21616. var props = isArr ? undefined : keysFunc(value);
  21617. arrayEach(props || value, function(subValue, key) {
  21618. if (props) {
  21619. key = subValue;
  21620. subValue = value[key];
  21621. }
  21622. // Recursively populate clone (susceptible to call stack limits).
  21623. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  21624. });
  21625. return result;
  21626. }
  21627. /**
  21628. * The base implementation of `_.conforms` which doesn't clone `source`.
  21629. *
  21630. * @private
  21631. * @param {Object} source The object of property predicates to conform to.
  21632. * @returns {Function} Returns the new spec function.
  21633. */
  21634. function baseConforms(source) {
  21635. var props = keys(source);
  21636. return function(object) {
  21637. return baseConformsTo(object, source, props);
  21638. };
  21639. }
  21640. /**
  21641. * The base implementation of `_.conformsTo` which accepts `props` to check.
  21642. *
  21643. * @private
  21644. * @param {Object} object The object to inspect.
  21645. * @param {Object} source The object of property predicates to conform to.
  21646. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  21647. */
  21648. function baseConformsTo(object, source, props) {
  21649. var length = props.length;
  21650. if (object == null) {
  21651. return !length;
  21652. }
  21653. object = Object(object);
  21654. while (length--) {
  21655. var key = props[length],
  21656. predicate = source[key],
  21657. value = object[key];
  21658. if ((value === undefined && !(key in object)) || !predicate(value)) {
  21659. return false;
  21660. }
  21661. }
  21662. return true;
  21663. }
  21664. /**
  21665. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  21666. * to provide to `func`.
  21667. *
  21668. * @private
  21669. * @param {Function} func The function to delay.
  21670. * @param {number} wait The number of milliseconds to delay invocation.
  21671. * @param {Array} args The arguments to provide to `func`.
  21672. * @returns {number|Object} Returns the timer id or timeout object.
  21673. */
  21674. function baseDelay(func, wait, args) {
  21675. if (typeof func != 'function') {
  21676. throw new TypeError(FUNC_ERROR_TEXT);
  21677. }
  21678. return setTimeout(function() { func.apply(undefined, args); }, wait);
  21679. }
  21680. /**
  21681. * The base implementation of methods like `_.difference` without support
  21682. * for excluding multiple arrays or iteratee shorthands.
  21683. *
  21684. * @private
  21685. * @param {Array} array The array to inspect.
  21686. * @param {Array} values The values to exclude.
  21687. * @param {Function} [iteratee] The iteratee invoked per element.
  21688. * @param {Function} [comparator] The comparator invoked per element.
  21689. * @returns {Array} Returns the new array of filtered values.
  21690. */
  21691. function baseDifference(array, values, iteratee, comparator) {
  21692. var index = -1,
  21693. includes = arrayIncludes,
  21694. isCommon = true,
  21695. length = array.length,
  21696. result = [],
  21697. valuesLength = values.length;
  21698. if (!length) {
  21699. return result;
  21700. }
  21701. if (iteratee) {
  21702. values = arrayMap(values, baseUnary(iteratee));
  21703. }
  21704. if (comparator) {
  21705. includes = arrayIncludesWith;
  21706. isCommon = false;
  21707. }
  21708. else if (values.length >= LARGE_ARRAY_SIZE) {
  21709. includes = cacheHas;
  21710. isCommon = false;
  21711. values = new SetCache(values);
  21712. }
  21713. outer:
  21714. while (++index < length) {
  21715. var value = array[index],
  21716. computed = iteratee == null ? value : iteratee(value);
  21717. value = (comparator || value !== 0) ? value : 0;
  21718. if (isCommon && computed === computed) {
  21719. var valuesIndex = valuesLength;
  21720. while (valuesIndex--) {
  21721. if (values[valuesIndex] === computed) {
  21722. continue outer;
  21723. }
  21724. }
  21725. result.push(value);
  21726. }
  21727. else if (!includes(values, computed, comparator)) {
  21728. result.push(value);
  21729. }
  21730. }
  21731. return result;
  21732. }
  21733. /**
  21734. * The base implementation of `_.forEach` without support for iteratee shorthands.
  21735. *
  21736. * @private
  21737. * @param {Array|Object} collection The collection to iterate over.
  21738. * @param {Function} iteratee The function invoked per iteration.
  21739. * @returns {Array|Object} Returns `collection`.
  21740. */
  21741. var baseEach = createBaseEach(baseForOwn);
  21742. /**
  21743. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  21744. *
  21745. * @private
  21746. * @param {Array|Object} collection The collection to iterate over.
  21747. * @param {Function} iteratee The function invoked per iteration.
  21748. * @returns {Array|Object} Returns `collection`.
  21749. */
  21750. var baseEachRight = createBaseEach(baseForOwnRight, true);
  21751. /**
  21752. * The base implementation of `_.every` without support for iteratee shorthands.
  21753. *
  21754. * @private
  21755. * @param {Array|Object} collection The collection to iterate over.
  21756. * @param {Function} predicate The function invoked per iteration.
  21757. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  21758. * else `false`
  21759. */
  21760. function baseEvery(collection, predicate) {
  21761. var result = true;
  21762. baseEach(collection, function(value, index, collection) {
  21763. result = !!predicate(value, index, collection);
  21764. return result;
  21765. });
  21766. return result;
  21767. }
  21768. /**
  21769. * The base implementation of methods like `_.max` and `_.min` which accepts a
  21770. * `comparator` to determine the extremum value.
  21771. *
  21772. * @private
  21773. * @param {Array} array The array to iterate over.
  21774. * @param {Function} iteratee The iteratee invoked per iteration.
  21775. * @param {Function} comparator The comparator used to compare values.
  21776. * @returns {*} Returns the extremum value.
  21777. */
  21778. function baseExtremum(array, iteratee, comparator) {
  21779. var index = -1,
  21780. length = array.length;
  21781. while (++index < length) {
  21782. var value = array[index],
  21783. current = iteratee(value);
  21784. if (current != null && (computed === undefined
  21785. ? (current === current && !isSymbol(current))
  21786. : comparator(current, computed)
  21787. )) {
  21788. var computed = current,
  21789. result = value;
  21790. }
  21791. }
  21792. return result;
  21793. }
  21794. /**
  21795. * The base implementation of `_.fill` without an iteratee call guard.
  21796. *
  21797. * @private
  21798. * @param {Array} array The array to fill.
  21799. * @param {*} value The value to fill `array` with.
  21800. * @param {number} [start=0] The start position.
  21801. * @param {number} [end=array.length] The end position.
  21802. * @returns {Array} Returns `array`.
  21803. */
  21804. function baseFill(array, value, start, end) {
  21805. var length = array.length;
  21806. start = toInteger(start);
  21807. if (start < 0) {
  21808. start = -start > length ? 0 : (length + start);
  21809. }
  21810. end = (end === undefined || end > length) ? length : toInteger(end);
  21811. if (end < 0) {
  21812. end += length;
  21813. }
  21814. end = start > end ? 0 : toLength(end);
  21815. while (start < end) {
  21816. array[start++] = value;
  21817. }
  21818. return array;
  21819. }
  21820. /**
  21821. * The base implementation of `_.filter` without support for iteratee shorthands.
  21822. *
  21823. * @private
  21824. * @param {Array|Object} collection The collection to iterate over.
  21825. * @param {Function} predicate The function invoked per iteration.
  21826. * @returns {Array} Returns the new filtered array.
  21827. */
  21828. function baseFilter(collection, predicate) {
  21829. var result = [];
  21830. baseEach(collection, function(value, index, collection) {
  21831. if (predicate(value, index, collection)) {
  21832. result.push(value);
  21833. }
  21834. });
  21835. return result;
  21836. }
  21837. /**
  21838. * The base implementation of `_.flatten` with support for restricting flattening.
  21839. *
  21840. * @private
  21841. * @param {Array} array The array to flatten.
  21842. * @param {number} depth The maximum recursion depth.
  21843. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  21844. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  21845. * @param {Array} [result=[]] The initial result value.
  21846. * @returns {Array} Returns the new flattened array.
  21847. */
  21848. function baseFlatten(array, depth, predicate, isStrict, result) {
  21849. var index = -1,
  21850. length = array.length;
  21851. predicate || (predicate = isFlattenable);
  21852. result || (result = []);
  21853. while (++index < length) {
  21854. var value = array[index];
  21855. if (depth > 0 && predicate(value)) {
  21856. if (depth > 1) {
  21857. // Recursively flatten arrays (susceptible to call stack limits).
  21858. baseFlatten(value, depth - 1, predicate, isStrict, result);
  21859. } else {
  21860. arrayPush(result, value);
  21861. }
  21862. } else if (!isStrict) {
  21863. result[result.length] = value;
  21864. }
  21865. }
  21866. return result;
  21867. }
  21868. /**
  21869. * The base implementation of `baseForOwn` which iterates over `object`
  21870. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  21871. * Iteratee functions may exit iteration early by explicitly returning `false`.
  21872. *
  21873. * @private
  21874. * @param {Object} object The object to iterate over.
  21875. * @param {Function} iteratee The function invoked per iteration.
  21876. * @param {Function} keysFunc The function to get the keys of `object`.
  21877. * @returns {Object} Returns `object`.
  21878. */
  21879. var baseFor = createBaseFor();
  21880. /**
  21881. * This function is like `baseFor` except that it iterates over properties
  21882. * in the opposite order.
  21883. *
  21884. * @private
  21885. * @param {Object} object The object to iterate over.
  21886. * @param {Function} iteratee The function invoked per iteration.
  21887. * @param {Function} keysFunc The function to get the keys of `object`.
  21888. * @returns {Object} Returns `object`.
  21889. */
  21890. var baseForRight = createBaseFor(true);
  21891. /**
  21892. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  21893. *
  21894. * @private
  21895. * @param {Object} object The object to iterate over.
  21896. * @param {Function} iteratee The function invoked per iteration.
  21897. * @returns {Object} Returns `object`.
  21898. */
  21899. function baseForOwn(object, iteratee) {
  21900. return object && baseFor(object, iteratee, keys);
  21901. }
  21902. /**
  21903. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  21904. *
  21905. * @private
  21906. * @param {Object} object The object to iterate over.
  21907. * @param {Function} iteratee The function invoked per iteration.
  21908. * @returns {Object} Returns `object`.
  21909. */
  21910. function baseForOwnRight(object, iteratee) {
  21911. return object && baseForRight(object, iteratee, keys);
  21912. }
  21913. /**
  21914. * The base implementation of `_.functions` which creates an array of
  21915. * `object` function property names filtered from `props`.
  21916. *
  21917. * @private
  21918. * @param {Object} object The object to inspect.
  21919. * @param {Array} props The property names to filter.
  21920. * @returns {Array} Returns the function names.
  21921. */
  21922. function baseFunctions(object, props) {
  21923. return arrayFilter(props, function(key) {
  21924. return isFunction(object[key]);
  21925. });
  21926. }
  21927. /**
  21928. * The base implementation of `_.get` without support for default values.
  21929. *
  21930. * @private
  21931. * @param {Object} object The object to query.
  21932. * @param {Array|string} path The path of the property to get.
  21933. * @returns {*} Returns the resolved value.
  21934. */
  21935. function baseGet(object, path) {
  21936. path = castPath(path, object);
  21937. var index = 0,
  21938. length = path.length;
  21939. while (object != null && index < length) {
  21940. object = object[toKey(path[index++])];
  21941. }
  21942. return (index && index == length) ? object : undefined;
  21943. }
  21944. /**
  21945. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  21946. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  21947. * symbols of `object`.
  21948. *
  21949. * @private
  21950. * @param {Object} object The object to query.
  21951. * @param {Function} keysFunc The function to get the keys of `object`.
  21952. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  21953. * @returns {Array} Returns the array of property names and symbols.
  21954. */
  21955. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  21956. var result = keysFunc(object);
  21957. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  21958. }
  21959. /**
  21960. * The base implementation of `getTag` without fallbacks for buggy environments.
  21961. *
  21962. * @private
  21963. * @param {*} value The value to query.
  21964. * @returns {string} Returns the `toStringTag`.
  21965. */
  21966. function baseGetTag(value) {
  21967. if (value == null) {
  21968. return value === undefined ? undefinedTag : nullTag;
  21969. }
  21970. return (symToStringTag && symToStringTag in Object(value))
  21971. ? getRawTag(value)
  21972. : objectToString(value);
  21973. }
  21974. /**
  21975. * The base implementation of `_.gt` which doesn't coerce arguments.
  21976. *
  21977. * @private
  21978. * @param {*} value The value to compare.
  21979. * @param {*} other The other value to compare.
  21980. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  21981. * else `false`.
  21982. */
  21983. function baseGt(value, other) {
  21984. return value > other;
  21985. }
  21986. /**
  21987. * The base implementation of `_.has` without support for deep paths.
  21988. *
  21989. * @private
  21990. * @param {Object} [object] The object to query.
  21991. * @param {Array|string} key The key to check.
  21992. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21993. */
  21994. function baseHas(object, key) {
  21995. return object != null && hasOwnProperty.call(object, key);
  21996. }
  21997. /**
  21998. * The base implementation of `_.hasIn` without support for deep paths.
  21999. *
  22000. * @private
  22001. * @param {Object} [object] The object to query.
  22002. * @param {Array|string} key The key to check.
  22003. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  22004. */
  22005. function baseHasIn(object, key) {
  22006. return object != null && key in Object(object);
  22007. }
  22008. /**
  22009. * The base implementation of `_.inRange` which doesn't coerce arguments.
  22010. *
  22011. * @private
  22012. * @param {number} number The number to check.
  22013. * @param {number} start The start of the range.
  22014. * @param {number} end The end of the range.
  22015. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  22016. */
  22017. function baseInRange(number, start, end) {
  22018. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  22019. }
  22020. /**
  22021. * The base implementation of methods like `_.intersection`, without support
  22022. * for iteratee shorthands, that accepts an array of arrays to inspect.
  22023. *
  22024. * @private
  22025. * @param {Array} arrays The arrays to inspect.
  22026. * @param {Function} [iteratee] The iteratee invoked per element.
  22027. * @param {Function} [comparator] The comparator invoked per element.
  22028. * @returns {Array} Returns the new array of shared values.
  22029. */
  22030. function baseIntersection(arrays, iteratee, comparator) {
  22031. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  22032. length = arrays[0].length,
  22033. othLength = arrays.length,
  22034. othIndex = othLength,
  22035. caches = Array(othLength),
  22036. maxLength = Infinity,
  22037. result = [];
  22038. while (othIndex--) {
  22039. var array = arrays[othIndex];
  22040. if (othIndex && iteratee) {
  22041. array = arrayMap(array, baseUnary(iteratee));
  22042. }
  22043. maxLength = nativeMin(array.length, maxLength);
  22044. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  22045. ? new SetCache(othIndex && array)
  22046. : undefined;
  22047. }
  22048. array = arrays[0];
  22049. var index = -1,
  22050. seen = caches[0];
  22051. outer:
  22052. while (++index < length && result.length < maxLength) {
  22053. var value = array[index],
  22054. computed = iteratee ? iteratee(value) : value;
  22055. value = (comparator || value !== 0) ? value : 0;
  22056. if (!(seen
  22057. ? cacheHas(seen, computed)
  22058. : includes(result, computed, comparator)
  22059. )) {
  22060. othIndex = othLength;
  22061. while (--othIndex) {
  22062. var cache = caches[othIndex];
  22063. if (!(cache
  22064. ? cacheHas(cache, computed)
  22065. : includes(arrays[othIndex], computed, comparator))
  22066. ) {
  22067. continue outer;
  22068. }
  22069. }
  22070. if (seen) {
  22071. seen.push(computed);
  22072. }
  22073. result.push(value);
  22074. }
  22075. }
  22076. return result;
  22077. }
  22078. /**
  22079. * The base implementation of `_.invert` and `_.invertBy` which inverts
  22080. * `object` with values transformed by `iteratee` and set by `setter`.
  22081. *
  22082. * @private
  22083. * @param {Object} object The object to iterate over.
  22084. * @param {Function} setter The function to set `accumulator` values.
  22085. * @param {Function} iteratee The iteratee to transform values.
  22086. * @param {Object} accumulator The initial inverted object.
  22087. * @returns {Function} Returns `accumulator`.
  22088. */
  22089. function baseInverter(object, setter, iteratee, accumulator) {
  22090. baseForOwn(object, function(value, key, object) {
  22091. setter(accumulator, iteratee(value), key, object);
  22092. });
  22093. return accumulator;
  22094. }
  22095. /**
  22096. * The base implementation of `_.invoke` without support for individual
  22097. * method arguments.
  22098. *
  22099. * @private
  22100. * @param {Object} object The object to query.
  22101. * @param {Array|string} path The path of the method to invoke.
  22102. * @param {Array} args The arguments to invoke the method with.
  22103. * @returns {*} Returns the result of the invoked method.
  22104. */
  22105. function baseInvoke(object, path, args) {
  22106. path = castPath(path, object);
  22107. object = parent(object, path);
  22108. var func = object == null ? object : object[toKey(last(path))];
  22109. return func == null ? undefined : apply(func, object, args);
  22110. }
  22111. /**
  22112. * The base implementation of `_.isArguments`.
  22113. *
  22114. * @private
  22115. * @param {*} value The value to check.
  22116. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  22117. */
  22118. function baseIsArguments(value) {
  22119. return isObjectLike(value) && baseGetTag(value) == argsTag;
  22120. }
  22121. /**
  22122. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  22123. *
  22124. * @private
  22125. * @param {*} value The value to check.
  22126. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  22127. */
  22128. function baseIsArrayBuffer(value) {
  22129. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  22130. }
  22131. /**
  22132. * The base implementation of `_.isDate` without Node.js optimizations.
  22133. *
  22134. * @private
  22135. * @param {*} value The value to check.
  22136. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  22137. */
  22138. function baseIsDate(value) {
  22139. return isObjectLike(value) && baseGetTag(value) == dateTag;
  22140. }
  22141. /**
  22142. * The base implementation of `_.isEqual` which supports partial comparisons
  22143. * and tracks traversed objects.
  22144. *
  22145. * @private
  22146. * @param {*} value The value to compare.
  22147. * @param {*} other The other value to compare.
  22148. * @param {boolean} bitmask The bitmask flags.
  22149. * 1 - Unordered comparison
  22150. * 2 - Partial comparison
  22151. * @param {Function} [customizer] The function to customize comparisons.
  22152. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  22153. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  22154. */
  22155. function baseIsEqual(value, other, bitmask, customizer, stack) {
  22156. if (value === other) {
  22157. return true;
  22158. }
  22159. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  22160. return value !== value && other !== other;
  22161. }
  22162. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  22163. }
  22164. /**
  22165. * A specialized version of `baseIsEqual` for arrays and objects which performs
  22166. * deep comparisons and tracks traversed objects enabling objects with circular
  22167. * references to be compared.
  22168. *
  22169. * @private
  22170. * @param {Object} object The object to compare.
  22171. * @param {Object} other The other object to compare.
  22172. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  22173. * @param {Function} customizer The function to customize comparisons.
  22174. * @param {Function} equalFunc The function to determine equivalents of values.
  22175. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  22176. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  22177. */
  22178. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  22179. var objIsArr = isArray(object),
  22180. othIsArr = isArray(other),
  22181. objTag = objIsArr ? arrayTag : getTag(object),
  22182. othTag = othIsArr ? arrayTag : getTag(other);
  22183. objTag = objTag == argsTag ? objectTag : objTag;
  22184. othTag = othTag == argsTag ? objectTag : othTag;
  22185. var objIsObj = objTag == objectTag,
  22186. othIsObj = othTag == objectTag,
  22187. isSameTag = objTag == othTag;
  22188. if (isSameTag && isBuffer(object)) {
  22189. if (!isBuffer(other)) {
  22190. return false;
  22191. }
  22192. objIsArr = true;
  22193. objIsObj = false;
  22194. }
  22195. if (isSameTag && !objIsObj) {
  22196. stack || (stack = new Stack);
  22197. return (objIsArr || isTypedArray(object))
  22198. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  22199. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  22200. }
  22201. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  22202. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  22203. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  22204. if (objIsWrapped || othIsWrapped) {
  22205. var objUnwrapped = objIsWrapped ? object.value() : object,
  22206. othUnwrapped = othIsWrapped ? other.value() : other;
  22207. stack || (stack = new Stack);
  22208. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  22209. }
  22210. }
  22211. if (!isSameTag) {
  22212. return false;
  22213. }
  22214. stack || (stack = new Stack);
  22215. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  22216. }
  22217. /**
  22218. * The base implementation of `_.isMap` without Node.js optimizations.
  22219. *
  22220. * @private
  22221. * @param {*} value The value to check.
  22222. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  22223. */
  22224. function baseIsMap(value) {
  22225. return isObjectLike(value) && getTag(value) == mapTag;
  22226. }
  22227. /**
  22228. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  22229. *
  22230. * @private
  22231. * @param {Object} object The object to inspect.
  22232. * @param {Object} source The object of property values to match.
  22233. * @param {Array} matchData The property names, values, and compare flags to match.
  22234. * @param {Function} [customizer] The function to customize comparisons.
  22235. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  22236. */
  22237. function baseIsMatch(object, source, matchData, customizer) {
  22238. var index = matchData.length,
  22239. length = index,
  22240. noCustomizer = !customizer;
  22241. if (object == null) {
  22242. return !length;
  22243. }
  22244. object = Object(object);
  22245. while (index--) {
  22246. var data = matchData[index];
  22247. if ((noCustomizer && data[2])
  22248. ? data[1] !== object[data[0]]
  22249. : !(data[0] in object)
  22250. ) {
  22251. return false;
  22252. }
  22253. }
  22254. while (++index < length) {
  22255. data = matchData[index];
  22256. var key = data[0],
  22257. objValue = object[key],
  22258. srcValue = data[1];
  22259. if (noCustomizer && data[2]) {
  22260. if (objValue === undefined && !(key in object)) {
  22261. return false;
  22262. }
  22263. } else {
  22264. var stack = new Stack;
  22265. if (customizer) {
  22266. var result = customizer(objValue, srcValue, key, object, source, stack);
  22267. }
  22268. if (!(result === undefined
  22269. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  22270. : result
  22271. )) {
  22272. return false;
  22273. }
  22274. }
  22275. }
  22276. return true;
  22277. }
  22278. /**
  22279. * The base implementation of `_.isNative` without bad shim checks.
  22280. *
  22281. * @private
  22282. * @param {*} value The value to check.
  22283. * @returns {boolean} Returns `true` if `value` is a native function,
  22284. * else `false`.
  22285. */
  22286. function baseIsNative(value) {
  22287. if (!isObject(value) || isMasked(value)) {
  22288. return false;
  22289. }
  22290. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  22291. return pattern.test(toSource(value));
  22292. }
  22293. /**
  22294. * The base implementation of `_.isRegExp` without Node.js optimizations.
  22295. *
  22296. * @private
  22297. * @param {*} value The value to check.
  22298. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  22299. */
  22300. function baseIsRegExp(value) {
  22301. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  22302. }
  22303. /**
  22304. * The base implementation of `_.isSet` without Node.js optimizations.
  22305. *
  22306. * @private
  22307. * @param {*} value The value to check.
  22308. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  22309. */
  22310. function baseIsSet(value) {
  22311. return isObjectLike(value) && getTag(value) == setTag;
  22312. }
  22313. /**
  22314. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  22315. *
  22316. * @private
  22317. * @param {*} value The value to check.
  22318. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  22319. */
  22320. function baseIsTypedArray(value) {
  22321. return isObjectLike(value) &&
  22322. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  22323. }
  22324. /**
  22325. * The base implementation of `_.iteratee`.
  22326. *
  22327. * @private
  22328. * @param {*} [value=_.identity] The value to convert to an iteratee.
  22329. * @returns {Function} Returns the iteratee.
  22330. */
  22331. function baseIteratee(value) {
  22332. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  22333. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  22334. if (typeof value == 'function') {
  22335. return value;
  22336. }
  22337. if (value == null) {
  22338. return identity;
  22339. }
  22340. if (typeof value == 'object') {
  22341. return isArray(value)
  22342. ? baseMatchesProperty(value[0], value[1])
  22343. : baseMatches(value);
  22344. }
  22345. return property(value);
  22346. }
  22347. /**
  22348. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  22349. *
  22350. * @private
  22351. * @param {Object} object The object to query.
  22352. * @returns {Array} Returns the array of property names.
  22353. */
  22354. function baseKeys(object) {
  22355. if (!isPrototype(object)) {
  22356. return nativeKeys(object);
  22357. }
  22358. var result = [];
  22359. for (var key in Object(object)) {
  22360. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  22361. result.push(key);
  22362. }
  22363. }
  22364. return result;
  22365. }
  22366. /**
  22367. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  22368. *
  22369. * @private
  22370. * @param {Object} object The object to query.
  22371. * @returns {Array} Returns the array of property names.
  22372. */
  22373. function baseKeysIn(object) {
  22374. if (!isObject(object)) {
  22375. return nativeKeysIn(object);
  22376. }
  22377. var isProto = isPrototype(object),
  22378. result = [];
  22379. for (var key in object) {
  22380. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  22381. result.push(key);
  22382. }
  22383. }
  22384. return result;
  22385. }
  22386. /**
  22387. * The base implementation of `_.lt` which doesn't coerce arguments.
  22388. *
  22389. * @private
  22390. * @param {*} value The value to compare.
  22391. * @param {*} other The other value to compare.
  22392. * @returns {boolean} Returns `true` if `value` is less than `other`,
  22393. * else `false`.
  22394. */
  22395. function baseLt(value, other) {
  22396. return value < other;
  22397. }
  22398. /**
  22399. * The base implementation of `_.map` without support for iteratee shorthands.
  22400. *
  22401. * @private
  22402. * @param {Array|Object} collection The collection to iterate over.
  22403. * @param {Function} iteratee The function invoked per iteration.
  22404. * @returns {Array} Returns the new mapped array.
  22405. */
  22406. function baseMap(collection, iteratee) {
  22407. var index = -1,
  22408. result = isArrayLike(collection) ? Array(collection.length) : [];
  22409. baseEach(collection, function(value, key, collection) {
  22410. result[++index] = iteratee(value, key, collection);
  22411. });
  22412. return result;
  22413. }
  22414. /**
  22415. * The base implementation of `_.matches` which doesn't clone `source`.
  22416. *
  22417. * @private
  22418. * @param {Object} source The object of property values to match.
  22419. * @returns {Function} Returns the new spec function.
  22420. */
  22421. function baseMatches(source) {
  22422. var matchData = getMatchData(source);
  22423. if (matchData.length == 1 && matchData[0][2]) {
  22424. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  22425. }
  22426. return function(object) {
  22427. return object === source || baseIsMatch(object, source, matchData);
  22428. };
  22429. }
  22430. /**
  22431. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  22432. *
  22433. * @private
  22434. * @param {string} path The path of the property to get.
  22435. * @param {*} srcValue The value to match.
  22436. * @returns {Function} Returns the new spec function.
  22437. */
  22438. function baseMatchesProperty(path, srcValue) {
  22439. if (isKey(path) && isStrictComparable(srcValue)) {
  22440. return matchesStrictComparable(toKey(path), srcValue);
  22441. }
  22442. return function(object) {
  22443. var objValue = get(object, path);
  22444. return (objValue === undefined && objValue === srcValue)
  22445. ? hasIn(object, path)
  22446. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  22447. };
  22448. }
  22449. /**
  22450. * The base implementation of `_.merge` without support for multiple sources.
  22451. *
  22452. * @private
  22453. * @param {Object} object The destination object.
  22454. * @param {Object} source The source object.
  22455. * @param {number} srcIndex The index of `source`.
  22456. * @param {Function} [customizer] The function to customize merged values.
  22457. * @param {Object} [stack] Tracks traversed source values and their merged
  22458. * counterparts.
  22459. */
  22460. function baseMerge(object, source, srcIndex, customizer, stack) {
  22461. if (object === source) {
  22462. return;
  22463. }
  22464. baseFor(source, function(srcValue, key) {
  22465. stack || (stack = new Stack);
  22466. if (isObject(srcValue)) {
  22467. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  22468. }
  22469. else {
  22470. var newValue = customizer
  22471. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  22472. : undefined;
  22473. if (newValue === undefined) {
  22474. newValue = srcValue;
  22475. }
  22476. assignMergeValue(object, key, newValue);
  22477. }
  22478. }, keysIn);
  22479. }
  22480. /**
  22481. * A specialized version of `baseMerge` for arrays and objects which performs
  22482. * deep merges and tracks traversed objects enabling objects with circular
  22483. * references to be merged.
  22484. *
  22485. * @private
  22486. * @param {Object} object The destination object.
  22487. * @param {Object} source The source object.
  22488. * @param {string} key The key of the value to merge.
  22489. * @param {number} srcIndex The index of `source`.
  22490. * @param {Function} mergeFunc The function to merge values.
  22491. * @param {Function} [customizer] The function to customize assigned values.
  22492. * @param {Object} [stack] Tracks traversed source values and their merged
  22493. * counterparts.
  22494. */
  22495. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  22496. var objValue = safeGet(object, key),
  22497. srcValue = safeGet(source, key),
  22498. stacked = stack.get(srcValue);
  22499. if (stacked) {
  22500. assignMergeValue(object, key, stacked);
  22501. return;
  22502. }
  22503. var newValue = customizer
  22504. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  22505. : undefined;
  22506. var isCommon = newValue === undefined;
  22507. if (isCommon) {
  22508. var isArr = isArray(srcValue),
  22509. isBuff = !isArr && isBuffer(srcValue),
  22510. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  22511. newValue = srcValue;
  22512. if (isArr || isBuff || isTyped) {
  22513. if (isArray(objValue)) {
  22514. newValue = objValue;
  22515. }
  22516. else if (isArrayLikeObject(objValue)) {
  22517. newValue = copyArray(objValue);
  22518. }
  22519. else if (isBuff) {
  22520. isCommon = false;
  22521. newValue = cloneBuffer(srcValue, true);
  22522. }
  22523. else if (isTyped) {
  22524. isCommon = false;
  22525. newValue = cloneTypedArray(srcValue, true);
  22526. }
  22527. else {
  22528. newValue = [];
  22529. }
  22530. }
  22531. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  22532. newValue = objValue;
  22533. if (isArguments(objValue)) {
  22534. newValue = toPlainObject(objValue);
  22535. }
  22536. else if (!isObject(objValue) || isFunction(objValue)) {
  22537. newValue = initCloneObject(srcValue);
  22538. }
  22539. }
  22540. else {
  22541. isCommon = false;
  22542. }
  22543. }
  22544. if (isCommon) {
  22545. // Recursively merge objects and arrays (susceptible to call stack limits).
  22546. stack.set(srcValue, newValue);
  22547. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  22548. stack['delete'](srcValue);
  22549. }
  22550. assignMergeValue(object, key, newValue);
  22551. }
  22552. /**
  22553. * The base implementation of `_.nth` which doesn't coerce arguments.
  22554. *
  22555. * @private
  22556. * @param {Array} array The array to query.
  22557. * @param {number} n The index of the element to return.
  22558. * @returns {*} Returns the nth element of `array`.
  22559. */
  22560. function baseNth(array, n) {
  22561. var length = array.length;
  22562. if (!length) {
  22563. return;
  22564. }
  22565. n += n < 0 ? length : 0;
  22566. return isIndex(n, length) ? array[n] : undefined;
  22567. }
  22568. /**
  22569. * The base implementation of `_.orderBy` without param guards.
  22570. *
  22571. * @private
  22572. * @param {Array|Object} collection The collection to iterate over.
  22573. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  22574. * @param {string[]} orders The sort orders of `iteratees`.
  22575. * @returns {Array} Returns the new sorted array.
  22576. */
  22577. function baseOrderBy(collection, iteratees, orders) {
  22578. var index = -1;
  22579. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  22580. var result = baseMap(collection, function(value, key, collection) {
  22581. var criteria = arrayMap(iteratees, function(iteratee) {
  22582. return iteratee(value);
  22583. });
  22584. return { 'criteria': criteria, 'index': ++index, 'value': value };
  22585. });
  22586. return baseSortBy(result, function(object, other) {
  22587. return compareMultiple(object, other, orders);
  22588. });
  22589. }
  22590. /**
  22591. * The base implementation of `_.pick` without support for individual
  22592. * property identifiers.
  22593. *
  22594. * @private
  22595. * @param {Object} object The source object.
  22596. * @param {string[]} paths The property paths to pick.
  22597. * @returns {Object} Returns the new object.
  22598. */
  22599. function basePick(object, paths) {
  22600. return basePickBy(object, paths, function(value, path) {
  22601. return hasIn(object, path);
  22602. });
  22603. }
  22604. /**
  22605. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  22606. *
  22607. * @private
  22608. * @param {Object} object The source object.
  22609. * @param {string[]} paths The property paths to pick.
  22610. * @param {Function} predicate The function invoked per property.
  22611. * @returns {Object} Returns the new object.
  22612. */
  22613. function basePickBy(object, paths, predicate) {
  22614. var index = -1,
  22615. length = paths.length,
  22616. result = {};
  22617. while (++index < length) {
  22618. var path = paths[index],
  22619. value = baseGet(object, path);
  22620. if (predicate(value, path)) {
  22621. baseSet(result, castPath(path, object), value);
  22622. }
  22623. }
  22624. return result;
  22625. }
  22626. /**
  22627. * A specialized version of `baseProperty` which supports deep paths.
  22628. *
  22629. * @private
  22630. * @param {Array|string} path The path of the property to get.
  22631. * @returns {Function} Returns the new accessor function.
  22632. */
  22633. function basePropertyDeep(path) {
  22634. return function(object) {
  22635. return baseGet(object, path);
  22636. };
  22637. }
  22638. /**
  22639. * The base implementation of `_.pullAllBy` without support for iteratee
  22640. * shorthands.
  22641. *
  22642. * @private
  22643. * @param {Array} array The array to modify.
  22644. * @param {Array} values The values to remove.
  22645. * @param {Function} [iteratee] The iteratee invoked per element.
  22646. * @param {Function} [comparator] The comparator invoked per element.
  22647. * @returns {Array} Returns `array`.
  22648. */
  22649. function basePullAll(array, values, iteratee, comparator) {
  22650. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  22651. index = -1,
  22652. length = values.length,
  22653. seen = array;
  22654. if (array === values) {
  22655. values = copyArray(values);
  22656. }
  22657. if (iteratee) {
  22658. seen = arrayMap(array, baseUnary(iteratee));
  22659. }
  22660. while (++index < length) {
  22661. var fromIndex = 0,
  22662. value = values[index],
  22663. computed = iteratee ? iteratee(value) : value;
  22664. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  22665. if (seen !== array) {
  22666. splice.call(seen, fromIndex, 1);
  22667. }
  22668. splice.call(array, fromIndex, 1);
  22669. }
  22670. }
  22671. return array;
  22672. }
  22673. /**
  22674. * The base implementation of `_.pullAt` without support for individual
  22675. * indexes or capturing the removed elements.
  22676. *
  22677. * @private
  22678. * @param {Array} array The array to modify.
  22679. * @param {number[]} indexes The indexes of elements to remove.
  22680. * @returns {Array} Returns `array`.
  22681. */
  22682. function basePullAt(array, indexes) {
  22683. var length = array ? indexes.length : 0,
  22684. lastIndex = length - 1;
  22685. while (length--) {
  22686. var index = indexes[length];
  22687. if (length == lastIndex || index !== previous) {
  22688. var previous = index;
  22689. if (isIndex(index)) {
  22690. splice.call(array, index, 1);
  22691. } else {
  22692. baseUnset(array, index);
  22693. }
  22694. }
  22695. }
  22696. return array;
  22697. }
  22698. /**
  22699. * The base implementation of `_.random` without support for returning
  22700. * floating-point numbers.
  22701. *
  22702. * @private
  22703. * @param {number} lower The lower bound.
  22704. * @param {number} upper The upper bound.
  22705. * @returns {number} Returns the random number.
  22706. */
  22707. function baseRandom(lower, upper) {
  22708. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  22709. }
  22710. /**
  22711. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  22712. * coerce arguments.
  22713. *
  22714. * @private
  22715. * @param {number} start The start of the range.
  22716. * @param {number} end The end of the range.
  22717. * @param {number} step The value to increment or decrement by.
  22718. * @param {boolean} [fromRight] Specify iterating from right to left.
  22719. * @returns {Array} Returns the range of numbers.
  22720. */
  22721. function baseRange(start, end, step, fromRight) {
  22722. var index = -1,
  22723. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  22724. result = Array(length);
  22725. while (length--) {
  22726. result[fromRight ? length : ++index] = start;
  22727. start += step;
  22728. }
  22729. return result;
  22730. }
  22731. /**
  22732. * The base implementation of `_.repeat` which doesn't coerce arguments.
  22733. *
  22734. * @private
  22735. * @param {string} string The string to repeat.
  22736. * @param {number} n The number of times to repeat the string.
  22737. * @returns {string} Returns the repeated string.
  22738. */
  22739. function baseRepeat(string, n) {
  22740. var result = '';
  22741. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  22742. return result;
  22743. }
  22744. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  22745. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  22746. do {
  22747. if (n % 2) {
  22748. result += string;
  22749. }
  22750. n = nativeFloor(n / 2);
  22751. if (n) {
  22752. string += string;
  22753. }
  22754. } while (n);
  22755. return result;
  22756. }
  22757. /**
  22758. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  22759. *
  22760. * @private
  22761. * @param {Function} func The function to apply a rest parameter to.
  22762. * @param {number} [start=func.length-1] The start position of the rest parameter.
  22763. * @returns {Function} Returns the new function.
  22764. */
  22765. function baseRest(func, start) {
  22766. return setToString(overRest(func, start, identity), func + '');
  22767. }
  22768. /**
  22769. * The base implementation of `_.sample`.
  22770. *
  22771. * @private
  22772. * @param {Array|Object} collection The collection to sample.
  22773. * @returns {*} Returns the random element.
  22774. */
  22775. function baseSample(collection) {
  22776. return arraySample(values(collection));
  22777. }
  22778. /**
  22779. * The base implementation of `_.sampleSize` without param guards.
  22780. *
  22781. * @private
  22782. * @param {Array|Object} collection The collection to sample.
  22783. * @param {number} n The number of elements to sample.
  22784. * @returns {Array} Returns the random elements.
  22785. */
  22786. function baseSampleSize(collection, n) {
  22787. var array = values(collection);
  22788. return shuffleSelf(array, baseClamp(n, 0, array.length));
  22789. }
  22790. /**
  22791. * The base implementation of `_.set`.
  22792. *
  22793. * @private
  22794. * @param {Object} object The object to modify.
  22795. * @param {Array|string} path The path of the property to set.
  22796. * @param {*} value The value to set.
  22797. * @param {Function} [customizer] The function to customize path creation.
  22798. * @returns {Object} Returns `object`.
  22799. */
  22800. function baseSet(object, path, value, customizer) {
  22801. if (!isObject(object)) {
  22802. return object;
  22803. }
  22804. path = castPath(path, object);
  22805. var index = -1,
  22806. length = path.length,
  22807. lastIndex = length - 1,
  22808. nested = object;
  22809. while (nested != null && ++index < length) {
  22810. var key = toKey(path[index]),
  22811. newValue = value;
  22812. if (index != lastIndex) {
  22813. var objValue = nested[key];
  22814. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  22815. if (newValue === undefined) {
  22816. newValue = isObject(objValue)
  22817. ? objValue
  22818. : (isIndex(path[index + 1]) ? [] : {});
  22819. }
  22820. }
  22821. assignValue(nested, key, newValue);
  22822. nested = nested[key];
  22823. }
  22824. return object;
  22825. }
  22826. /**
  22827. * The base implementation of `setData` without support for hot loop shorting.
  22828. *
  22829. * @private
  22830. * @param {Function} func The function to associate metadata with.
  22831. * @param {*} data The metadata.
  22832. * @returns {Function} Returns `func`.
  22833. */
  22834. var baseSetData = !metaMap ? identity : function(func, data) {
  22835. metaMap.set(func, data);
  22836. return func;
  22837. };
  22838. /**
  22839. * The base implementation of `setToString` without support for hot loop shorting.
  22840. *
  22841. * @private
  22842. * @param {Function} func The function to modify.
  22843. * @param {Function} string The `toString` result.
  22844. * @returns {Function} Returns `func`.
  22845. */
  22846. var baseSetToString = !defineProperty ? identity : function(func, string) {
  22847. return defineProperty(func, 'toString', {
  22848. 'configurable': true,
  22849. 'enumerable': false,
  22850. 'value': constant(string),
  22851. 'writable': true
  22852. });
  22853. };
  22854. /**
  22855. * The base implementation of `_.shuffle`.
  22856. *
  22857. * @private
  22858. * @param {Array|Object} collection The collection to shuffle.
  22859. * @returns {Array} Returns the new shuffled array.
  22860. */
  22861. function baseShuffle(collection) {
  22862. return shuffleSelf(values(collection));
  22863. }
  22864. /**
  22865. * The base implementation of `_.slice` without an iteratee call guard.
  22866. *
  22867. * @private
  22868. * @param {Array} array The array to slice.
  22869. * @param {number} [start=0] The start position.
  22870. * @param {number} [end=array.length] The end position.
  22871. * @returns {Array} Returns the slice of `array`.
  22872. */
  22873. function baseSlice(array, start, end) {
  22874. var index = -1,
  22875. length = array.length;
  22876. if (start < 0) {
  22877. start = -start > length ? 0 : (length + start);
  22878. }
  22879. end = end > length ? length : end;
  22880. if (end < 0) {
  22881. end += length;
  22882. }
  22883. length = start > end ? 0 : ((end - start) >>> 0);
  22884. start >>>= 0;
  22885. var result = Array(length);
  22886. while (++index < length) {
  22887. result[index] = array[index + start];
  22888. }
  22889. return result;
  22890. }
  22891. /**
  22892. * The base implementation of `_.some` without support for iteratee shorthands.
  22893. *
  22894. * @private
  22895. * @param {Array|Object} collection The collection to iterate over.
  22896. * @param {Function} predicate The function invoked per iteration.
  22897. * @returns {boolean} Returns `true` if any element passes the predicate check,
  22898. * else `false`.
  22899. */
  22900. function baseSome(collection, predicate) {
  22901. var result;
  22902. baseEach(collection, function(value, index, collection) {
  22903. result = predicate(value, index, collection);
  22904. return !result;
  22905. });
  22906. return !!result;
  22907. }
  22908. /**
  22909. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  22910. * performs a binary search of `array` to determine the index at which `value`
  22911. * should be inserted into `array` in order to maintain its sort order.
  22912. *
  22913. * @private
  22914. * @param {Array} array The sorted array to inspect.
  22915. * @param {*} value The value to evaluate.
  22916. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22917. * @returns {number} Returns the index at which `value` should be inserted
  22918. * into `array`.
  22919. */
  22920. function baseSortedIndex(array, value, retHighest) {
  22921. var low = 0,
  22922. high = array == null ? low : array.length;
  22923. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  22924. while (low < high) {
  22925. var mid = (low + high) >>> 1,
  22926. computed = array[mid];
  22927. if (computed !== null && !isSymbol(computed) &&
  22928. (retHighest ? (computed <= value) : (computed < value))) {
  22929. low = mid + 1;
  22930. } else {
  22931. high = mid;
  22932. }
  22933. }
  22934. return high;
  22935. }
  22936. return baseSortedIndexBy(array, value, identity, retHighest);
  22937. }
  22938. /**
  22939. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  22940. * which invokes `iteratee` for `value` and each element of `array` to compute
  22941. * their sort ranking. The iteratee is invoked with one argument; (value).
  22942. *
  22943. * @private
  22944. * @param {Array} array The sorted array to inspect.
  22945. * @param {*} value The value to evaluate.
  22946. * @param {Function} iteratee The iteratee invoked per element.
  22947. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22948. * @returns {number} Returns the index at which `value` should be inserted
  22949. * into `array`.
  22950. */
  22951. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  22952. value = iteratee(value);
  22953. var low = 0,
  22954. high = array == null ? 0 : array.length,
  22955. valIsNaN = value !== value,
  22956. valIsNull = value === null,
  22957. valIsSymbol = isSymbol(value),
  22958. valIsUndefined = value === undefined;
  22959. while (low < high) {
  22960. var mid = nativeFloor((low + high) / 2),
  22961. computed = iteratee(array[mid]),
  22962. othIsDefined = computed !== undefined,
  22963. othIsNull = computed === null,
  22964. othIsReflexive = computed === computed,
  22965. othIsSymbol = isSymbol(computed);
  22966. if (valIsNaN) {
  22967. var setLow = retHighest || othIsReflexive;
  22968. } else if (valIsUndefined) {
  22969. setLow = othIsReflexive && (retHighest || othIsDefined);
  22970. } else if (valIsNull) {
  22971. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  22972. } else if (valIsSymbol) {
  22973. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  22974. } else if (othIsNull || othIsSymbol) {
  22975. setLow = false;
  22976. } else {
  22977. setLow = retHighest ? (computed <= value) : (computed < value);
  22978. }
  22979. if (setLow) {
  22980. low = mid + 1;
  22981. } else {
  22982. high = mid;
  22983. }
  22984. }
  22985. return nativeMin(high, MAX_ARRAY_INDEX);
  22986. }
  22987. /**
  22988. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  22989. * support for iteratee shorthands.
  22990. *
  22991. * @private
  22992. * @param {Array} array The array to inspect.
  22993. * @param {Function} [iteratee] The iteratee invoked per element.
  22994. * @returns {Array} Returns the new duplicate free array.
  22995. */
  22996. function baseSortedUniq(array, iteratee) {
  22997. var index = -1,
  22998. length = array.length,
  22999. resIndex = 0,
  23000. result = [];
  23001. while (++index < length) {
  23002. var value = array[index],
  23003. computed = iteratee ? iteratee(value) : value;
  23004. if (!index || !eq(computed, seen)) {
  23005. var seen = computed;
  23006. result[resIndex++] = value === 0 ? 0 : value;
  23007. }
  23008. }
  23009. return result;
  23010. }
  23011. /**
  23012. * The base implementation of `_.toNumber` which doesn't ensure correct
  23013. * conversions of binary, hexadecimal, or octal string values.
  23014. *
  23015. * @private
  23016. * @param {*} value The value to process.
  23017. * @returns {number} Returns the number.
  23018. */
  23019. function baseToNumber(value) {
  23020. if (typeof value == 'number') {
  23021. return value;
  23022. }
  23023. if (isSymbol(value)) {
  23024. return NAN;
  23025. }
  23026. return +value;
  23027. }
  23028. /**
  23029. * The base implementation of `_.toString` which doesn't convert nullish
  23030. * values to empty strings.
  23031. *
  23032. * @private
  23033. * @param {*} value The value to process.
  23034. * @returns {string} Returns the string.
  23035. */
  23036. function baseToString(value) {
  23037. // Exit early for strings to avoid a performance hit in some environments.
  23038. if (typeof value == 'string') {
  23039. return value;
  23040. }
  23041. if (isArray(value)) {
  23042. // Recursively convert values (susceptible to call stack limits).
  23043. return arrayMap(value, baseToString) + '';
  23044. }
  23045. if (isSymbol(value)) {
  23046. return symbolToString ? symbolToString.call(value) : '';
  23047. }
  23048. var result = (value + '');
  23049. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  23050. }
  23051. /**
  23052. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  23053. *
  23054. * @private
  23055. * @param {Array} array The array to inspect.
  23056. * @param {Function} [iteratee] The iteratee invoked per element.
  23057. * @param {Function} [comparator] The comparator invoked per element.
  23058. * @returns {Array} Returns the new duplicate free array.
  23059. */
  23060. function baseUniq(array, iteratee, comparator) {
  23061. var index = -1,
  23062. includes = arrayIncludes,
  23063. length = array.length,
  23064. isCommon = true,
  23065. result = [],
  23066. seen = result;
  23067. if (comparator) {
  23068. isCommon = false;
  23069. includes = arrayIncludesWith;
  23070. }
  23071. else if (length >= LARGE_ARRAY_SIZE) {
  23072. var set = iteratee ? null : createSet(array);
  23073. if (set) {
  23074. return setToArray(set);
  23075. }
  23076. isCommon = false;
  23077. includes = cacheHas;
  23078. seen = new SetCache;
  23079. }
  23080. else {
  23081. seen = iteratee ? [] : result;
  23082. }
  23083. outer:
  23084. while (++index < length) {
  23085. var value = array[index],
  23086. computed = iteratee ? iteratee(value) : value;
  23087. value = (comparator || value !== 0) ? value : 0;
  23088. if (isCommon && computed === computed) {
  23089. var seenIndex = seen.length;
  23090. while (seenIndex--) {
  23091. if (seen[seenIndex] === computed) {
  23092. continue outer;
  23093. }
  23094. }
  23095. if (iteratee) {
  23096. seen.push(computed);
  23097. }
  23098. result.push(value);
  23099. }
  23100. else if (!includes(seen, computed, comparator)) {
  23101. if (seen !== result) {
  23102. seen.push(computed);
  23103. }
  23104. result.push(value);
  23105. }
  23106. }
  23107. return result;
  23108. }
  23109. /**
  23110. * The base implementation of `_.unset`.
  23111. *
  23112. * @private
  23113. * @param {Object} object The object to modify.
  23114. * @param {Array|string} path The property path to unset.
  23115. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  23116. */
  23117. function baseUnset(object, path) {
  23118. path = castPath(path, object);
  23119. object = parent(object, path);
  23120. return object == null || delete object[toKey(last(path))];
  23121. }
  23122. /**
  23123. * The base implementation of `_.update`.
  23124. *
  23125. * @private
  23126. * @param {Object} object The object to modify.
  23127. * @param {Array|string} path The path of the property to update.
  23128. * @param {Function} updater The function to produce the updated value.
  23129. * @param {Function} [customizer] The function to customize path creation.
  23130. * @returns {Object} Returns `object`.
  23131. */
  23132. function baseUpdate(object, path, updater, customizer) {
  23133. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  23134. }
  23135. /**
  23136. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  23137. * without support for iteratee shorthands.
  23138. *
  23139. * @private
  23140. * @param {Array} array The array to query.
  23141. * @param {Function} predicate The function invoked per iteration.
  23142. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  23143. * @param {boolean} [fromRight] Specify iterating from right to left.
  23144. * @returns {Array} Returns the slice of `array`.
  23145. */
  23146. function baseWhile(array, predicate, isDrop, fromRight) {
  23147. var length = array.length,
  23148. index = fromRight ? length : -1;
  23149. while ((fromRight ? index-- : ++index < length) &&
  23150. predicate(array[index], index, array)) {}
  23151. return isDrop
  23152. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  23153. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  23154. }
  23155. /**
  23156. * The base implementation of `wrapperValue` which returns the result of
  23157. * performing a sequence of actions on the unwrapped `value`, where each
  23158. * successive action is supplied the return value of the previous.
  23159. *
  23160. * @private
  23161. * @param {*} value The unwrapped value.
  23162. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  23163. * @returns {*} Returns the resolved value.
  23164. */
  23165. function baseWrapperValue(value, actions) {
  23166. var result = value;
  23167. if (result instanceof LazyWrapper) {
  23168. result = result.value();
  23169. }
  23170. return arrayReduce(actions, function(result, action) {
  23171. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  23172. }, result);
  23173. }
  23174. /**
  23175. * The base implementation of methods like `_.xor`, without support for
  23176. * iteratee shorthands, that accepts an array of arrays to inspect.
  23177. *
  23178. * @private
  23179. * @param {Array} arrays The arrays to inspect.
  23180. * @param {Function} [iteratee] The iteratee invoked per element.
  23181. * @param {Function} [comparator] The comparator invoked per element.
  23182. * @returns {Array} Returns the new array of values.
  23183. */
  23184. function baseXor(arrays, iteratee, comparator) {
  23185. var length = arrays.length;
  23186. if (length < 2) {
  23187. return length ? baseUniq(arrays[0]) : [];
  23188. }
  23189. var index = -1,
  23190. result = Array(length);
  23191. while (++index < length) {
  23192. var array = arrays[index],
  23193. othIndex = -1;
  23194. while (++othIndex < length) {
  23195. if (othIndex != index) {
  23196. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  23197. }
  23198. }
  23199. }
  23200. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  23201. }
  23202. /**
  23203. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  23204. *
  23205. * @private
  23206. * @param {Array} props The property identifiers.
  23207. * @param {Array} values The property values.
  23208. * @param {Function} assignFunc The function to assign values.
  23209. * @returns {Object} Returns the new object.
  23210. */
  23211. function baseZipObject(props, values, assignFunc) {
  23212. var index = -1,
  23213. length = props.length,
  23214. valsLength = values.length,
  23215. result = {};
  23216. while (++index < length) {
  23217. var value = index < valsLength ? values[index] : undefined;
  23218. assignFunc(result, props[index], value);
  23219. }
  23220. return result;
  23221. }
  23222. /**
  23223. * Casts `value` to an empty array if it's not an array like object.
  23224. *
  23225. * @private
  23226. * @param {*} value The value to inspect.
  23227. * @returns {Array|Object} Returns the cast array-like object.
  23228. */
  23229. function castArrayLikeObject(value) {
  23230. return isArrayLikeObject(value) ? value : [];
  23231. }
  23232. /**
  23233. * Casts `value` to `identity` if it's not a function.
  23234. *
  23235. * @private
  23236. * @param {*} value The value to inspect.
  23237. * @returns {Function} Returns cast function.
  23238. */
  23239. function castFunction(value) {
  23240. return typeof value == 'function' ? value : identity;
  23241. }
  23242. /**
  23243. * Casts `value` to a path array if it's not one.
  23244. *
  23245. * @private
  23246. * @param {*} value The value to inspect.
  23247. * @param {Object} [object] The object to query keys on.
  23248. * @returns {Array} Returns the cast property path array.
  23249. */
  23250. function castPath(value, object) {
  23251. if (isArray(value)) {
  23252. return value;
  23253. }
  23254. return isKey(value, object) ? [value] : stringToPath(toString(value));
  23255. }
  23256. /**
  23257. * A `baseRest` alias which can be replaced with `identity` by module
  23258. * replacement plugins.
  23259. *
  23260. * @private
  23261. * @type {Function}
  23262. * @param {Function} func The function to apply a rest parameter to.
  23263. * @returns {Function} Returns the new function.
  23264. */
  23265. var castRest = baseRest;
  23266. /**
  23267. * Casts `array` to a slice if it's needed.
  23268. *
  23269. * @private
  23270. * @param {Array} array The array to inspect.
  23271. * @param {number} start The start position.
  23272. * @param {number} [end=array.length] The end position.
  23273. * @returns {Array} Returns the cast slice.
  23274. */
  23275. function castSlice(array, start, end) {
  23276. var length = array.length;
  23277. end = end === undefined ? length : end;
  23278. return (!start && end >= length) ? array : baseSlice(array, start, end);
  23279. }
  23280. /**
  23281. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  23282. *
  23283. * @private
  23284. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  23285. */
  23286. var clearTimeout = ctxClearTimeout || function(id) {
  23287. return root.clearTimeout(id);
  23288. };
  23289. /**
  23290. * Creates a clone of `buffer`.
  23291. *
  23292. * @private
  23293. * @param {Buffer} buffer The buffer to clone.
  23294. * @param {boolean} [isDeep] Specify a deep clone.
  23295. * @returns {Buffer} Returns the cloned buffer.
  23296. */
  23297. function cloneBuffer(buffer, isDeep) {
  23298. if (isDeep) {
  23299. return buffer.slice();
  23300. }
  23301. var length = buffer.length,
  23302. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  23303. buffer.copy(result);
  23304. return result;
  23305. }
  23306. /**
  23307. * Creates a clone of `arrayBuffer`.
  23308. *
  23309. * @private
  23310. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  23311. * @returns {ArrayBuffer} Returns the cloned array buffer.
  23312. */
  23313. function cloneArrayBuffer(arrayBuffer) {
  23314. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  23315. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  23316. return result;
  23317. }
  23318. /**
  23319. * Creates a clone of `dataView`.
  23320. *
  23321. * @private
  23322. * @param {Object} dataView The data view to clone.
  23323. * @param {boolean} [isDeep] Specify a deep clone.
  23324. * @returns {Object} Returns the cloned data view.
  23325. */
  23326. function cloneDataView(dataView, isDeep) {
  23327. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  23328. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  23329. }
  23330. /**
  23331. * Creates a clone of `regexp`.
  23332. *
  23333. * @private
  23334. * @param {Object} regexp The regexp to clone.
  23335. * @returns {Object} Returns the cloned regexp.
  23336. */
  23337. function cloneRegExp(regexp) {
  23338. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  23339. result.lastIndex = regexp.lastIndex;
  23340. return result;
  23341. }
  23342. /**
  23343. * Creates a clone of the `symbol` object.
  23344. *
  23345. * @private
  23346. * @param {Object} symbol The symbol object to clone.
  23347. * @returns {Object} Returns the cloned symbol object.
  23348. */
  23349. function cloneSymbol(symbol) {
  23350. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  23351. }
  23352. /**
  23353. * Creates a clone of `typedArray`.
  23354. *
  23355. * @private
  23356. * @param {Object} typedArray The typed array to clone.
  23357. * @param {boolean} [isDeep] Specify a deep clone.
  23358. * @returns {Object} Returns the cloned typed array.
  23359. */
  23360. function cloneTypedArray(typedArray, isDeep) {
  23361. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  23362. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  23363. }
  23364. /**
  23365. * Compares values to sort them in ascending order.
  23366. *
  23367. * @private
  23368. * @param {*} value The value to compare.
  23369. * @param {*} other The other value to compare.
  23370. * @returns {number} Returns the sort order indicator for `value`.
  23371. */
  23372. function compareAscending(value, other) {
  23373. if (value !== other) {
  23374. var valIsDefined = value !== undefined,
  23375. valIsNull = value === null,
  23376. valIsReflexive = value === value,
  23377. valIsSymbol = isSymbol(value);
  23378. var othIsDefined = other !== undefined,
  23379. othIsNull = other === null,
  23380. othIsReflexive = other === other,
  23381. othIsSymbol = isSymbol(other);
  23382. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  23383. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  23384. (valIsNull && othIsDefined && othIsReflexive) ||
  23385. (!valIsDefined && othIsReflexive) ||
  23386. !valIsReflexive) {
  23387. return 1;
  23388. }
  23389. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  23390. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  23391. (othIsNull && valIsDefined && valIsReflexive) ||
  23392. (!othIsDefined && valIsReflexive) ||
  23393. !othIsReflexive) {
  23394. return -1;
  23395. }
  23396. }
  23397. return 0;
  23398. }
  23399. /**
  23400. * Used by `_.orderBy` to compare multiple properties of a value to another
  23401. * and stable sort them.
  23402. *
  23403. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  23404. * specify an order of "desc" for descending or "asc" for ascending sort order
  23405. * of corresponding values.
  23406. *
  23407. * @private
  23408. * @param {Object} object The object to compare.
  23409. * @param {Object} other The other object to compare.
  23410. * @param {boolean[]|string[]} orders The order to sort by for each property.
  23411. * @returns {number} Returns the sort order indicator for `object`.
  23412. */
  23413. function compareMultiple(object, other, orders) {
  23414. var index = -1,
  23415. objCriteria = object.criteria,
  23416. othCriteria = other.criteria,
  23417. length = objCriteria.length,
  23418. ordersLength = orders.length;
  23419. while (++index < length) {
  23420. var result = compareAscending(objCriteria[index], othCriteria[index]);
  23421. if (result) {
  23422. if (index >= ordersLength) {
  23423. return result;
  23424. }
  23425. var order = orders[index];
  23426. return result * (order == 'desc' ? -1 : 1);
  23427. }
  23428. }
  23429. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  23430. // that causes it, under certain circumstances, to provide the same value for
  23431. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  23432. // for more details.
  23433. //
  23434. // This also ensures a stable sort in V8 and other engines.
  23435. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  23436. return object.index - other.index;
  23437. }
  23438. /**
  23439. * Creates an array that is the composition of partially applied arguments,
  23440. * placeholders, and provided arguments into a single array of arguments.
  23441. *
  23442. * @private
  23443. * @param {Array} args The provided arguments.
  23444. * @param {Array} partials The arguments to prepend to those provided.
  23445. * @param {Array} holders The `partials` placeholder indexes.
  23446. * @params {boolean} [isCurried] Specify composing for a curried function.
  23447. * @returns {Array} Returns the new array of composed arguments.
  23448. */
  23449. function composeArgs(args, partials, holders, isCurried) {
  23450. var argsIndex = -1,
  23451. argsLength = args.length,
  23452. holdersLength = holders.length,
  23453. leftIndex = -1,
  23454. leftLength = partials.length,
  23455. rangeLength = nativeMax(argsLength - holdersLength, 0),
  23456. result = Array(leftLength + rangeLength),
  23457. isUncurried = !isCurried;
  23458. while (++leftIndex < leftLength) {
  23459. result[leftIndex] = partials[leftIndex];
  23460. }
  23461. while (++argsIndex < holdersLength) {
  23462. if (isUncurried || argsIndex < argsLength) {
  23463. result[holders[argsIndex]] = args[argsIndex];
  23464. }
  23465. }
  23466. while (rangeLength--) {
  23467. result[leftIndex++] = args[argsIndex++];
  23468. }
  23469. return result;
  23470. }
  23471. /**
  23472. * This function is like `composeArgs` except that the arguments composition
  23473. * is tailored for `_.partialRight`.
  23474. *
  23475. * @private
  23476. * @param {Array} args The provided arguments.
  23477. * @param {Array} partials The arguments to append to those provided.
  23478. * @param {Array} holders The `partials` placeholder indexes.
  23479. * @params {boolean} [isCurried] Specify composing for a curried function.
  23480. * @returns {Array} Returns the new array of composed arguments.
  23481. */
  23482. function composeArgsRight(args, partials, holders, isCurried) {
  23483. var argsIndex = -1,
  23484. argsLength = args.length,
  23485. holdersIndex = -1,
  23486. holdersLength = holders.length,
  23487. rightIndex = -1,
  23488. rightLength = partials.length,
  23489. rangeLength = nativeMax(argsLength - holdersLength, 0),
  23490. result = Array(rangeLength + rightLength),
  23491. isUncurried = !isCurried;
  23492. while (++argsIndex < rangeLength) {
  23493. result[argsIndex] = args[argsIndex];
  23494. }
  23495. var offset = argsIndex;
  23496. while (++rightIndex < rightLength) {
  23497. result[offset + rightIndex] = partials[rightIndex];
  23498. }
  23499. while (++holdersIndex < holdersLength) {
  23500. if (isUncurried || argsIndex < argsLength) {
  23501. result[offset + holders[holdersIndex]] = args[argsIndex++];
  23502. }
  23503. }
  23504. return result;
  23505. }
  23506. /**
  23507. * Copies the values of `source` to `array`.
  23508. *
  23509. * @private
  23510. * @param {Array} source The array to copy values from.
  23511. * @param {Array} [array=[]] The array to copy values to.
  23512. * @returns {Array} Returns `array`.
  23513. */
  23514. function copyArray(source, array) {
  23515. var index = -1,
  23516. length = source.length;
  23517. array || (array = Array(length));
  23518. while (++index < length) {
  23519. array[index] = source[index];
  23520. }
  23521. return array;
  23522. }
  23523. /**
  23524. * Copies properties of `source` to `object`.
  23525. *
  23526. * @private
  23527. * @param {Object} source The object to copy properties from.
  23528. * @param {Array} props The property identifiers to copy.
  23529. * @param {Object} [object={}] The object to copy properties to.
  23530. * @param {Function} [customizer] The function to customize copied values.
  23531. * @returns {Object} Returns `object`.
  23532. */
  23533. function copyObject(source, props, object, customizer) {
  23534. var isNew = !object;
  23535. object || (object = {});
  23536. var index = -1,
  23537. length = props.length;
  23538. while (++index < length) {
  23539. var key = props[index];
  23540. var newValue = customizer
  23541. ? customizer(object[key], source[key], key, object, source)
  23542. : undefined;
  23543. if (newValue === undefined) {
  23544. newValue = source[key];
  23545. }
  23546. if (isNew) {
  23547. baseAssignValue(object, key, newValue);
  23548. } else {
  23549. assignValue(object, key, newValue);
  23550. }
  23551. }
  23552. return object;
  23553. }
  23554. /**
  23555. * Copies own symbols of `source` to `object`.
  23556. *
  23557. * @private
  23558. * @param {Object} source The object to copy symbols from.
  23559. * @param {Object} [object={}] The object to copy symbols to.
  23560. * @returns {Object} Returns `object`.
  23561. */
  23562. function copySymbols(source, object) {
  23563. return copyObject(source, getSymbols(source), object);
  23564. }
  23565. /**
  23566. * Copies own and inherited symbols of `source` to `object`.
  23567. *
  23568. * @private
  23569. * @param {Object} source The object to copy symbols from.
  23570. * @param {Object} [object={}] The object to copy symbols to.
  23571. * @returns {Object} Returns `object`.
  23572. */
  23573. function copySymbolsIn(source, object) {
  23574. return copyObject(source, getSymbolsIn(source), object);
  23575. }
  23576. /**
  23577. * Creates a function like `_.groupBy`.
  23578. *
  23579. * @private
  23580. * @param {Function} setter The function to set accumulator values.
  23581. * @param {Function} [initializer] The accumulator object initializer.
  23582. * @returns {Function} Returns the new aggregator function.
  23583. */
  23584. function createAggregator(setter, initializer) {
  23585. return function(collection, iteratee) {
  23586. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  23587. accumulator = initializer ? initializer() : {};
  23588. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  23589. };
  23590. }
  23591. /**
  23592. * Creates a function like `_.assign`.
  23593. *
  23594. * @private
  23595. * @param {Function} assigner The function to assign values.
  23596. * @returns {Function} Returns the new assigner function.
  23597. */
  23598. function createAssigner(assigner) {
  23599. return baseRest(function(object, sources) {
  23600. var index = -1,
  23601. length = sources.length,
  23602. customizer = length > 1 ? sources[length - 1] : undefined,
  23603. guard = length > 2 ? sources[2] : undefined;
  23604. customizer = (assigner.length > 3 && typeof customizer == 'function')
  23605. ? (length--, customizer)
  23606. : undefined;
  23607. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  23608. customizer = length < 3 ? undefined : customizer;
  23609. length = 1;
  23610. }
  23611. object = Object(object);
  23612. while (++index < length) {
  23613. var source = sources[index];
  23614. if (source) {
  23615. assigner(object, source, index, customizer);
  23616. }
  23617. }
  23618. return object;
  23619. });
  23620. }
  23621. /**
  23622. * Creates a `baseEach` or `baseEachRight` function.
  23623. *
  23624. * @private
  23625. * @param {Function} eachFunc The function to iterate over a collection.
  23626. * @param {boolean} [fromRight] Specify iterating from right to left.
  23627. * @returns {Function} Returns the new base function.
  23628. */
  23629. function createBaseEach(eachFunc, fromRight) {
  23630. return function(collection, iteratee) {
  23631. if (collection == null) {
  23632. return collection;
  23633. }
  23634. if (!isArrayLike(collection)) {
  23635. return eachFunc(collection, iteratee);
  23636. }
  23637. var length = collection.length,
  23638. index = fromRight ? length : -1,
  23639. iterable = Object(collection);
  23640. while ((fromRight ? index-- : ++index < length)) {
  23641. if (iteratee(iterable[index], index, iterable) === false) {
  23642. break;
  23643. }
  23644. }
  23645. return collection;
  23646. };
  23647. }
  23648. /**
  23649. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  23650. *
  23651. * @private
  23652. * @param {boolean} [fromRight] Specify iterating from right to left.
  23653. * @returns {Function} Returns the new base function.
  23654. */
  23655. function createBaseFor(fromRight) {
  23656. return function(object, iteratee, keysFunc) {
  23657. var index = -1,
  23658. iterable = Object(object),
  23659. props = keysFunc(object),
  23660. length = props.length;
  23661. while (length--) {
  23662. var key = props[fromRight ? length : ++index];
  23663. if (iteratee(iterable[key], key, iterable) === false) {
  23664. break;
  23665. }
  23666. }
  23667. return object;
  23668. };
  23669. }
  23670. /**
  23671. * Creates a function that wraps `func` to invoke it with the optional `this`
  23672. * binding of `thisArg`.
  23673. *
  23674. * @private
  23675. * @param {Function} func The function to wrap.
  23676. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23677. * @param {*} [thisArg] The `this` binding of `func`.
  23678. * @returns {Function} Returns the new wrapped function.
  23679. */
  23680. function createBind(func, bitmask, thisArg) {
  23681. var isBind = bitmask & WRAP_BIND_FLAG,
  23682. Ctor = createCtor(func);
  23683. function wrapper() {
  23684. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23685. return fn.apply(isBind ? thisArg : this, arguments);
  23686. }
  23687. return wrapper;
  23688. }
  23689. /**
  23690. * Creates a function like `_.lowerFirst`.
  23691. *
  23692. * @private
  23693. * @param {string} methodName The name of the `String` case method to use.
  23694. * @returns {Function} Returns the new case function.
  23695. */
  23696. function createCaseFirst(methodName) {
  23697. return function(string) {
  23698. string = toString(string);
  23699. var strSymbols = hasUnicode(string)
  23700. ? stringToArray(string)
  23701. : undefined;
  23702. var chr = strSymbols
  23703. ? strSymbols[0]
  23704. : string.charAt(0);
  23705. var trailing = strSymbols
  23706. ? castSlice(strSymbols, 1).join('')
  23707. : string.slice(1);
  23708. return chr[methodName]() + trailing;
  23709. };
  23710. }
  23711. /**
  23712. * Creates a function like `_.camelCase`.
  23713. *
  23714. * @private
  23715. * @param {Function} callback The function to combine each word.
  23716. * @returns {Function} Returns the new compounder function.
  23717. */
  23718. function createCompounder(callback) {
  23719. return function(string) {
  23720. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  23721. };
  23722. }
  23723. /**
  23724. * Creates a function that produces an instance of `Ctor` regardless of
  23725. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  23726. *
  23727. * @private
  23728. * @param {Function} Ctor The constructor to wrap.
  23729. * @returns {Function} Returns the new wrapped function.
  23730. */
  23731. function createCtor(Ctor) {
  23732. return function() {
  23733. // Use a `switch` statement to work with class constructors. See
  23734. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  23735. // for more details.
  23736. var args = arguments;
  23737. switch (args.length) {
  23738. case 0: return new Ctor;
  23739. case 1: return new Ctor(args[0]);
  23740. case 2: return new Ctor(args[0], args[1]);
  23741. case 3: return new Ctor(args[0], args[1], args[2]);
  23742. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  23743. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  23744. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  23745. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  23746. }
  23747. var thisBinding = baseCreate(Ctor.prototype),
  23748. result = Ctor.apply(thisBinding, args);
  23749. // Mimic the constructor's `return` behavior.
  23750. // See https://es5.github.io/#x13.2.2 for more details.
  23751. return isObject(result) ? result : thisBinding;
  23752. };
  23753. }
  23754. /**
  23755. * Creates a function that wraps `func` to enable currying.
  23756. *
  23757. * @private
  23758. * @param {Function} func The function to wrap.
  23759. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23760. * @param {number} arity The arity of `func`.
  23761. * @returns {Function} Returns the new wrapped function.
  23762. */
  23763. function createCurry(func, bitmask, arity) {
  23764. var Ctor = createCtor(func);
  23765. function wrapper() {
  23766. var length = arguments.length,
  23767. args = Array(length),
  23768. index = length,
  23769. placeholder = getHolder(wrapper);
  23770. while (index--) {
  23771. args[index] = arguments[index];
  23772. }
  23773. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  23774. ? []
  23775. : replaceHolders(args, placeholder);
  23776. length -= holders.length;
  23777. if (length < arity) {
  23778. return createRecurry(
  23779. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  23780. args, holders, undefined, undefined, arity - length);
  23781. }
  23782. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23783. return apply(fn, this, args);
  23784. }
  23785. return wrapper;
  23786. }
  23787. /**
  23788. * Creates a `_.find` or `_.findLast` function.
  23789. *
  23790. * @private
  23791. * @param {Function} findIndexFunc The function to find the collection index.
  23792. * @returns {Function} Returns the new find function.
  23793. */
  23794. function createFind(findIndexFunc) {
  23795. return function(collection, predicate, fromIndex) {
  23796. var iterable = Object(collection);
  23797. if (!isArrayLike(collection)) {
  23798. var iteratee = getIteratee(predicate, 3);
  23799. collection = keys(collection);
  23800. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  23801. }
  23802. var index = findIndexFunc(collection, predicate, fromIndex);
  23803. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  23804. };
  23805. }
  23806. /**
  23807. * Creates a `_.flow` or `_.flowRight` function.
  23808. *
  23809. * @private
  23810. * @param {boolean} [fromRight] Specify iterating from right to left.
  23811. * @returns {Function} Returns the new flow function.
  23812. */
  23813. function createFlow(fromRight) {
  23814. return flatRest(function(funcs) {
  23815. var length = funcs.length,
  23816. index = length,
  23817. prereq = LodashWrapper.prototype.thru;
  23818. if (fromRight) {
  23819. funcs.reverse();
  23820. }
  23821. while (index--) {
  23822. var func = funcs[index];
  23823. if (typeof func != 'function') {
  23824. throw new TypeError(FUNC_ERROR_TEXT);
  23825. }
  23826. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  23827. var wrapper = new LodashWrapper([], true);
  23828. }
  23829. }
  23830. index = wrapper ? index : length;
  23831. while (++index < length) {
  23832. func = funcs[index];
  23833. var funcName = getFuncName(func),
  23834. data = funcName == 'wrapper' ? getData(func) : undefined;
  23835. if (data && isLaziable(data[0]) &&
  23836. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  23837. !data[4].length && data[9] == 1
  23838. ) {
  23839. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  23840. } else {
  23841. wrapper = (func.length == 1 && isLaziable(func))
  23842. ? wrapper[funcName]()
  23843. : wrapper.thru(func);
  23844. }
  23845. }
  23846. return function() {
  23847. var args = arguments,
  23848. value = args[0];
  23849. if (wrapper && args.length == 1 && isArray(value)) {
  23850. return wrapper.plant(value).value();
  23851. }
  23852. var index = 0,
  23853. result = length ? funcs[index].apply(this, args) : value;
  23854. while (++index < length) {
  23855. result = funcs[index].call(this, result);
  23856. }
  23857. return result;
  23858. };
  23859. });
  23860. }
  23861. /**
  23862. * Creates a function that wraps `func` to invoke it with optional `this`
  23863. * binding of `thisArg`, partial application, and currying.
  23864. *
  23865. * @private
  23866. * @param {Function|string} func The function or method name to wrap.
  23867. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23868. * @param {*} [thisArg] The `this` binding of `func`.
  23869. * @param {Array} [partials] The arguments to prepend to those provided to
  23870. * the new function.
  23871. * @param {Array} [holders] The `partials` placeholder indexes.
  23872. * @param {Array} [partialsRight] The arguments to append to those provided
  23873. * to the new function.
  23874. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  23875. * @param {Array} [argPos] The argument positions of the new function.
  23876. * @param {number} [ary] The arity cap of `func`.
  23877. * @param {number} [arity] The arity of `func`.
  23878. * @returns {Function} Returns the new wrapped function.
  23879. */
  23880. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  23881. var isAry = bitmask & WRAP_ARY_FLAG,
  23882. isBind = bitmask & WRAP_BIND_FLAG,
  23883. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  23884. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  23885. isFlip = bitmask & WRAP_FLIP_FLAG,
  23886. Ctor = isBindKey ? undefined : createCtor(func);
  23887. function wrapper() {
  23888. var length = arguments.length,
  23889. args = Array(length),
  23890. index = length;
  23891. while (index--) {
  23892. args[index] = arguments[index];
  23893. }
  23894. if (isCurried) {
  23895. var placeholder = getHolder(wrapper),
  23896. holdersCount = countHolders(args, placeholder);
  23897. }
  23898. if (partials) {
  23899. args = composeArgs(args, partials, holders, isCurried);
  23900. }
  23901. if (partialsRight) {
  23902. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  23903. }
  23904. length -= holdersCount;
  23905. if (isCurried && length < arity) {
  23906. var newHolders = replaceHolders(args, placeholder);
  23907. return createRecurry(
  23908. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  23909. args, newHolders, argPos, ary, arity - length
  23910. );
  23911. }
  23912. var thisBinding = isBind ? thisArg : this,
  23913. fn = isBindKey ? thisBinding[func] : func;
  23914. length = args.length;
  23915. if (argPos) {
  23916. args = reorder(args, argPos);
  23917. } else if (isFlip && length > 1) {
  23918. args.reverse();
  23919. }
  23920. if (isAry && ary < length) {
  23921. args.length = ary;
  23922. }
  23923. if (this && this !== root && this instanceof wrapper) {
  23924. fn = Ctor || createCtor(fn);
  23925. }
  23926. return fn.apply(thisBinding, args);
  23927. }
  23928. return wrapper;
  23929. }
  23930. /**
  23931. * Creates a function like `_.invertBy`.
  23932. *
  23933. * @private
  23934. * @param {Function} setter The function to set accumulator values.
  23935. * @param {Function} toIteratee The function to resolve iteratees.
  23936. * @returns {Function} Returns the new inverter function.
  23937. */
  23938. function createInverter(setter, toIteratee) {
  23939. return function(object, iteratee) {
  23940. return baseInverter(object, setter, toIteratee(iteratee), {});
  23941. };
  23942. }
  23943. /**
  23944. * Creates a function that performs a mathematical operation on two values.
  23945. *
  23946. * @private
  23947. * @param {Function} operator The function to perform the operation.
  23948. * @param {number} [defaultValue] The value used for `undefined` arguments.
  23949. * @returns {Function} Returns the new mathematical operation function.
  23950. */
  23951. function createMathOperation(operator, defaultValue) {
  23952. return function(value, other) {
  23953. var result;
  23954. if (value === undefined && other === undefined) {
  23955. return defaultValue;
  23956. }
  23957. if (value !== undefined) {
  23958. result = value;
  23959. }
  23960. if (other !== undefined) {
  23961. if (result === undefined) {
  23962. return other;
  23963. }
  23964. if (typeof value == 'string' || typeof other == 'string') {
  23965. value = baseToString(value);
  23966. other = baseToString(other);
  23967. } else {
  23968. value = baseToNumber(value);
  23969. other = baseToNumber(other);
  23970. }
  23971. result = operator(value, other);
  23972. }
  23973. return result;
  23974. };
  23975. }
  23976. /**
  23977. * Creates a function like `_.over`.
  23978. *
  23979. * @private
  23980. * @param {Function} arrayFunc The function to iterate over iteratees.
  23981. * @returns {Function} Returns the new over function.
  23982. */
  23983. function createOver(arrayFunc) {
  23984. return flatRest(function(iteratees) {
  23985. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  23986. return baseRest(function(args) {
  23987. var thisArg = this;
  23988. return arrayFunc(iteratees, function(iteratee) {
  23989. return apply(iteratee, thisArg, args);
  23990. });
  23991. });
  23992. });
  23993. }
  23994. /**
  23995. * Creates the padding for `string` based on `length`. The `chars` string
  23996. * is truncated if the number of characters exceeds `length`.
  23997. *
  23998. * @private
  23999. * @param {number} length The padding length.
  24000. * @param {string} [chars=' '] The string used as padding.
  24001. * @returns {string} Returns the padding for `string`.
  24002. */
  24003. function createPadding(length, chars) {
  24004. chars = chars === undefined ? ' ' : baseToString(chars);
  24005. var charsLength = chars.length;
  24006. if (charsLength < 2) {
  24007. return charsLength ? baseRepeat(chars, length) : chars;
  24008. }
  24009. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  24010. return hasUnicode(chars)
  24011. ? castSlice(stringToArray(result), 0, length).join('')
  24012. : result.slice(0, length);
  24013. }
  24014. /**
  24015. * Creates a function that wraps `func` to invoke it with the `this` binding
  24016. * of `thisArg` and `partials` prepended to the arguments it receives.
  24017. *
  24018. * @private
  24019. * @param {Function} func The function to wrap.
  24020. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24021. * @param {*} thisArg The `this` binding of `func`.
  24022. * @param {Array} partials The arguments to prepend to those provided to
  24023. * the new function.
  24024. * @returns {Function} Returns the new wrapped function.
  24025. */
  24026. function createPartial(func, bitmask, thisArg, partials) {
  24027. var isBind = bitmask & WRAP_BIND_FLAG,
  24028. Ctor = createCtor(func);
  24029. function wrapper() {
  24030. var argsIndex = -1,
  24031. argsLength = arguments.length,
  24032. leftIndex = -1,
  24033. leftLength = partials.length,
  24034. args = Array(leftLength + argsLength),
  24035. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  24036. while (++leftIndex < leftLength) {
  24037. args[leftIndex] = partials[leftIndex];
  24038. }
  24039. while (argsLength--) {
  24040. args[leftIndex++] = arguments[++argsIndex];
  24041. }
  24042. return apply(fn, isBind ? thisArg : this, args);
  24043. }
  24044. return wrapper;
  24045. }
  24046. /**
  24047. * Creates a `_.range` or `_.rangeRight` function.
  24048. *
  24049. * @private
  24050. * @param {boolean} [fromRight] Specify iterating from right to left.
  24051. * @returns {Function} Returns the new range function.
  24052. */
  24053. function createRange(fromRight) {
  24054. return function(start, end, step) {
  24055. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  24056. end = step = undefined;
  24057. }
  24058. // Ensure the sign of `-0` is preserved.
  24059. start = toFinite(start);
  24060. if (end === undefined) {
  24061. end = start;
  24062. start = 0;
  24063. } else {
  24064. end = toFinite(end);
  24065. }
  24066. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  24067. return baseRange(start, end, step, fromRight);
  24068. };
  24069. }
  24070. /**
  24071. * Creates a function that performs a relational operation on two values.
  24072. *
  24073. * @private
  24074. * @param {Function} operator The function to perform the operation.
  24075. * @returns {Function} Returns the new relational operation function.
  24076. */
  24077. function createRelationalOperation(operator) {
  24078. return function(value, other) {
  24079. if (!(typeof value == 'string' && typeof other == 'string')) {
  24080. value = toNumber(value);
  24081. other = toNumber(other);
  24082. }
  24083. return operator(value, other);
  24084. };
  24085. }
  24086. /**
  24087. * Creates a function that wraps `func` to continue currying.
  24088. *
  24089. * @private
  24090. * @param {Function} func The function to wrap.
  24091. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24092. * @param {Function} wrapFunc The function to create the `func` wrapper.
  24093. * @param {*} placeholder The placeholder value.
  24094. * @param {*} [thisArg] The `this` binding of `func`.
  24095. * @param {Array} [partials] The arguments to prepend to those provided to
  24096. * the new function.
  24097. * @param {Array} [holders] The `partials` placeholder indexes.
  24098. * @param {Array} [argPos] The argument positions of the new function.
  24099. * @param {number} [ary] The arity cap of `func`.
  24100. * @param {number} [arity] The arity of `func`.
  24101. * @returns {Function} Returns the new wrapped function.
  24102. */
  24103. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  24104. var isCurry = bitmask & WRAP_CURRY_FLAG,
  24105. newHolders = isCurry ? holders : undefined,
  24106. newHoldersRight = isCurry ? undefined : holders,
  24107. newPartials = isCurry ? partials : undefined,
  24108. newPartialsRight = isCurry ? undefined : partials;
  24109. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  24110. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  24111. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  24112. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  24113. }
  24114. var newData = [
  24115. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  24116. newHoldersRight, argPos, ary, arity
  24117. ];
  24118. var result = wrapFunc.apply(undefined, newData);
  24119. if (isLaziable(func)) {
  24120. setData(result, newData);
  24121. }
  24122. result.placeholder = placeholder;
  24123. return setWrapToString(result, func, bitmask);
  24124. }
  24125. /**
  24126. * Creates a function like `_.round`.
  24127. *
  24128. * @private
  24129. * @param {string} methodName The name of the `Math` method to use when rounding.
  24130. * @returns {Function} Returns the new round function.
  24131. */
  24132. function createRound(methodName) {
  24133. var func = Math[methodName];
  24134. return function(number, precision) {
  24135. number = toNumber(number);
  24136. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  24137. if (precision && nativeIsFinite(number)) {
  24138. // Shift with exponential notation to avoid floating-point issues.
  24139. // See [MDN](https://mdn.io/round#Examples) for more details.
  24140. var pair = (toString(number) + 'e').split('e'),
  24141. value = func(pair[0] + 'e' + (+pair[1] + precision));
  24142. pair = (toString(value) + 'e').split('e');
  24143. return +(pair[0] + 'e' + (+pair[1] - precision));
  24144. }
  24145. return func(number);
  24146. };
  24147. }
  24148. /**
  24149. * Creates a set object of `values`.
  24150. *
  24151. * @private
  24152. * @param {Array} values The values to add to the set.
  24153. * @returns {Object} Returns the new set.
  24154. */
  24155. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  24156. return new Set(values);
  24157. };
  24158. /**
  24159. * Creates a `_.toPairs` or `_.toPairsIn` function.
  24160. *
  24161. * @private
  24162. * @param {Function} keysFunc The function to get the keys of a given object.
  24163. * @returns {Function} Returns the new pairs function.
  24164. */
  24165. function createToPairs(keysFunc) {
  24166. return function(object) {
  24167. var tag = getTag(object);
  24168. if (tag == mapTag) {
  24169. return mapToArray(object);
  24170. }
  24171. if (tag == setTag) {
  24172. return setToPairs(object);
  24173. }
  24174. return baseToPairs(object, keysFunc(object));
  24175. };
  24176. }
  24177. /**
  24178. * Creates a function that either curries or invokes `func` with optional
  24179. * `this` binding and partially applied arguments.
  24180. *
  24181. * @private
  24182. * @param {Function|string} func The function or method name to wrap.
  24183. * @param {number} bitmask The bitmask flags.
  24184. * 1 - `_.bind`
  24185. * 2 - `_.bindKey`
  24186. * 4 - `_.curry` or `_.curryRight` of a bound function
  24187. * 8 - `_.curry`
  24188. * 16 - `_.curryRight`
  24189. * 32 - `_.partial`
  24190. * 64 - `_.partialRight`
  24191. * 128 - `_.rearg`
  24192. * 256 - `_.ary`
  24193. * 512 - `_.flip`
  24194. * @param {*} [thisArg] The `this` binding of `func`.
  24195. * @param {Array} [partials] The arguments to be partially applied.
  24196. * @param {Array} [holders] The `partials` placeholder indexes.
  24197. * @param {Array} [argPos] The argument positions of the new function.
  24198. * @param {number} [ary] The arity cap of `func`.
  24199. * @param {number} [arity] The arity of `func`.
  24200. * @returns {Function} Returns the new wrapped function.
  24201. */
  24202. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  24203. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  24204. if (!isBindKey && typeof func != 'function') {
  24205. throw new TypeError(FUNC_ERROR_TEXT);
  24206. }
  24207. var length = partials ? partials.length : 0;
  24208. if (!length) {
  24209. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  24210. partials = holders = undefined;
  24211. }
  24212. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  24213. arity = arity === undefined ? arity : toInteger(arity);
  24214. length -= holders ? holders.length : 0;
  24215. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  24216. var partialsRight = partials,
  24217. holdersRight = holders;
  24218. partials = holders = undefined;
  24219. }
  24220. var data = isBindKey ? undefined : getData(func);
  24221. var newData = [
  24222. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  24223. argPos, ary, arity
  24224. ];
  24225. if (data) {
  24226. mergeData(newData, data);
  24227. }
  24228. func = newData[0];
  24229. bitmask = newData[1];
  24230. thisArg = newData[2];
  24231. partials = newData[3];
  24232. holders = newData[4];
  24233. arity = newData[9] = newData[9] === undefined
  24234. ? (isBindKey ? 0 : func.length)
  24235. : nativeMax(newData[9] - length, 0);
  24236. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  24237. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  24238. }
  24239. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  24240. var result = createBind(func, bitmask, thisArg);
  24241. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  24242. result = createCurry(func, bitmask, arity);
  24243. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  24244. result = createPartial(func, bitmask, thisArg, partials);
  24245. } else {
  24246. result = createHybrid.apply(undefined, newData);
  24247. }
  24248. var setter = data ? baseSetData : setData;
  24249. return setWrapToString(setter(result, newData), func, bitmask);
  24250. }
  24251. /**
  24252. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  24253. * of source objects to the destination object for all destination properties
  24254. * that resolve to `undefined`.
  24255. *
  24256. * @private
  24257. * @param {*} objValue The destination value.
  24258. * @param {*} srcValue The source value.
  24259. * @param {string} key The key of the property to assign.
  24260. * @param {Object} object The parent object of `objValue`.
  24261. * @returns {*} Returns the value to assign.
  24262. */
  24263. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  24264. if (objValue === undefined ||
  24265. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  24266. return srcValue;
  24267. }
  24268. return objValue;
  24269. }
  24270. /**
  24271. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  24272. * objects into destination objects that are passed thru.
  24273. *
  24274. * @private
  24275. * @param {*} objValue The destination value.
  24276. * @param {*} srcValue The source value.
  24277. * @param {string} key The key of the property to merge.
  24278. * @param {Object} object The parent object of `objValue`.
  24279. * @param {Object} source The parent object of `srcValue`.
  24280. * @param {Object} [stack] Tracks traversed source values and their merged
  24281. * counterparts.
  24282. * @returns {*} Returns the value to assign.
  24283. */
  24284. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  24285. if (isObject(objValue) && isObject(srcValue)) {
  24286. // Recursively merge objects and arrays (susceptible to call stack limits).
  24287. stack.set(srcValue, objValue);
  24288. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  24289. stack['delete'](srcValue);
  24290. }
  24291. return objValue;
  24292. }
  24293. /**
  24294. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  24295. * objects.
  24296. *
  24297. * @private
  24298. * @param {*} value The value to inspect.
  24299. * @param {string} key The key of the property to inspect.
  24300. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  24301. */
  24302. function customOmitClone(value) {
  24303. return isPlainObject(value) ? undefined : value;
  24304. }
  24305. /**
  24306. * A specialized version of `baseIsEqualDeep` for arrays with support for
  24307. * partial deep comparisons.
  24308. *
  24309. * @private
  24310. * @param {Array} array The array to compare.
  24311. * @param {Array} other The other array to compare.
  24312. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  24313. * @param {Function} customizer The function to customize comparisons.
  24314. * @param {Function} equalFunc The function to determine equivalents of values.
  24315. * @param {Object} stack Tracks traversed `array` and `other` objects.
  24316. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  24317. */
  24318. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  24319. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  24320. arrLength = array.length,
  24321. othLength = other.length;
  24322. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  24323. return false;
  24324. }
  24325. // Assume cyclic values are equal.
  24326. var stacked = stack.get(array);
  24327. if (stacked && stack.get(other)) {
  24328. return stacked == other;
  24329. }
  24330. var index = -1,
  24331. result = true,
  24332. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  24333. stack.set(array, other);
  24334. stack.set(other, array);
  24335. // Ignore non-index properties.
  24336. while (++index < arrLength) {
  24337. var arrValue = array[index],
  24338. othValue = other[index];
  24339. if (customizer) {
  24340. var compared = isPartial
  24341. ? customizer(othValue, arrValue, index, other, array, stack)
  24342. : customizer(arrValue, othValue, index, array, other, stack);
  24343. }
  24344. if (compared !== undefined) {
  24345. if (compared) {
  24346. continue;
  24347. }
  24348. result = false;
  24349. break;
  24350. }
  24351. // Recursively compare arrays (susceptible to call stack limits).
  24352. if (seen) {
  24353. if (!arraySome(other, function(othValue, othIndex) {
  24354. if (!cacheHas(seen, othIndex) &&
  24355. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  24356. return seen.push(othIndex);
  24357. }
  24358. })) {
  24359. result = false;
  24360. break;
  24361. }
  24362. } else if (!(
  24363. arrValue === othValue ||
  24364. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  24365. )) {
  24366. result = false;
  24367. break;
  24368. }
  24369. }
  24370. stack['delete'](array);
  24371. stack['delete'](other);
  24372. return result;
  24373. }
  24374. /**
  24375. * A specialized version of `baseIsEqualDeep` for comparing objects of
  24376. * the same `toStringTag`.
  24377. *
  24378. * **Note:** This function only supports comparing values with tags of
  24379. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  24380. *
  24381. * @private
  24382. * @param {Object} object The object to compare.
  24383. * @param {Object} other The other object to compare.
  24384. * @param {string} tag The `toStringTag` of the objects to compare.
  24385. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  24386. * @param {Function} customizer The function to customize comparisons.
  24387. * @param {Function} equalFunc The function to determine equivalents of values.
  24388. * @param {Object} stack Tracks traversed `object` and `other` objects.
  24389. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  24390. */
  24391. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  24392. switch (tag) {
  24393. case dataViewTag:
  24394. if ((object.byteLength != other.byteLength) ||
  24395. (object.byteOffset != other.byteOffset)) {
  24396. return false;
  24397. }
  24398. object = object.buffer;
  24399. other = other.buffer;
  24400. case arrayBufferTag:
  24401. if ((object.byteLength != other.byteLength) ||
  24402. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  24403. return false;
  24404. }
  24405. return true;
  24406. case boolTag:
  24407. case dateTag:
  24408. case numberTag:
  24409. // Coerce booleans to `1` or `0` and dates to milliseconds.
  24410. // Invalid dates are coerced to `NaN`.
  24411. return eq(+object, +other);
  24412. case errorTag:
  24413. return object.name == other.name && object.message == other.message;
  24414. case regexpTag:
  24415. case stringTag:
  24416. // Coerce regexes to strings and treat strings, primitives and objects,
  24417. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  24418. // for more details.
  24419. return object == (other + '');
  24420. case mapTag:
  24421. var convert = mapToArray;
  24422. case setTag:
  24423. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  24424. convert || (convert = setToArray);
  24425. if (object.size != other.size && !isPartial) {
  24426. return false;
  24427. }
  24428. // Assume cyclic values are equal.
  24429. var stacked = stack.get(object);
  24430. if (stacked) {
  24431. return stacked == other;
  24432. }
  24433. bitmask |= COMPARE_UNORDERED_FLAG;
  24434. // Recursively compare objects (susceptible to call stack limits).
  24435. stack.set(object, other);
  24436. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  24437. stack['delete'](object);
  24438. return result;
  24439. case symbolTag:
  24440. if (symbolValueOf) {
  24441. return symbolValueOf.call(object) == symbolValueOf.call(other);
  24442. }
  24443. }
  24444. return false;
  24445. }
  24446. /**
  24447. * A specialized version of `baseIsEqualDeep` for objects with support for
  24448. * partial deep comparisons.
  24449. *
  24450. * @private
  24451. * @param {Object} object The object to compare.
  24452. * @param {Object} other The other object to compare.
  24453. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  24454. * @param {Function} customizer The function to customize comparisons.
  24455. * @param {Function} equalFunc The function to determine equivalents of values.
  24456. * @param {Object} stack Tracks traversed `object` and `other` objects.
  24457. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  24458. */
  24459. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  24460. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  24461. objProps = getAllKeys(object),
  24462. objLength = objProps.length,
  24463. othProps = getAllKeys(other),
  24464. othLength = othProps.length;
  24465. if (objLength != othLength && !isPartial) {
  24466. return false;
  24467. }
  24468. var index = objLength;
  24469. while (index--) {
  24470. var key = objProps[index];
  24471. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  24472. return false;
  24473. }
  24474. }
  24475. // Assume cyclic values are equal.
  24476. var stacked = stack.get(object);
  24477. if (stacked && stack.get(other)) {
  24478. return stacked == other;
  24479. }
  24480. var result = true;
  24481. stack.set(object, other);
  24482. stack.set(other, object);
  24483. var skipCtor = isPartial;
  24484. while (++index < objLength) {
  24485. key = objProps[index];
  24486. var objValue = object[key],
  24487. othValue = other[key];
  24488. if (customizer) {
  24489. var compared = isPartial
  24490. ? customizer(othValue, objValue, key, other, object, stack)
  24491. : customizer(objValue, othValue, key, object, other, stack);
  24492. }
  24493. // Recursively compare objects (susceptible to call stack limits).
  24494. if (!(compared === undefined
  24495. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  24496. : compared
  24497. )) {
  24498. result = false;
  24499. break;
  24500. }
  24501. skipCtor || (skipCtor = key == 'constructor');
  24502. }
  24503. if (result && !skipCtor) {
  24504. var objCtor = object.constructor,
  24505. othCtor = other.constructor;
  24506. // Non `Object` object instances with different constructors are not equal.
  24507. if (objCtor != othCtor &&
  24508. ('constructor' in object && 'constructor' in other) &&
  24509. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  24510. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  24511. result = false;
  24512. }
  24513. }
  24514. stack['delete'](object);
  24515. stack['delete'](other);
  24516. return result;
  24517. }
  24518. /**
  24519. * A specialized version of `baseRest` which flattens the rest array.
  24520. *
  24521. * @private
  24522. * @param {Function} func The function to apply a rest parameter to.
  24523. * @returns {Function} Returns the new function.
  24524. */
  24525. function flatRest(func) {
  24526. return setToString(overRest(func, undefined, flatten), func + '');
  24527. }
  24528. /**
  24529. * Creates an array of own enumerable property names and symbols of `object`.
  24530. *
  24531. * @private
  24532. * @param {Object} object The object to query.
  24533. * @returns {Array} Returns the array of property names and symbols.
  24534. */
  24535. function getAllKeys(object) {
  24536. return baseGetAllKeys(object, keys, getSymbols);
  24537. }
  24538. /**
  24539. * Creates an array of own and inherited enumerable property names and
  24540. * symbols of `object`.
  24541. *
  24542. * @private
  24543. * @param {Object} object The object to query.
  24544. * @returns {Array} Returns the array of property names and symbols.
  24545. */
  24546. function getAllKeysIn(object) {
  24547. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  24548. }
  24549. /**
  24550. * Gets metadata for `func`.
  24551. *
  24552. * @private
  24553. * @param {Function} func The function to query.
  24554. * @returns {*} Returns the metadata for `func`.
  24555. */
  24556. var getData = !metaMap ? noop : function(func) {
  24557. return metaMap.get(func);
  24558. };
  24559. /**
  24560. * Gets the name of `func`.
  24561. *
  24562. * @private
  24563. * @param {Function} func The function to query.
  24564. * @returns {string} Returns the function name.
  24565. */
  24566. function getFuncName(func) {
  24567. var result = (func.name + ''),
  24568. array = realNames[result],
  24569. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  24570. while (length--) {
  24571. var data = array[length],
  24572. otherFunc = data.func;
  24573. if (otherFunc == null || otherFunc == func) {
  24574. return data.name;
  24575. }
  24576. }
  24577. return result;
  24578. }
  24579. /**
  24580. * Gets the argument placeholder value for `func`.
  24581. *
  24582. * @private
  24583. * @param {Function} func The function to inspect.
  24584. * @returns {*} Returns the placeholder value.
  24585. */
  24586. function getHolder(func) {
  24587. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  24588. return object.placeholder;
  24589. }
  24590. /**
  24591. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  24592. * this function returns the custom method, otherwise it returns `baseIteratee`.
  24593. * If arguments are provided, the chosen function is invoked with them and
  24594. * its result is returned.
  24595. *
  24596. * @private
  24597. * @param {*} [value] The value to convert to an iteratee.
  24598. * @param {number} [arity] The arity of the created iteratee.
  24599. * @returns {Function} Returns the chosen function or its result.
  24600. */
  24601. function getIteratee() {
  24602. var result = lodash.iteratee || iteratee;
  24603. result = result === iteratee ? baseIteratee : result;
  24604. return arguments.length ? result(arguments[0], arguments[1]) : result;
  24605. }
  24606. /**
  24607. * Gets the data for `map`.
  24608. *
  24609. * @private
  24610. * @param {Object} map The map to query.
  24611. * @param {string} key The reference key.
  24612. * @returns {*} Returns the map data.
  24613. */
  24614. function getMapData(map, key) {
  24615. var data = map.__data__;
  24616. return isKeyable(key)
  24617. ? data[typeof key == 'string' ? 'string' : 'hash']
  24618. : data.map;
  24619. }
  24620. /**
  24621. * Gets the property names, values, and compare flags of `object`.
  24622. *
  24623. * @private
  24624. * @param {Object} object The object to query.
  24625. * @returns {Array} Returns the match data of `object`.
  24626. */
  24627. function getMatchData(object) {
  24628. var result = keys(object),
  24629. length = result.length;
  24630. while (length--) {
  24631. var key = result[length],
  24632. value = object[key];
  24633. result[length] = [key, value, isStrictComparable(value)];
  24634. }
  24635. return result;
  24636. }
  24637. /**
  24638. * Gets the native function at `key` of `object`.
  24639. *
  24640. * @private
  24641. * @param {Object} object The object to query.
  24642. * @param {string} key The key of the method to get.
  24643. * @returns {*} Returns the function if it's native, else `undefined`.
  24644. */
  24645. function getNative(object, key) {
  24646. var value = getValue(object, key);
  24647. return baseIsNative(value) ? value : undefined;
  24648. }
  24649. /**
  24650. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  24651. *
  24652. * @private
  24653. * @param {*} value The value to query.
  24654. * @returns {string} Returns the raw `toStringTag`.
  24655. */
  24656. function getRawTag(value) {
  24657. var isOwn = hasOwnProperty.call(value, symToStringTag),
  24658. tag = value[symToStringTag];
  24659. try {
  24660. value[symToStringTag] = undefined;
  24661. var unmasked = true;
  24662. } catch (e) {}
  24663. var result = nativeObjectToString.call(value);
  24664. if (unmasked) {
  24665. if (isOwn) {
  24666. value[symToStringTag] = tag;
  24667. } else {
  24668. delete value[symToStringTag];
  24669. }
  24670. }
  24671. return result;
  24672. }
  24673. /**
  24674. * Creates an array of the own enumerable symbols of `object`.
  24675. *
  24676. * @private
  24677. * @param {Object} object The object to query.
  24678. * @returns {Array} Returns the array of symbols.
  24679. */
  24680. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  24681. if (object == null) {
  24682. return [];
  24683. }
  24684. object = Object(object);
  24685. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  24686. return propertyIsEnumerable.call(object, symbol);
  24687. });
  24688. };
  24689. /**
  24690. * Creates an array of the own and inherited enumerable symbols of `object`.
  24691. *
  24692. * @private
  24693. * @param {Object} object The object to query.
  24694. * @returns {Array} Returns the array of symbols.
  24695. */
  24696. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  24697. var result = [];
  24698. while (object) {
  24699. arrayPush(result, getSymbols(object));
  24700. object = getPrototype(object);
  24701. }
  24702. return result;
  24703. };
  24704. /**
  24705. * Gets the `toStringTag` of `value`.
  24706. *
  24707. * @private
  24708. * @param {*} value The value to query.
  24709. * @returns {string} Returns the `toStringTag`.
  24710. */
  24711. var getTag = baseGetTag;
  24712. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  24713. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  24714. (Map && getTag(new Map) != mapTag) ||
  24715. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  24716. (Set && getTag(new Set) != setTag) ||
  24717. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  24718. getTag = function(value) {
  24719. var result = baseGetTag(value),
  24720. Ctor = result == objectTag ? value.constructor : undefined,
  24721. ctorString = Ctor ? toSource(Ctor) : '';
  24722. if (ctorString) {
  24723. switch (ctorString) {
  24724. case dataViewCtorString: return dataViewTag;
  24725. case mapCtorString: return mapTag;
  24726. case promiseCtorString: return promiseTag;
  24727. case setCtorString: return setTag;
  24728. case weakMapCtorString: return weakMapTag;
  24729. }
  24730. }
  24731. return result;
  24732. };
  24733. }
  24734. /**
  24735. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  24736. *
  24737. * @private
  24738. * @param {number} start The start of the view.
  24739. * @param {number} end The end of the view.
  24740. * @param {Array} transforms The transformations to apply to the view.
  24741. * @returns {Object} Returns an object containing the `start` and `end`
  24742. * positions of the view.
  24743. */
  24744. function getView(start, end, transforms) {
  24745. var index = -1,
  24746. length = transforms.length;
  24747. while (++index < length) {
  24748. var data = transforms[index],
  24749. size = data.size;
  24750. switch (data.type) {
  24751. case 'drop': start += size; break;
  24752. case 'dropRight': end -= size; break;
  24753. case 'take': end = nativeMin(end, start + size); break;
  24754. case 'takeRight': start = nativeMax(start, end - size); break;
  24755. }
  24756. }
  24757. return { 'start': start, 'end': end };
  24758. }
  24759. /**
  24760. * Extracts wrapper details from the `source` body comment.
  24761. *
  24762. * @private
  24763. * @param {string} source The source to inspect.
  24764. * @returns {Array} Returns the wrapper details.
  24765. */
  24766. function getWrapDetails(source) {
  24767. var match = source.match(reWrapDetails);
  24768. return match ? match[1].split(reSplitDetails) : [];
  24769. }
  24770. /**
  24771. * Checks if `path` exists on `object`.
  24772. *
  24773. * @private
  24774. * @param {Object} object The object to query.
  24775. * @param {Array|string} path The path to check.
  24776. * @param {Function} hasFunc The function to check properties.
  24777. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  24778. */
  24779. function hasPath(object, path, hasFunc) {
  24780. path = castPath(path, object);
  24781. var index = -1,
  24782. length = path.length,
  24783. result = false;
  24784. while (++index < length) {
  24785. var key = toKey(path[index]);
  24786. if (!(result = object != null && hasFunc(object, key))) {
  24787. break;
  24788. }
  24789. object = object[key];
  24790. }
  24791. if (result || ++index != length) {
  24792. return result;
  24793. }
  24794. length = object == null ? 0 : object.length;
  24795. return !!length && isLength(length) && isIndex(key, length) &&
  24796. (isArray(object) || isArguments(object));
  24797. }
  24798. /**
  24799. * Initializes an array clone.
  24800. *
  24801. * @private
  24802. * @param {Array} array The array to clone.
  24803. * @returns {Array} Returns the initialized clone.
  24804. */
  24805. function initCloneArray(array) {
  24806. var length = array.length,
  24807. result = new array.constructor(length);
  24808. // Add properties assigned by `RegExp#exec`.
  24809. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  24810. result.index = array.index;
  24811. result.input = array.input;
  24812. }
  24813. return result;
  24814. }
  24815. /**
  24816. * Initializes an object clone.
  24817. *
  24818. * @private
  24819. * @param {Object} object The object to clone.
  24820. * @returns {Object} Returns the initialized clone.
  24821. */
  24822. function initCloneObject(object) {
  24823. return (typeof object.constructor == 'function' && !isPrototype(object))
  24824. ? baseCreate(getPrototype(object))
  24825. : {};
  24826. }
  24827. /**
  24828. * Initializes an object clone based on its `toStringTag`.
  24829. *
  24830. * **Note:** This function only supports cloning values with tags of
  24831. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  24832. *
  24833. * @private
  24834. * @param {Object} object The object to clone.
  24835. * @param {string} tag The `toStringTag` of the object to clone.
  24836. * @param {boolean} [isDeep] Specify a deep clone.
  24837. * @returns {Object} Returns the initialized clone.
  24838. */
  24839. function initCloneByTag(object, tag, isDeep) {
  24840. var Ctor = object.constructor;
  24841. switch (tag) {
  24842. case arrayBufferTag:
  24843. return cloneArrayBuffer(object);
  24844. case boolTag:
  24845. case dateTag:
  24846. return new Ctor(+object);
  24847. case dataViewTag:
  24848. return cloneDataView(object, isDeep);
  24849. case float32Tag: case float64Tag:
  24850. case int8Tag: case int16Tag: case int32Tag:
  24851. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  24852. return cloneTypedArray(object, isDeep);
  24853. case mapTag:
  24854. return new Ctor;
  24855. case numberTag:
  24856. case stringTag:
  24857. return new Ctor(object);
  24858. case regexpTag:
  24859. return cloneRegExp(object);
  24860. case setTag:
  24861. return new Ctor;
  24862. case symbolTag:
  24863. return cloneSymbol(object);
  24864. }
  24865. }
  24866. /**
  24867. * Inserts wrapper `details` in a comment at the top of the `source` body.
  24868. *
  24869. * @private
  24870. * @param {string} source The source to modify.
  24871. * @returns {Array} details The details to insert.
  24872. * @returns {string} Returns the modified source.
  24873. */
  24874. function insertWrapDetails(source, details) {
  24875. var length = details.length;
  24876. if (!length) {
  24877. return source;
  24878. }
  24879. var lastIndex = length - 1;
  24880. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  24881. details = details.join(length > 2 ? ', ' : ' ');
  24882. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  24883. }
  24884. /**
  24885. * Checks if `value` is a flattenable `arguments` object or array.
  24886. *
  24887. * @private
  24888. * @param {*} value The value to check.
  24889. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  24890. */
  24891. function isFlattenable(value) {
  24892. return isArray(value) || isArguments(value) ||
  24893. !!(spreadableSymbol && value && value[spreadableSymbol]);
  24894. }
  24895. /**
  24896. * Checks if `value` is a valid array-like index.
  24897. *
  24898. * @private
  24899. * @param {*} value The value to check.
  24900. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  24901. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  24902. */
  24903. function isIndex(value, length) {
  24904. var type = typeof value;
  24905. length = length == null ? MAX_SAFE_INTEGER : length;
  24906. return !!length &&
  24907. (type == 'number' ||
  24908. (type != 'symbol' && reIsUint.test(value))) &&
  24909. (value > -1 && value % 1 == 0 && value < length);
  24910. }
  24911. /**
  24912. * Checks if the given arguments are from an iteratee call.
  24913. *
  24914. * @private
  24915. * @param {*} value The potential iteratee value argument.
  24916. * @param {*} index The potential iteratee index or key argument.
  24917. * @param {*} object The potential iteratee object argument.
  24918. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  24919. * else `false`.
  24920. */
  24921. function isIterateeCall(value, index, object) {
  24922. if (!isObject(object)) {
  24923. return false;
  24924. }
  24925. var type = typeof index;
  24926. if (type == 'number'
  24927. ? (isArrayLike(object) && isIndex(index, object.length))
  24928. : (type == 'string' && index in object)
  24929. ) {
  24930. return eq(object[index], value);
  24931. }
  24932. return false;
  24933. }
  24934. /**
  24935. * Checks if `value` is a property name and not a property path.
  24936. *
  24937. * @private
  24938. * @param {*} value The value to check.
  24939. * @param {Object} [object] The object to query keys on.
  24940. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  24941. */
  24942. function isKey(value, object) {
  24943. if (isArray(value)) {
  24944. return false;
  24945. }
  24946. var type = typeof value;
  24947. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  24948. value == null || isSymbol(value)) {
  24949. return true;
  24950. }
  24951. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  24952. (object != null && value in Object(object));
  24953. }
  24954. /**
  24955. * Checks if `value` is suitable for use as unique object key.
  24956. *
  24957. * @private
  24958. * @param {*} value The value to check.
  24959. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  24960. */
  24961. function isKeyable(value) {
  24962. var type = typeof value;
  24963. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  24964. ? (value !== '__proto__')
  24965. : (value === null);
  24966. }
  24967. /**
  24968. * Checks if `func` has a lazy counterpart.
  24969. *
  24970. * @private
  24971. * @param {Function} func The function to check.
  24972. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  24973. * else `false`.
  24974. */
  24975. function isLaziable(func) {
  24976. var funcName = getFuncName(func),
  24977. other = lodash[funcName];
  24978. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  24979. return false;
  24980. }
  24981. if (func === other) {
  24982. return true;
  24983. }
  24984. var data = getData(other);
  24985. return !!data && func === data[0];
  24986. }
  24987. /**
  24988. * Checks if `func` has its source masked.
  24989. *
  24990. * @private
  24991. * @param {Function} func The function to check.
  24992. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  24993. */
  24994. function isMasked(func) {
  24995. return !!maskSrcKey && (maskSrcKey in func);
  24996. }
  24997. /**
  24998. * Checks if `func` is capable of being masked.
  24999. *
  25000. * @private
  25001. * @param {*} value The value to check.
  25002. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  25003. */
  25004. var isMaskable = coreJsData ? isFunction : stubFalse;
  25005. /**
  25006. * Checks if `value` is likely a prototype object.
  25007. *
  25008. * @private
  25009. * @param {*} value The value to check.
  25010. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  25011. */
  25012. function isPrototype(value) {
  25013. var Ctor = value && value.constructor,
  25014. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  25015. return value === proto;
  25016. }
  25017. /**
  25018. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  25019. *
  25020. * @private
  25021. * @param {*} value The value to check.
  25022. * @returns {boolean} Returns `true` if `value` if suitable for strict
  25023. * equality comparisons, else `false`.
  25024. */
  25025. function isStrictComparable(value) {
  25026. return value === value && !isObject(value);
  25027. }
  25028. /**
  25029. * A specialized version of `matchesProperty` for source values suitable
  25030. * for strict equality comparisons, i.e. `===`.
  25031. *
  25032. * @private
  25033. * @param {string} key The key of the property to get.
  25034. * @param {*} srcValue The value to match.
  25035. * @returns {Function} Returns the new spec function.
  25036. */
  25037. function matchesStrictComparable(key, srcValue) {
  25038. return function(object) {
  25039. if (object == null) {
  25040. return false;
  25041. }
  25042. return object[key] === srcValue &&
  25043. (srcValue !== undefined || (key in Object(object)));
  25044. };
  25045. }
  25046. /**
  25047. * A specialized version of `_.memoize` which clears the memoized function's
  25048. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  25049. *
  25050. * @private
  25051. * @param {Function} func The function to have its output memoized.
  25052. * @returns {Function} Returns the new memoized function.
  25053. */
  25054. function memoizeCapped(func) {
  25055. var result = memoize(func, function(key) {
  25056. if (cache.size === MAX_MEMOIZE_SIZE) {
  25057. cache.clear();
  25058. }
  25059. return key;
  25060. });
  25061. var cache = result.cache;
  25062. return result;
  25063. }
  25064. /**
  25065. * Merges the function metadata of `source` into `data`.
  25066. *
  25067. * Merging metadata reduces the number of wrappers used to invoke a function.
  25068. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  25069. * may be applied regardless of execution order. Methods like `_.ary` and
  25070. * `_.rearg` modify function arguments, making the order in which they are
  25071. * executed important, preventing the merging of metadata. However, we make
  25072. * an exception for a safe combined case where curried functions have `_.ary`
  25073. * and or `_.rearg` applied.
  25074. *
  25075. * @private
  25076. * @param {Array} data The destination metadata.
  25077. * @param {Array} source The source metadata.
  25078. * @returns {Array} Returns `data`.
  25079. */
  25080. function mergeData(data, source) {
  25081. var bitmask = data[1],
  25082. srcBitmask = source[1],
  25083. newBitmask = bitmask | srcBitmask,
  25084. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  25085. var isCombo =
  25086. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  25087. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  25088. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  25089. // Exit early if metadata can't be merged.
  25090. if (!(isCommon || isCombo)) {
  25091. return data;
  25092. }
  25093. // Use source `thisArg` if available.
  25094. if (srcBitmask & WRAP_BIND_FLAG) {
  25095. data[2] = source[2];
  25096. // Set when currying a bound function.
  25097. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  25098. }
  25099. // Compose partial arguments.
  25100. var value = source[3];
  25101. if (value) {
  25102. var partials = data[3];
  25103. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  25104. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  25105. }
  25106. // Compose partial right arguments.
  25107. value = source[5];
  25108. if (value) {
  25109. partials = data[5];
  25110. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  25111. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  25112. }
  25113. // Use source `argPos` if available.
  25114. value = source[7];
  25115. if (value) {
  25116. data[7] = value;
  25117. }
  25118. // Use source `ary` if it's smaller.
  25119. if (srcBitmask & WRAP_ARY_FLAG) {
  25120. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  25121. }
  25122. // Use source `arity` if one is not provided.
  25123. if (data[9] == null) {
  25124. data[9] = source[9];
  25125. }
  25126. // Use source `func` and merge bitmasks.
  25127. data[0] = source[0];
  25128. data[1] = newBitmask;
  25129. return data;
  25130. }
  25131. /**
  25132. * This function is like
  25133. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  25134. * except that it includes inherited enumerable properties.
  25135. *
  25136. * @private
  25137. * @param {Object} object The object to query.
  25138. * @returns {Array} Returns the array of property names.
  25139. */
  25140. function nativeKeysIn(object) {
  25141. var result = [];
  25142. if (object != null) {
  25143. for (var key in Object(object)) {
  25144. result.push(key);
  25145. }
  25146. }
  25147. return result;
  25148. }
  25149. /**
  25150. * Converts `value` to a string using `Object.prototype.toString`.
  25151. *
  25152. * @private
  25153. * @param {*} value The value to convert.
  25154. * @returns {string} Returns the converted string.
  25155. */
  25156. function objectToString(value) {
  25157. return nativeObjectToString.call(value);
  25158. }
  25159. /**
  25160. * A specialized version of `baseRest` which transforms the rest array.
  25161. *
  25162. * @private
  25163. * @param {Function} func The function to apply a rest parameter to.
  25164. * @param {number} [start=func.length-1] The start position of the rest parameter.
  25165. * @param {Function} transform The rest array transform.
  25166. * @returns {Function} Returns the new function.
  25167. */
  25168. function overRest(func, start, transform) {
  25169. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  25170. return function() {
  25171. var args = arguments,
  25172. index = -1,
  25173. length = nativeMax(args.length - start, 0),
  25174. array = Array(length);
  25175. while (++index < length) {
  25176. array[index] = args[start + index];
  25177. }
  25178. index = -1;
  25179. var otherArgs = Array(start + 1);
  25180. while (++index < start) {
  25181. otherArgs[index] = args[index];
  25182. }
  25183. otherArgs[start] = transform(array);
  25184. return apply(func, this, otherArgs);
  25185. };
  25186. }
  25187. /**
  25188. * Gets the parent value at `path` of `object`.
  25189. *
  25190. * @private
  25191. * @param {Object} object The object to query.
  25192. * @param {Array} path The path to get the parent value of.
  25193. * @returns {*} Returns the parent value.
  25194. */
  25195. function parent(object, path) {
  25196. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  25197. }
  25198. /**
  25199. * Reorder `array` according to the specified indexes where the element at
  25200. * the first index is assigned as the first element, the element at
  25201. * the second index is assigned as the second element, and so on.
  25202. *
  25203. * @private
  25204. * @param {Array} array The array to reorder.
  25205. * @param {Array} indexes The arranged array indexes.
  25206. * @returns {Array} Returns `array`.
  25207. */
  25208. function reorder(array, indexes) {
  25209. var arrLength = array.length,
  25210. length = nativeMin(indexes.length, arrLength),
  25211. oldArray = copyArray(array);
  25212. while (length--) {
  25213. var index = indexes[length];
  25214. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  25215. }
  25216. return array;
  25217. }
  25218. /**
  25219. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  25220. *
  25221. * @private
  25222. * @param {Object} object The object to query.
  25223. * @param {string} key The key of the property to get.
  25224. * @returns {*} Returns the property value.
  25225. */
  25226. function safeGet(object, key) {
  25227. if (key === 'constructor' && typeof object[key] === 'function') {
  25228. return;
  25229. }
  25230. if (key == '__proto__') {
  25231. return;
  25232. }
  25233. return object[key];
  25234. }
  25235. /**
  25236. * Sets metadata for `func`.
  25237. *
  25238. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  25239. * period of time, it will trip its breaker and transition to an identity
  25240. * function to avoid garbage collection pauses in V8. See
  25241. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  25242. * for more details.
  25243. *
  25244. * @private
  25245. * @param {Function} func The function to associate metadata with.
  25246. * @param {*} data The metadata.
  25247. * @returns {Function} Returns `func`.
  25248. */
  25249. var setData = shortOut(baseSetData);
  25250. /**
  25251. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  25252. *
  25253. * @private
  25254. * @param {Function} func The function to delay.
  25255. * @param {number} wait The number of milliseconds to delay invocation.
  25256. * @returns {number|Object} Returns the timer id or timeout object.
  25257. */
  25258. var setTimeout = ctxSetTimeout || function(func, wait) {
  25259. return root.setTimeout(func, wait);
  25260. };
  25261. /**
  25262. * Sets the `toString` method of `func` to return `string`.
  25263. *
  25264. * @private
  25265. * @param {Function} func The function to modify.
  25266. * @param {Function} string The `toString` result.
  25267. * @returns {Function} Returns `func`.
  25268. */
  25269. var setToString = shortOut(baseSetToString);
  25270. /**
  25271. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  25272. * with wrapper details in a comment at the top of the source body.
  25273. *
  25274. * @private
  25275. * @param {Function} wrapper The function to modify.
  25276. * @param {Function} reference The reference function.
  25277. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  25278. * @returns {Function} Returns `wrapper`.
  25279. */
  25280. function setWrapToString(wrapper, reference, bitmask) {
  25281. var source = (reference + '');
  25282. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  25283. }
  25284. /**
  25285. * Creates a function that'll short out and invoke `identity` instead
  25286. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  25287. * milliseconds.
  25288. *
  25289. * @private
  25290. * @param {Function} func The function to restrict.
  25291. * @returns {Function} Returns the new shortable function.
  25292. */
  25293. function shortOut(func) {
  25294. var count = 0,
  25295. lastCalled = 0;
  25296. return function() {
  25297. var stamp = nativeNow(),
  25298. remaining = HOT_SPAN - (stamp - lastCalled);
  25299. lastCalled = stamp;
  25300. if (remaining > 0) {
  25301. if (++count >= HOT_COUNT) {
  25302. return arguments[0];
  25303. }
  25304. } else {
  25305. count = 0;
  25306. }
  25307. return func.apply(undefined, arguments);
  25308. };
  25309. }
  25310. /**
  25311. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  25312. *
  25313. * @private
  25314. * @param {Array} array The array to shuffle.
  25315. * @param {number} [size=array.length] The size of `array`.
  25316. * @returns {Array} Returns `array`.
  25317. */
  25318. function shuffleSelf(array, size) {
  25319. var index = -1,
  25320. length = array.length,
  25321. lastIndex = length - 1;
  25322. size = size === undefined ? length : size;
  25323. while (++index < size) {
  25324. var rand = baseRandom(index, lastIndex),
  25325. value = array[rand];
  25326. array[rand] = array[index];
  25327. array[index] = value;
  25328. }
  25329. array.length = size;
  25330. return array;
  25331. }
  25332. /**
  25333. * Converts `string` to a property path array.
  25334. *
  25335. * @private
  25336. * @param {string} string The string to convert.
  25337. * @returns {Array} Returns the property path array.
  25338. */
  25339. var stringToPath = memoizeCapped(function(string) {
  25340. var result = [];
  25341. if (string.charCodeAt(0) === 46 /* . */) {
  25342. result.push('');
  25343. }
  25344. string.replace(rePropName, function(match, number, quote, subString) {
  25345. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  25346. });
  25347. return result;
  25348. });
  25349. /**
  25350. * Converts `value` to a string key if it's not a string or symbol.
  25351. *
  25352. * @private
  25353. * @param {*} value The value to inspect.
  25354. * @returns {string|symbol} Returns the key.
  25355. */
  25356. function toKey(value) {
  25357. if (typeof value == 'string' || isSymbol(value)) {
  25358. return value;
  25359. }
  25360. var result = (value + '');
  25361. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  25362. }
  25363. /**
  25364. * Converts `func` to its source code.
  25365. *
  25366. * @private
  25367. * @param {Function} func The function to convert.
  25368. * @returns {string} Returns the source code.
  25369. */
  25370. function toSource(func) {
  25371. if (func != null) {
  25372. try {
  25373. return funcToString.call(func);
  25374. } catch (e) {}
  25375. try {
  25376. return (func + '');
  25377. } catch (e) {}
  25378. }
  25379. return '';
  25380. }
  25381. /**
  25382. * Updates wrapper `details` based on `bitmask` flags.
  25383. *
  25384. * @private
  25385. * @returns {Array} details The details to modify.
  25386. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  25387. * @returns {Array} Returns `details`.
  25388. */
  25389. function updateWrapDetails(details, bitmask) {
  25390. arrayEach(wrapFlags, function(pair) {
  25391. var value = '_.' + pair[0];
  25392. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  25393. details.push(value);
  25394. }
  25395. });
  25396. return details.sort();
  25397. }
  25398. /**
  25399. * Creates a clone of `wrapper`.
  25400. *
  25401. * @private
  25402. * @param {Object} wrapper The wrapper to clone.
  25403. * @returns {Object} Returns the cloned wrapper.
  25404. */
  25405. function wrapperClone(wrapper) {
  25406. if (wrapper instanceof LazyWrapper) {
  25407. return wrapper.clone();
  25408. }
  25409. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  25410. result.__actions__ = copyArray(wrapper.__actions__);
  25411. result.__index__ = wrapper.__index__;
  25412. result.__values__ = wrapper.__values__;
  25413. return result;
  25414. }
  25415. /*------------------------------------------------------------------------*/
  25416. /**
  25417. * Creates an array of elements split into groups the length of `size`.
  25418. * If `array` can't be split evenly, the final chunk will be the remaining
  25419. * elements.
  25420. *
  25421. * @static
  25422. * @memberOf _
  25423. * @since 3.0.0
  25424. * @category Array
  25425. * @param {Array} array The array to process.
  25426. * @param {number} [size=1] The length of each chunk
  25427. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25428. * @returns {Array} Returns the new array of chunks.
  25429. * @example
  25430. *
  25431. * _.chunk(['a', 'b', 'c', 'd'], 2);
  25432. * // => [['a', 'b'], ['c', 'd']]
  25433. *
  25434. * _.chunk(['a', 'b', 'c', 'd'], 3);
  25435. * // => [['a', 'b', 'c'], ['d']]
  25436. */
  25437. function chunk(array, size, guard) {
  25438. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  25439. size = 1;
  25440. } else {
  25441. size = nativeMax(toInteger(size), 0);
  25442. }
  25443. var length = array == null ? 0 : array.length;
  25444. if (!length || size < 1) {
  25445. return [];
  25446. }
  25447. var index = 0,
  25448. resIndex = 0,
  25449. result = Array(nativeCeil(length / size));
  25450. while (index < length) {
  25451. result[resIndex++] = baseSlice(array, index, (index += size));
  25452. }
  25453. return result;
  25454. }
  25455. /**
  25456. * Creates an array with all falsey values removed. The values `false`, `null`,
  25457. * `0`, `""`, `undefined`, and `NaN` are falsey.
  25458. *
  25459. * @static
  25460. * @memberOf _
  25461. * @since 0.1.0
  25462. * @category Array
  25463. * @param {Array} array The array to compact.
  25464. * @returns {Array} Returns the new array of filtered values.
  25465. * @example
  25466. *
  25467. * _.compact([0, 1, false, 2, '', 3]);
  25468. * // => [1, 2, 3]
  25469. */
  25470. function compact(array) {
  25471. var index = -1,
  25472. length = array == null ? 0 : array.length,
  25473. resIndex = 0,
  25474. result = [];
  25475. while (++index < length) {
  25476. var value = array[index];
  25477. if (value) {
  25478. result[resIndex++] = value;
  25479. }
  25480. }
  25481. return result;
  25482. }
  25483. /**
  25484. * Creates a new array concatenating `array` with any additional arrays
  25485. * and/or values.
  25486. *
  25487. * @static
  25488. * @memberOf _
  25489. * @since 4.0.0
  25490. * @category Array
  25491. * @param {Array} array The array to concatenate.
  25492. * @param {...*} [values] The values to concatenate.
  25493. * @returns {Array} Returns the new concatenated array.
  25494. * @example
  25495. *
  25496. * var array = [1];
  25497. * var other = _.concat(array, 2, [3], [[4]]);
  25498. *
  25499. * console.log(other);
  25500. * // => [1, 2, 3, [4]]
  25501. *
  25502. * console.log(array);
  25503. * // => [1]
  25504. */
  25505. function concat() {
  25506. var length = arguments.length;
  25507. if (!length) {
  25508. return [];
  25509. }
  25510. var args = Array(length - 1),
  25511. array = arguments[0],
  25512. index = length;
  25513. while (index--) {
  25514. args[index - 1] = arguments[index];
  25515. }
  25516. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  25517. }
  25518. /**
  25519. * Creates an array of `array` values not included in the other given arrays
  25520. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25521. * for equality comparisons. The order and references of result values are
  25522. * determined by the first array.
  25523. *
  25524. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  25525. *
  25526. * @static
  25527. * @memberOf _
  25528. * @since 0.1.0
  25529. * @category Array
  25530. * @param {Array} array The array to inspect.
  25531. * @param {...Array} [values] The values to exclude.
  25532. * @returns {Array} Returns the new array of filtered values.
  25533. * @see _.without, _.xor
  25534. * @example
  25535. *
  25536. * _.difference([2, 1], [2, 3]);
  25537. * // => [1]
  25538. */
  25539. var difference = baseRest(function(array, values) {
  25540. return isArrayLikeObject(array)
  25541. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  25542. : [];
  25543. });
  25544. /**
  25545. * This method is like `_.difference` except that it accepts `iteratee` which
  25546. * is invoked for each element of `array` and `values` to generate the criterion
  25547. * by which they're compared. The order and references of result values are
  25548. * determined by the first array. The iteratee is invoked with one argument:
  25549. * (value).
  25550. *
  25551. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  25552. *
  25553. * @static
  25554. * @memberOf _
  25555. * @since 4.0.0
  25556. * @category Array
  25557. * @param {Array} array The array to inspect.
  25558. * @param {...Array} [values] The values to exclude.
  25559. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25560. * @returns {Array} Returns the new array of filtered values.
  25561. * @example
  25562. *
  25563. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25564. * // => [1.2]
  25565. *
  25566. * // The `_.property` iteratee shorthand.
  25567. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  25568. * // => [{ 'x': 2 }]
  25569. */
  25570. var differenceBy = baseRest(function(array, values) {
  25571. var iteratee = last(values);
  25572. if (isArrayLikeObject(iteratee)) {
  25573. iteratee = undefined;
  25574. }
  25575. return isArrayLikeObject(array)
  25576. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  25577. : [];
  25578. });
  25579. /**
  25580. * This method is like `_.difference` except that it accepts `comparator`
  25581. * which is invoked to compare elements of `array` to `values`. The order and
  25582. * references of result values are determined by the first array. The comparator
  25583. * is invoked with two arguments: (arrVal, othVal).
  25584. *
  25585. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  25586. *
  25587. * @static
  25588. * @memberOf _
  25589. * @since 4.0.0
  25590. * @category Array
  25591. * @param {Array} array The array to inspect.
  25592. * @param {...Array} [values] The values to exclude.
  25593. * @param {Function} [comparator] The comparator invoked per element.
  25594. * @returns {Array} Returns the new array of filtered values.
  25595. * @example
  25596. *
  25597. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25598. *
  25599. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  25600. * // => [{ 'x': 2, 'y': 1 }]
  25601. */
  25602. var differenceWith = baseRest(function(array, values) {
  25603. var comparator = last(values);
  25604. if (isArrayLikeObject(comparator)) {
  25605. comparator = undefined;
  25606. }
  25607. return isArrayLikeObject(array)
  25608. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  25609. : [];
  25610. });
  25611. /**
  25612. * Creates a slice of `array` with `n` elements dropped from the beginning.
  25613. *
  25614. * @static
  25615. * @memberOf _
  25616. * @since 0.5.0
  25617. * @category Array
  25618. * @param {Array} array The array to query.
  25619. * @param {number} [n=1] The number of elements to drop.
  25620. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25621. * @returns {Array} Returns the slice of `array`.
  25622. * @example
  25623. *
  25624. * _.drop([1, 2, 3]);
  25625. * // => [2, 3]
  25626. *
  25627. * _.drop([1, 2, 3], 2);
  25628. * // => [3]
  25629. *
  25630. * _.drop([1, 2, 3], 5);
  25631. * // => []
  25632. *
  25633. * _.drop([1, 2, 3], 0);
  25634. * // => [1, 2, 3]
  25635. */
  25636. function drop(array, n, guard) {
  25637. var length = array == null ? 0 : array.length;
  25638. if (!length) {
  25639. return [];
  25640. }
  25641. n = (guard || n === undefined) ? 1 : toInteger(n);
  25642. return baseSlice(array, n < 0 ? 0 : n, length);
  25643. }
  25644. /**
  25645. * Creates a slice of `array` with `n` elements dropped from the end.
  25646. *
  25647. * @static
  25648. * @memberOf _
  25649. * @since 3.0.0
  25650. * @category Array
  25651. * @param {Array} array The array to query.
  25652. * @param {number} [n=1] The number of elements to drop.
  25653. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25654. * @returns {Array} Returns the slice of `array`.
  25655. * @example
  25656. *
  25657. * _.dropRight([1, 2, 3]);
  25658. * // => [1, 2]
  25659. *
  25660. * _.dropRight([1, 2, 3], 2);
  25661. * // => [1]
  25662. *
  25663. * _.dropRight([1, 2, 3], 5);
  25664. * // => []
  25665. *
  25666. * _.dropRight([1, 2, 3], 0);
  25667. * // => [1, 2, 3]
  25668. */
  25669. function dropRight(array, n, guard) {
  25670. var length = array == null ? 0 : array.length;
  25671. if (!length) {
  25672. return [];
  25673. }
  25674. n = (guard || n === undefined) ? 1 : toInteger(n);
  25675. n = length - n;
  25676. return baseSlice(array, 0, n < 0 ? 0 : n);
  25677. }
  25678. /**
  25679. * Creates a slice of `array` excluding elements dropped from the end.
  25680. * Elements are dropped until `predicate` returns falsey. The predicate is
  25681. * invoked with three arguments: (value, index, array).
  25682. *
  25683. * @static
  25684. * @memberOf _
  25685. * @since 3.0.0
  25686. * @category Array
  25687. * @param {Array} array The array to query.
  25688. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25689. * @returns {Array} Returns the slice of `array`.
  25690. * @example
  25691. *
  25692. * var users = [
  25693. * { 'user': 'barney', 'active': true },
  25694. * { 'user': 'fred', 'active': false },
  25695. * { 'user': 'pebbles', 'active': false }
  25696. * ];
  25697. *
  25698. * _.dropRightWhile(users, function(o) { return !o.active; });
  25699. * // => objects for ['barney']
  25700. *
  25701. * // The `_.matches` iteratee shorthand.
  25702. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  25703. * // => objects for ['barney', 'fred']
  25704. *
  25705. * // The `_.matchesProperty` iteratee shorthand.
  25706. * _.dropRightWhile(users, ['active', false]);
  25707. * // => objects for ['barney']
  25708. *
  25709. * // The `_.property` iteratee shorthand.
  25710. * _.dropRightWhile(users, 'active');
  25711. * // => objects for ['barney', 'fred', 'pebbles']
  25712. */
  25713. function dropRightWhile(array, predicate) {
  25714. return (array && array.length)
  25715. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  25716. : [];
  25717. }
  25718. /**
  25719. * Creates a slice of `array` excluding elements dropped from the beginning.
  25720. * Elements are dropped until `predicate` returns falsey. The predicate is
  25721. * invoked with three arguments: (value, index, array).
  25722. *
  25723. * @static
  25724. * @memberOf _
  25725. * @since 3.0.0
  25726. * @category Array
  25727. * @param {Array} array The array to query.
  25728. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25729. * @returns {Array} Returns the slice of `array`.
  25730. * @example
  25731. *
  25732. * var users = [
  25733. * { 'user': 'barney', 'active': false },
  25734. * { 'user': 'fred', 'active': false },
  25735. * { 'user': 'pebbles', 'active': true }
  25736. * ];
  25737. *
  25738. * _.dropWhile(users, function(o) { return !o.active; });
  25739. * // => objects for ['pebbles']
  25740. *
  25741. * // The `_.matches` iteratee shorthand.
  25742. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  25743. * // => objects for ['fred', 'pebbles']
  25744. *
  25745. * // The `_.matchesProperty` iteratee shorthand.
  25746. * _.dropWhile(users, ['active', false]);
  25747. * // => objects for ['pebbles']
  25748. *
  25749. * // The `_.property` iteratee shorthand.
  25750. * _.dropWhile(users, 'active');
  25751. * // => objects for ['barney', 'fred', 'pebbles']
  25752. */
  25753. function dropWhile(array, predicate) {
  25754. return (array && array.length)
  25755. ? baseWhile(array, getIteratee(predicate, 3), true)
  25756. : [];
  25757. }
  25758. /**
  25759. * Fills elements of `array` with `value` from `start` up to, but not
  25760. * including, `end`.
  25761. *
  25762. * **Note:** This method mutates `array`.
  25763. *
  25764. * @static
  25765. * @memberOf _
  25766. * @since 3.2.0
  25767. * @category Array
  25768. * @param {Array} array The array to fill.
  25769. * @param {*} value The value to fill `array` with.
  25770. * @param {number} [start=0] The start position.
  25771. * @param {number} [end=array.length] The end position.
  25772. * @returns {Array} Returns `array`.
  25773. * @example
  25774. *
  25775. * var array = [1, 2, 3];
  25776. *
  25777. * _.fill(array, 'a');
  25778. * console.log(array);
  25779. * // => ['a', 'a', 'a']
  25780. *
  25781. * _.fill(Array(3), 2);
  25782. * // => [2, 2, 2]
  25783. *
  25784. * _.fill([4, 6, 8, 10], '*', 1, 3);
  25785. * // => [4, '*', '*', 10]
  25786. */
  25787. function fill(array, value, start, end) {
  25788. var length = array == null ? 0 : array.length;
  25789. if (!length) {
  25790. return [];
  25791. }
  25792. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  25793. start = 0;
  25794. end = length;
  25795. }
  25796. return baseFill(array, value, start, end);
  25797. }
  25798. /**
  25799. * This method is like `_.find` except that it returns the index of the first
  25800. * element `predicate` returns truthy for instead of the element itself.
  25801. *
  25802. * @static
  25803. * @memberOf _
  25804. * @since 1.1.0
  25805. * @category Array
  25806. * @param {Array} array The array to inspect.
  25807. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25808. * @param {number} [fromIndex=0] The index to search from.
  25809. * @returns {number} Returns the index of the found element, else `-1`.
  25810. * @example
  25811. *
  25812. * var users = [
  25813. * { 'user': 'barney', 'active': false },
  25814. * { 'user': 'fred', 'active': false },
  25815. * { 'user': 'pebbles', 'active': true }
  25816. * ];
  25817. *
  25818. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  25819. * // => 0
  25820. *
  25821. * // The `_.matches` iteratee shorthand.
  25822. * _.findIndex(users, { 'user': 'fred', 'active': false });
  25823. * // => 1
  25824. *
  25825. * // The `_.matchesProperty` iteratee shorthand.
  25826. * _.findIndex(users, ['active', false]);
  25827. * // => 0
  25828. *
  25829. * // The `_.property` iteratee shorthand.
  25830. * _.findIndex(users, 'active');
  25831. * // => 2
  25832. */
  25833. function findIndex(array, predicate, fromIndex) {
  25834. var length = array == null ? 0 : array.length;
  25835. if (!length) {
  25836. return -1;
  25837. }
  25838. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25839. if (index < 0) {
  25840. index = nativeMax(length + index, 0);
  25841. }
  25842. return baseFindIndex(array, getIteratee(predicate, 3), index);
  25843. }
  25844. /**
  25845. * This method is like `_.findIndex` except that it iterates over elements
  25846. * of `collection` from right to left.
  25847. *
  25848. * @static
  25849. * @memberOf _
  25850. * @since 2.0.0
  25851. * @category Array
  25852. * @param {Array} array The array to inspect.
  25853. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25854. * @param {number} [fromIndex=array.length-1] The index to search from.
  25855. * @returns {number} Returns the index of the found element, else `-1`.
  25856. * @example
  25857. *
  25858. * var users = [
  25859. * { 'user': 'barney', 'active': true },
  25860. * { 'user': 'fred', 'active': false },
  25861. * { 'user': 'pebbles', 'active': false }
  25862. * ];
  25863. *
  25864. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  25865. * // => 2
  25866. *
  25867. * // The `_.matches` iteratee shorthand.
  25868. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  25869. * // => 0
  25870. *
  25871. * // The `_.matchesProperty` iteratee shorthand.
  25872. * _.findLastIndex(users, ['active', false]);
  25873. * // => 2
  25874. *
  25875. * // The `_.property` iteratee shorthand.
  25876. * _.findLastIndex(users, 'active');
  25877. * // => 0
  25878. */
  25879. function findLastIndex(array, predicate, fromIndex) {
  25880. var length = array == null ? 0 : array.length;
  25881. if (!length) {
  25882. return -1;
  25883. }
  25884. var index = length - 1;
  25885. if (fromIndex !== undefined) {
  25886. index = toInteger(fromIndex);
  25887. index = fromIndex < 0
  25888. ? nativeMax(length + index, 0)
  25889. : nativeMin(index, length - 1);
  25890. }
  25891. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  25892. }
  25893. /**
  25894. * Flattens `array` a single level deep.
  25895. *
  25896. * @static
  25897. * @memberOf _
  25898. * @since 0.1.0
  25899. * @category Array
  25900. * @param {Array} array The array to flatten.
  25901. * @returns {Array} Returns the new flattened array.
  25902. * @example
  25903. *
  25904. * _.flatten([1, [2, [3, [4]], 5]]);
  25905. * // => [1, 2, [3, [4]], 5]
  25906. */
  25907. function flatten(array) {
  25908. var length = array == null ? 0 : array.length;
  25909. return length ? baseFlatten(array, 1) : [];
  25910. }
  25911. /**
  25912. * Recursively flattens `array`.
  25913. *
  25914. * @static
  25915. * @memberOf _
  25916. * @since 3.0.0
  25917. * @category Array
  25918. * @param {Array} array The array to flatten.
  25919. * @returns {Array} Returns the new flattened array.
  25920. * @example
  25921. *
  25922. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  25923. * // => [1, 2, 3, 4, 5]
  25924. */
  25925. function flattenDeep(array) {
  25926. var length = array == null ? 0 : array.length;
  25927. return length ? baseFlatten(array, INFINITY) : [];
  25928. }
  25929. /**
  25930. * Recursively flatten `array` up to `depth` times.
  25931. *
  25932. * @static
  25933. * @memberOf _
  25934. * @since 4.4.0
  25935. * @category Array
  25936. * @param {Array} array The array to flatten.
  25937. * @param {number} [depth=1] The maximum recursion depth.
  25938. * @returns {Array} Returns the new flattened array.
  25939. * @example
  25940. *
  25941. * var array = [1, [2, [3, [4]], 5]];
  25942. *
  25943. * _.flattenDepth(array, 1);
  25944. * // => [1, 2, [3, [4]], 5]
  25945. *
  25946. * _.flattenDepth(array, 2);
  25947. * // => [1, 2, 3, [4], 5]
  25948. */
  25949. function flattenDepth(array, depth) {
  25950. var length = array == null ? 0 : array.length;
  25951. if (!length) {
  25952. return [];
  25953. }
  25954. depth = depth === undefined ? 1 : toInteger(depth);
  25955. return baseFlatten(array, depth);
  25956. }
  25957. /**
  25958. * The inverse of `_.toPairs`; this method returns an object composed
  25959. * from key-value `pairs`.
  25960. *
  25961. * @static
  25962. * @memberOf _
  25963. * @since 4.0.0
  25964. * @category Array
  25965. * @param {Array} pairs The key-value pairs.
  25966. * @returns {Object} Returns the new object.
  25967. * @example
  25968. *
  25969. * _.fromPairs([['a', 1], ['b', 2]]);
  25970. * // => { 'a': 1, 'b': 2 }
  25971. */
  25972. function fromPairs(pairs) {
  25973. var index = -1,
  25974. length = pairs == null ? 0 : pairs.length,
  25975. result = {};
  25976. while (++index < length) {
  25977. var pair = pairs[index];
  25978. result[pair[0]] = pair[1];
  25979. }
  25980. return result;
  25981. }
  25982. /**
  25983. * Gets the first element of `array`.
  25984. *
  25985. * @static
  25986. * @memberOf _
  25987. * @since 0.1.0
  25988. * @alias first
  25989. * @category Array
  25990. * @param {Array} array The array to query.
  25991. * @returns {*} Returns the first element of `array`.
  25992. * @example
  25993. *
  25994. * _.head([1, 2, 3]);
  25995. * // => 1
  25996. *
  25997. * _.head([]);
  25998. * // => undefined
  25999. */
  26000. function head(array) {
  26001. return (array && array.length) ? array[0] : undefined;
  26002. }
  26003. /**
  26004. * Gets the index at which the first occurrence of `value` is found in `array`
  26005. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26006. * for equality comparisons. If `fromIndex` is negative, it's used as the
  26007. * offset from the end of `array`.
  26008. *
  26009. * @static
  26010. * @memberOf _
  26011. * @since 0.1.0
  26012. * @category Array
  26013. * @param {Array} array The array to inspect.
  26014. * @param {*} value The value to search for.
  26015. * @param {number} [fromIndex=0] The index to search from.
  26016. * @returns {number} Returns the index of the matched value, else `-1`.
  26017. * @example
  26018. *
  26019. * _.indexOf([1, 2, 1, 2], 2);
  26020. * // => 1
  26021. *
  26022. * // Search from the `fromIndex`.
  26023. * _.indexOf([1, 2, 1, 2], 2, 2);
  26024. * // => 3
  26025. */
  26026. function indexOf(array, value, fromIndex) {
  26027. var length = array == null ? 0 : array.length;
  26028. if (!length) {
  26029. return -1;
  26030. }
  26031. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  26032. if (index < 0) {
  26033. index = nativeMax(length + index, 0);
  26034. }
  26035. return baseIndexOf(array, value, index);
  26036. }
  26037. /**
  26038. * Gets all but the last element of `array`.
  26039. *
  26040. * @static
  26041. * @memberOf _
  26042. * @since 0.1.0
  26043. * @category Array
  26044. * @param {Array} array The array to query.
  26045. * @returns {Array} Returns the slice of `array`.
  26046. * @example
  26047. *
  26048. * _.initial([1, 2, 3]);
  26049. * // => [1, 2]
  26050. */
  26051. function initial(array) {
  26052. var length = array == null ? 0 : array.length;
  26053. return length ? baseSlice(array, 0, -1) : [];
  26054. }
  26055. /**
  26056. * Creates an array of unique values that are included in all given arrays
  26057. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26058. * for equality comparisons. The order and references of result values are
  26059. * determined by the first array.
  26060. *
  26061. * @static
  26062. * @memberOf _
  26063. * @since 0.1.0
  26064. * @category Array
  26065. * @param {...Array} [arrays] The arrays to inspect.
  26066. * @returns {Array} Returns the new array of intersecting values.
  26067. * @example
  26068. *
  26069. * _.intersection([2, 1], [2, 3]);
  26070. * // => [2]
  26071. */
  26072. var intersection = baseRest(function(arrays) {
  26073. var mapped = arrayMap(arrays, castArrayLikeObject);
  26074. return (mapped.length && mapped[0] === arrays[0])
  26075. ? baseIntersection(mapped)
  26076. : [];
  26077. });
  26078. /**
  26079. * This method is like `_.intersection` except that it accepts `iteratee`
  26080. * which is invoked for each element of each `arrays` to generate the criterion
  26081. * by which they're compared. The order and references of result values are
  26082. * determined by the first array. The iteratee is invoked with one argument:
  26083. * (value).
  26084. *
  26085. * @static
  26086. * @memberOf _
  26087. * @since 4.0.0
  26088. * @category Array
  26089. * @param {...Array} [arrays] The arrays to inspect.
  26090. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26091. * @returns {Array} Returns the new array of intersecting values.
  26092. * @example
  26093. *
  26094. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  26095. * // => [2.1]
  26096. *
  26097. * // The `_.property` iteratee shorthand.
  26098. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26099. * // => [{ 'x': 1 }]
  26100. */
  26101. var intersectionBy = baseRest(function(arrays) {
  26102. var iteratee = last(arrays),
  26103. mapped = arrayMap(arrays, castArrayLikeObject);
  26104. if (iteratee === last(mapped)) {
  26105. iteratee = undefined;
  26106. } else {
  26107. mapped.pop();
  26108. }
  26109. return (mapped.length && mapped[0] === arrays[0])
  26110. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  26111. : [];
  26112. });
  26113. /**
  26114. * This method is like `_.intersection` except that it accepts `comparator`
  26115. * which is invoked to compare elements of `arrays`. The order and references
  26116. * of result values are determined by the first array. The comparator is
  26117. * invoked with two arguments: (arrVal, othVal).
  26118. *
  26119. * @static
  26120. * @memberOf _
  26121. * @since 4.0.0
  26122. * @category Array
  26123. * @param {...Array} [arrays] The arrays to inspect.
  26124. * @param {Function} [comparator] The comparator invoked per element.
  26125. * @returns {Array} Returns the new array of intersecting values.
  26126. * @example
  26127. *
  26128. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26129. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26130. *
  26131. * _.intersectionWith(objects, others, _.isEqual);
  26132. * // => [{ 'x': 1, 'y': 2 }]
  26133. */
  26134. var intersectionWith = baseRest(function(arrays) {
  26135. var comparator = last(arrays),
  26136. mapped = arrayMap(arrays, castArrayLikeObject);
  26137. comparator = typeof comparator == 'function' ? comparator : undefined;
  26138. if (comparator) {
  26139. mapped.pop();
  26140. }
  26141. return (mapped.length && mapped[0] === arrays[0])
  26142. ? baseIntersection(mapped, undefined, comparator)
  26143. : [];
  26144. });
  26145. /**
  26146. * Converts all elements in `array` into a string separated by `separator`.
  26147. *
  26148. * @static
  26149. * @memberOf _
  26150. * @since 4.0.0
  26151. * @category Array
  26152. * @param {Array} array The array to convert.
  26153. * @param {string} [separator=','] The element separator.
  26154. * @returns {string} Returns the joined string.
  26155. * @example
  26156. *
  26157. * _.join(['a', 'b', 'c'], '~');
  26158. * // => 'a~b~c'
  26159. */
  26160. function join(array, separator) {
  26161. return array == null ? '' : nativeJoin.call(array, separator);
  26162. }
  26163. /**
  26164. * Gets the last element of `array`.
  26165. *
  26166. * @static
  26167. * @memberOf _
  26168. * @since 0.1.0
  26169. * @category Array
  26170. * @param {Array} array The array to query.
  26171. * @returns {*} Returns the last element of `array`.
  26172. * @example
  26173. *
  26174. * _.last([1, 2, 3]);
  26175. * // => 3
  26176. */
  26177. function last(array) {
  26178. var length = array == null ? 0 : array.length;
  26179. return length ? array[length - 1] : undefined;
  26180. }
  26181. /**
  26182. * This method is like `_.indexOf` except that it iterates over elements of
  26183. * `array` from right to left.
  26184. *
  26185. * @static
  26186. * @memberOf _
  26187. * @since 0.1.0
  26188. * @category Array
  26189. * @param {Array} array The array to inspect.
  26190. * @param {*} value The value to search for.
  26191. * @param {number} [fromIndex=array.length-1] The index to search from.
  26192. * @returns {number} Returns the index of the matched value, else `-1`.
  26193. * @example
  26194. *
  26195. * _.lastIndexOf([1, 2, 1, 2], 2);
  26196. * // => 3
  26197. *
  26198. * // Search from the `fromIndex`.
  26199. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  26200. * // => 1
  26201. */
  26202. function lastIndexOf(array, value, fromIndex) {
  26203. var length = array == null ? 0 : array.length;
  26204. if (!length) {
  26205. return -1;
  26206. }
  26207. var index = length;
  26208. if (fromIndex !== undefined) {
  26209. index = toInteger(fromIndex);
  26210. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  26211. }
  26212. return value === value
  26213. ? strictLastIndexOf(array, value, index)
  26214. : baseFindIndex(array, baseIsNaN, index, true);
  26215. }
  26216. /**
  26217. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  26218. * element from the end is returned.
  26219. *
  26220. * @static
  26221. * @memberOf _
  26222. * @since 4.11.0
  26223. * @category Array
  26224. * @param {Array} array The array to query.
  26225. * @param {number} [n=0] The index of the element to return.
  26226. * @returns {*} Returns the nth element of `array`.
  26227. * @example
  26228. *
  26229. * var array = ['a', 'b', 'c', 'd'];
  26230. *
  26231. * _.nth(array, 1);
  26232. * // => 'b'
  26233. *
  26234. * _.nth(array, -2);
  26235. * // => 'c';
  26236. */
  26237. function nth(array, n) {
  26238. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  26239. }
  26240. /**
  26241. * Removes all given values from `array` using
  26242. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26243. * for equality comparisons.
  26244. *
  26245. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  26246. * to remove elements from an array by predicate.
  26247. *
  26248. * @static
  26249. * @memberOf _
  26250. * @since 2.0.0
  26251. * @category Array
  26252. * @param {Array} array The array to modify.
  26253. * @param {...*} [values] The values to remove.
  26254. * @returns {Array} Returns `array`.
  26255. * @example
  26256. *
  26257. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  26258. *
  26259. * _.pull(array, 'a', 'c');
  26260. * console.log(array);
  26261. * // => ['b', 'b']
  26262. */
  26263. var pull = baseRest(pullAll);
  26264. /**
  26265. * This method is like `_.pull` except that it accepts an array of values to remove.
  26266. *
  26267. * **Note:** Unlike `_.difference`, this method mutates `array`.
  26268. *
  26269. * @static
  26270. * @memberOf _
  26271. * @since 4.0.0
  26272. * @category Array
  26273. * @param {Array} array The array to modify.
  26274. * @param {Array} values The values to remove.
  26275. * @returns {Array} Returns `array`.
  26276. * @example
  26277. *
  26278. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  26279. *
  26280. * _.pullAll(array, ['a', 'c']);
  26281. * console.log(array);
  26282. * // => ['b', 'b']
  26283. */
  26284. function pullAll(array, values) {
  26285. return (array && array.length && values && values.length)
  26286. ? basePullAll(array, values)
  26287. : array;
  26288. }
  26289. /**
  26290. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  26291. * invoked for each element of `array` and `values` to generate the criterion
  26292. * by which they're compared. The iteratee is invoked with one argument: (value).
  26293. *
  26294. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  26295. *
  26296. * @static
  26297. * @memberOf _
  26298. * @since 4.0.0
  26299. * @category Array
  26300. * @param {Array} array The array to modify.
  26301. * @param {Array} values The values to remove.
  26302. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26303. * @returns {Array} Returns `array`.
  26304. * @example
  26305. *
  26306. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  26307. *
  26308. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  26309. * console.log(array);
  26310. * // => [{ 'x': 2 }]
  26311. */
  26312. function pullAllBy(array, values, iteratee) {
  26313. return (array && array.length && values && values.length)
  26314. ? basePullAll(array, values, getIteratee(iteratee, 2))
  26315. : array;
  26316. }
  26317. /**
  26318. * This method is like `_.pullAll` except that it accepts `comparator` which
  26319. * is invoked to compare elements of `array` to `values`. The comparator is
  26320. * invoked with two arguments: (arrVal, othVal).
  26321. *
  26322. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  26323. *
  26324. * @static
  26325. * @memberOf _
  26326. * @since 4.6.0
  26327. * @category Array
  26328. * @param {Array} array The array to modify.
  26329. * @param {Array} values The values to remove.
  26330. * @param {Function} [comparator] The comparator invoked per element.
  26331. * @returns {Array} Returns `array`.
  26332. * @example
  26333. *
  26334. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  26335. *
  26336. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  26337. * console.log(array);
  26338. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  26339. */
  26340. function pullAllWith(array, values, comparator) {
  26341. return (array && array.length && values && values.length)
  26342. ? basePullAll(array, values, undefined, comparator)
  26343. : array;
  26344. }
  26345. /**
  26346. * Removes elements from `array` corresponding to `indexes` and returns an
  26347. * array of removed elements.
  26348. *
  26349. * **Note:** Unlike `_.at`, this method mutates `array`.
  26350. *
  26351. * @static
  26352. * @memberOf _
  26353. * @since 3.0.0
  26354. * @category Array
  26355. * @param {Array} array The array to modify.
  26356. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  26357. * @returns {Array} Returns the new array of removed elements.
  26358. * @example
  26359. *
  26360. * var array = ['a', 'b', 'c', 'd'];
  26361. * var pulled = _.pullAt(array, [1, 3]);
  26362. *
  26363. * console.log(array);
  26364. * // => ['a', 'c']
  26365. *
  26366. * console.log(pulled);
  26367. * // => ['b', 'd']
  26368. */
  26369. var pullAt = flatRest(function(array, indexes) {
  26370. var length = array == null ? 0 : array.length,
  26371. result = baseAt(array, indexes);
  26372. basePullAt(array, arrayMap(indexes, function(index) {
  26373. return isIndex(index, length) ? +index : index;
  26374. }).sort(compareAscending));
  26375. return result;
  26376. });
  26377. /**
  26378. * Removes all elements from `array` that `predicate` returns truthy for
  26379. * and returns an array of the removed elements. The predicate is invoked
  26380. * with three arguments: (value, index, array).
  26381. *
  26382. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  26383. * to pull elements from an array by value.
  26384. *
  26385. * @static
  26386. * @memberOf _
  26387. * @since 2.0.0
  26388. * @category Array
  26389. * @param {Array} array The array to modify.
  26390. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26391. * @returns {Array} Returns the new array of removed elements.
  26392. * @example
  26393. *
  26394. * var array = [1, 2, 3, 4];
  26395. * var evens = _.remove(array, function(n) {
  26396. * return n % 2 == 0;
  26397. * });
  26398. *
  26399. * console.log(array);
  26400. * // => [1, 3]
  26401. *
  26402. * console.log(evens);
  26403. * // => [2, 4]
  26404. */
  26405. function remove(array, predicate) {
  26406. var result = [];
  26407. if (!(array && array.length)) {
  26408. return result;
  26409. }
  26410. var index = -1,
  26411. indexes = [],
  26412. length = array.length;
  26413. predicate = getIteratee(predicate, 3);
  26414. while (++index < length) {
  26415. var value = array[index];
  26416. if (predicate(value, index, array)) {
  26417. result.push(value);
  26418. indexes.push(index);
  26419. }
  26420. }
  26421. basePullAt(array, indexes);
  26422. return result;
  26423. }
  26424. /**
  26425. * Reverses `array` so that the first element becomes the last, the second
  26426. * element becomes the second to last, and so on.
  26427. *
  26428. * **Note:** This method mutates `array` and is based on
  26429. * [`Array#reverse`](https://mdn.io/Array/reverse).
  26430. *
  26431. * @static
  26432. * @memberOf _
  26433. * @since 4.0.0
  26434. * @category Array
  26435. * @param {Array} array The array to modify.
  26436. * @returns {Array} Returns `array`.
  26437. * @example
  26438. *
  26439. * var array = [1, 2, 3];
  26440. *
  26441. * _.reverse(array);
  26442. * // => [3, 2, 1]
  26443. *
  26444. * console.log(array);
  26445. * // => [3, 2, 1]
  26446. */
  26447. function reverse(array) {
  26448. return array == null ? array : nativeReverse.call(array);
  26449. }
  26450. /**
  26451. * Creates a slice of `array` from `start` up to, but not including, `end`.
  26452. *
  26453. * **Note:** This method is used instead of
  26454. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  26455. * returned.
  26456. *
  26457. * @static
  26458. * @memberOf _
  26459. * @since 3.0.0
  26460. * @category Array
  26461. * @param {Array} array The array to slice.
  26462. * @param {number} [start=0] The start position.
  26463. * @param {number} [end=array.length] The end position.
  26464. * @returns {Array} Returns the slice of `array`.
  26465. */
  26466. function slice(array, start, end) {
  26467. var length = array == null ? 0 : array.length;
  26468. if (!length) {
  26469. return [];
  26470. }
  26471. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  26472. start = 0;
  26473. end = length;
  26474. }
  26475. else {
  26476. start = start == null ? 0 : toInteger(start);
  26477. end = end === undefined ? length : toInteger(end);
  26478. }
  26479. return baseSlice(array, start, end);
  26480. }
  26481. /**
  26482. * Uses a binary search to determine the lowest index at which `value`
  26483. * should be inserted into `array` in order to maintain its sort order.
  26484. *
  26485. * @static
  26486. * @memberOf _
  26487. * @since 0.1.0
  26488. * @category Array
  26489. * @param {Array} array The sorted array to inspect.
  26490. * @param {*} value The value to evaluate.
  26491. * @returns {number} Returns the index at which `value` should be inserted
  26492. * into `array`.
  26493. * @example
  26494. *
  26495. * _.sortedIndex([30, 50], 40);
  26496. * // => 1
  26497. */
  26498. function sortedIndex(array, value) {
  26499. return baseSortedIndex(array, value);
  26500. }
  26501. /**
  26502. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  26503. * which is invoked for `value` and each element of `array` to compute their
  26504. * sort ranking. The iteratee is invoked with one argument: (value).
  26505. *
  26506. * @static
  26507. * @memberOf _
  26508. * @since 4.0.0
  26509. * @category Array
  26510. * @param {Array} array The sorted array to inspect.
  26511. * @param {*} value The value to evaluate.
  26512. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26513. * @returns {number} Returns the index at which `value` should be inserted
  26514. * into `array`.
  26515. * @example
  26516. *
  26517. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  26518. *
  26519. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  26520. * // => 0
  26521. *
  26522. * // The `_.property` iteratee shorthand.
  26523. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  26524. * // => 0
  26525. */
  26526. function sortedIndexBy(array, value, iteratee) {
  26527. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  26528. }
  26529. /**
  26530. * This method is like `_.indexOf` except that it performs a binary
  26531. * search on a sorted `array`.
  26532. *
  26533. * @static
  26534. * @memberOf _
  26535. * @since 4.0.0
  26536. * @category Array
  26537. * @param {Array} array The array to inspect.
  26538. * @param {*} value The value to search for.
  26539. * @returns {number} Returns the index of the matched value, else `-1`.
  26540. * @example
  26541. *
  26542. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  26543. * // => 1
  26544. */
  26545. function sortedIndexOf(array, value) {
  26546. var length = array == null ? 0 : array.length;
  26547. if (length) {
  26548. var index = baseSortedIndex(array, value);
  26549. if (index < length && eq(array[index], value)) {
  26550. return index;
  26551. }
  26552. }
  26553. return -1;
  26554. }
  26555. /**
  26556. * This method is like `_.sortedIndex` except that it returns the highest
  26557. * index at which `value` should be inserted into `array` in order to
  26558. * maintain its sort order.
  26559. *
  26560. * @static
  26561. * @memberOf _
  26562. * @since 3.0.0
  26563. * @category Array
  26564. * @param {Array} array The sorted array to inspect.
  26565. * @param {*} value The value to evaluate.
  26566. * @returns {number} Returns the index at which `value` should be inserted
  26567. * into `array`.
  26568. * @example
  26569. *
  26570. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  26571. * // => 4
  26572. */
  26573. function sortedLastIndex(array, value) {
  26574. return baseSortedIndex(array, value, true);
  26575. }
  26576. /**
  26577. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  26578. * which is invoked for `value` and each element of `array` to compute their
  26579. * sort ranking. The iteratee is invoked with one argument: (value).
  26580. *
  26581. * @static
  26582. * @memberOf _
  26583. * @since 4.0.0
  26584. * @category Array
  26585. * @param {Array} array The sorted array to inspect.
  26586. * @param {*} value The value to evaluate.
  26587. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26588. * @returns {number} Returns the index at which `value` should be inserted
  26589. * into `array`.
  26590. * @example
  26591. *
  26592. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  26593. *
  26594. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  26595. * // => 1
  26596. *
  26597. * // The `_.property` iteratee shorthand.
  26598. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  26599. * // => 1
  26600. */
  26601. function sortedLastIndexBy(array, value, iteratee) {
  26602. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  26603. }
  26604. /**
  26605. * This method is like `_.lastIndexOf` except that it performs a binary
  26606. * search on a sorted `array`.
  26607. *
  26608. * @static
  26609. * @memberOf _
  26610. * @since 4.0.0
  26611. * @category Array
  26612. * @param {Array} array The array to inspect.
  26613. * @param {*} value The value to search for.
  26614. * @returns {number} Returns the index of the matched value, else `-1`.
  26615. * @example
  26616. *
  26617. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  26618. * // => 3
  26619. */
  26620. function sortedLastIndexOf(array, value) {
  26621. var length = array == null ? 0 : array.length;
  26622. if (length) {
  26623. var index = baseSortedIndex(array, value, true) - 1;
  26624. if (eq(array[index], value)) {
  26625. return index;
  26626. }
  26627. }
  26628. return -1;
  26629. }
  26630. /**
  26631. * This method is like `_.uniq` except that it's designed and optimized
  26632. * for sorted arrays.
  26633. *
  26634. * @static
  26635. * @memberOf _
  26636. * @since 4.0.0
  26637. * @category Array
  26638. * @param {Array} array The array to inspect.
  26639. * @returns {Array} Returns the new duplicate free array.
  26640. * @example
  26641. *
  26642. * _.sortedUniq([1, 1, 2]);
  26643. * // => [1, 2]
  26644. */
  26645. function sortedUniq(array) {
  26646. return (array && array.length)
  26647. ? baseSortedUniq(array)
  26648. : [];
  26649. }
  26650. /**
  26651. * This method is like `_.uniqBy` except that it's designed and optimized
  26652. * for sorted arrays.
  26653. *
  26654. * @static
  26655. * @memberOf _
  26656. * @since 4.0.0
  26657. * @category Array
  26658. * @param {Array} array The array to inspect.
  26659. * @param {Function} [iteratee] The iteratee invoked per element.
  26660. * @returns {Array} Returns the new duplicate free array.
  26661. * @example
  26662. *
  26663. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  26664. * // => [1.1, 2.3]
  26665. */
  26666. function sortedUniqBy(array, iteratee) {
  26667. return (array && array.length)
  26668. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  26669. : [];
  26670. }
  26671. /**
  26672. * Gets all but the first element of `array`.
  26673. *
  26674. * @static
  26675. * @memberOf _
  26676. * @since 4.0.0
  26677. * @category Array
  26678. * @param {Array} array The array to query.
  26679. * @returns {Array} Returns the slice of `array`.
  26680. * @example
  26681. *
  26682. * _.tail([1, 2, 3]);
  26683. * // => [2, 3]
  26684. */
  26685. function tail(array) {
  26686. var length = array == null ? 0 : array.length;
  26687. return length ? baseSlice(array, 1, length) : [];
  26688. }
  26689. /**
  26690. * Creates a slice of `array` with `n` elements taken from the beginning.
  26691. *
  26692. * @static
  26693. * @memberOf _
  26694. * @since 0.1.0
  26695. * @category Array
  26696. * @param {Array} array The array to query.
  26697. * @param {number} [n=1] The number of elements to take.
  26698. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26699. * @returns {Array} Returns the slice of `array`.
  26700. * @example
  26701. *
  26702. * _.take([1, 2, 3]);
  26703. * // => [1]
  26704. *
  26705. * _.take([1, 2, 3], 2);
  26706. * // => [1, 2]
  26707. *
  26708. * _.take([1, 2, 3], 5);
  26709. * // => [1, 2, 3]
  26710. *
  26711. * _.take([1, 2, 3], 0);
  26712. * // => []
  26713. */
  26714. function take(array, n, guard) {
  26715. if (!(array && array.length)) {
  26716. return [];
  26717. }
  26718. n = (guard || n === undefined) ? 1 : toInteger(n);
  26719. return baseSlice(array, 0, n < 0 ? 0 : n);
  26720. }
  26721. /**
  26722. * Creates a slice of `array` with `n` elements taken from the end.
  26723. *
  26724. * @static
  26725. * @memberOf _
  26726. * @since 3.0.0
  26727. * @category Array
  26728. * @param {Array} array The array to query.
  26729. * @param {number} [n=1] The number of elements to take.
  26730. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26731. * @returns {Array} Returns the slice of `array`.
  26732. * @example
  26733. *
  26734. * _.takeRight([1, 2, 3]);
  26735. * // => [3]
  26736. *
  26737. * _.takeRight([1, 2, 3], 2);
  26738. * // => [2, 3]
  26739. *
  26740. * _.takeRight([1, 2, 3], 5);
  26741. * // => [1, 2, 3]
  26742. *
  26743. * _.takeRight([1, 2, 3], 0);
  26744. * // => []
  26745. */
  26746. function takeRight(array, n, guard) {
  26747. var length = array == null ? 0 : array.length;
  26748. if (!length) {
  26749. return [];
  26750. }
  26751. n = (guard || n === undefined) ? 1 : toInteger(n);
  26752. n = length - n;
  26753. return baseSlice(array, n < 0 ? 0 : n, length);
  26754. }
  26755. /**
  26756. * Creates a slice of `array` with elements taken from the end. Elements are
  26757. * taken until `predicate` returns falsey. The predicate is invoked with
  26758. * three arguments: (value, index, array).
  26759. *
  26760. * @static
  26761. * @memberOf _
  26762. * @since 3.0.0
  26763. * @category Array
  26764. * @param {Array} array The array to query.
  26765. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26766. * @returns {Array} Returns the slice of `array`.
  26767. * @example
  26768. *
  26769. * var users = [
  26770. * { 'user': 'barney', 'active': true },
  26771. * { 'user': 'fred', 'active': false },
  26772. * { 'user': 'pebbles', 'active': false }
  26773. * ];
  26774. *
  26775. * _.takeRightWhile(users, function(o) { return !o.active; });
  26776. * // => objects for ['fred', 'pebbles']
  26777. *
  26778. * // The `_.matches` iteratee shorthand.
  26779. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  26780. * // => objects for ['pebbles']
  26781. *
  26782. * // The `_.matchesProperty` iteratee shorthand.
  26783. * _.takeRightWhile(users, ['active', false]);
  26784. * // => objects for ['fred', 'pebbles']
  26785. *
  26786. * // The `_.property` iteratee shorthand.
  26787. * _.takeRightWhile(users, 'active');
  26788. * // => []
  26789. */
  26790. function takeRightWhile(array, predicate) {
  26791. return (array && array.length)
  26792. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  26793. : [];
  26794. }
  26795. /**
  26796. * Creates a slice of `array` with elements taken from the beginning. Elements
  26797. * are taken until `predicate` returns falsey. The predicate is invoked with
  26798. * three arguments: (value, index, array).
  26799. *
  26800. * @static
  26801. * @memberOf _
  26802. * @since 3.0.0
  26803. * @category Array
  26804. * @param {Array} array The array to query.
  26805. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26806. * @returns {Array} Returns the slice of `array`.
  26807. * @example
  26808. *
  26809. * var users = [
  26810. * { 'user': 'barney', 'active': false },
  26811. * { 'user': 'fred', 'active': false },
  26812. * { 'user': 'pebbles', 'active': true }
  26813. * ];
  26814. *
  26815. * _.takeWhile(users, function(o) { return !o.active; });
  26816. * // => objects for ['barney', 'fred']
  26817. *
  26818. * // The `_.matches` iteratee shorthand.
  26819. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  26820. * // => objects for ['barney']
  26821. *
  26822. * // The `_.matchesProperty` iteratee shorthand.
  26823. * _.takeWhile(users, ['active', false]);
  26824. * // => objects for ['barney', 'fred']
  26825. *
  26826. * // The `_.property` iteratee shorthand.
  26827. * _.takeWhile(users, 'active');
  26828. * // => []
  26829. */
  26830. function takeWhile(array, predicate) {
  26831. return (array && array.length)
  26832. ? baseWhile(array, getIteratee(predicate, 3))
  26833. : [];
  26834. }
  26835. /**
  26836. * Creates an array of unique values, in order, from all given arrays using
  26837. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26838. * for equality comparisons.
  26839. *
  26840. * @static
  26841. * @memberOf _
  26842. * @since 0.1.0
  26843. * @category Array
  26844. * @param {...Array} [arrays] The arrays to inspect.
  26845. * @returns {Array} Returns the new array of combined values.
  26846. * @example
  26847. *
  26848. * _.union([2], [1, 2]);
  26849. * // => [2, 1]
  26850. */
  26851. var union = baseRest(function(arrays) {
  26852. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  26853. });
  26854. /**
  26855. * This method is like `_.union` except that it accepts `iteratee` which is
  26856. * invoked for each element of each `arrays` to generate the criterion by
  26857. * which uniqueness is computed. Result values are chosen from the first
  26858. * array in which the value occurs. The iteratee is invoked with one argument:
  26859. * (value).
  26860. *
  26861. * @static
  26862. * @memberOf _
  26863. * @since 4.0.0
  26864. * @category Array
  26865. * @param {...Array} [arrays] The arrays to inspect.
  26866. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26867. * @returns {Array} Returns the new array of combined values.
  26868. * @example
  26869. *
  26870. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  26871. * // => [2.1, 1.2]
  26872. *
  26873. * // The `_.property` iteratee shorthand.
  26874. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26875. * // => [{ 'x': 1 }, { 'x': 2 }]
  26876. */
  26877. var unionBy = baseRest(function(arrays) {
  26878. var iteratee = last(arrays);
  26879. if (isArrayLikeObject(iteratee)) {
  26880. iteratee = undefined;
  26881. }
  26882. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  26883. });
  26884. /**
  26885. * This method is like `_.union` except that it accepts `comparator` which
  26886. * is invoked to compare elements of `arrays`. Result values are chosen from
  26887. * the first array in which the value occurs. The comparator is invoked
  26888. * with two arguments: (arrVal, othVal).
  26889. *
  26890. * @static
  26891. * @memberOf _
  26892. * @since 4.0.0
  26893. * @category Array
  26894. * @param {...Array} [arrays] The arrays to inspect.
  26895. * @param {Function} [comparator] The comparator invoked per element.
  26896. * @returns {Array} Returns the new array of combined values.
  26897. * @example
  26898. *
  26899. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26900. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26901. *
  26902. * _.unionWith(objects, others, _.isEqual);
  26903. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26904. */
  26905. var unionWith = baseRest(function(arrays) {
  26906. var comparator = last(arrays);
  26907. comparator = typeof comparator == 'function' ? comparator : undefined;
  26908. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  26909. });
  26910. /**
  26911. * Creates a duplicate-free version of an array, using
  26912. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26913. * for equality comparisons, in which only the first occurrence of each element
  26914. * is kept. The order of result values is determined by the order they occur
  26915. * in the array.
  26916. *
  26917. * @static
  26918. * @memberOf _
  26919. * @since 0.1.0
  26920. * @category Array
  26921. * @param {Array} array The array to inspect.
  26922. * @returns {Array} Returns the new duplicate free array.
  26923. * @example
  26924. *
  26925. * _.uniq([2, 1, 2]);
  26926. * // => [2, 1]
  26927. */
  26928. function uniq(array) {
  26929. return (array && array.length) ? baseUniq(array) : [];
  26930. }
  26931. /**
  26932. * This method is like `_.uniq` except that it accepts `iteratee` which is
  26933. * invoked for each element in `array` to generate the criterion by which
  26934. * uniqueness is computed. The order of result values is determined by the
  26935. * order they occur in the array. The iteratee is invoked with one argument:
  26936. * (value).
  26937. *
  26938. * @static
  26939. * @memberOf _
  26940. * @since 4.0.0
  26941. * @category Array
  26942. * @param {Array} array The array to inspect.
  26943. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26944. * @returns {Array} Returns the new duplicate free array.
  26945. * @example
  26946. *
  26947. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  26948. * // => [2.1, 1.2]
  26949. *
  26950. * // The `_.property` iteratee shorthand.
  26951. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  26952. * // => [{ 'x': 1 }, { 'x': 2 }]
  26953. */
  26954. function uniqBy(array, iteratee) {
  26955. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  26956. }
  26957. /**
  26958. * This method is like `_.uniq` except that it accepts `comparator` which
  26959. * is invoked to compare elements of `array`. The order of result values is
  26960. * determined by the order they occur in the array.The comparator is invoked
  26961. * with two arguments: (arrVal, othVal).
  26962. *
  26963. * @static
  26964. * @memberOf _
  26965. * @since 4.0.0
  26966. * @category Array
  26967. * @param {Array} array The array to inspect.
  26968. * @param {Function} [comparator] The comparator invoked per element.
  26969. * @returns {Array} Returns the new duplicate free array.
  26970. * @example
  26971. *
  26972. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26973. *
  26974. * _.uniqWith(objects, _.isEqual);
  26975. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  26976. */
  26977. function uniqWith(array, comparator) {
  26978. comparator = typeof comparator == 'function' ? comparator : undefined;
  26979. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  26980. }
  26981. /**
  26982. * This method is like `_.zip` except that it accepts an array of grouped
  26983. * elements and creates an array regrouping the elements to their pre-zip
  26984. * configuration.
  26985. *
  26986. * @static
  26987. * @memberOf _
  26988. * @since 1.2.0
  26989. * @category Array
  26990. * @param {Array} array The array of grouped elements to process.
  26991. * @returns {Array} Returns the new array of regrouped elements.
  26992. * @example
  26993. *
  26994. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  26995. * // => [['a', 1, true], ['b', 2, false]]
  26996. *
  26997. * _.unzip(zipped);
  26998. * // => [['a', 'b'], [1, 2], [true, false]]
  26999. */
  27000. function unzip(array) {
  27001. if (!(array && array.length)) {
  27002. return [];
  27003. }
  27004. var length = 0;
  27005. array = arrayFilter(array, function(group) {
  27006. if (isArrayLikeObject(group)) {
  27007. length = nativeMax(group.length, length);
  27008. return true;
  27009. }
  27010. });
  27011. return baseTimes(length, function(index) {
  27012. return arrayMap(array, baseProperty(index));
  27013. });
  27014. }
  27015. /**
  27016. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  27017. * how regrouped values should be combined. The iteratee is invoked with the
  27018. * elements of each group: (...group).
  27019. *
  27020. * @static
  27021. * @memberOf _
  27022. * @since 3.8.0
  27023. * @category Array
  27024. * @param {Array} array The array of grouped elements to process.
  27025. * @param {Function} [iteratee=_.identity] The function to combine
  27026. * regrouped values.
  27027. * @returns {Array} Returns the new array of regrouped elements.
  27028. * @example
  27029. *
  27030. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  27031. * // => [[1, 10, 100], [2, 20, 200]]
  27032. *
  27033. * _.unzipWith(zipped, _.add);
  27034. * // => [3, 30, 300]
  27035. */
  27036. function unzipWith(array, iteratee) {
  27037. if (!(array && array.length)) {
  27038. return [];
  27039. }
  27040. var result = unzip(array);
  27041. if (iteratee == null) {
  27042. return result;
  27043. }
  27044. return arrayMap(result, function(group) {
  27045. return apply(iteratee, undefined, group);
  27046. });
  27047. }
  27048. /**
  27049. * Creates an array excluding all given values using
  27050. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  27051. * for equality comparisons.
  27052. *
  27053. * **Note:** Unlike `_.pull`, this method returns a new array.
  27054. *
  27055. * @static
  27056. * @memberOf _
  27057. * @since 0.1.0
  27058. * @category Array
  27059. * @param {Array} array The array to inspect.
  27060. * @param {...*} [values] The values to exclude.
  27061. * @returns {Array} Returns the new array of filtered values.
  27062. * @see _.difference, _.xor
  27063. * @example
  27064. *
  27065. * _.without([2, 1, 2, 3], 1, 2);
  27066. * // => [3]
  27067. */
  27068. var without = baseRest(function(array, values) {
  27069. return isArrayLikeObject(array)
  27070. ? baseDifference(array, values)
  27071. : [];
  27072. });
  27073. /**
  27074. * Creates an array of unique values that is the
  27075. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  27076. * of the given arrays. The order of result values is determined by the order
  27077. * they occur in the arrays.
  27078. *
  27079. * @static
  27080. * @memberOf _
  27081. * @since 2.4.0
  27082. * @category Array
  27083. * @param {...Array} [arrays] The arrays to inspect.
  27084. * @returns {Array} Returns the new array of filtered values.
  27085. * @see _.difference, _.without
  27086. * @example
  27087. *
  27088. * _.xor([2, 1], [2, 3]);
  27089. * // => [1, 3]
  27090. */
  27091. var xor = baseRest(function(arrays) {
  27092. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  27093. });
  27094. /**
  27095. * This method is like `_.xor` except that it accepts `iteratee` which is
  27096. * invoked for each element of each `arrays` to generate the criterion by
  27097. * which by which they're compared. The order of result values is determined
  27098. * by the order they occur in the arrays. The iteratee is invoked with one
  27099. * argument: (value).
  27100. *
  27101. * @static
  27102. * @memberOf _
  27103. * @since 4.0.0
  27104. * @category Array
  27105. * @param {...Array} [arrays] The arrays to inspect.
  27106. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  27107. * @returns {Array} Returns the new array of filtered values.
  27108. * @example
  27109. *
  27110. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  27111. * // => [1.2, 3.4]
  27112. *
  27113. * // The `_.property` iteratee shorthand.
  27114. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  27115. * // => [{ 'x': 2 }]
  27116. */
  27117. var xorBy = baseRest(function(arrays) {
  27118. var iteratee = last(arrays);
  27119. if (isArrayLikeObject(iteratee)) {
  27120. iteratee = undefined;
  27121. }
  27122. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  27123. });
  27124. /**
  27125. * This method is like `_.xor` except that it accepts `comparator` which is
  27126. * invoked to compare elements of `arrays`. The order of result values is
  27127. * determined by the order they occur in the arrays. The comparator is invoked
  27128. * with two arguments: (arrVal, othVal).
  27129. *
  27130. * @static
  27131. * @memberOf _
  27132. * @since 4.0.0
  27133. * @category Array
  27134. * @param {...Array} [arrays] The arrays to inspect.
  27135. * @param {Function} [comparator] The comparator invoked per element.
  27136. * @returns {Array} Returns the new array of filtered values.
  27137. * @example
  27138. *
  27139. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  27140. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  27141. *
  27142. * _.xorWith(objects, others, _.isEqual);
  27143. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  27144. */
  27145. var xorWith = baseRest(function(arrays) {
  27146. var comparator = last(arrays);
  27147. comparator = typeof comparator == 'function' ? comparator : undefined;
  27148. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  27149. });
  27150. /**
  27151. * Creates an array of grouped elements, the first of which contains the
  27152. * first elements of the given arrays, the second of which contains the
  27153. * second elements of the given arrays, and so on.
  27154. *
  27155. * @static
  27156. * @memberOf _
  27157. * @since 0.1.0
  27158. * @category Array
  27159. * @param {...Array} [arrays] The arrays to process.
  27160. * @returns {Array} Returns the new array of grouped elements.
  27161. * @example
  27162. *
  27163. * _.zip(['a', 'b'], [1, 2], [true, false]);
  27164. * // => [['a', 1, true], ['b', 2, false]]
  27165. */
  27166. var zip = baseRest(unzip);
  27167. /**
  27168. * This method is like `_.fromPairs` except that it accepts two arrays,
  27169. * one of property identifiers and one of corresponding values.
  27170. *
  27171. * @static
  27172. * @memberOf _
  27173. * @since 0.4.0
  27174. * @category Array
  27175. * @param {Array} [props=[]] The property identifiers.
  27176. * @param {Array} [values=[]] The property values.
  27177. * @returns {Object} Returns the new object.
  27178. * @example
  27179. *
  27180. * _.zipObject(['a', 'b'], [1, 2]);
  27181. * // => { 'a': 1, 'b': 2 }
  27182. */
  27183. function zipObject(props, values) {
  27184. return baseZipObject(props || [], values || [], assignValue);
  27185. }
  27186. /**
  27187. * This method is like `_.zipObject` except that it supports property paths.
  27188. *
  27189. * @static
  27190. * @memberOf _
  27191. * @since 4.1.0
  27192. * @category Array
  27193. * @param {Array} [props=[]] The property identifiers.
  27194. * @param {Array} [values=[]] The property values.
  27195. * @returns {Object} Returns the new object.
  27196. * @example
  27197. *
  27198. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  27199. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  27200. */
  27201. function zipObjectDeep(props, values) {
  27202. return baseZipObject(props || [], values || [], baseSet);
  27203. }
  27204. /**
  27205. * This method is like `_.zip` except that it accepts `iteratee` to specify
  27206. * how grouped values should be combined. The iteratee is invoked with the
  27207. * elements of each group: (...group).
  27208. *
  27209. * @static
  27210. * @memberOf _
  27211. * @since 3.8.0
  27212. * @category Array
  27213. * @param {...Array} [arrays] The arrays to process.
  27214. * @param {Function} [iteratee=_.identity] The function to combine
  27215. * grouped values.
  27216. * @returns {Array} Returns the new array of grouped elements.
  27217. * @example
  27218. *
  27219. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  27220. * return a + b + c;
  27221. * });
  27222. * // => [111, 222]
  27223. */
  27224. var zipWith = baseRest(function(arrays) {
  27225. var length = arrays.length,
  27226. iteratee = length > 1 ? arrays[length - 1] : undefined;
  27227. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  27228. return unzipWith(arrays, iteratee);
  27229. });
  27230. /*------------------------------------------------------------------------*/
  27231. /**
  27232. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  27233. * chain sequences enabled. The result of such sequences must be unwrapped
  27234. * with `_#value`.
  27235. *
  27236. * @static
  27237. * @memberOf _
  27238. * @since 1.3.0
  27239. * @category Seq
  27240. * @param {*} value The value to wrap.
  27241. * @returns {Object} Returns the new `lodash` wrapper instance.
  27242. * @example
  27243. *
  27244. * var users = [
  27245. * { 'user': 'barney', 'age': 36 },
  27246. * { 'user': 'fred', 'age': 40 },
  27247. * { 'user': 'pebbles', 'age': 1 }
  27248. * ];
  27249. *
  27250. * var youngest = _
  27251. * .chain(users)
  27252. * .sortBy('age')
  27253. * .map(function(o) {
  27254. * return o.user + ' is ' + o.age;
  27255. * })
  27256. * .head()
  27257. * .value();
  27258. * // => 'pebbles is 1'
  27259. */
  27260. function chain(value) {
  27261. var result = lodash(value);
  27262. result.__chain__ = true;
  27263. return result;
  27264. }
  27265. /**
  27266. * This method invokes `interceptor` and returns `value`. The interceptor
  27267. * is invoked with one argument; (value). The purpose of this method is to
  27268. * "tap into" a method chain sequence in order to modify intermediate results.
  27269. *
  27270. * @static
  27271. * @memberOf _
  27272. * @since 0.1.0
  27273. * @category Seq
  27274. * @param {*} value The value to provide to `interceptor`.
  27275. * @param {Function} interceptor The function to invoke.
  27276. * @returns {*} Returns `value`.
  27277. * @example
  27278. *
  27279. * _([1, 2, 3])
  27280. * .tap(function(array) {
  27281. * // Mutate input array.
  27282. * array.pop();
  27283. * })
  27284. * .reverse()
  27285. * .value();
  27286. * // => [2, 1]
  27287. */
  27288. function tap(value, interceptor) {
  27289. interceptor(value);
  27290. return value;
  27291. }
  27292. /**
  27293. * This method is like `_.tap` except that it returns the result of `interceptor`.
  27294. * The purpose of this method is to "pass thru" values replacing intermediate
  27295. * results in a method chain sequence.
  27296. *
  27297. * @static
  27298. * @memberOf _
  27299. * @since 3.0.0
  27300. * @category Seq
  27301. * @param {*} value The value to provide to `interceptor`.
  27302. * @param {Function} interceptor The function to invoke.
  27303. * @returns {*} Returns the result of `interceptor`.
  27304. * @example
  27305. *
  27306. * _(' abc ')
  27307. * .chain()
  27308. * .trim()
  27309. * .thru(function(value) {
  27310. * return [value];
  27311. * })
  27312. * .value();
  27313. * // => ['abc']
  27314. */
  27315. function thru(value, interceptor) {
  27316. return interceptor(value);
  27317. }
  27318. /**
  27319. * This method is the wrapper version of `_.at`.
  27320. *
  27321. * @name at
  27322. * @memberOf _
  27323. * @since 1.0.0
  27324. * @category Seq
  27325. * @param {...(string|string[])} [paths] The property paths to pick.
  27326. * @returns {Object} Returns the new `lodash` wrapper instance.
  27327. * @example
  27328. *
  27329. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  27330. *
  27331. * _(object).at(['a[0].b.c', 'a[1]']).value();
  27332. * // => [3, 4]
  27333. */
  27334. var wrapperAt = flatRest(function(paths) {
  27335. var length = paths.length,
  27336. start = length ? paths[0] : 0,
  27337. value = this.__wrapped__,
  27338. interceptor = function(object) { return baseAt(object, paths); };
  27339. if (length > 1 || this.__actions__.length ||
  27340. !(value instanceof LazyWrapper) || !isIndex(start)) {
  27341. return this.thru(interceptor);
  27342. }
  27343. value = value.slice(start, +start + (length ? 1 : 0));
  27344. value.__actions__.push({
  27345. 'func': thru,
  27346. 'args': [interceptor],
  27347. 'thisArg': undefined
  27348. });
  27349. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  27350. if (length && !array.length) {
  27351. array.push(undefined);
  27352. }
  27353. return array;
  27354. });
  27355. });
  27356. /**
  27357. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  27358. *
  27359. * @name chain
  27360. * @memberOf _
  27361. * @since 0.1.0
  27362. * @category Seq
  27363. * @returns {Object} Returns the new `lodash` wrapper instance.
  27364. * @example
  27365. *
  27366. * var users = [
  27367. * { 'user': 'barney', 'age': 36 },
  27368. * { 'user': 'fred', 'age': 40 }
  27369. * ];
  27370. *
  27371. * // A sequence without explicit chaining.
  27372. * _(users).head();
  27373. * // => { 'user': 'barney', 'age': 36 }
  27374. *
  27375. * // A sequence with explicit chaining.
  27376. * _(users)
  27377. * .chain()
  27378. * .head()
  27379. * .pick('user')
  27380. * .value();
  27381. * // => { 'user': 'barney' }
  27382. */
  27383. function wrapperChain() {
  27384. return chain(this);
  27385. }
  27386. /**
  27387. * Executes the chain sequence and returns the wrapped result.
  27388. *
  27389. * @name commit
  27390. * @memberOf _
  27391. * @since 3.2.0
  27392. * @category Seq
  27393. * @returns {Object} Returns the new `lodash` wrapper instance.
  27394. * @example
  27395. *
  27396. * var array = [1, 2];
  27397. * var wrapped = _(array).push(3);
  27398. *
  27399. * console.log(array);
  27400. * // => [1, 2]
  27401. *
  27402. * wrapped = wrapped.commit();
  27403. * console.log(array);
  27404. * // => [1, 2, 3]
  27405. *
  27406. * wrapped.last();
  27407. * // => 3
  27408. *
  27409. * console.log(array);
  27410. * // => [1, 2, 3]
  27411. */
  27412. function wrapperCommit() {
  27413. return new LodashWrapper(this.value(), this.__chain__);
  27414. }
  27415. /**
  27416. * Gets the next value on a wrapped object following the
  27417. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  27418. *
  27419. * @name next
  27420. * @memberOf _
  27421. * @since 4.0.0
  27422. * @category Seq
  27423. * @returns {Object} Returns the next iterator value.
  27424. * @example
  27425. *
  27426. * var wrapped = _([1, 2]);
  27427. *
  27428. * wrapped.next();
  27429. * // => { 'done': false, 'value': 1 }
  27430. *
  27431. * wrapped.next();
  27432. * // => { 'done': false, 'value': 2 }
  27433. *
  27434. * wrapped.next();
  27435. * // => { 'done': true, 'value': undefined }
  27436. */
  27437. function wrapperNext() {
  27438. if (this.__values__ === undefined) {
  27439. this.__values__ = toArray(this.value());
  27440. }
  27441. var done = this.__index__ >= this.__values__.length,
  27442. value = done ? undefined : this.__values__[this.__index__++];
  27443. return { 'done': done, 'value': value };
  27444. }
  27445. /**
  27446. * Enables the wrapper to be iterable.
  27447. *
  27448. * @name Symbol.iterator
  27449. * @memberOf _
  27450. * @since 4.0.0
  27451. * @category Seq
  27452. * @returns {Object} Returns the wrapper object.
  27453. * @example
  27454. *
  27455. * var wrapped = _([1, 2]);
  27456. *
  27457. * wrapped[Symbol.iterator]() === wrapped;
  27458. * // => true
  27459. *
  27460. * Array.from(wrapped);
  27461. * // => [1, 2]
  27462. */
  27463. function wrapperToIterator() {
  27464. return this;
  27465. }
  27466. /**
  27467. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  27468. *
  27469. * @name plant
  27470. * @memberOf _
  27471. * @since 3.2.0
  27472. * @category Seq
  27473. * @param {*} value The value to plant.
  27474. * @returns {Object} Returns the new `lodash` wrapper instance.
  27475. * @example
  27476. *
  27477. * function square(n) {
  27478. * return n * n;
  27479. * }
  27480. *
  27481. * var wrapped = _([1, 2]).map(square);
  27482. * var other = wrapped.plant([3, 4]);
  27483. *
  27484. * other.value();
  27485. * // => [9, 16]
  27486. *
  27487. * wrapped.value();
  27488. * // => [1, 4]
  27489. */
  27490. function wrapperPlant(value) {
  27491. var result,
  27492. parent = this;
  27493. while (parent instanceof baseLodash) {
  27494. var clone = wrapperClone(parent);
  27495. clone.__index__ = 0;
  27496. clone.__values__ = undefined;
  27497. if (result) {
  27498. previous.__wrapped__ = clone;
  27499. } else {
  27500. result = clone;
  27501. }
  27502. var previous = clone;
  27503. parent = parent.__wrapped__;
  27504. }
  27505. previous.__wrapped__ = value;
  27506. return result;
  27507. }
  27508. /**
  27509. * This method is the wrapper version of `_.reverse`.
  27510. *
  27511. * **Note:** This method mutates the wrapped array.
  27512. *
  27513. * @name reverse
  27514. * @memberOf _
  27515. * @since 0.1.0
  27516. * @category Seq
  27517. * @returns {Object} Returns the new `lodash` wrapper instance.
  27518. * @example
  27519. *
  27520. * var array = [1, 2, 3];
  27521. *
  27522. * _(array).reverse().value()
  27523. * // => [3, 2, 1]
  27524. *
  27525. * console.log(array);
  27526. * // => [3, 2, 1]
  27527. */
  27528. function wrapperReverse() {
  27529. var value = this.__wrapped__;
  27530. if (value instanceof LazyWrapper) {
  27531. var wrapped = value;
  27532. if (this.__actions__.length) {
  27533. wrapped = new LazyWrapper(this);
  27534. }
  27535. wrapped = wrapped.reverse();
  27536. wrapped.__actions__.push({
  27537. 'func': thru,
  27538. 'args': [reverse],
  27539. 'thisArg': undefined
  27540. });
  27541. return new LodashWrapper(wrapped, this.__chain__);
  27542. }
  27543. return this.thru(reverse);
  27544. }
  27545. /**
  27546. * Executes the chain sequence to resolve the unwrapped value.
  27547. *
  27548. * @name value
  27549. * @memberOf _
  27550. * @since 0.1.0
  27551. * @alias toJSON, valueOf
  27552. * @category Seq
  27553. * @returns {*} Returns the resolved unwrapped value.
  27554. * @example
  27555. *
  27556. * _([1, 2, 3]).value();
  27557. * // => [1, 2, 3]
  27558. */
  27559. function wrapperValue() {
  27560. return baseWrapperValue(this.__wrapped__, this.__actions__);
  27561. }
  27562. /*------------------------------------------------------------------------*/
  27563. /**
  27564. * Creates an object composed of keys generated from the results of running
  27565. * each element of `collection` thru `iteratee`. The corresponding value of
  27566. * each key is the number of times the key was returned by `iteratee`. The
  27567. * iteratee is invoked with one argument: (value).
  27568. *
  27569. * @static
  27570. * @memberOf _
  27571. * @since 0.5.0
  27572. * @category Collection
  27573. * @param {Array|Object} collection The collection to iterate over.
  27574. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27575. * @returns {Object} Returns the composed aggregate object.
  27576. * @example
  27577. *
  27578. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  27579. * // => { '4': 1, '6': 2 }
  27580. *
  27581. * // The `_.property` iteratee shorthand.
  27582. * _.countBy(['one', 'two', 'three'], 'length');
  27583. * // => { '3': 2, '5': 1 }
  27584. */
  27585. var countBy = createAggregator(function(result, value, key) {
  27586. if (hasOwnProperty.call(result, key)) {
  27587. ++result[key];
  27588. } else {
  27589. baseAssignValue(result, key, 1);
  27590. }
  27591. });
  27592. /**
  27593. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  27594. * Iteration is stopped once `predicate` returns falsey. The predicate is
  27595. * invoked with three arguments: (value, index|key, collection).
  27596. *
  27597. * **Note:** This method returns `true` for
  27598. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  27599. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  27600. * elements of empty collections.
  27601. *
  27602. * @static
  27603. * @memberOf _
  27604. * @since 0.1.0
  27605. * @category Collection
  27606. * @param {Array|Object} collection The collection to iterate over.
  27607. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27608. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27609. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  27610. * else `false`.
  27611. * @example
  27612. *
  27613. * _.every([true, 1, null, 'yes'], Boolean);
  27614. * // => false
  27615. *
  27616. * var users = [
  27617. * { 'user': 'barney', 'age': 36, 'active': false },
  27618. * { 'user': 'fred', 'age': 40, 'active': false }
  27619. * ];
  27620. *
  27621. * // The `_.matches` iteratee shorthand.
  27622. * _.every(users, { 'user': 'barney', 'active': false });
  27623. * // => false
  27624. *
  27625. * // The `_.matchesProperty` iteratee shorthand.
  27626. * _.every(users, ['active', false]);
  27627. * // => true
  27628. *
  27629. * // The `_.property` iteratee shorthand.
  27630. * _.every(users, 'active');
  27631. * // => false
  27632. */
  27633. function every(collection, predicate, guard) {
  27634. var func = isArray(collection) ? arrayEvery : baseEvery;
  27635. if (guard && isIterateeCall(collection, predicate, guard)) {
  27636. predicate = undefined;
  27637. }
  27638. return func(collection, getIteratee(predicate, 3));
  27639. }
  27640. /**
  27641. * Iterates over elements of `collection`, returning an array of all elements
  27642. * `predicate` returns truthy for. The predicate is invoked with three
  27643. * arguments: (value, index|key, collection).
  27644. *
  27645. * **Note:** Unlike `_.remove`, this method returns a new array.
  27646. *
  27647. * @static
  27648. * @memberOf _
  27649. * @since 0.1.0
  27650. * @category Collection
  27651. * @param {Array|Object} collection The collection to iterate over.
  27652. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27653. * @returns {Array} Returns the new filtered array.
  27654. * @see _.reject
  27655. * @example
  27656. *
  27657. * var users = [
  27658. * { 'user': 'barney', 'age': 36, 'active': true },
  27659. * { 'user': 'fred', 'age': 40, 'active': false }
  27660. * ];
  27661. *
  27662. * _.filter(users, function(o) { return !o.active; });
  27663. * // => objects for ['fred']
  27664. *
  27665. * // The `_.matches` iteratee shorthand.
  27666. * _.filter(users, { 'age': 36, 'active': true });
  27667. * // => objects for ['barney']
  27668. *
  27669. * // The `_.matchesProperty` iteratee shorthand.
  27670. * _.filter(users, ['active', false]);
  27671. * // => objects for ['fred']
  27672. *
  27673. * // The `_.property` iteratee shorthand.
  27674. * _.filter(users, 'active');
  27675. * // => objects for ['barney']
  27676. */
  27677. function filter(collection, predicate) {
  27678. var func = isArray(collection) ? arrayFilter : baseFilter;
  27679. return func(collection, getIteratee(predicate, 3));
  27680. }
  27681. /**
  27682. * Iterates over elements of `collection`, returning the first element
  27683. * `predicate` returns truthy for. The predicate is invoked with three
  27684. * arguments: (value, index|key, collection).
  27685. *
  27686. * @static
  27687. * @memberOf _
  27688. * @since 0.1.0
  27689. * @category Collection
  27690. * @param {Array|Object} collection The collection to inspect.
  27691. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27692. * @param {number} [fromIndex=0] The index to search from.
  27693. * @returns {*} Returns the matched element, else `undefined`.
  27694. * @example
  27695. *
  27696. * var users = [
  27697. * { 'user': 'barney', 'age': 36, 'active': true },
  27698. * { 'user': 'fred', 'age': 40, 'active': false },
  27699. * { 'user': 'pebbles', 'age': 1, 'active': true }
  27700. * ];
  27701. *
  27702. * _.find(users, function(o) { return o.age < 40; });
  27703. * // => object for 'barney'
  27704. *
  27705. * // The `_.matches` iteratee shorthand.
  27706. * _.find(users, { 'age': 1, 'active': true });
  27707. * // => object for 'pebbles'
  27708. *
  27709. * // The `_.matchesProperty` iteratee shorthand.
  27710. * _.find(users, ['active', false]);
  27711. * // => object for 'fred'
  27712. *
  27713. * // The `_.property` iteratee shorthand.
  27714. * _.find(users, 'active');
  27715. * // => object for 'barney'
  27716. */
  27717. var find = createFind(findIndex);
  27718. /**
  27719. * This method is like `_.find` except that it iterates over elements of
  27720. * `collection` from right to left.
  27721. *
  27722. * @static
  27723. * @memberOf _
  27724. * @since 2.0.0
  27725. * @category Collection
  27726. * @param {Array|Object} collection The collection to inspect.
  27727. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27728. * @param {number} [fromIndex=collection.length-1] The index to search from.
  27729. * @returns {*} Returns the matched element, else `undefined`.
  27730. * @example
  27731. *
  27732. * _.findLast([1, 2, 3, 4], function(n) {
  27733. * return n % 2 == 1;
  27734. * });
  27735. * // => 3
  27736. */
  27737. var findLast = createFind(findLastIndex);
  27738. /**
  27739. * Creates a flattened array of values by running each element in `collection`
  27740. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  27741. * with three arguments: (value, index|key, collection).
  27742. *
  27743. * @static
  27744. * @memberOf _
  27745. * @since 4.0.0
  27746. * @category Collection
  27747. * @param {Array|Object} collection The collection to iterate over.
  27748. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27749. * @returns {Array} Returns the new flattened array.
  27750. * @example
  27751. *
  27752. * function duplicate(n) {
  27753. * return [n, n];
  27754. * }
  27755. *
  27756. * _.flatMap([1, 2], duplicate);
  27757. * // => [1, 1, 2, 2]
  27758. */
  27759. function flatMap(collection, iteratee) {
  27760. return baseFlatten(map(collection, iteratee), 1);
  27761. }
  27762. /**
  27763. * This method is like `_.flatMap` except that it recursively flattens the
  27764. * mapped results.
  27765. *
  27766. * @static
  27767. * @memberOf _
  27768. * @since 4.7.0
  27769. * @category Collection
  27770. * @param {Array|Object} collection The collection to iterate over.
  27771. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27772. * @returns {Array} Returns the new flattened array.
  27773. * @example
  27774. *
  27775. * function duplicate(n) {
  27776. * return [[[n, n]]];
  27777. * }
  27778. *
  27779. * _.flatMapDeep([1, 2], duplicate);
  27780. * // => [1, 1, 2, 2]
  27781. */
  27782. function flatMapDeep(collection, iteratee) {
  27783. return baseFlatten(map(collection, iteratee), INFINITY);
  27784. }
  27785. /**
  27786. * This method is like `_.flatMap` except that it recursively flattens the
  27787. * mapped results up to `depth` times.
  27788. *
  27789. * @static
  27790. * @memberOf _
  27791. * @since 4.7.0
  27792. * @category Collection
  27793. * @param {Array|Object} collection The collection to iterate over.
  27794. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27795. * @param {number} [depth=1] The maximum recursion depth.
  27796. * @returns {Array} Returns the new flattened array.
  27797. * @example
  27798. *
  27799. * function duplicate(n) {
  27800. * return [[[n, n]]];
  27801. * }
  27802. *
  27803. * _.flatMapDepth([1, 2], duplicate, 2);
  27804. * // => [[1, 1], [2, 2]]
  27805. */
  27806. function flatMapDepth(collection, iteratee, depth) {
  27807. depth = depth === undefined ? 1 : toInteger(depth);
  27808. return baseFlatten(map(collection, iteratee), depth);
  27809. }
  27810. /**
  27811. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  27812. * The iteratee is invoked with three arguments: (value, index|key, collection).
  27813. * Iteratee functions may exit iteration early by explicitly returning `false`.
  27814. *
  27815. * **Note:** As with other "Collections" methods, objects with a "length"
  27816. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  27817. * or `_.forOwn` for object iteration.
  27818. *
  27819. * @static
  27820. * @memberOf _
  27821. * @since 0.1.0
  27822. * @alias each
  27823. * @category Collection
  27824. * @param {Array|Object} collection The collection to iterate over.
  27825. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27826. * @returns {Array|Object} Returns `collection`.
  27827. * @see _.forEachRight
  27828. * @example
  27829. *
  27830. * _.forEach([1, 2], function(value) {
  27831. * console.log(value);
  27832. * });
  27833. * // => Logs `1` then `2`.
  27834. *
  27835. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  27836. * console.log(key);
  27837. * });
  27838. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  27839. */
  27840. function forEach(collection, iteratee) {
  27841. var func = isArray(collection) ? arrayEach : baseEach;
  27842. return func(collection, getIteratee(iteratee, 3));
  27843. }
  27844. /**
  27845. * This method is like `_.forEach` except that it iterates over elements of
  27846. * `collection` from right to left.
  27847. *
  27848. * @static
  27849. * @memberOf _
  27850. * @since 2.0.0
  27851. * @alias eachRight
  27852. * @category Collection
  27853. * @param {Array|Object} collection The collection to iterate over.
  27854. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27855. * @returns {Array|Object} Returns `collection`.
  27856. * @see _.forEach
  27857. * @example
  27858. *
  27859. * _.forEachRight([1, 2], function(value) {
  27860. * console.log(value);
  27861. * });
  27862. * // => Logs `2` then `1`.
  27863. */
  27864. function forEachRight(collection, iteratee) {
  27865. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  27866. return func(collection, getIteratee(iteratee, 3));
  27867. }
  27868. /**
  27869. * Creates an object composed of keys generated from the results of running
  27870. * each element of `collection` thru `iteratee`. The order of grouped values
  27871. * is determined by the order they occur in `collection`. The corresponding
  27872. * value of each key is an array of elements responsible for generating the
  27873. * key. The iteratee is invoked with one argument: (value).
  27874. *
  27875. * @static
  27876. * @memberOf _
  27877. * @since 0.1.0
  27878. * @category Collection
  27879. * @param {Array|Object} collection The collection to iterate over.
  27880. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27881. * @returns {Object} Returns the composed aggregate object.
  27882. * @example
  27883. *
  27884. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  27885. * // => { '4': [4.2], '6': [6.1, 6.3] }
  27886. *
  27887. * // The `_.property` iteratee shorthand.
  27888. * _.groupBy(['one', 'two', 'three'], 'length');
  27889. * // => { '3': ['one', 'two'], '5': ['three'] }
  27890. */
  27891. var groupBy = createAggregator(function(result, value, key) {
  27892. if (hasOwnProperty.call(result, key)) {
  27893. result[key].push(value);
  27894. } else {
  27895. baseAssignValue(result, key, [value]);
  27896. }
  27897. });
  27898. /**
  27899. * Checks if `value` is in `collection`. If `collection` is a string, it's
  27900. * checked for a substring of `value`, otherwise
  27901. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  27902. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  27903. * the offset from the end of `collection`.
  27904. *
  27905. * @static
  27906. * @memberOf _
  27907. * @since 0.1.0
  27908. * @category Collection
  27909. * @param {Array|Object|string} collection The collection to inspect.
  27910. * @param {*} value The value to search for.
  27911. * @param {number} [fromIndex=0] The index to search from.
  27912. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27913. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  27914. * @example
  27915. *
  27916. * _.includes([1, 2, 3], 1);
  27917. * // => true
  27918. *
  27919. * _.includes([1, 2, 3], 1, 2);
  27920. * // => false
  27921. *
  27922. * _.includes({ 'a': 1, 'b': 2 }, 1);
  27923. * // => true
  27924. *
  27925. * _.includes('abcd', 'bc');
  27926. * // => true
  27927. */
  27928. function includes(collection, value, fromIndex, guard) {
  27929. collection = isArrayLike(collection) ? collection : values(collection);
  27930. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  27931. var length = collection.length;
  27932. if (fromIndex < 0) {
  27933. fromIndex = nativeMax(length + fromIndex, 0);
  27934. }
  27935. return isString(collection)
  27936. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  27937. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  27938. }
  27939. /**
  27940. * Invokes the method at `path` of each element in `collection`, returning
  27941. * an array of the results of each invoked method. Any additional arguments
  27942. * are provided to each invoked method. If `path` is a function, it's invoked
  27943. * for, and `this` bound to, each element in `collection`.
  27944. *
  27945. * @static
  27946. * @memberOf _
  27947. * @since 4.0.0
  27948. * @category Collection
  27949. * @param {Array|Object} collection The collection to iterate over.
  27950. * @param {Array|Function|string} path The path of the method to invoke or
  27951. * the function invoked per iteration.
  27952. * @param {...*} [args] The arguments to invoke each method with.
  27953. * @returns {Array} Returns the array of results.
  27954. * @example
  27955. *
  27956. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  27957. * // => [[1, 5, 7], [1, 2, 3]]
  27958. *
  27959. * _.invokeMap([123, 456], String.prototype.split, '');
  27960. * // => [['1', '2', '3'], ['4', '5', '6']]
  27961. */
  27962. var invokeMap = baseRest(function(collection, path, args) {
  27963. var index = -1,
  27964. isFunc = typeof path == 'function',
  27965. result = isArrayLike(collection) ? Array(collection.length) : [];
  27966. baseEach(collection, function(value) {
  27967. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  27968. });
  27969. return result;
  27970. });
  27971. /**
  27972. * Creates an object composed of keys generated from the results of running
  27973. * each element of `collection` thru `iteratee`. The corresponding value of
  27974. * each key is the last element responsible for generating the key. The
  27975. * iteratee is invoked with one argument: (value).
  27976. *
  27977. * @static
  27978. * @memberOf _
  27979. * @since 4.0.0
  27980. * @category Collection
  27981. * @param {Array|Object} collection The collection to iterate over.
  27982. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27983. * @returns {Object} Returns the composed aggregate object.
  27984. * @example
  27985. *
  27986. * var array = [
  27987. * { 'dir': 'left', 'code': 97 },
  27988. * { 'dir': 'right', 'code': 100 }
  27989. * ];
  27990. *
  27991. * _.keyBy(array, function(o) {
  27992. * return String.fromCharCode(o.code);
  27993. * });
  27994. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  27995. *
  27996. * _.keyBy(array, 'dir');
  27997. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  27998. */
  27999. var keyBy = createAggregator(function(result, value, key) {
  28000. baseAssignValue(result, key, value);
  28001. });
  28002. /**
  28003. * Creates an array of values by running each element in `collection` thru
  28004. * `iteratee`. The iteratee is invoked with three arguments:
  28005. * (value, index|key, collection).
  28006. *
  28007. * Many lodash methods are guarded to work as iteratees for methods like
  28008. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  28009. *
  28010. * The guarded methods are:
  28011. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  28012. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  28013. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  28014. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  28015. *
  28016. * @static
  28017. * @memberOf _
  28018. * @since 0.1.0
  28019. * @category Collection
  28020. * @param {Array|Object} collection The collection to iterate over.
  28021. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  28022. * @returns {Array} Returns the new mapped array.
  28023. * @example
  28024. *
  28025. * function square(n) {
  28026. * return n * n;
  28027. * }
  28028. *
  28029. * _.map([4, 8], square);
  28030. * // => [16, 64]
  28031. *
  28032. * _.map({ 'a': 4, 'b': 8 }, square);
  28033. * // => [16, 64] (iteration order is not guaranteed)
  28034. *
  28035. * var users = [
  28036. * { 'user': 'barney' },
  28037. * { 'user': 'fred' }
  28038. * ];
  28039. *
  28040. * // The `_.property` iteratee shorthand.
  28041. * _.map(users, 'user');
  28042. * // => ['barney', 'fred']
  28043. */
  28044. function map(collection, iteratee) {
  28045. var func = isArray(collection) ? arrayMap : baseMap;
  28046. return func(collection, getIteratee(iteratee, 3));
  28047. }
  28048. /**
  28049. * This method is like `_.sortBy` except that it allows specifying the sort
  28050. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  28051. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  28052. * descending or "asc" for ascending sort order of corresponding values.
  28053. *
  28054. * @static
  28055. * @memberOf _
  28056. * @since 4.0.0
  28057. * @category Collection
  28058. * @param {Array|Object} collection The collection to iterate over.
  28059. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  28060. * The iteratees to sort by.
  28061. * @param {string[]} [orders] The sort orders of `iteratees`.
  28062. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  28063. * @returns {Array} Returns the new sorted array.
  28064. * @example
  28065. *
  28066. * var users = [
  28067. * { 'user': 'fred', 'age': 48 },
  28068. * { 'user': 'barney', 'age': 34 },
  28069. * { 'user': 'fred', 'age': 40 },
  28070. * { 'user': 'barney', 'age': 36 }
  28071. * ];
  28072. *
  28073. * // Sort by `user` in ascending order and by `age` in descending order.
  28074. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  28075. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  28076. */
  28077. function orderBy(collection, iteratees, orders, guard) {
  28078. if (collection == null) {
  28079. return [];
  28080. }
  28081. if (!isArray(iteratees)) {
  28082. iteratees = iteratees == null ? [] : [iteratees];
  28083. }
  28084. orders = guard ? undefined : orders;
  28085. if (!isArray(orders)) {
  28086. orders = orders == null ? [] : [orders];
  28087. }
  28088. return baseOrderBy(collection, iteratees, orders);
  28089. }
  28090. /**
  28091. * Creates an array of elements split into two groups, the first of which
  28092. * contains elements `predicate` returns truthy for, the second of which
  28093. * contains elements `predicate` returns falsey for. The predicate is
  28094. * invoked with one argument: (value).
  28095. *
  28096. * @static
  28097. * @memberOf _
  28098. * @since 3.0.0
  28099. * @category Collection
  28100. * @param {Array|Object} collection The collection to iterate over.
  28101. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  28102. * @returns {Array} Returns the array of grouped elements.
  28103. * @example
  28104. *
  28105. * var users = [
  28106. * { 'user': 'barney', 'age': 36, 'active': false },
  28107. * { 'user': 'fred', 'age': 40, 'active': true },
  28108. * { 'user': 'pebbles', 'age': 1, 'active': false }
  28109. * ];
  28110. *
  28111. * _.partition(users, function(o) { return o.active; });
  28112. * // => objects for [['fred'], ['barney', 'pebbles']]
  28113. *
  28114. * // The `_.matches` iteratee shorthand.
  28115. * _.partition(users, { 'age': 1, 'active': false });
  28116. * // => objects for [['pebbles'], ['barney', 'fred']]
  28117. *
  28118. * // The `_.matchesProperty` iteratee shorthand.
  28119. * _.partition(users, ['active', false]);
  28120. * // => objects for [['barney', 'pebbles'], ['fred']]
  28121. *
  28122. * // The `_.property` iteratee shorthand.
  28123. * _.partition(users, 'active');
  28124. * // => objects for [['fred'], ['barney', 'pebbles']]
  28125. */
  28126. var partition = createAggregator(function(result, value, key) {
  28127. result[key ? 0 : 1].push(value);
  28128. }, function() { return [[], []]; });
  28129. /**
  28130. * Reduces `collection` to a value which is the accumulated result of running
  28131. * each element in `collection` thru `iteratee`, where each successive
  28132. * invocation is supplied the return value of the previous. If `accumulator`
  28133. * is not given, the first element of `collection` is used as the initial
  28134. * value. The iteratee is invoked with four arguments:
  28135. * (accumulator, value, index|key, collection).
  28136. *
  28137. * Many lodash methods are guarded to work as iteratees for methods like
  28138. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  28139. *
  28140. * The guarded methods are:
  28141. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  28142. * and `sortBy`
  28143. *
  28144. * @static
  28145. * @memberOf _
  28146. * @since 0.1.0
  28147. * @category Collection
  28148. * @param {Array|Object} collection The collection to iterate over.
  28149. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  28150. * @param {*} [accumulator] The initial value.
  28151. * @returns {*} Returns the accumulated value.
  28152. * @see _.reduceRight
  28153. * @example
  28154. *
  28155. * _.reduce([1, 2], function(sum, n) {
  28156. * return sum + n;
  28157. * }, 0);
  28158. * // => 3
  28159. *
  28160. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  28161. * (result[value] || (result[value] = [])).push(key);
  28162. * return result;
  28163. * }, {});
  28164. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  28165. */
  28166. function reduce(collection, iteratee, accumulator) {
  28167. var func = isArray(collection) ? arrayReduce : baseReduce,
  28168. initAccum = arguments.length < 3;
  28169. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  28170. }
  28171. /**
  28172. * This method is like `_.reduce` except that it iterates over elements of
  28173. * `collection` from right to left.
  28174. *
  28175. * @static
  28176. * @memberOf _
  28177. * @since 0.1.0
  28178. * @category Collection
  28179. * @param {Array|Object} collection The collection to iterate over.
  28180. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  28181. * @param {*} [accumulator] The initial value.
  28182. * @returns {*} Returns the accumulated value.
  28183. * @see _.reduce
  28184. * @example
  28185. *
  28186. * var array = [[0, 1], [2, 3], [4, 5]];
  28187. *
  28188. * _.reduceRight(array, function(flattened, other) {
  28189. * return flattened.concat(other);
  28190. * }, []);
  28191. * // => [4, 5, 2, 3, 0, 1]
  28192. */
  28193. function reduceRight(collection, iteratee, accumulator) {
  28194. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  28195. initAccum = arguments.length < 3;
  28196. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  28197. }
  28198. /**
  28199. * The opposite of `_.filter`; this method returns the elements of `collection`
  28200. * that `predicate` does **not** return truthy for.
  28201. *
  28202. * @static
  28203. * @memberOf _
  28204. * @since 0.1.0
  28205. * @category Collection
  28206. * @param {Array|Object} collection The collection to iterate over.
  28207. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  28208. * @returns {Array} Returns the new filtered array.
  28209. * @see _.filter
  28210. * @example
  28211. *
  28212. * var users = [
  28213. * { 'user': 'barney', 'age': 36, 'active': false },
  28214. * { 'user': 'fred', 'age': 40, 'active': true }
  28215. * ];
  28216. *
  28217. * _.reject(users, function(o) { return !o.active; });
  28218. * // => objects for ['fred']
  28219. *
  28220. * // The `_.matches` iteratee shorthand.
  28221. * _.reject(users, { 'age': 40, 'active': true });
  28222. * // => objects for ['barney']
  28223. *
  28224. * // The `_.matchesProperty` iteratee shorthand.
  28225. * _.reject(users, ['active', false]);
  28226. * // => objects for ['fred']
  28227. *
  28228. * // The `_.property` iteratee shorthand.
  28229. * _.reject(users, 'active');
  28230. * // => objects for ['barney']
  28231. */
  28232. function reject(collection, predicate) {
  28233. var func = isArray(collection) ? arrayFilter : baseFilter;
  28234. return func(collection, negate(getIteratee(predicate, 3)));
  28235. }
  28236. /**
  28237. * Gets a random element from `collection`.
  28238. *
  28239. * @static
  28240. * @memberOf _
  28241. * @since 2.0.0
  28242. * @category Collection
  28243. * @param {Array|Object} collection The collection to sample.
  28244. * @returns {*} Returns the random element.
  28245. * @example
  28246. *
  28247. * _.sample([1, 2, 3, 4]);
  28248. * // => 2
  28249. */
  28250. function sample(collection) {
  28251. var func = isArray(collection) ? arraySample : baseSample;
  28252. return func(collection);
  28253. }
  28254. /**
  28255. * Gets `n` random elements at unique keys from `collection` up to the
  28256. * size of `collection`.
  28257. *
  28258. * @static
  28259. * @memberOf _
  28260. * @since 4.0.0
  28261. * @category Collection
  28262. * @param {Array|Object} collection The collection to sample.
  28263. * @param {number} [n=1] The number of elements to sample.
  28264. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28265. * @returns {Array} Returns the random elements.
  28266. * @example
  28267. *
  28268. * _.sampleSize([1, 2, 3], 2);
  28269. * // => [3, 1]
  28270. *
  28271. * _.sampleSize([1, 2, 3], 4);
  28272. * // => [2, 3, 1]
  28273. */
  28274. function sampleSize(collection, n, guard) {
  28275. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  28276. n = 1;
  28277. } else {
  28278. n = toInteger(n);
  28279. }
  28280. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  28281. return func(collection, n);
  28282. }
  28283. /**
  28284. * Creates an array of shuffled values, using a version of the
  28285. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  28286. *
  28287. * @static
  28288. * @memberOf _
  28289. * @since 0.1.0
  28290. * @category Collection
  28291. * @param {Array|Object} collection The collection to shuffle.
  28292. * @returns {Array} Returns the new shuffled array.
  28293. * @example
  28294. *
  28295. * _.shuffle([1, 2, 3, 4]);
  28296. * // => [4, 1, 3, 2]
  28297. */
  28298. function shuffle(collection) {
  28299. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  28300. return func(collection);
  28301. }
  28302. /**
  28303. * Gets the size of `collection` by returning its length for array-like
  28304. * values or the number of own enumerable string keyed properties for objects.
  28305. *
  28306. * @static
  28307. * @memberOf _
  28308. * @since 0.1.0
  28309. * @category Collection
  28310. * @param {Array|Object|string} collection The collection to inspect.
  28311. * @returns {number} Returns the collection size.
  28312. * @example
  28313. *
  28314. * _.size([1, 2, 3]);
  28315. * // => 3
  28316. *
  28317. * _.size({ 'a': 1, 'b': 2 });
  28318. * // => 2
  28319. *
  28320. * _.size('pebbles');
  28321. * // => 7
  28322. */
  28323. function size(collection) {
  28324. if (collection == null) {
  28325. return 0;
  28326. }
  28327. if (isArrayLike(collection)) {
  28328. return isString(collection) ? stringSize(collection) : collection.length;
  28329. }
  28330. var tag = getTag(collection);
  28331. if (tag == mapTag || tag == setTag) {
  28332. return collection.size;
  28333. }
  28334. return baseKeys(collection).length;
  28335. }
  28336. /**
  28337. * Checks if `predicate` returns truthy for **any** element of `collection`.
  28338. * Iteration is stopped once `predicate` returns truthy. The predicate is
  28339. * invoked with three arguments: (value, index|key, collection).
  28340. *
  28341. * @static
  28342. * @memberOf _
  28343. * @since 0.1.0
  28344. * @category Collection
  28345. * @param {Array|Object} collection The collection to iterate over.
  28346. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  28347. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28348. * @returns {boolean} Returns `true` if any element passes the predicate check,
  28349. * else `false`.
  28350. * @example
  28351. *
  28352. * _.some([null, 0, 'yes', false], Boolean);
  28353. * // => true
  28354. *
  28355. * var users = [
  28356. * { 'user': 'barney', 'active': true },
  28357. * { 'user': 'fred', 'active': false }
  28358. * ];
  28359. *
  28360. * // The `_.matches` iteratee shorthand.
  28361. * _.some(users, { 'user': 'barney', 'active': false });
  28362. * // => false
  28363. *
  28364. * // The `_.matchesProperty` iteratee shorthand.
  28365. * _.some(users, ['active', false]);
  28366. * // => true
  28367. *
  28368. * // The `_.property` iteratee shorthand.
  28369. * _.some(users, 'active');
  28370. * // => true
  28371. */
  28372. function some(collection, predicate, guard) {
  28373. var func = isArray(collection) ? arraySome : baseSome;
  28374. if (guard && isIterateeCall(collection, predicate, guard)) {
  28375. predicate = undefined;
  28376. }
  28377. return func(collection, getIteratee(predicate, 3));
  28378. }
  28379. /**
  28380. * Creates an array of elements, sorted in ascending order by the results of
  28381. * running each element in a collection thru each iteratee. This method
  28382. * performs a stable sort, that is, it preserves the original sort order of
  28383. * equal elements. The iteratees are invoked with one argument: (value).
  28384. *
  28385. * @static
  28386. * @memberOf _
  28387. * @since 0.1.0
  28388. * @category Collection
  28389. * @param {Array|Object} collection The collection to iterate over.
  28390. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  28391. * The iteratees to sort by.
  28392. * @returns {Array} Returns the new sorted array.
  28393. * @example
  28394. *
  28395. * var users = [
  28396. * { 'user': 'fred', 'age': 48 },
  28397. * { 'user': 'barney', 'age': 36 },
  28398. * { 'user': 'fred', 'age': 40 },
  28399. * { 'user': 'barney', 'age': 34 }
  28400. * ];
  28401. *
  28402. * _.sortBy(users, [function(o) { return o.user; }]);
  28403. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  28404. *
  28405. * _.sortBy(users, ['user', 'age']);
  28406. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  28407. */
  28408. var sortBy = baseRest(function(collection, iteratees) {
  28409. if (collection == null) {
  28410. return [];
  28411. }
  28412. var length = iteratees.length;
  28413. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  28414. iteratees = [];
  28415. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  28416. iteratees = [iteratees[0]];
  28417. }
  28418. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  28419. });
  28420. /*------------------------------------------------------------------------*/
  28421. /**
  28422. * Gets the timestamp of the number of milliseconds that have elapsed since
  28423. * the Unix epoch (1 January 1970 00:00:00 UTC).
  28424. *
  28425. * @static
  28426. * @memberOf _
  28427. * @since 2.4.0
  28428. * @category Date
  28429. * @returns {number} Returns the timestamp.
  28430. * @example
  28431. *
  28432. * _.defer(function(stamp) {
  28433. * console.log(_.now() - stamp);
  28434. * }, _.now());
  28435. * // => Logs the number of milliseconds it took for the deferred invocation.
  28436. */
  28437. var now = ctxNow || function() {
  28438. return root.Date.now();
  28439. };
  28440. /*------------------------------------------------------------------------*/
  28441. /**
  28442. * The opposite of `_.before`; this method creates a function that invokes
  28443. * `func` once it's called `n` or more times.
  28444. *
  28445. * @static
  28446. * @memberOf _
  28447. * @since 0.1.0
  28448. * @category Function
  28449. * @param {number} n The number of calls before `func` is invoked.
  28450. * @param {Function} func The function to restrict.
  28451. * @returns {Function} Returns the new restricted function.
  28452. * @example
  28453. *
  28454. * var saves = ['profile', 'settings'];
  28455. *
  28456. * var done = _.after(saves.length, function() {
  28457. * console.log('done saving!');
  28458. * });
  28459. *
  28460. * _.forEach(saves, function(type) {
  28461. * asyncSave({ 'type': type, 'complete': done });
  28462. * });
  28463. * // => Logs 'done saving!' after the two async saves have completed.
  28464. */
  28465. function after(n, func) {
  28466. if (typeof func != 'function') {
  28467. throw new TypeError(FUNC_ERROR_TEXT);
  28468. }
  28469. n = toInteger(n);
  28470. return function() {
  28471. if (--n < 1) {
  28472. return func.apply(this, arguments);
  28473. }
  28474. };
  28475. }
  28476. /**
  28477. * Creates a function that invokes `func`, with up to `n` arguments,
  28478. * ignoring any additional arguments.
  28479. *
  28480. * @static
  28481. * @memberOf _
  28482. * @since 3.0.0
  28483. * @category Function
  28484. * @param {Function} func The function to cap arguments for.
  28485. * @param {number} [n=func.length] The arity cap.
  28486. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28487. * @returns {Function} Returns the new capped function.
  28488. * @example
  28489. *
  28490. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  28491. * // => [6, 8, 10]
  28492. */
  28493. function ary(func, n, guard) {
  28494. n = guard ? undefined : n;
  28495. n = (func && n == null) ? func.length : n;
  28496. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  28497. }
  28498. /**
  28499. * Creates a function that invokes `func`, with the `this` binding and arguments
  28500. * of the created function, while it's called less than `n` times. Subsequent
  28501. * calls to the created function return the result of the last `func` invocation.
  28502. *
  28503. * @static
  28504. * @memberOf _
  28505. * @since 3.0.0
  28506. * @category Function
  28507. * @param {number} n The number of calls at which `func` is no longer invoked.
  28508. * @param {Function} func The function to restrict.
  28509. * @returns {Function} Returns the new restricted function.
  28510. * @example
  28511. *
  28512. * jQuery(element).on('click', _.before(5, addContactToList));
  28513. * // => Allows adding up to 4 contacts to the list.
  28514. */
  28515. function before(n, func) {
  28516. var result;
  28517. if (typeof func != 'function') {
  28518. throw new TypeError(FUNC_ERROR_TEXT);
  28519. }
  28520. n = toInteger(n);
  28521. return function() {
  28522. if (--n > 0) {
  28523. result = func.apply(this, arguments);
  28524. }
  28525. if (n <= 1) {
  28526. func = undefined;
  28527. }
  28528. return result;
  28529. };
  28530. }
  28531. /**
  28532. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  28533. * and `partials` prepended to the arguments it receives.
  28534. *
  28535. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  28536. * may be used as a placeholder for partially applied arguments.
  28537. *
  28538. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  28539. * property of bound functions.
  28540. *
  28541. * @static
  28542. * @memberOf _
  28543. * @since 0.1.0
  28544. * @category Function
  28545. * @param {Function} func The function to bind.
  28546. * @param {*} thisArg The `this` binding of `func`.
  28547. * @param {...*} [partials] The arguments to be partially applied.
  28548. * @returns {Function} Returns the new bound function.
  28549. * @example
  28550. *
  28551. * function greet(greeting, punctuation) {
  28552. * return greeting + ' ' + this.user + punctuation;
  28553. * }
  28554. *
  28555. * var object = { 'user': 'fred' };
  28556. *
  28557. * var bound = _.bind(greet, object, 'hi');
  28558. * bound('!');
  28559. * // => 'hi fred!'
  28560. *
  28561. * // Bound with placeholders.
  28562. * var bound = _.bind(greet, object, _, '!');
  28563. * bound('hi');
  28564. * // => 'hi fred!'
  28565. */
  28566. var bind = baseRest(function(func, thisArg, partials) {
  28567. var bitmask = WRAP_BIND_FLAG;
  28568. if (partials.length) {
  28569. var holders = replaceHolders(partials, getHolder(bind));
  28570. bitmask |= WRAP_PARTIAL_FLAG;
  28571. }
  28572. return createWrap(func, bitmask, thisArg, partials, holders);
  28573. });
  28574. /**
  28575. * Creates a function that invokes the method at `object[key]` with `partials`
  28576. * prepended to the arguments it receives.
  28577. *
  28578. * This method differs from `_.bind` by allowing bound functions to reference
  28579. * methods that may be redefined or don't yet exist. See
  28580. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  28581. * for more details.
  28582. *
  28583. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  28584. * builds, may be used as a placeholder for partially applied arguments.
  28585. *
  28586. * @static
  28587. * @memberOf _
  28588. * @since 0.10.0
  28589. * @category Function
  28590. * @param {Object} object The object to invoke the method on.
  28591. * @param {string} key The key of the method.
  28592. * @param {...*} [partials] The arguments to be partially applied.
  28593. * @returns {Function} Returns the new bound function.
  28594. * @example
  28595. *
  28596. * var object = {
  28597. * 'user': 'fred',
  28598. * 'greet': function(greeting, punctuation) {
  28599. * return greeting + ' ' + this.user + punctuation;
  28600. * }
  28601. * };
  28602. *
  28603. * var bound = _.bindKey(object, 'greet', 'hi');
  28604. * bound('!');
  28605. * // => 'hi fred!'
  28606. *
  28607. * object.greet = function(greeting, punctuation) {
  28608. * return greeting + 'ya ' + this.user + punctuation;
  28609. * };
  28610. *
  28611. * bound('!');
  28612. * // => 'hiya fred!'
  28613. *
  28614. * // Bound with placeholders.
  28615. * var bound = _.bindKey(object, 'greet', _, '!');
  28616. * bound('hi');
  28617. * // => 'hiya fred!'
  28618. */
  28619. var bindKey = baseRest(function(object, key, partials) {
  28620. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  28621. if (partials.length) {
  28622. var holders = replaceHolders(partials, getHolder(bindKey));
  28623. bitmask |= WRAP_PARTIAL_FLAG;
  28624. }
  28625. return createWrap(key, bitmask, object, partials, holders);
  28626. });
  28627. /**
  28628. * Creates a function that accepts arguments of `func` and either invokes
  28629. * `func` returning its result, if at least `arity` number of arguments have
  28630. * been provided, or returns a function that accepts the remaining `func`
  28631. * arguments, and so on. The arity of `func` may be specified if `func.length`
  28632. * is not sufficient.
  28633. *
  28634. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  28635. * may be used as a placeholder for provided arguments.
  28636. *
  28637. * **Note:** This method doesn't set the "length" property of curried functions.
  28638. *
  28639. * @static
  28640. * @memberOf _
  28641. * @since 2.0.0
  28642. * @category Function
  28643. * @param {Function} func The function to curry.
  28644. * @param {number} [arity=func.length] The arity of `func`.
  28645. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28646. * @returns {Function} Returns the new curried function.
  28647. * @example
  28648. *
  28649. * var abc = function(a, b, c) {
  28650. * return [a, b, c];
  28651. * };
  28652. *
  28653. * var curried = _.curry(abc);
  28654. *
  28655. * curried(1)(2)(3);
  28656. * // => [1, 2, 3]
  28657. *
  28658. * curried(1, 2)(3);
  28659. * // => [1, 2, 3]
  28660. *
  28661. * curried(1, 2, 3);
  28662. * // => [1, 2, 3]
  28663. *
  28664. * // Curried with placeholders.
  28665. * curried(1)(_, 3)(2);
  28666. * // => [1, 2, 3]
  28667. */
  28668. function curry(func, arity, guard) {
  28669. arity = guard ? undefined : arity;
  28670. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  28671. result.placeholder = curry.placeholder;
  28672. return result;
  28673. }
  28674. /**
  28675. * This method is like `_.curry` except that arguments are applied to `func`
  28676. * in the manner of `_.partialRight` instead of `_.partial`.
  28677. *
  28678. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  28679. * builds, may be used as a placeholder for provided arguments.
  28680. *
  28681. * **Note:** This method doesn't set the "length" property of curried functions.
  28682. *
  28683. * @static
  28684. * @memberOf _
  28685. * @since 3.0.0
  28686. * @category Function
  28687. * @param {Function} func The function to curry.
  28688. * @param {number} [arity=func.length] The arity of `func`.
  28689. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28690. * @returns {Function} Returns the new curried function.
  28691. * @example
  28692. *
  28693. * var abc = function(a, b, c) {
  28694. * return [a, b, c];
  28695. * };
  28696. *
  28697. * var curried = _.curryRight(abc);
  28698. *
  28699. * curried(3)(2)(1);
  28700. * // => [1, 2, 3]
  28701. *
  28702. * curried(2, 3)(1);
  28703. * // => [1, 2, 3]
  28704. *
  28705. * curried(1, 2, 3);
  28706. * // => [1, 2, 3]
  28707. *
  28708. * // Curried with placeholders.
  28709. * curried(3)(1, _)(2);
  28710. * // => [1, 2, 3]
  28711. */
  28712. function curryRight(func, arity, guard) {
  28713. arity = guard ? undefined : arity;
  28714. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  28715. result.placeholder = curryRight.placeholder;
  28716. return result;
  28717. }
  28718. /**
  28719. * Creates a debounced function that delays invoking `func` until after `wait`
  28720. * milliseconds have elapsed since the last time the debounced function was
  28721. * invoked. The debounced function comes with a `cancel` method to cancel
  28722. * delayed `func` invocations and a `flush` method to immediately invoke them.
  28723. * Provide `options` to indicate whether `func` should be invoked on the
  28724. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  28725. * with the last arguments provided to the debounced function. Subsequent
  28726. * calls to the debounced function return the result of the last `func`
  28727. * invocation.
  28728. *
  28729. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  28730. * invoked on the trailing edge of the timeout only if the debounced function
  28731. * is invoked more than once during the `wait` timeout.
  28732. *
  28733. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  28734. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  28735. *
  28736. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  28737. * for details over the differences between `_.debounce` and `_.throttle`.
  28738. *
  28739. * @static
  28740. * @memberOf _
  28741. * @since 0.1.0
  28742. * @category Function
  28743. * @param {Function} func The function to debounce.
  28744. * @param {number} [wait=0] The number of milliseconds to delay.
  28745. * @param {Object} [options={}] The options object.
  28746. * @param {boolean} [options.leading=false]
  28747. * Specify invoking on the leading edge of the timeout.
  28748. * @param {number} [options.maxWait]
  28749. * The maximum time `func` is allowed to be delayed before it's invoked.
  28750. * @param {boolean} [options.trailing=true]
  28751. * Specify invoking on the trailing edge of the timeout.
  28752. * @returns {Function} Returns the new debounced function.
  28753. * @example
  28754. *
  28755. * // Avoid costly calculations while the window size is in flux.
  28756. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  28757. *
  28758. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  28759. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  28760. * 'leading': true,
  28761. * 'trailing': false
  28762. * }));
  28763. *
  28764. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  28765. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  28766. * var source = new EventSource('/stream');
  28767. * jQuery(source).on('message', debounced);
  28768. *
  28769. * // Cancel the trailing debounced invocation.
  28770. * jQuery(window).on('popstate', debounced.cancel);
  28771. */
  28772. function debounce(func, wait, options) {
  28773. var lastArgs,
  28774. lastThis,
  28775. maxWait,
  28776. result,
  28777. timerId,
  28778. lastCallTime,
  28779. lastInvokeTime = 0,
  28780. leading = false,
  28781. maxing = false,
  28782. trailing = true;
  28783. if (typeof func != 'function') {
  28784. throw new TypeError(FUNC_ERROR_TEXT);
  28785. }
  28786. wait = toNumber(wait) || 0;
  28787. if (isObject(options)) {
  28788. leading = !!options.leading;
  28789. maxing = 'maxWait' in options;
  28790. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  28791. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28792. }
  28793. function invokeFunc(time) {
  28794. var args = lastArgs,
  28795. thisArg = lastThis;
  28796. lastArgs = lastThis = undefined;
  28797. lastInvokeTime = time;
  28798. result = func.apply(thisArg, args);
  28799. return result;
  28800. }
  28801. function leadingEdge(time) {
  28802. // Reset any `maxWait` timer.
  28803. lastInvokeTime = time;
  28804. // Start the timer for the trailing edge.
  28805. timerId = setTimeout(timerExpired, wait);
  28806. // Invoke the leading edge.
  28807. return leading ? invokeFunc(time) : result;
  28808. }
  28809. function remainingWait(time) {
  28810. var timeSinceLastCall = time - lastCallTime,
  28811. timeSinceLastInvoke = time - lastInvokeTime,
  28812. timeWaiting = wait - timeSinceLastCall;
  28813. return maxing
  28814. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  28815. : timeWaiting;
  28816. }
  28817. function shouldInvoke(time) {
  28818. var timeSinceLastCall = time - lastCallTime,
  28819. timeSinceLastInvoke = time - lastInvokeTime;
  28820. // Either this is the first call, activity has stopped and we're at the
  28821. // trailing edge, the system time has gone backwards and we're treating
  28822. // it as the trailing edge, or we've hit the `maxWait` limit.
  28823. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  28824. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  28825. }
  28826. function timerExpired() {
  28827. var time = now();
  28828. if (shouldInvoke(time)) {
  28829. return trailingEdge(time);
  28830. }
  28831. // Restart the timer.
  28832. timerId = setTimeout(timerExpired, remainingWait(time));
  28833. }
  28834. function trailingEdge(time) {
  28835. timerId = undefined;
  28836. // Only invoke if we have `lastArgs` which means `func` has been
  28837. // debounced at least once.
  28838. if (trailing && lastArgs) {
  28839. return invokeFunc(time);
  28840. }
  28841. lastArgs = lastThis = undefined;
  28842. return result;
  28843. }
  28844. function cancel() {
  28845. if (timerId !== undefined) {
  28846. clearTimeout(timerId);
  28847. }
  28848. lastInvokeTime = 0;
  28849. lastArgs = lastCallTime = lastThis = timerId = undefined;
  28850. }
  28851. function flush() {
  28852. return timerId === undefined ? result : trailingEdge(now());
  28853. }
  28854. function debounced() {
  28855. var time = now(),
  28856. isInvoking = shouldInvoke(time);
  28857. lastArgs = arguments;
  28858. lastThis = this;
  28859. lastCallTime = time;
  28860. if (isInvoking) {
  28861. if (timerId === undefined) {
  28862. return leadingEdge(lastCallTime);
  28863. }
  28864. if (maxing) {
  28865. // Handle invocations in a tight loop.
  28866. clearTimeout(timerId);
  28867. timerId = setTimeout(timerExpired, wait);
  28868. return invokeFunc(lastCallTime);
  28869. }
  28870. }
  28871. if (timerId === undefined) {
  28872. timerId = setTimeout(timerExpired, wait);
  28873. }
  28874. return result;
  28875. }
  28876. debounced.cancel = cancel;
  28877. debounced.flush = flush;
  28878. return debounced;
  28879. }
  28880. /**
  28881. * Defers invoking the `func` until the current call stack has cleared. Any
  28882. * additional arguments are provided to `func` when it's invoked.
  28883. *
  28884. * @static
  28885. * @memberOf _
  28886. * @since 0.1.0
  28887. * @category Function
  28888. * @param {Function} func The function to defer.
  28889. * @param {...*} [args] The arguments to invoke `func` with.
  28890. * @returns {number} Returns the timer id.
  28891. * @example
  28892. *
  28893. * _.defer(function(text) {
  28894. * console.log(text);
  28895. * }, 'deferred');
  28896. * // => Logs 'deferred' after one millisecond.
  28897. */
  28898. var defer = baseRest(function(func, args) {
  28899. return baseDelay(func, 1, args);
  28900. });
  28901. /**
  28902. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  28903. * provided to `func` when it's invoked.
  28904. *
  28905. * @static
  28906. * @memberOf _
  28907. * @since 0.1.0
  28908. * @category Function
  28909. * @param {Function} func The function to delay.
  28910. * @param {number} wait The number of milliseconds to delay invocation.
  28911. * @param {...*} [args] The arguments to invoke `func` with.
  28912. * @returns {number} Returns the timer id.
  28913. * @example
  28914. *
  28915. * _.delay(function(text) {
  28916. * console.log(text);
  28917. * }, 1000, 'later');
  28918. * // => Logs 'later' after one second.
  28919. */
  28920. var delay = baseRest(function(func, wait, args) {
  28921. return baseDelay(func, toNumber(wait) || 0, args);
  28922. });
  28923. /**
  28924. * Creates a function that invokes `func` with arguments reversed.
  28925. *
  28926. * @static
  28927. * @memberOf _
  28928. * @since 4.0.0
  28929. * @category Function
  28930. * @param {Function} func The function to flip arguments for.
  28931. * @returns {Function} Returns the new flipped function.
  28932. * @example
  28933. *
  28934. * var flipped = _.flip(function() {
  28935. * return _.toArray(arguments);
  28936. * });
  28937. *
  28938. * flipped('a', 'b', 'c', 'd');
  28939. * // => ['d', 'c', 'b', 'a']
  28940. */
  28941. function flip(func) {
  28942. return createWrap(func, WRAP_FLIP_FLAG);
  28943. }
  28944. /**
  28945. * Creates a function that memoizes the result of `func`. If `resolver` is
  28946. * provided, it determines the cache key for storing the result based on the
  28947. * arguments provided to the memoized function. By default, the first argument
  28948. * provided to the memoized function is used as the map cache key. The `func`
  28949. * is invoked with the `this` binding of the memoized function.
  28950. *
  28951. * **Note:** The cache is exposed as the `cache` property on the memoized
  28952. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  28953. * constructor with one whose instances implement the
  28954. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  28955. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  28956. *
  28957. * @static
  28958. * @memberOf _
  28959. * @since 0.1.0
  28960. * @category Function
  28961. * @param {Function} func The function to have its output memoized.
  28962. * @param {Function} [resolver] The function to resolve the cache key.
  28963. * @returns {Function} Returns the new memoized function.
  28964. * @example
  28965. *
  28966. * var object = { 'a': 1, 'b': 2 };
  28967. * var other = { 'c': 3, 'd': 4 };
  28968. *
  28969. * var values = _.memoize(_.values);
  28970. * values(object);
  28971. * // => [1, 2]
  28972. *
  28973. * values(other);
  28974. * // => [3, 4]
  28975. *
  28976. * object.a = 2;
  28977. * values(object);
  28978. * // => [1, 2]
  28979. *
  28980. * // Modify the result cache.
  28981. * values.cache.set(object, ['a', 'b']);
  28982. * values(object);
  28983. * // => ['a', 'b']
  28984. *
  28985. * // Replace `_.memoize.Cache`.
  28986. * _.memoize.Cache = WeakMap;
  28987. */
  28988. function memoize(func, resolver) {
  28989. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  28990. throw new TypeError(FUNC_ERROR_TEXT);
  28991. }
  28992. var memoized = function() {
  28993. var args = arguments,
  28994. key = resolver ? resolver.apply(this, args) : args[0],
  28995. cache = memoized.cache;
  28996. if (cache.has(key)) {
  28997. return cache.get(key);
  28998. }
  28999. var result = func.apply(this, args);
  29000. memoized.cache = cache.set(key, result) || cache;
  29001. return result;
  29002. };
  29003. memoized.cache = new (memoize.Cache || MapCache);
  29004. return memoized;
  29005. }
  29006. // Expose `MapCache`.
  29007. memoize.Cache = MapCache;
  29008. /**
  29009. * Creates a function that negates the result of the predicate `func`. The
  29010. * `func` predicate is invoked with the `this` binding and arguments of the
  29011. * created function.
  29012. *
  29013. * @static
  29014. * @memberOf _
  29015. * @since 3.0.0
  29016. * @category Function
  29017. * @param {Function} predicate The predicate to negate.
  29018. * @returns {Function} Returns the new negated function.
  29019. * @example
  29020. *
  29021. * function isEven(n) {
  29022. * return n % 2 == 0;
  29023. * }
  29024. *
  29025. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  29026. * // => [1, 3, 5]
  29027. */
  29028. function negate(predicate) {
  29029. if (typeof predicate != 'function') {
  29030. throw new TypeError(FUNC_ERROR_TEXT);
  29031. }
  29032. return function() {
  29033. var args = arguments;
  29034. switch (args.length) {
  29035. case 0: return !predicate.call(this);
  29036. case 1: return !predicate.call(this, args[0]);
  29037. case 2: return !predicate.call(this, args[0], args[1]);
  29038. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  29039. }
  29040. return !predicate.apply(this, args);
  29041. };
  29042. }
  29043. /**
  29044. * Creates a function that is restricted to invoking `func` once. Repeat calls
  29045. * to the function return the value of the first invocation. The `func` is
  29046. * invoked with the `this` binding and arguments of the created function.
  29047. *
  29048. * @static
  29049. * @memberOf _
  29050. * @since 0.1.0
  29051. * @category Function
  29052. * @param {Function} func The function to restrict.
  29053. * @returns {Function} Returns the new restricted function.
  29054. * @example
  29055. *
  29056. * var initialize = _.once(createApplication);
  29057. * initialize();
  29058. * initialize();
  29059. * // => `createApplication` is invoked once
  29060. */
  29061. function once(func) {
  29062. return before(2, func);
  29063. }
  29064. /**
  29065. * Creates a function that invokes `func` with its arguments transformed.
  29066. *
  29067. * @static
  29068. * @since 4.0.0
  29069. * @memberOf _
  29070. * @category Function
  29071. * @param {Function} func The function to wrap.
  29072. * @param {...(Function|Function[])} [transforms=[_.identity]]
  29073. * The argument transforms.
  29074. * @returns {Function} Returns the new function.
  29075. * @example
  29076. *
  29077. * function doubled(n) {
  29078. * return n * 2;
  29079. * }
  29080. *
  29081. * function square(n) {
  29082. * return n * n;
  29083. * }
  29084. *
  29085. * var func = _.overArgs(function(x, y) {
  29086. * return [x, y];
  29087. * }, [square, doubled]);
  29088. *
  29089. * func(9, 3);
  29090. * // => [81, 6]
  29091. *
  29092. * func(10, 5);
  29093. * // => [100, 10]
  29094. */
  29095. var overArgs = castRest(function(func, transforms) {
  29096. transforms = (transforms.length == 1 && isArray(transforms[0]))
  29097. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  29098. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  29099. var funcsLength = transforms.length;
  29100. return baseRest(function(args) {
  29101. var index = -1,
  29102. length = nativeMin(args.length, funcsLength);
  29103. while (++index < length) {
  29104. args[index] = transforms[index].call(this, args[index]);
  29105. }
  29106. return apply(func, this, args);
  29107. });
  29108. });
  29109. /**
  29110. * Creates a function that invokes `func` with `partials` prepended to the
  29111. * arguments it receives. This method is like `_.bind` except it does **not**
  29112. * alter the `this` binding.
  29113. *
  29114. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  29115. * builds, may be used as a placeholder for partially applied arguments.
  29116. *
  29117. * **Note:** This method doesn't set the "length" property of partially
  29118. * applied functions.
  29119. *
  29120. * @static
  29121. * @memberOf _
  29122. * @since 0.2.0
  29123. * @category Function
  29124. * @param {Function} func The function to partially apply arguments to.
  29125. * @param {...*} [partials] The arguments to be partially applied.
  29126. * @returns {Function} Returns the new partially applied function.
  29127. * @example
  29128. *
  29129. * function greet(greeting, name) {
  29130. * return greeting + ' ' + name;
  29131. * }
  29132. *
  29133. * var sayHelloTo = _.partial(greet, 'hello');
  29134. * sayHelloTo('fred');
  29135. * // => 'hello fred'
  29136. *
  29137. * // Partially applied with placeholders.
  29138. * var greetFred = _.partial(greet, _, 'fred');
  29139. * greetFred('hi');
  29140. * // => 'hi fred'
  29141. */
  29142. var partial = baseRest(function(func, partials) {
  29143. var holders = replaceHolders(partials, getHolder(partial));
  29144. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  29145. });
  29146. /**
  29147. * This method is like `_.partial` except that partially applied arguments
  29148. * are appended to the arguments it receives.
  29149. *
  29150. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  29151. * builds, may be used as a placeholder for partially applied arguments.
  29152. *
  29153. * **Note:** This method doesn't set the "length" property of partially
  29154. * applied functions.
  29155. *
  29156. * @static
  29157. * @memberOf _
  29158. * @since 1.0.0
  29159. * @category Function
  29160. * @param {Function} func The function to partially apply arguments to.
  29161. * @param {...*} [partials] The arguments to be partially applied.
  29162. * @returns {Function} Returns the new partially applied function.
  29163. * @example
  29164. *
  29165. * function greet(greeting, name) {
  29166. * return greeting + ' ' + name;
  29167. * }
  29168. *
  29169. * var greetFred = _.partialRight(greet, 'fred');
  29170. * greetFred('hi');
  29171. * // => 'hi fred'
  29172. *
  29173. * // Partially applied with placeholders.
  29174. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  29175. * sayHelloTo('fred');
  29176. * // => 'hello fred'
  29177. */
  29178. var partialRight = baseRest(function(func, partials) {
  29179. var holders = replaceHolders(partials, getHolder(partialRight));
  29180. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  29181. });
  29182. /**
  29183. * Creates a function that invokes `func` with arguments arranged according
  29184. * to the specified `indexes` where the argument value at the first index is
  29185. * provided as the first argument, the argument value at the second index is
  29186. * provided as the second argument, and so on.
  29187. *
  29188. * @static
  29189. * @memberOf _
  29190. * @since 3.0.0
  29191. * @category Function
  29192. * @param {Function} func The function to rearrange arguments for.
  29193. * @param {...(number|number[])} indexes The arranged argument indexes.
  29194. * @returns {Function} Returns the new function.
  29195. * @example
  29196. *
  29197. * var rearged = _.rearg(function(a, b, c) {
  29198. * return [a, b, c];
  29199. * }, [2, 0, 1]);
  29200. *
  29201. * rearged('b', 'c', 'a')
  29202. * // => ['a', 'b', 'c']
  29203. */
  29204. var rearg = flatRest(function(func, indexes) {
  29205. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  29206. });
  29207. /**
  29208. * Creates a function that invokes `func` with the `this` binding of the
  29209. * created function and arguments from `start` and beyond provided as
  29210. * an array.
  29211. *
  29212. * **Note:** This method is based on the
  29213. * [rest parameter](https://mdn.io/rest_parameters).
  29214. *
  29215. * @static
  29216. * @memberOf _
  29217. * @since 4.0.0
  29218. * @category Function
  29219. * @param {Function} func The function to apply a rest parameter to.
  29220. * @param {number} [start=func.length-1] The start position of the rest parameter.
  29221. * @returns {Function} Returns the new function.
  29222. * @example
  29223. *
  29224. * var say = _.rest(function(what, names) {
  29225. * return what + ' ' + _.initial(names).join(', ') +
  29226. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  29227. * });
  29228. *
  29229. * say('hello', 'fred', 'barney', 'pebbles');
  29230. * // => 'hello fred, barney, & pebbles'
  29231. */
  29232. function rest(func, start) {
  29233. if (typeof func != 'function') {
  29234. throw new TypeError(FUNC_ERROR_TEXT);
  29235. }
  29236. start = start === undefined ? start : toInteger(start);
  29237. return baseRest(func, start);
  29238. }
  29239. /**
  29240. * Creates a function that invokes `func` with the `this` binding of the
  29241. * create function and an array of arguments much like
  29242. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  29243. *
  29244. * **Note:** This method is based on the
  29245. * [spread operator](https://mdn.io/spread_operator).
  29246. *
  29247. * @static
  29248. * @memberOf _
  29249. * @since 3.2.0
  29250. * @category Function
  29251. * @param {Function} func The function to spread arguments over.
  29252. * @param {number} [start=0] The start position of the spread.
  29253. * @returns {Function} Returns the new function.
  29254. * @example
  29255. *
  29256. * var say = _.spread(function(who, what) {
  29257. * return who + ' says ' + what;
  29258. * });
  29259. *
  29260. * say(['fred', 'hello']);
  29261. * // => 'fred says hello'
  29262. *
  29263. * var numbers = Promise.all([
  29264. * Promise.resolve(40),
  29265. * Promise.resolve(36)
  29266. * ]);
  29267. *
  29268. * numbers.then(_.spread(function(x, y) {
  29269. * return x + y;
  29270. * }));
  29271. * // => a Promise of 76
  29272. */
  29273. function spread(func, start) {
  29274. if (typeof func != 'function') {
  29275. throw new TypeError(FUNC_ERROR_TEXT);
  29276. }
  29277. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  29278. return baseRest(function(args) {
  29279. var array = args[start],
  29280. otherArgs = castSlice(args, 0, start);
  29281. if (array) {
  29282. arrayPush(otherArgs, array);
  29283. }
  29284. return apply(func, this, otherArgs);
  29285. });
  29286. }
  29287. /**
  29288. * Creates a throttled function that only invokes `func` at most once per
  29289. * every `wait` milliseconds. The throttled function comes with a `cancel`
  29290. * method to cancel delayed `func` invocations and a `flush` method to
  29291. * immediately invoke them. Provide `options` to indicate whether `func`
  29292. * should be invoked on the leading and/or trailing edge of the `wait`
  29293. * timeout. The `func` is invoked with the last arguments provided to the
  29294. * throttled function. Subsequent calls to the throttled function return the
  29295. * result of the last `func` invocation.
  29296. *
  29297. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  29298. * invoked on the trailing edge of the timeout only if the throttled function
  29299. * is invoked more than once during the `wait` timeout.
  29300. *
  29301. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  29302. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  29303. *
  29304. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  29305. * for details over the differences between `_.throttle` and `_.debounce`.
  29306. *
  29307. * @static
  29308. * @memberOf _
  29309. * @since 0.1.0
  29310. * @category Function
  29311. * @param {Function} func The function to throttle.
  29312. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  29313. * @param {Object} [options={}] The options object.
  29314. * @param {boolean} [options.leading=true]
  29315. * Specify invoking on the leading edge of the timeout.
  29316. * @param {boolean} [options.trailing=true]
  29317. * Specify invoking on the trailing edge of the timeout.
  29318. * @returns {Function} Returns the new throttled function.
  29319. * @example
  29320. *
  29321. * // Avoid excessively updating the position while scrolling.
  29322. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  29323. *
  29324. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  29325. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  29326. * jQuery(element).on('click', throttled);
  29327. *
  29328. * // Cancel the trailing throttled invocation.
  29329. * jQuery(window).on('popstate', throttled.cancel);
  29330. */
  29331. function throttle(func, wait, options) {
  29332. var leading = true,
  29333. trailing = true;
  29334. if (typeof func != 'function') {
  29335. throw new TypeError(FUNC_ERROR_TEXT);
  29336. }
  29337. if (isObject(options)) {
  29338. leading = 'leading' in options ? !!options.leading : leading;
  29339. trailing = 'trailing' in options ? !!options.trailing : trailing;
  29340. }
  29341. return debounce(func, wait, {
  29342. 'leading': leading,
  29343. 'maxWait': wait,
  29344. 'trailing': trailing
  29345. });
  29346. }
  29347. /**
  29348. * Creates a function that accepts up to one argument, ignoring any
  29349. * additional arguments.
  29350. *
  29351. * @static
  29352. * @memberOf _
  29353. * @since 4.0.0
  29354. * @category Function
  29355. * @param {Function} func The function to cap arguments for.
  29356. * @returns {Function} Returns the new capped function.
  29357. * @example
  29358. *
  29359. * _.map(['6', '8', '10'], _.unary(parseInt));
  29360. * // => [6, 8, 10]
  29361. */
  29362. function unary(func) {
  29363. return ary(func, 1);
  29364. }
  29365. /**
  29366. * Creates a function that provides `value` to `wrapper` as its first
  29367. * argument. Any additional arguments provided to the function are appended
  29368. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  29369. * binding of the created function.
  29370. *
  29371. * @static
  29372. * @memberOf _
  29373. * @since 0.1.0
  29374. * @category Function
  29375. * @param {*} value The value to wrap.
  29376. * @param {Function} [wrapper=identity] The wrapper function.
  29377. * @returns {Function} Returns the new function.
  29378. * @example
  29379. *
  29380. * var p = _.wrap(_.escape, function(func, text) {
  29381. * return '<p>' + func(text) + '</p>';
  29382. * });
  29383. *
  29384. * p('fred, barney, & pebbles');
  29385. * // => '<p>fred, barney, &amp; pebbles</p>'
  29386. */
  29387. function wrap(value, wrapper) {
  29388. return partial(castFunction(wrapper), value);
  29389. }
  29390. /*------------------------------------------------------------------------*/
  29391. /**
  29392. * Casts `value` as an array if it's not one.
  29393. *
  29394. * @static
  29395. * @memberOf _
  29396. * @since 4.4.0
  29397. * @category Lang
  29398. * @param {*} value The value to inspect.
  29399. * @returns {Array} Returns the cast array.
  29400. * @example
  29401. *
  29402. * _.castArray(1);
  29403. * // => [1]
  29404. *
  29405. * _.castArray({ 'a': 1 });
  29406. * // => [{ 'a': 1 }]
  29407. *
  29408. * _.castArray('abc');
  29409. * // => ['abc']
  29410. *
  29411. * _.castArray(null);
  29412. * // => [null]
  29413. *
  29414. * _.castArray(undefined);
  29415. * // => [undefined]
  29416. *
  29417. * _.castArray();
  29418. * // => []
  29419. *
  29420. * var array = [1, 2, 3];
  29421. * console.log(_.castArray(array) === array);
  29422. * // => true
  29423. */
  29424. function castArray() {
  29425. if (!arguments.length) {
  29426. return [];
  29427. }
  29428. var value = arguments[0];
  29429. return isArray(value) ? value : [value];
  29430. }
  29431. /**
  29432. * Creates a shallow clone of `value`.
  29433. *
  29434. * **Note:** This method is loosely based on the
  29435. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  29436. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  29437. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  29438. * arrays. The own enumerable properties of `arguments` objects are cloned
  29439. * as plain objects. An empty object is returned for uncloneable values such
  29440. * as error objects, functions, DOM nodes, and WeakMaps.
  29441. *
  29442. * @static
  29443. * @memberOf _
  29444. * @since 0.1.0
  29445. * @category Lang
  29446. * @param {*} value The value to clone.
  29447. * @returns {*} Returns the cloned value.
  29448. * @see _.cloneDeep
  29449. * @example
  29450. *
  29451. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  29452. *
  29453. * var shallow = _.clone(objects);
  29454. * console.log(shallow[0] === objects[0]);
  29455. * // => true
  29456. */
  29457. function clone(value) {
  29458. return baseClone(value, CLONE_SYMBOLS_FLAG);
  29459. }
  29460. /**
  29461. * This method is like `_.clone` except that it accepts `customizer` which
  29462. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  29463. * cloning is handled by the method instead. The `customizer` is invoked with
  29464. * up to four arguments; (value [, index|key, object, stack]).
  29465. *
  29466. * @static
  29467. * @memberOf _
  29468. * @since 4.0.0
  29469. * @category Lang
  29470. * @param {*} value The value to clone.
  29471. * @param {Function} [customizer] The function to customize cloning.
  29472. * @returns {*} Returns the cloned value.
  29473. * @see _.cloneDeepWith
  29474. * @example
  29475. *
  29476. * function customizer(value) {
  29477. * if (_.isElement(value)) {
  29478. * return value.cloneNode(false);
  29479. * }
  29480. * }
  29481. *
  29482. * var el = _.cloneWith(document.body, customizer);
  29483. *
  29484. * console.log(el === document.body);
  29485. * // => false
  29486. * console.log(el.nodeName);
  29487. * // => 'BODY'
  29488. * console.log(el.childNodes.length);
  29489. * // => 0
  29490. */
  29491. function cloneWith(value, customizer) {
  29492. customizer = typeof customizer == 'function' ? customizer : undefined;
  29493. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  29494. }
  29495. /**
  29496. * This method is like `_.clone` except that it recursively clones `value`.
  29497. *
  29498. * @static
  29499. * @memberOf _
  29500. * @since 1.0.0
  29501. * @category Lang
  29502. * @param {*} value The value to recursively clone.
  29503. * @returns {*} Returns the deep cloned value.
  29504. * @see _.clone
  29505. * @example
  29506. *
  29507. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  29508. *
  29509. * var deep = _.cloneDeep(objects);
  29510. * console.log(deep[0] === objects[0]);
  29511. * // => false
  29512. */
  29513. function cloneDeep(value) {
  29514. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  29515. }
  29516. /**
  29517. * This method is like `_.cloneWith` except that it recursively clones `value`.
  29518. *
  29519. * @static
  29520. * @memberOf _
  29521. * @since 4.0.0
  29522. * @category Lang
  29523. * @param {*} value The value to recursively clone.
  29524. * @param {Function} [customizer] The function to customize cloning.
  29525. * @returns {*} Returns the deep cloned value.
  29526. * @see _.cloneWith
  29527. * @example
  29528. *
  29529. * function customizer(value) {
  29530. * if (_.isElement(value)) {
  29531. * return value.cloneNode(true);
  29532. * }
  29533. * }
  29534. *
  29535. * var el = _.cloneDeepWith(document.body, customizer);
  29536. *
  29537. * console.log(el === document.body);
  29538. * // => false
  29539. * console.log(el.nodeName);
  29540. * // => 'BODY'
  29541. * console.log(el.childNodes.length);
  29542. * // => 20
  29543. */
  29544. function cloneDeepWith(value, customizer) {
  29545. customizer = typeof customizer == 'function' ? customizer : undefined;
  29546. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  29547. }
  29548. /**
  29549. * Checks if `object` conforms to `source` by invoking the predicate
  29550. * properties of `source` with the corresponding property values of `object`.
  29551. *
  29552. * **Note:** This method is equivalent to `_.conforms` when `source` is
  29553. * partially applied.
  29554. *
  29555. * @static
  29556. * @memberOf _
  29557. * @since 4.14.0
  29558. * @category Lang
  29559. * @param {Object} object The object to inspect.
  29560. * @param {Object} source The object of property predicates to conform to.
  29561. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  29562. * @example
  29563. *
  29564. * var object = { 'a': 1, 'b': 2 };
  29565. *
  29566. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  29567. * // => true
  29568. *
  29569. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  29570. * // => false
  29571. */
  29572. function conformsTo(object, source) {
  29573. return source == null || baseConformsTo(object, source, keys(source));
  29574. }
  29575. /**
  29576. * Performs a
  29577. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  29578. * comparison between two values to determine if they are equivalent.
  29579. *
  29580. * @static
  29581. * @memberOf _
  29582. * @since 4.0.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. * _.eq(object, object);
  29593. * // => true
  29594. *
  29595. * _.eq(object, other);
  29596. * // => false
  29597. *
  29598. * _.eq('a', 'a');
  29599. * // => true
  29600. *
  29601. * _.eq('a', Object('a'));
  29602. * // => false
  29603. *
  29604. * _.eq(NaN, NaN);
  29605. * // => true
  29606. */
  29607. function eq(value, other) {
  29608. return value === other || (value !== value && other !== other);
  29609. }
  29610. /**
  29611. * Checks if `value` is greater than `other`.
  29612. *
  29613. * @static
  29614. * @memberOf _
  29615. * @since 3.9.0
  29616. * @category Lang
  29617. * @param {*} value The value to compare.
  29618. * @param {*} other The other value to compare.
  29619. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  29620. * else `false`.
  29621. * @see _.lt
  29622. * @example
  29623. *
  29624. * _.gt(3, 1);
  29625. * // => true
  29626. *
  29627. * _.gt(3, 3);
  29628. * // => false
  29629. *
  29630. * _.gt(1, 3);
  29631. * // => false
  29632. */
  29633. var gt = createRelationalOperation(baseGt);
  29634. /**
  29635. * Checks if `value` is greater than or equal to `other`.
  29636. *
  29637. * @static
  29638. * @memberOf _
  29639. * @since 3.9.0
  29640. * @category Lang
  29641. * @param {*} value The value to compare.
  29642. * @param {*} other The other value to compare.
  29643. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  29644. * `other`, else `false`.
  29645. * @see _.lte
  29646. * @example
  29647. *
  29648. * _.gte(3, 1);
  29649. * // => true
  29650. *
  29651. * _.gte(3, 3);
  29652. * // => true
  29653. *
  29654. * _.gte(1, 3);
  29655. * // => false
  29656. */
  29657. var gte = createRelationalOperation(function(value, other) {
  29658. return value >= other;
  29659. });
  29660. /**
  29661. * Checks if `value` is likely an `arguments` object.
  29662. *
  29663. * @static
  29664. * @memberOf _
  29665. * @since 0.1.0
  29666. * @category Lang
  29667. * @param {*} value The value to check.
  29668. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  29669. * else `false`.
  29670. * @example
  29671. *
  29672. * _.isArguments(function() { return arguments; }());
  29673. * // => true
  29674. *
  29675. * _.isArguments([1, 2, 3]);
  29676. * // => false
  29677. */
  29678. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  29679. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  29680. !propertyIsEnumerable.call(value, 'callee');
  29681. };
  29682. /**
  29683. * Checks if `value` is classified as an `Array` object.
  29684. *
  29685. * @static
  29686. * @memberOf _
  29687. * @since 0.1.0
  29688. * @category Lang
  29689. * @param {*} value The value to check.
  29690. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  29691. * @example
  29692. *
  29693. * _.isArray([1, 2, 3]);
  29694. * // => true
  29695. *
  29696. * _.isArray(document.body.children);
  29697. * // => false
  29698. *
  29699. * _.isArray('abc');
  29700. * // => false
  29701. *
  29702. * _.isArray(_.noop);
  29703. * // => false
  29704. */
  29705. var isArray = Array.isArray;
  29706. /**
  29707. * Checks if `value` is classified as an `ArrayBuffer` object.
  29708. *
  29709. * @static
  29710. * @memberOf _
  29711. * @since 4.3.0
  29712. * @category Lang
  29713. * @param {*} value The value to check.
  29714. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  29715. * @example
  29716. *
  29717. * _.isArrayBuffer(new ArrayBuffer(2));
  29718. * // => true
  29719. *
  29720. * _.isArrayBuffer(new Array(2));
  29721. * // => false
  29722. */
  29723. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  29724. /**
  29725. * Checks if `value` is array-like. A value is considered array-like if it's
  29726. * not a function and has a `value.length` that's an integer greater than or
  29727. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  29728. *
  29729. * @static
  29730. * @memberOf _
  29731. * @since 4.0.0
  29732. * @category Lang
  29733. * @param {*} value The value to check.
  29734. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  29735. * @example
  29736. *
  29737. * _.isArrayLike([1, 2, 3]);
  29738. * // => true
  29739. *
  29740. * _.isArrayLike(document.body.children);
  29741. * // => true
  29742. *
  29743. * _.isArrayLike('abc');
  29744. * // => true
  29745. *
  29746. * _.isArrayLike(_.noop);
  29747. * // => false
  29748. */
  29749. function isArrayLike(value) {
  29750. return value != null && isLength(value.length) && !isFunction(value);
  29751. }
  29752. /**
  29753. * This method is like `_.isArrayLike` except that it also checks if `value`
  29754. * is an object.
  29755. *
  29756. * @static
  29757. * @memberOf _
  29758. * @since 4.0.0
  29759. * @category Lang
  29760. * @param {*} value The value to check.
  29761. * @returns {boolean} Returns `true` if `value` is an array-like object,
  29762. * else `false`.
  29763. * @example
  29764. *
  29765. * _.isArrayLikeObject([1, 2, 3]);
  29766. * // => true
  29767. *
  29768. * _.isArrayLikeObject(document.body.children);
  29769. * // => true
  29770. *
  29771. * _.isArrayLikeObject('abc');
  29772. * // => false
  29773. *
  29774. * _.isArrayLikeObject(_.noop);
  29775. * // => false
  29776. */
  29777. function isArrayLikeObject(value) {
  29778. return isObjectLike(value) && isArrayLike(value);
  29779. }
  29780. /**
  29781. * Checks if `value` is classified as a boolean primitive or object.
  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 a boolean, else `false`.
  29789. * @example
  29790. *
  29791. * _.isBoolean(false);
  29792. * // => true
  29793. *
  29794. * _.isBoolean(null);
  29795. * // => false
  29796. */
  29797. function isBoolean(value) {
  29798. return value === true || value === false ||
  29799. (isObjectLike(value) && baseGetTag(value) == boolTag);
  29800. }
  29801. /**
  29802. * Checks if `value` is a buffer.
  29803. *
  29804. * @static
  29805. * @memberOf _
  29806. * @since 4.3.0
  29807. * @category Lang
  29808. * @param {*} value The value to check.
  29809. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  29810. * @example
  29811. *
  29812. * _.isBuffer(new Buffer(2));
  29813. * // => true
  29814. *
  29815. * _.isBuffer(new Uint8Array(2));
  29816. * // => false
  29817. */
  29818. var isBuffer = nativeIsBuffer || stubFalse;
  29819. /**
  29820. * Checks if `value` is classified as a `Date` object.
  29821. *
  29822. * @static
  29823. * @memberOf _
  29824. * @since 0.1.0
  29825. * @category Lang
  29826. * @param {*} value The value to check.
  29827. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  29828. * @example
  29829. *
  29830. * _.isDate(new Date);
  29831. * // => true
  29832. *
  29833. * _.isDate('Mon April 23 2012');
  29834. * // => false
  29835. */
  29836. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  29837. /**
  29838. * Checks if `value` is likely a DOM element.
  29839. *
  29840. * @static
  29841. * @memberOf _
  29842. * @since 0.1.0
  29843. * @category Lang
  29844. * @param {*} value The value to check.
  29845. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  29846. * @example
  29847. *
  29848. * _.isElement(document.body);
  29849. * // => true
  29850. *
  29851. * _.isElement('<body>');
  29852. * // => false
  29853. */
  29854. function isElement(value) {
  29855. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  29856. }
  29857. /**
  29858. * Checks if `value` is an empty object, collection, map, or set.
  29859. *
  29860. * Objects are considered empty if they have no own enumerable string keyed
  29861. * properties.
  29862. *
  29863. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  29864. * jQuery-like collections are considered empty if they have a `length` of `0`.
  29865. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  29866. *
  29867. * @static
  29868. * @memberOf _
  29869. * @since 0.1.0
  29870. * @category Lang
  29871. * @param {*} value The value to check.
  29872. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  29873. * @example
  29874. *
  29875. * _.isEmpty(null);
  29876. * // => true
  29877. *
  29878. * _.isEmpty(true);
  29879. * // => true
  29880. *
  29881. * _.isEmpty(1);
  29882. * // => true
  29883. *
  29884. * _.isEmpty([1, 2, 3]);
  29885. * // => false
  29886. *
  29887. * _.isEmpty({ 'a': 1 });
  29888. * // => false
  29889. */
  29890. function isEmpty(value) {
  29891. if (value == null) {
  29892. return true;
  29893. }
  29894. if (isArrayLike(value) &&
  29895. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  29896. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  29897. return !value.length;
  29898. }
  29899. var tag = getTag(value);
  29900. if (tag == mapTag || tag == setTag) {
  29901. return !value.size;
  29902. }
  29903. if (isPrototype(value)) {
  29904. return !baseKeys(value).length;
  29905. }
  29906. for (var key in value) {
  29907. if (hasOwnProperty.call(value, key)) {
  29908. return false;
  29909. }
  29910. }
  29911. return true;
  29912. }
  29913. /**
  29914. * Performs a deep comparison between two values to determine if they are
  29915. * equivalent.
  29916. *
  29917. * **Note:** This method supports comparing arrays, array buffers, booleans,
  29918. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  29919. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  29920. * by their own, not inherited, enumerable properties. Functions and DOM
  29921. * nodes are compared by strict equality, i.e. `===`.
  29922. *
  29923. * @static
  29924. * @memberOf _
  29925. * @since 0.1.0
  29926. * @category Lang
  29927. * @param {*} value The value to compare.
  29928. * @param {*} other The other value to compare.
  29929. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29930. * @example
  29931. *
  29932. * var object = { 'a': 1 };
  29933. * var other = { 'a': 1 };
  29934. *
  29935. * _.isEqual(object, other);
  29936. * // => true
  29937. *
  29938. * object === other;
  29939. * // => false
  29940. */
  29941. function isEqual(value, other) {
  29942. return baseIsEqual(value, other);
  29943. }
  29944. /**
  29945. * This method is like `_.isEqual` except that it accepts `customizer` which
  29946. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29947. * are handled by the method instead. The `customizer` is invoked with up to
  29948. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  29949. *
  29950. * @static
  29951. * @memberOf _
  29952. * @since 4.0.0
  29953. * @category Lang
  29954. * @param {*} value The value to compare.
  29955. * @param {*} other The other value to compare.
  29956. * @param {Function} [customizer] The function to customize comparisons.
  29957. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29958. * @example
  29959. *
  29960. * function isGreeting(value) {
  29961. * return /^h(?:i|ello)$/.test(value);
  29962. * }
  29963. *
  29964. * function customizer(objValue, othValue) {
  29965. * if (isGreeting(objValue) && isGreeting(othValue)) {
  29966. * return true;
  29967. * }
  29968. * }
  29969. *
  29970. * var array = ['hello', 'goodbye'];
  29971. * var other = ['hi', 'goodbye'];
  29972. *
  29973. * _.isEqualWith(array, other, customizer);
  29974. * // => true
  29975. */
  29976. function isEqualWith(value, other, customizer) {
  29977. customizer = typeof customizer == 'function' ? customizer : undefined;
  29978. var result = customizer ? customizer(value, other) : undefined;
  29979. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  29980. }
  29981. /**
  29982. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  29983. * `SyntaxError`, `TypeError`, or `URIError` object.
  29984. *
  29985. * @static
  29986. * @memberOf _
  29987. * @since 3.0.0
  29988. * @category Lang
  29989. * @param {*} value The value to check.
  29990. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  29991. * @example
  29992. *
  29993. * _.isError(new Error);
  29994. * // => true
  29995. *
  29996. * _.isError(Error);
  29997. * // => false
  29998. */
  29999. function isError(value) {
  30000. if (!isObjectLike(value)) {
  30001. return false;
  30002. }
  30003. var tag = baseGetTag(value);
  30004. return tag == errorTag || tag == domExcTag ||
  30005. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  30006. }
  30007. /**
  30008. * Checks if `value` is a finite primitive number.
  30009. *
  30010. * **Note:** This method is based on
  30011. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  30012. *
  30013. * @static
  30014. * @memberOf _
  30015. * @since 0.1.0
  30016. * @category Lang
  30017. * @param {*} value The value to check.
  30018. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  30019. * @example
  30020. *
  30021. * _.isFinite(3);
  30022. * // => true
  30023. *
  30024. * _.isFinite(Number.MIN_VALUE);
  30025. * // => true
  30026. *
  30027. * _.isFinite(Infinity);
  30028. * // => false
  30029. *
  30030. * _.isFinite('3');
  30031. * // => false
  30032. */
  30033. function isFinite(value) {
  30034. return typeof value == 'number' && nativeIsFinite(value);
  30035. }
  30036. /**
  30037. * Checks if `value` is classified as a `Function` object.
  30038. *
  30039. * @static
  30040. * @memberOf _
  30041. * @since 0.1.0
  30042. * @category Lang
  30043. * @param {*} value The value to check.
  30044. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  30045. * @example
  30046. *
  30047. * _.isFunction(_);
  30048. * // => true
  30049. *
  30050. * _.isFunction(/abc/);
  30051. * // => false
  30052. */
  30053. function isFunction(value) {
  30054. if (!isObject(value)) {
  30055. return false;
  30056. }
  30057. // The use of `Object#toString` avoids issues with the `typeof` operator
  30058. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  30059. var tag = baseGetTag(value);
  30060. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  30061. }
  30062. /**
  30063. * Checks if `value` is an integer.
  30064. *
  30065. * **Note:** This method is based on
  30066. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  30067. *
  30068. * @static
  30069. * @memberOf _
  30070. * @since 4.0.0
  30071. * @category Lang
  30072. * @param {*} value The value to check.
  30073. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  30074. * @example
  30075. *
  30076. * _.isInteger(3);
  30077. * // => true
  30078. *
  30079. * _.isInteger(Number.MIN_VALUE);
  30080. * // => false
  30081. *
  30082. * _.isInteger(Infinity);
  30083. * // => false
  30084. *
  30085. * _.isInteger('3');
  30086. * // => false
  30087. */
  30088. function isInteger(value) {
  30089. return typeof value == 'number' && value == toInteger(value);
  30090. }
  30091. /**
  30092. * Checks if `value` is a valid array-like length.
  30093. *
  30094. * **Note:** This method is loosely based on
  30095. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  30096. *
  30097. * @static
  30098. * @memberOf _
  30099. * @since 4.0.0
  30100. * @category Lang
  30101. * @param {*} value The value to check.
  30102. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  30103. * @example
  30104. *
  30105. * _.isLength(3);
  30106. * // => true
  30107. *
  30108. * _.isLength(Number.MIN_VALUE);
  30109. * // => false
  30110. *
  30111. * _.isLength(Infinity);
  30112. * // => false
  30113. *
  30114. * _.isLength('3');
  30115. * // => false
  30116. */
  30117. function isLength(value) {
  30118. return typeof value == 'number' &&
  30119. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  30120. }
  30121. /**
  30122. * Checks if `value` is the
  30123. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  30124. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  30125. *
  30126. * @static
  30127. * @memberOf _
  30128. * @since 0.1.0
  30129. * @category Lang
  30130. * @param {*} value The value to check.
  30131. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  30132. * @example
  30133. *
  30134. * _.isObject({});
  30135. * // => true
  30136. *
  30137. * _.isObject([1, 2, 3]);
  30138. * // => true
  30139. *
  30140. * _.isObject(_.noop);
  30141. * // => true
  30142. *
  30143. * _.isObject(null);
  30144. * // => false
  30145. */
  30146. function isObject(value) {
  30147. var type = typeof value;
  30148. return value != null && (type == 'object' || type == 'function');
  30149. }
  30150. /**
  30151. * Checks if `value` is object-like. A value is object-like if it's not `null`
  30152. * and has a `typeof` result of "object".
  30153. *
  30154. * @static
  30155. * @memberOf _
  30156. * @since 4.0.0
  30157. * @category Lang
  30158. * @param {*} value The value to check.
  30159. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  30160. * @example
  30161. *
  30162. * _.isObjectLike({});
  30163. * // => true
  30164. *
  30165. * _.isObjectLike([1, 2, 3]);
  30166. * // => true
  30167. *
  30168. * _.isObjectLike(_.noop);
  30169. * // => false
  30170. *
  30171. * _.isObjectLike(null);
  30172. * // => false
  30173. */
  30174. function isObjectLike(value) {
  30175. return value != null && typeof value == 'object';
  30176. }
  30177. /**
  30178. * Checks if `value` is classified as a `Map` object.
  30179. *
  30180. * @static
  30181. * @memberOf _
  30182. * @since 4.3.0
  30183. * @category Lang
  30184. * @param {*} value The value to check.
  30185. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  30186. * @example
  30187. *
  30188. * _.isMap(new Map);
  30189. * // => true
  30190. *
  30191. * _.isMap(new WeakMap);
  30192. * // => false
  30193. */
  30194. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  30195. /**
  30196. * Performs a partial deep comparison between `object` and `source` to
  30197. * determine if `object` contains equivalent property values.
  30198. *
  30199. * **Note:** This method is equivalent to `_.matches` when `source` is
  30200. * partially applied.
  30201. *
  30202. * Partial comparisons will match empty array and empty object `source`
  30203. * values against any array or object value, respectively. See `_.isEqual`
  30204. * for a list of supported value comparisons.
  30205. *
  30206. * @static
  30207. * @memberOf _
  30208. * @since 3.0.0
  30209. * @category Lang
  30210. * @param {Object} object The object to inspect.
  30211. * @param {Object} source The object of property values to match.
  30212. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  30213. * @example
  30214. *
  30215. * var object = { 'a': 1, 'b': 2 };
  30216. *
  30217. * _.isMatch(object, { 'b': 2 });
  30218. * // => true
  30219. *
  30220. * _.isMatch(object, { 'b': 1 });
  30221. * // => false
  30222. */
  30223. function isMatch(object, source) {
  30224. return object === source || baseIsMatch(object, source, getMatchData(source));
  30225. }
  30226. /**
  30227. * This method is like `_.isMatch` except that it accepts `customizer` which
  30228. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  30229. * are handled by the method instead. The `customizer` is invoked with five
  30230. * arguments: (objValue, srcValue, index|key, object, source).
  30231. *
  30232. * @static
  30233. * @memberOf _
  30234. * @since 4.0.0
  30235. * @category Lang
  30236. * @param {Object} object The object to inspect.
  30237. * @param {Object} source The object of property values to match.
  30238. * @param {Function} [customizer] The function to customize comparisons.
  30239. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  30240. * @example
  30241. *
  30242. * function isGreeting(value) {
  30243. * return /^h(?:i|ello)$/.test(value);
  30244. * }
  30245. *
  30246. * function customizer(objValue, srcValue) {
  30247. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  30248. * return true;
  30249. * }
  30250. * }
  30251. *
  30252. * var object = { 'greeting': 'hello' };
  30253. * var source = { 'greeting': 'hi' };
  30254. *
  30255. * _.isMatchWith(object, source, customizer);
  30256. * // => true
  30257. */
  30258. function isMatchWith(object, source, customizer) {
  30259. customizer = typeof customizer == 'function' ? customizer : undefined;
  30260. return baseIsMatch(object, source, getMatchData(source), customizer);
  30261. }
  30262. /**
  30263. * Checks if `value` is `NaN`.
  30264. *
  30265. * **Note:** This method is based on
  30266. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  30267. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  30268. * `undefined` and other non-number values.
  30269. *
  30270. * @static
  30271. * @memberOf _
  30272. * @since 0.1.0
  30273. * @category Lang
  30274. * @param {*} value The value to check.
  30275. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  30276. * @example
  30277. *
  30278. * _.isNaN(NaN);
  30279. * // => true
  30280. *
  30281. * _.isNaN(new Number(NaN));
  30282. * // => true
  30283. *
  30284. * isNaN(undefined);
  30285. * // => true
  30286. *
  30287. * _.isNaN(undefined);
  30288. * // => false
  30289. */
  30290. function isNaN(value) {
  30291. // An `NaN` primitive is the only value that is not equal to itself.
  30292. // Perform the `toStringTag` check first to avoid errors with some
  30293. // ActiveX objects in IE.
  30294. return isNumber(value) && value != +value;
  30295. }
  30296. /**
  30297. * Checks if `value` is a pristine native function.
  30298. *
  30299. * **Note:** This method can't reliably detect native functions in the presence
  30300. * of the core-js package because core-js circumvents this kind of detection.
  30301. * Despite multiple requests, the core-js maintainer has made it clear: any
  30302. * attempt to fix the detection will be obstructed. As a result, we're left
  30303. * with little choice but to throw an error. Unfortunately, this also affects
  30304. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  30305. * which rely on core-js.
  30306. *
  30307. * @static
  30308. * @memberOf _
  30309. * @since 3.0.0
  30310. * @category Lang
  30311. * @param {*} value The value to check.
  30312. * @returns {boolean} Returns `true` if `value` is a native function,
  30313. * else `false`.
  30314. * @example
  30315. *
  30316. * _.isNative(Array.prototype.push);
  30317. * // => true
  30318. *
  30319. * _.isNative(_);
  30320. * // => false
  30321. */
  30322. function isNative(value) {
  30323. if (isMaskable(value)) {
  30324. throw new Error(CORE_ERROR_TEXT);
  30325. }
  30326. return baseIsNative(value);
  30327. }
  30328. /**
  30329. * Checks if `value` is `null`.
  30330. *
  30331. * @static
  30332. * @memberOf _
  30333. * @since 0.1.0
  30334. * @category Lang
  30335. * @param {*} value The value to check.
  30336. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  30337. * @example
  30338. *
  30339. * _.isNull(null);
  30340. * // => true
  30341. *
  30342. * _.isNull(void 0);
  30343. * // => false
  30344. */
  30345. function isNull(value) {
  30346. return value === null;
  30347. }
  30348. /**
  30349. * Checks if `value` is `null` or `undefined`.
  30350. *
  30351. * @static
  30352. * @memberOf _
  30353. * @since 4.0.0
  30354. * @category Lang
  30355. * @param {*} value The value to check.
  30356. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  30357. * @example
  30358. *
  30359. * _.isNil(null);
  30360. * // => true
  30361. *
  30362. * _.isNil(void 0);
  30363. * // => true
  30364. *
  30365. * _.isNil(NaN);
  30366. * // => false
  30367. */
  30368. function isNil(value) {
  30369. return value == null;
  30370. }
  30371. /**
  30372. * Checks if `value` is classified as a `Number` primitive or object.
  30373. *
  30374. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  30375. * classified as numbers, use the `_.isFinite` method.
  30376. *
  30377. * @static
  30378. * @memberOf _
  30379. * @since 0.1.0
  30380. * @category Lang
  30381. * @param {*} value The value to check.
  30382. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  30383. * @example
  30384. *
  30385. * _.isNumber(3);
  30386. * // => true
  30387. *
  30388. * _.isNumber(Number.MIN_VALUE);
  30389. * // => true
  30390. *
  30391. * _.isNumber(Infinity);
  30392. * // => true
  30393. *
  30394. * _.isNumber('3');
  30395. * // => false
  30396. */
  30397. function isNumber(value) {
  30398. return typeof value == 'number' ||
  30399. (isObjectLike(value) && baseGetTag(value) == numberTag);
  30400. }
  30401. /**
  30402. * Checks if `value` is a plain object, that is, an object created by the
  30403. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  30404. *
  30405. * @static
  30406. * @memberOf _
  30407. * @since 0.8.0
  30408. * @category Lang
  30409. * @param {*} value The value to check.
  30410. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  30411. * @example
  30412. *
  30413. * function Foo() {
  30414. * this.a = 1;
  30415. * }
  30416. *
  30417. * _.isPlainObject(new Foo);
  30418. * // => false
  30419. *
  30420. * _.isPlainObject([1, 2, 3]);
  30421. * // => false
  30422. *
  30423. * _.isPlainObject({ 'x': 0, 'y': 0 });
  30424. * // => true
  30425. *
  30426. * _.isPlainObject(Object.create(null));
  30427. * // => true
  30428. */
  30429. function isPlainObject(value) {
  30430. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  30431. return false;
  30432. }
  30433. var proto = getPrototype(value);
  30434. if (proto === null) {
  30435. return true;
  30436. }
  30437. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  30438. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  30439. funcToString.call(Ctor) == objectCtorString;
  30440. }
  30441. /**
  30442. * Checks if `value` is classified as a `RegExp` object.
  30443. *
  30444. * @static
  30445. * @memberOf _
  30446. * @since 0.1.0
  30447. * @category Lang
  30448. * @param {*} value The value to check.
  30449. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  30450. * @example
  30451. *
  30452. * _.isRegExp(/abc/);
  30453. * // => true
  30454. *
  30455. * _.isRegExp('/abc/');
  30456. * // => false
  30457. */
  30458. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  30459. /**
  30460. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  30461. * double precision number which isn't the result of a rounded unsafe integer.
  30462. *
  30463. * **Note:** This method is based on
  30464. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  30465. *
  30466. * @static
  30467. * @memberOf _
  30468. * @since 4.0.0
  30469. * @category Lang
  30470. * @param {*} value The value to check.
  30471. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  30472. * @example
  30473. *
  30474. * _.isSafeInteger(3);
  30475. * // => true
  30476. *
  30477. * _.isSafeInteger(Number.MIN_VALUE);
  30478. * // => false
  30479. *
  30480. * _.isSafeInteger(Infinity);
  30481. * // => false
  30482. *
  30483. * _.isSafeInteger('3');
  30484. * // => false
  30485. */
  30486. function isSafeInteger(value) {
  30487. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  30488. }
  30489. /**
  30490. * Checks if `value` is classified as a `Set` object.
  30491. *
  30492. * @static
  30493. * @memberOf _
  30494. * @since 4.3.0
  30495. * @category Lang
  30496. * @param {*} value The value to check.
  30497. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  30498. * @example
  30499. *
  30500. * _.isSet(new Set);
  30501. * // => true
  30502. *
  30503. * _.isSet(new WeakSet);
  30504. * // => false
  30505. */
  30506. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  30507. /**
  30508. * Checks if `value` is classified as a `String` primitive or object.
  30509. *
  30510. * @static
  30511. * @since 0.1.0
  30512. * @memberOf _
  30513. * @category Lang
  30514. * @param {*} value The value to check.
  30515. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  30516. * @example
  30517. *
  30518. * _.isString('abc');
  30519. * // => true
  30520. *
  30521. * _.isString(1);
  30522. * // => false
  30523. */
  30524. function isString(value) {
  30525. return typeof value == 'string' ||
  30526. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  30527. }
  30528. /**
  30529. * Checks if `value` is classified as a `Symbol` primitive or object.
  30530. *
  30531. * @static
  30532. * @memberOf _
  30533. * @since 4.0.0
  30534. * @category Lang
  30535. * @param {*} value The value to check.
  30536. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  30537. * @example
  30538. *
  30539. * _.isSymbol(Symbol.iterator);
  30540. * // => true
  30541. *
  30542. * _.isSymbol('abc');
  30543. * // => false
  30544. */
  30545. function isSymbol(value) {
  30546. return typeof value == 'symbol' ||
  30547. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  30548. }
  30549. /**
  30550. * Checks if `value` is classified as a typed array.
  30551. *
  30552. * @static
  30553. * @memberOf _
  30554. * @since 3.0.0
  30555. * @category Lang
  30556. * @param {*} value The value to check.
  30557. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  30558. * @example
  30559. *
  30560. * _.isTypedArray(new Uint8Array);
  30561. * // => true
  30562. *
  30563. * _.isTypedArray([]);
  30564. * // => false
  30565. */
  30566. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  30567. /**
  30568. * Checks if `value` is `undefined`.
  30569. *
  30570. * @static
  30571. * @since 0.1.0
  30572. * @memberOf _
  30573. * @category Lang
  30574. * @param {*} value The value to check.
  30575. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  30576. * @example
  30577. *
  30578. * _.isUndefined(void 0);
  30579. * // => true
  30580. *
  30581. * _.isUndefined(null);
  30582. * // => false
  30583. */
  30584. function isUndefined(value) {
  30585. return value === undefined;
  30586. }
  30587. /**
  30588. * Checks if `value` is classified as a `WeakMap` object.
  30589. *
  30590. * @static
  30591. * @memberOf _
  30592. * @since 4.3.0
  30593. * @category Lang
  30594. * @param {*} value The value to check.
  30595. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  30596. * @example
  30597. *
  30598. * _.isWeakMap(new WeakMap);
  30599. * // => true
  30600. *
  30601. * _.isWeakMap(new Map);
  30602. * // => false
  30603. */
  30604. function isWeakMap(value) {
  30605. return isObjectLike(value) && getTag(value) == weakMapTag;
  30606. }
  30607. /**
  30608. * Checks if `value` is classified as a `WeakSet` object.
  30609. *
  30610. * @static
  30611. * @memberOf _
  30612. * @since 4.3.0
  30613. * @category Lang
  30614. * @param {*} value The value to check.
  30615. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  30616. * @example
  30617. *
  30618. * _.isWeakSet(new WeakSet);
  30619. * // => true
  30620. *
  30621. * _.isWeakSet(new Set);
  30622. * // => false
  30623. */
  30624. function isWeakSet(value) {
  30625. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  30626. }
  30627. /**
  30628. * Checks if `value` is less than `other`.
  30629. *
  30630. * @static
  30631. * @memberOf _
  30632. * @since 3.9.0
  30633. * @category Lang
  30634. * @param {*} value The value to compare.
  30635. * @param {*} other The other value to compare.
  30636. * @returns {boolean} Returns `true` if `value` is less than `other`,
  30637. * else `false`.
  30638. * @see _.gt
  30639. * @example
  30640. *
  30641. * _.lt(1, 3);
  30642. * // => true
  30643. *
  30644. * _.lt(3, 3);
  30645. * // => false
  30646. *
  30647. * _.lt(3, 1);
  30648. * // => false
  30649. */
  30650. var lt = createRelationalOperation(baseLt);
  30651. /**
  30652. * Checks if `value` is less than or equal to `other`.
  30653. *
  30654. * @static
  30655. * @memberOf _
  30656. * @since 3.9.0
  30657. * @category Lang
  30658. * @param {*} value The value to compare.
  30659. * @param {*} other The other value to compare.
  30660. * @returns {boolean} Returns `true` if `value` is less than or equal to
  30661. * `other`, else `false`.
  30662. * @see _.gte
  30663. * @example
  30664. *
  30665. * _.lte(1, 3);
  30666. * // => true
  30667. *
  30668. * _.lte(3, 3);
  30669. * // => true
  30670. *
  30671. * _.lte(3, 1);
  30672. * // => false
  30673. */
  30674. var lte = createRelationalOperation(function(value, other) {
  30675. return value <= other;
  30676. });
  30677. /**
  30678. * Converts `value` to an array.
  30679. *
  30680. * @static
  30681. * @since 0.1.0
  30682. * @memberOf _
  30683. * @category Lang
  30684. * @param {*} value The value to convert.
  30685. * @returns {Array} Returns the converted array.
  30686. * @example
  30687. *
  30688. * _.toArray({ 'a': 1, 'b': 2 });
  30689. * // => [1, 2]
  30690. *
  30691. * _.toArray('abc');
  30692. * // => ['a', 'b', 'c']
  30693. *
  30694. * _.toArray(1);
  30695. * // => []
  30696. *
  30697. * _.toArray(null);
  30698. * // => []
  30699. */
  30700. function toArray(value) {
  30701. if (!value) {
  30702. return [];
  30703. }
  30704. if (isArrayLike(value)) {
  30705. return isString(value) ? stringToArray(value) : copyArray(value);
  30706. }
  30707. if (symIterator && value[symIterator]) {
  30708. return iteratorToArray(value[symIterator]());
  30709. }
  30710. var tag = getTag(value),
  30711. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  30712. return func(value);
  30713. }
  30714. /**
  30715. * Converts `value` to a finite number.
  30716. *
  30717. * @static
  30718. * @memberOf _
  30719. * @since 4.12.0
  30720. * @category Lang
  30721. * @param {*} value The value to convert.
  30722. * @returns {number} Returns the converted number.
  30723. * @example
  30724. *
  30725. * _.toFinite(3.2);
  30726. * // => 3.2
  30727. *
  30728. * _.toFinite(Number.MIN_VALUE);
  30729. * // => 5e-324
  30730. *
  30731. * _.toFinite(Infinity);
  30732. * // => 1.7976931348623157e+308
  30733. *
  30734. * _.toFinite('3.2');
  30735. * // => 3.2
  30736. */
  30737. function toFinite(value) {
  30738. if (!value) {
  30739. return value === 0 ? value : 0;
  30740. }
  30741. value = toNumber(value);
  30742. if (value === INFINITY || value === -INFINITY) {
  30743. var sign = (value < 0 ? -1 : 1);
  30744. return sign * MAX_INTEGER;
  30745. }
  30746. return value === value ? value : 0;
  30747. }
  30748. /**
  30749. * Converts `value` to an integer.
  30750. *
  30751. * **Note:** This method is loosely based on
  30752. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  30753. *
  30754. * @static
  30755. * @memberOf _
  30756. * @since 4.0.0
  30757. * @category Lang
  30758. * @param {*} value The value to convert.
  30759. * @returns {number} Returns the converted integer.
  30760. * @example
  30761. *
  30762. * _.toInteger(3.2);
  30763. * // => 3
  30764. *
  30765. * _.toInteger(Number.MIN_VALUE);
  30766. * // => 0
  30767. *
  30768. * _.toInteger(Infinity);
  30769. * // => 1.7976931348623157e+308
  30770. *
  30771. * _.toInteger('3.2');
  30772. * // => 3
  30773. */
  30774. function toInteger(value) {
  30775. var result = toFinite(value),
  30776. remainder = result % 1;
  30777. return result === result ? (remainder ? result - remainder : result) : 0;
  30778. }
  30779. /**
  30780. * Converts `value` to an integer suitable for use as the length of an
  30781. * array-like object.
  30782. *
  30783. * **Note:** This method is based on
  30784. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  30785. *
  30786. * @static
  30787. * @memberOf _
  30788. * @since 4.0.0
  30789. * @category Lang
  30790. * @param {*} value The value to convert.
  30791. * @returns {number} Returns the converted integer.
  30792. * @example
  30793. *
  30794. * _.toLength(3.2);
  30795. * // => 3
  30796. *
  30797. * _.toLength(Number.MIN_VALUE);
  30798. * // => 0
  30799. *
  30800. * _.toLength(Infinity);
  30801. * // => 4294967295
  30802. *
  30803. * _.toLength('3.2');
  30804. * // => 3
  30805. */
  30806. function toLength(value) {
  30807. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  30808. }
  30809. /**
  30810. * Converts `value` to a number.
  30811. *
  30812. * @static
  30813. * @memberOf _
  30814. * @since 4.0.0
  30815. * @category Lang
  30816. * @param {*} value The value to process.
  30817. * @returns {number} Returns the number.
  30818. * @example
  30819. *
  30820. * _.toNumber(3.2);
  30821. * // => 3.2
  30822. *
  30823. * _.toNumber(Number.MIN_VALUE);
  30824. * // => 5e-324
  30825. *
  30826. * _.toNumber(Infinity);
  30827. * // => Infinity
  30828. *
  30829. * _.toNumber('3.2');
  30830. * // => 3.2
  30831. */
  30832. function toNumber(value) {
  30833. if (typeof value == 'number') {
  30834. return value;
  30835. }
  30836. if (isSymbol(value)) {
  30837. return NAN;
  30838. }
  30839. if (isObject(value)) {
  30840. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  30841. value = isObject(other) ? (other + '') : other;
  30842. }
  30843. if (typeof value != 'string') {
  30844. return value === 0 ? value : +value;
  30845. }
  30846. value = value.replace(reTrim, '');
  30847. var isBinary = reIsBinary.test(value);
  30848. return (isBinary || reIsOctal.test(value))
  30849. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  30850. : (reIsBadHex.test(value) ? NAN : +value);
  30851. }
  30852. /**
  30853. * Converts `value` to a plain object flattening inherited enumerable string
  30854. * keyed properties of `value` to own properties of the plain object.
  30855. *
  30856. * @static
  30857. * @memberOf _
  30858. * @since 3.0.0
  30859. * @category Lang
  30860. * @param {*} value The value to convert.
  30861. * @returns {Object} Returns the converted plain object.
  30862. * @example
  30863. *
  30864. * function Foo() {
  30865. * this.b = 2;
  30866. * }
  30867. *
  30868. * Foo.prototype.c = 3;
  30869. *
  30870. * _.assign({ 'a': 1 }, new Foo);
  30871. * // => { 'a': 1, 'b': 2 }
  30872. *
  30873. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  30874. * // => { 'a': 1, 'b': 2, 'c': 3 }
  30875. */
  30876. function toPlainObject(value) {
  30877. return copyObject(value, keysIn(value));
  30878. }
  30879. /**
  30880. * Converts `value` to a safe integer. A safe integer can be compared and
  30881. * represented correctly.
  30882. *
  30883. * @static
  30884. * @memberOf _
  30885. * @since 4.0.0
  30886. * @category Lang
  30887. * @param {*} value The value to convert.
  30888. * @returns {number} Returns the converted integer.
  30889. * @example
  30890. *
  30891. * _.toSafeInteger(3.2);
  30892. * // => 3
  30893. *
  30894. * _.toSafeInteger(Number.MIN_VALUE);
  30895. * // => 0
  30896. *
  30897. * _.toSafeInteger(Infinity);
  30898. * // => 9007199254740991
  30899. *
  30900. * _.toSafeInteger('3.2');
  30901. * // => 3
  30902. */
  30903. function toSafeInteger(value) {
  30904. return value
  30905. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  30906. : (value === 0 ? value : 0);
  30907. }
  30908. /**
  30909. * Converts `value` to a string. An empty string is returned for `null`
  30910. * and `undefined` values. The sign of `-0` is preserved.
  30911. *
  30912. * @static
  30913. * @memberOf _
  30914. * @since 4.0.0
  30915. * @category Lang
  30916. * @param {*} value The value to convert.
  30917. * @returns {string} Returns the converted string.
  30918. * @example
  30919. *
  30920. * _.toString(null);
  30921. * // => ''
  30922. *
  30923. * _.toString(-0);
  30924. * // => '-0'
  30925. *
  30926. * _.toString([1, 2, 3]);
  30927. * // => '1,2,3'
  30928. */
  30929. function toString(value) {
  30930. return value == null ? '' : baseToString(value);
  30931. }
  30932. /*------------------------------------------------------------------------*/
  30933. /**
  30934. * Assigns own enumerable string keyed properties of source objects to the
  30935. * destination object. Source objects are applied from left to right.
  30936. * Subsequent sources overwrite property assignments of previous sources.
  30937. *
  30938. * **Note:** This method mutates `object` and is loosely based on
  30939. * [`Object.assign`](https://mdn.io/Object/assign).
  30940. *
  30941. * @static
  30942. * @memberOf _
  30943. * @since 0.10.0
  30944. * @category Object
  30945. * @param {Object} object The destination object.
  30946. * @param {...Object} [sources] The source objects.
  30947. * @returns {Object} Returns `object`.
  30948. * @see _.assignIn
  30949. * @example
  30950. *
  30951. * function Foo() {
  30952. * this.a = 1;
  30953. * }
  30954. *
  30955. * function Bar() {
  30956. * this.c = 3;
  30957. * }
  30958. *
  30959. * Foo.prototype.b = 2;
  30960. * Bar.prototype.d = 4;
  30961. *
  30962. * _.assign({ 'a': 0 }, new Foo, new Bar);
  30963. * // => { 'a': 1, 'c': 3 }
  30964. */
  30965. var assign = createAssigner(function(object, source) {
  30966. if (isPrototype(source) || isArrayLike(source)) {
  30967. copyObject(source, keys(source), object);
  30968. return;
  30969. }
  30970. for (var key in source) {
  30971. if (hasOwnProperty.call(source, key)) {
  30972. assignValue(object, key, source[key]);
  30973. }
  30974. }
  30975. });
  30976. /**
  30977. * This method is like `_.assign` except that it iterates over own and
  30978. * inherited source properties.
  30979. *
  30980. * **Note:** This method mutates `object`.
  30981. *
  30982. * @static
  30983. * @memberOf _
  30984. * @since 4.0.0
  30985. * @alias extend
  30986. * @category Object
  30987. * @param {Object} object The destination object.
  30988. * @param {...Object} [sources] The source objects.
  30989. * @returns {Object} Returns `object`.
  30990. * @see _.assign
  30991. * @example
  30992. *
  30993. * function Foo() {
  30994. * this.a = 1;
  30995. * }
  30996. *
  30997. * function Bar() {
  30998. * this.c = 3;
  30999. * }
  31000. *
  31001. * Foo.prototype.b = 2;
  31002. * Bar.prototype.d = 4;
  31003. *
  31004. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  31005. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  31006. */
  31007. var assignIn = createAssigner(function(object, source) {
  31008. copyObject(source, keysIn(source), object);
  31009. });
  31010. /**
  31011. * This method is like `_.assignIn` except that it accepts `customizer`
  31012. * which is invoked to produce the assigned values. If `customizer` returns
  31013. * `undefined`, assignment is handled by the method instead. The `customizer`
  31014. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  31015. *
  31016. * **Note:** This method mutates `object`.
  31017. *
  31018. * @static
  31019. * @memberOf _
  31020. * @since 4.0.0
  31021. * @alias extendWith
  31022. * @category Object
  31023. * @param {Object} object The destination object.
  31024. * @param {...Object} sources The source objects.
  31025. * @param {Function} [customizer] The function to customize assigned values.
  31026. * @returns {Object} Returns `object`.
  31027. * @see _.assignWith
  31028. * @example
  31029. *
  31030. * function customizer(objValue, srcValue) {
  31031. * return _.isUndefined(objValue) ? srcValue : objValue;
  31032. * }
  31033. *
  31034. * var defaults = _.partialRight(_.assignInWith, customizer);
  31035. *
  31036. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  31037. * // => { 'a': 1, 'b': 2 }
  31038. */
  31039. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  31040. copyObject(source, keysIn(source), object, customizer);
  31041. });
  31042. /**
  31043. * This method is like `_.assign` except that it accepts `customizer`
  31044. * which is invoked to produce the assigned values. If `customizer` returns
  31045. * `undefined`, assignment is handled by the method instead. The `customizer`
  31046. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  31047. *
  31048. * **Note:** This method mutates `object`.
  31049. *
  31050. * @static
  31051. * @memberOf _
  31052. * @since 4.0.0
  31053. * @category Object
  31054. * @param {Object} object The destination object.
  31055. * @param {...Object} sources The source objects.
  31056. * @param {Function} [customizer] The function to customize assigned values.
  31057. * @returns {Object} Returns `object`.
  31058. * @see _.assignInWith
  31059. * @example
  31060. *
  31061. * function customizer(objValue, srcValue) {
  31062. * return _.isUndefined(objValue) ? srcValue : objValue;
  31063. * }
  31064. *
  31065. * var defaults = _.partialRight(_.assignWith, customizer);
  31066. *
  31067. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  31068. * // => { 'a': 1, 'b': 2 }
  31069. */
  31070. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  31071. copyObject(source, keys(source), object, customizer);
  31072. });
  31073. /**
  31074. * Creates an array of values corresponding to `paths` of `object`.
  31075. *
  31076. * @static
  31077. * @memberOf _
  31078. * @since 1.0.0
  31079. * @category Object
  31080. * @param {Object} object The object to iterate over.
  31081. * @param {...(string|string[])} [paths] The property paths to pick.
  31082. * @returns {Array} Returns the picked values.
  31083. * @example
  31084. *
  31085. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  31086. *
  31087. * _.at(object, ['a[0].b.c', 'a[1]']);
  31088. * // => [3, 4]
  31089. */
  31090. var at = flatRest(baseAt);
  31091. /**
  31092. * Creates an object that inherits from the `prototype` object. If a
  31093. * `properties` object is given, its own enumerable string keyed properties
  31094. * are assigned to the created object.
  31095. *
  31096. * @static
  31097. * @memberOf _
  31098. * @since 2.3.0
  31099. * @category Object
  31100. * @param {Object} prototype The object to inherit from.
  31101. * @param {Object} [properties] The properties to assign to the object.
  31102. * @returns {Object} Returns the new object.
  31103. * @example
  31104. *
  31105. * function Shape() {
  31106. * this.x = 0;
  31107. * this.y = 0;
  31108. * }
  31109. *
  31110. * function Circle() {
  31111. * Shape.call(this);
  31112. * }
  31113. *
  31114. * Circle.prototype = _.create(Shape.prototype, {
  31115. * 'constructor': Circle
  31116. * });
  31117. *
  31118. * var circle = new Circle;
  31119. * circle instanceof Circle;
  31120. * // => true
  31121. *
  31122. * circle instanceof Shape;
  31123. * // => true
  31124. */
  31125. function create(prototype, properties) {
  31126. var result = baseCreate(prototype);
  31127. return properties == null ? result : baseAssign(result, properties);
  31128. }
  31129. /**
  31130. * Assigns own and inherited enumerable string keyed properties of source
  31131. * objects to the destination object for all destination properties that
  31132. * resolve to `undefined`. Source objects are applied from left to right.
  31133. * Once a property is set, additional values of the same property are ignored.
  31134. *
  31135. * **Note:** This method mutates `object`.
  31136. *
  31137. * @static
  31138. * @since 0.1.0
  31139. * @memberOf _
  31140. * @category Object
  31141. * @param {Object} object The destination object.
  31142. * @param {...Object} [sources] The source objects.
  31143. * @returns {Object} Returns `object`.
  31144. * @see _.defaultsDeep
  31145. * @example
  31146. *
  31147. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  31148. * // => { 'a': 1, 'b': 2 }
  31149. */
  31150. var defaults = baseRest(function(object, sources) {
  31151. object = Object(object);
  31152. var index = -1;
  31153. var length = sources.length;
  31154. var guard = length > 2 ? sources[2] : undefined;
  31155. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  31156. length = 1;
  31157. }
  31158. while (++index < length) {
  31159. var source = sources[index];
  31160. var props = keysIn(source);
  31161. var propsIndex = -1;
  31162. var propsLength = props.length;
  31163. while (++propsIndex < propsLength) {
  31164. var key = props[propsIndex];
  31165. var value = object[key];
  31166. if (value === undefined ||
  31167. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  31168. object[key] = source[key];
  31169. }
  31170. }
  31171. }
  31172. return object;
  31173. });
  31174. /**
  31175. * This method is like `_.defaults` except that it recursively assigns
  31176. * default properties.
  31177. *
  31178. * **Note:** This method mutates `object`.
  31179. *
  31180. * @static
  31181. * @memberOf _
  31182. * @since 3.10.0
  31183. * @category Object
  31184. * @param {Object} object The destination object.
  31185. * @param {...Object} [sources] The source objects.
  31186. * @returns {Object} Returns `object`.
  31187. * @see _.defaults
  31188. * @example
  31189. *
  31190. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  31191. * // => { 'a': { 'b': 2, 'c': 3 } }
  31192. */
  31193. var defaultsDeep = baseRest(function(args) {
  31194. args.push(undefined, customDefaultsMerge);
  31195. return apply(mergeWith, undefined, args);
  31196. });
  31197. /**
  31198. * This method is like `_.find` except that it returns the key of the first
  31199. * element `predicate` returns truthy for instead of the element itself.
  31200. *
  31201. * @static
  31202. * @memberOf _
  31203. * @since 1.1.0
  31204. * @category Object
  31205. * @param {Object} object The object to inspect.
  31206. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  31207. * @returns {string|undefined} Returns the key of the matched element,
  31208. * else `undefined`.
  31209. * @example
  31210. *
  31211. * var users = {
  31212. * 'barney': { 'age': 36, 'active': true },
  31213. * 'fred': { 'age': 40, 'active': false },
  31214. * 'pebbles': { 'age': 1, 'active': true }
  31215. * };
  31216. *
  31217. * _.findKey(users, function(o) { return o.age < 40; });
  31218. * // => 'barney' (iteration order is not guaranteed)
  31219. *
  31220. * // The `_.matches` iteratee shorthand.
  31221. * _.findKey(users, { 'age': 1, 'active': true });
  31222. * // => 'pebbles'
  31223. *
  31224. * // The `_.matchesProperty` iteratee shorthand.
  31225. * _.findKey(users, ['active', false]);
  31226. * // => 'fred'
  31227. *
  31228. * // The `_.property` iteratee shorthand.
  31229. * _.findKey(users, 'active');
  31230. * // => 'barney'
  31231. */
  31232. function findKey(object, predicate) {
  31233. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  31234. }
  31235. /**
  31236. * This method is like `_.findKey` except that it iterates over elements of
  31237. * a collection in the opposite order.
  31238. *
  31239. * @static
  31240. * @memberOf _
  31241. * @since 2.0.0
  31242. * @category Object
  31243. * @param {Object} object The object to inspect.
  31244. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  31245. * @returns {string|undefined} Returns the key of the matched element,
  31246. * else `undefined`.
  31247. * @example
  31248. *
  31249. * var users = {
  31250. * 'barney': { 'age': 36, 'active': true },
  31251. * 'fred': { 'age': 40, 'active': false },
  31252. * 'pebbles': { 'age': 1, 'active': true }
  31253. * };
  31254. *
  31255. * _.findLastKey(users, function(o) { return o.age < 40; });
  31256. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  31257. *
  31258. * // The `_.matches` iteratee shorthand.
  31259. * _.findLastKey(users, { 'age': 36, 'active': true });
  31260. * // => 'barney'
  31261. *
  31262. * // The `_.matchesProperty` iteratee shorthand.
  31263. * _.findLastKey(users, ['active', false]);
  31264. * // => 'fred'
  31265. *
  31266. * // The `_.property` iteratee shorthand.
  31267. * _.findLastKey(users, 'active');
  31268. * // => 'pebbles'
  31269. */
  31270. function findLastKey(object, predicate) {
  31271. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  31272. }
  31273. /**
  31274. * Iterates over own and inherited enumerable string keyed properties of an
  31275. * object and invokes `iteratee` for each property. The iteratee is invoked
  31276. * with three arguments: (value, key, object). Iteratee functions may exit
  31277. * iteration early by explicitly returning `false`.
  31278. *
  31279. * @static
  31280. * @memberOf _
  31281. * @since 0.3.0
  31282. * @category Object
  31283. * @param {Object} object The object to iterate over.
  31284. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31285. * @returns {Object} Returns `object`.
  31286. * @see _.forInRight
  31287. * @example
  31288. *
  31289. * function Foo() {
  31290. * this.a = 1;
  31291. * this.b = 2;
  31292. * }
  31293. *
  31294. * Foo.prototype.c = 3;
  31295. *
  31296. * _.forIn(new Foo, function(value, key) {
  31297. * console.log(key);
  31298. * });
  31299. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  31300. */
  31301. function forIn(object, iteratee) {
  31302. return object == null
  31303. ? object
  31304. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  31305. }
  31306. /**
  31307. * This method is like `_.forIn` except that it iterates over properties of
  31308. * `object` in the opposite order.
  31309. *
  31310. * @static
  31311. * @memberOf _
  31312. * @since 2.0.0
  31313. * @category Object
  31314. * @param {Object} object The object to iterate over.
  31315. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31316. * @returns {Object} Returns `object`.
  31317. * @see _.forIn
  31318. * @example
  31319. *
  31320. * function Foo() {
  31321. * this.a = 1;
  31322. * this.b = 2;
  31323. * }
  31324. *
  31325. * Foo.prototype.c = 3;
  31326. *
  31327. * _.forInRight(new Foo, function(value, key) {
  31328. * console.log(key);
  31329. * });
  31330. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  31331. */
  31332. function forInRight(object, iteratee) {
  31333. return object == null
  31334. ? object
  31335. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  31336. }
  31337. /**
  31338. * Iterates over own enumerable string keyed properties of an object and
  31339. * invokes `iteratee` for each property. The iteratee is invoked with three
  31340. * arguments: (value, key, object). Iteratee functions may exit iteration
  31341. * early by explicitly returning `false`.
  31342. *
  31343. * @static
  31344. * @memberOf _
  31345. * @since 0.3.0
  31346. * @category Object
  31347. * @param {Object} object The object to iterate over.
  31348. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31349. * @returns {Object} Returns `object`.
  31350. * @see _.forOwnRight
  31351. * @example
  31352. *
  31353. * function Foo() {
  31354. * this.a = 1;
  31355. * this.b = 2;
  31356. * }
  31357. *
  31358. * Foo.prototype.c = 3;
  31359. *
  31360. * _.forOwn(new Foo, function(value, key) {
  31361. * console.log(key);
  31362. * });
  31363. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  31364. */
  31365. function forOwn(object, iteratee) {
  31366. return object && baseForOwn(object, getIteratee(iteratee, 3));
  31367. }
  31368. /**
  31369. * This method is like `_.forOwn` except that it iterates over properties of
  31370. * `object` in the opposite order.
  31371. *
  31372. * @static
  31373. * @memberOf _
  31374. * @since 2.0.0
  31375. * @category Object
  31376. * @param {Object} object The object to iterate over.
  31377. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31378. * @returns {Object} Returns `object`.
  31379. * @see _.forOwn
  31380. * @example
  31381. *
  31382. * function Foo() {
  31383. * this.a = 1;
  31384. * this.b = 2;
  31385. * }
  31386. *
  31387. * Foo.prototype.c = 3;
  31388. *
  31389. * _.forOwnRight(new Foo, function(value, key) {
  31390. * console.log(key);
  31391. * });
  31392. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  31393. */
  31394. function forOwnRight(object, iteratee) {
  31395. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  31396. }
  31397. /**
  31398. * Creates an array of function property names from own enumerable properties
  31399. * of `object`.
  31400. *
  31401. * @static
  31402. * @since 0.1.0
  31403. * @memberOf _
  31404. * @category Object
  31405. * @param {Object} object The object to inspect.
  31406. * @returns {Array} Returns the function names.
  31407. * @see _.functionsIn
  31408. * @example
  31409. *
  31410. * function Foo() {
  31411. * this.a = _.constant('a');
  31412. * this.b = _.constant('b');
  31413. * }
  31414. *
  31415. * Foo.prototype.c = _.constant('c');
  31416. *
  31417. * _.functions(new Foo);
  31418. * // => ['a', 'b']
  31419. */
  31420. function functions(object) {
  31421. return object == null ? [] : baseFunctions(object, keys(object));
  31422. }
  31423. /**
  31424. * Creates an array of function property names from own and inherited
  31425. * enumerable properties of `object`.
  31426. *
  31427. * @static
  31428. * @memberOf _
  31429. * @since 4.0.0
  31430. * @category Object
  31431. * @param {Object} object The object to inspect.
  31432. * @returns {Array} Returns the function names.
  31433. * @see _.functions
  31434. * @example
  31435. *
  31436. * function Foo() {
  31437. * this.a = _.constant('a');
  31438. * this.b = _.constant('b');
  31439. * }
  31440. *
  31441. * Foo.prototype.c = _.constant('c');
  31442. *
  31443. * _.functionsIn(new Foo);
  31444. * // => ['a', 'b', 'c']
  31445. */
  31446. function functionsIn(object) {
  31447. return object == null ? [] : baseFunctions(object, keysIn(object));
  31448. }
  31449. /**
  31450. * Gets the value at `path` of `object`. If the resolved value is
  31451. * `undefined`, the `defaultValue` is returned in its place.
  31452. *
  31453. * @static
  31454. * @memberOf _
  31455. * @since 3.7.0
  31456. * @category Object
  31457. * @param {Object} object The object to query.
  31458. * @param {Array|string} path The path of the property to get.
  31459. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  31460. * @returns {*} Returns the resolved value.
  31461. * @example
  31462. *
  31463. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31464. *
  31465. * _.get(object, 'a[0].b.c');
  31466. * // => 3
  31467. *
  31468. * _.get(object, ['a', '0', 'b', 'c']);
  31469. * // => 3
  31470. *
  31471. * _.get(object, 'a.b.c', 'default');
  31472. * // => 'default'
  31473. */
  31474. function get(object, path, defaultValue) {
  31475. var result = object == null ? undefined : baseGet(object, path);
  31476. return result === undefined ? defaultValue : result;
  31477. }
  31478. /**
  31479. * Checks if `path` is a direct property of `object`.
  31480. *
  31481. * @static
  31482. * @since 0.1.0
  31483. * @memberOf _
  31484. * @category Object
  31485. * @param {Object} object The object to query.
  31486. * @param {Array|string} path The path to check.
  31487. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  31488. * @example
  31489. *
  31490. * var object = { 'a': { 'b': 2 } };
  31491. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  31492. *
  31493. * _.has(object, 'a');
  31494. * // => true
  31495. *
  31496. * _.has(object, 'a.b');
  31497. * // => true
  31498. *
  31499. * _.has(object, ['a', 'b']);
  31500. * // => true
  31501. *
  31502. * _.has(other, 'a');
  31503. * // => false
  31504. */
  31505. function has(object, path) {
  31506. return object != null && hasPath(object, path, baseHas);
  31507. }
  31508. /**
  31509. * Checks if `path` is a direct or inherited property of `object`.
  31510. *
  31511. * @static
  31512. * @memberOf _
  31513. * @since 4.0.0
  31514. * @category Object
  31515. * @param {Object} object The object to query.
  31516. * @param {Array|string} path The path to check.
  31517. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  31518. * @example
  31519. *
  31520. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  31521. *
  31522. * _.hasIn(object, 'a');
  31523. * // => true
  31524. *
  31525. * _.hasIn(object, 'a.b');
  31526. * // => true
  31527. *
  31528. * _.hasIn(object, ['a', 'b']);
  31529. * // => true
  31530. *
  31531. * _.hasIn(object, 'b');
  31532. * // => false
  31533. */
  31534. function hasIn(object, path) {
  31535. return object != null && hasPath(object, path, baseHasIn);
  31536. }
  31537. /**
  31538. * Creates an object composed of the inverted keys and values of `object`.
  31539. * If `object` contains duplicate values, subsequent values overwrite
  31540. * property assignments of previous values.
  31541. *
  31542. * @static
  31543. * @memberOf _
  31544. * @since 0.7.0
  31545. * @category Object
  31546. * @param {Object} object The object to invert.
  31547. * @returns {Object} Returns the new inverted object.
  31548. * @example
  31549. *
  31550. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  31551. *
  31552. * _.invert(object);
  31553. * // => { '1': 'c', '2': 'b' }
  31554. */
  31555. var invert = createInverter(function(result, value, key) {
  31556. if (value != null &&
  31557. typeof value.toString != 'function') {
  31558. value = nativeObjectToString.call(value);
  31559. }
  31560. result[value] = key;
  31561. }, constant(identity));
  31562. /**
  31563. * This method is like `_.invert` except that the inverted object is generated
  31564. * from the results of running each element of `object` thru `iteratee`. The
  31565. * corresponding inverted value of each inverted key is an array of keys
  31566. * responsible for generating the inverted value. The iteratee is invoked
  31567. * with one argument: (value).
  31568. *
  31569. * @static
  31570. * @memberOf _
  31571. * @since 4.1.0
  31572. * @category Object
  31573. * @param {Object} object The object to invert.
  31574. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  31575. * @returns {Object} Returns the new inverted object.
  31576. * @example
  31577. *
  31578. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  31579. *
  31580. * _.invertBy(object);
  31581. * // => { '1': ['a', 'c'], '2': ['b'] }
  31582. *
  31583. * _.invertBy(object, function(value) {
  31584. * return 'group' + value;
  31585. * });
  31586. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  31587. */
  31588. var invertBy = createInverter(function(result, value, key) {
  31589. if (value != null &&
  31590. typeof value.toString != 'function') {
  31591. value = nativeObjectToString.call(value);
  31592. }
  31593. if (hasOwnProperty.call(result, value)) {
  31594. result[value].push(key);
  31595. } else {
  31596. result[value] = [key];
  31597. }
  31598. }, getIteratee);
  31599. /**
  31600. * Invokes the method at `path` of `object`.
  31601. *
  31602. * @static
  31603. * @memberOf _
  31604. * @since 4.0.0
  31605. * @category Object
  31606. * @param {Object} object The object to query.
  31607. * @param {Array|string} path The path of the method to invoke.
  31608. * @param {...*} [args] The arguments to invoke the method with.
  31609. * @returns {*} Returns the result of the invoked method.
  31610. * @example
  31611. *
  31612. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  31613. *
  31614. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  31615. * // => [2, 3]
  31616. */
  31617. var invoke = baseRest(baseInvoke);
  31618. /**
  31619. * Creates an array of the own enumerable property names of `object`.
  31620. *
  31621. * **Note:** Non-object values are coerced to objects. See the
  31622. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  31623. * for more details.
  31624. *
  31625. * @static
  31626. * @since 0.1.0
  31627. * @memberOf _
  31628. * @category Object
  31629. * @param {Object} object The object to query.
  31630. * @returns {Array} Returns the array of property names.
  31631. * @example
  31632. *
  31633. * function Foo() {
  31634. * this.a = 1;
  31635. * this.b = 2;
  31636. * }
  31637. *
  31638. * Foo.prototype.c = 3;
  31639. *
  31640. * _.keys(new Foo);
  31641. * // => ['a', 'b'] (iteration order is not guaranteed)
  31642. *
  31643. * _.keys('hi');
  31644. * // => ['0', '1']
  31645. */
  31646. function keys(object) {
  31647. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  31648. }
  31649. /**
  31650. * Creates an array of the own and inherited enumerable property names of `object`.
  31651. *
  31652. * **Note:** Non-object values are coerced to objects.
  31653. *
  31654. * @static
  31655. * @memberOf _
  31656. * @since 3.0.0
  31657. * @category Object
  31658. * @param {Object} object The object to query.
  31659. * @returns {Array} Returns the array of property names.
  31660. * @example
  31661. *
  31662. * function Foo() {
  31663. * this.a = 1;
  31664. * this.b = 2;
  31665. * }
  31666. *
  31667. * Foo.prototype.c = 3;
  31668. *
  31669. * _.keysIn(new Foo);
  31670. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  31671. */
  31672. function keysIn(object) {
  31673. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  31674. }
  31675. /**
  31676. * The opposite of `_.mapValues`; this method creates an object with the
  31677. * same values as `object` and keys generated by running each own enumerable
  31678. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  31679. * with three arguments: (value, key, object).
  31680. *
  31681. * @static
  31682. * @memberOf _
  31683. * @since 3.8.0
  31684. * @category Object
  31685. * @param {Object} object The object to iterate over.
  31686. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31687. * @returns {Object} Returns the new mapped object.
  31688. * @see _.mapValues
  31689. * @example
  31690. *
  31691. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  31692. * return key + value;
  31693. * });
  31694. * // => { 'a1': 1, 'b2': 2 }
  31695. */
  31696. function mapKeys(object, iteratee) {
  31697. var result = {};
  31698. iteratee = getIteratee(iteratee, 3);
  31699. baseForOwn(object, function(value, key, object) {
  31700. baseAssignValue(result, iteratee(value, key, object), value);
  31701. });
  31702. return result;
  31703. }
  31704. /**
  31705. * Creates an object with the same keys as `object` and values generated
  31706. * by running each own enumerable string keyed property of `object` thru
  31707. * `iteratee`. The iteratee is invoked with three arguments:
  31708. * (value, key, object).
  31709. *
  31710. * @static
  31711. * @memberOf _
  31712. * @since 2.4.0
  31713. * @category Object
  31714. * @param {Object} object The object to iterate over.
  31715. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31716. * @returns {Object} Returns the new mapped object.
  31717. * @see _.mapKeys
  31718. * @example
  31719. *
  31720. * var users = {
  31721. * 'fred': { 'user': 'fred', 'age': 40 },
  31722. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  31723. * };
  31724. *
  31725. * _.mapValues(users, function(o) { return o.age; });
  31726. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  31727. *
  31728. * // The `_.property` iteratee shorthand.
  31729. * _.mapValues(users, 'age');
  31730. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  31731. */
  31732. function mapValues(object, iteratee) {
  31733. var result = {};
  31734. iteratee = getIteratee(iteratee, 3);
  31735. baseForOwn(object, function(value, key, object) {
  31736. baseAssignValue(result, key, iteratee(value, key, object));
  31737. });
  31738. return result;
  31739. }
  31740. /**
  31741. * This method is like `_.assign` except that it recursively merges own and
  31742. * inherited enumerable string keyed properties of source objects into the
  31743. * destination object. Source properties that resolve to `undefined` are
  31744. * skipped if a destination value exists. Array and plain object properties
  31745. * are merged recursively. Other objects and value types are overridden by
  31746. * assignment. Source objects are applied from left to right. Subsequent
  31747. * sources overwrite property assignments of previous sources.
  31748. *
  31749. * **Note:** This method mutates `object`.
  31750. *
  31751. * @static
  31752. * @memberOf _
  31753. * @since 0.5.0
  31754. * @category Object
  31755. * @param {Object} object The destination object.
  31756. * @param {...Object} [sources] The source objects.
  31757. * @returns {Object} Returns `object`.
  31758. * @example
  31759. *
  31760. * var object = {
  31761. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  31762. * };
  31763. *
  31764. * var other = {
  31765. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  31766. * };
  31767. *
  31768. * _.merge(object, other);
  31769. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  31770. */
  31771. var merge = createAssigner(function(object, source, srcIndex) {
  31772. baseMerge(object, source, srcIndex);
  31773. });
  31774. /**
  31775. * This method is like `_.merge` except that it accepts `customizer` which
  31776. * is invoked to produce the merged values of the destination and source
  31777. * properties. If `customizer` returns `undefined`, merging is handled by the
  31778. * method instead. The `customizer` is invoked with six arguments:
  31779. * (objValue, srcValue, key, object, source, stack).
  31780. *
  31781. * **Note:** This method mutates `object`.
  31782. *
  31783. * @static
  31784. * @memberOf _
  31785. * @since 4.0.0
  31786. * @category Object
  31787. * @param {Object} object The destination object.
  31788. * @param {...Object} sources The source objects.
  31789. * @param {Function} customizer The function to customize assigned values.
  31790. * @returns {Object} Returns `object`.
  31791. * @example
  31792. *
  31793. * function customizer(objValue, srcValue) {
  31794. * if (_.isArray(objValue)) {
  31795. * return objValue.concat(srcValue);
  31796. * }
  31797. * }
  31798. *
  31799. * var object = { 'a': [1], 'b': [2] };
  31800. * var other = { 'a': [3], 'b': [4] };
  31801. *
  31802. * _.mergeWith(object, other, customizer);
  31803. * // => { 'a': [1, 3], 'b': [2, 4] }
  31804. */
  31805. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  31806. baseMerge(object, source, srcIndex, customizer);
  31807. });
  31808. /**
  31809. * The opposite of `_.pick`; this method creates an object composed of the
  31810. * own and inherited enumerable property paths of `object` that are not omitted.
  31811. *
  31812. * **Note:** This method is considerably slower than `_.pick`.
  31813. *
  31814. * @static
  31815. * @since 0.1.0
  31816. * @memberOf _
  31817. * @category Object
  31818. * @param {Object} object The source object.
  31819. * @param {...(string|string[])} [paths] The property paths to omit.
  31820. * @returns {Object} Returns the new object.
  31821. * @example
  31822. *
  31823. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31824. *
  31825. * _.omit(object, ['a', 'c']);
  31826. * // => { 'b': '2' }
  31827. */
  31828. var omit = flatRest(function(object, paths) {
  31829. var result = {};
  31830. if (object == null) {
  31831. return result;
  31832. }
  31833. var isDeep = false;
  31834. paths = arrayMap(paths, function(path) {
  31835. path = castPath(path, object);
  31836. isDeep || (isDeep = path.length > 1);
  31837. return path;
  31838. });
  31839. copyObject(object, getAllKeysIn(object), result);
  31840. if (isDeep) {
  31841. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  31842. }
  31843. var length = paths.length;
  31844. while (length--) {
  31845. baseUnset(result, paths[length]);
  31846. }
  31847. return result;
  31848. });
  31849. /**
  31850. * The opposite of `_.pickBy`; this method creates an object composed of
  31851. * the own and inherited enumerable string keyed properties of `object` that
  31852. * `predicate` doesn't return truthy for. The predicate is invoked with two
  31853. * arguments: (value, key).
  31854. *
  31855. * @static
  31856. * @memberOf _
  31857. * @since 4.0.0
  31858. * @category Object
  31859. * @param {Object} object The source object.
  31860. * @param {Function} [predicate=_.identity] The function invoked per property.
  31861. * @returns {Object} Returns the new object.
  31862. * @example
  31863. *
  31864. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31865. *
  31866. * _.omitBy(object, _.isNumber);
  31867. * // => { 'b': '2' }
  31868. */
  31869. function omitBy(object, predicate) {
  31870. return pickBy(object, negate(getIteratee(predicate)));
  31871. }
  31872. /**
  31873. * Creates an object composed of the picked `object` properties.
  31874. *
  31875. * @static
  31876. * @since 0.1.0
  31877. * @memberOf _
  31878. * @category Object
  31879. * @param {Object} object The source object.
  31880. * @param {...(string|string[])} [paths] The property paths to pick.
  31881. * @returns {Object} Returns the new object.
  31882. * @example
  31883. *
  31884. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31885. *
  31886. * _.pick(object, ['a', 'c']);
  31887. * // => { 'a': 1, 'c': 3 }
  31888. */
  31889. var pick = flatRest(function(object, paths) {
  31890. return object == null ? {} : basePick(object, paths);
  31891. });
  31892. /**
  31893. * Creates an object composed of the `object` properties `predicate` returns
  31894. * truthy for. The predicate is invoked with two arguments: (value, key).
  31895. *
  31896. * @static
  31897. * @memberOf _
  31898. * @since 4.0.0
  31899. * @category Object
  31900. * @param {Object} object The source object.
  31901. * @param {Function} [predicate=_.identity] The function invoked per property.
  31902. * @returns {Object} Returns the new object.
  31903. * @example
  31904. *
  31905. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31906. *
  31907. * _.pickBy(object, _.isNumber);
  31908. * // => { 'a': 1, 'c': 3 }
  31909. */
  31910. function pickBy(object, predicate) {
  31911. if (object == null) {
  31912. return {};
  31913. }
  31914. var props = arrayMap(getAllKeysIn(object), function(prop) {
  31915. return [prop];
  31916. });
  31917. predicate = getIteratee(predicate);
  31918. return basePickBy(object, props, function(value, path) {
  31919. return predicate(value, path[0]);
  31920. });
  31921. }
  31922. /**
  31923. * This method is like `_.get` except that if the resolved value is a
  31924. * function it's invoked with the `this` binding of its parent object and
  31925. * its result is returned.
  31926. *
  31927. * @static
  31928. * @since 0.1.0
  31929. * @memberOf _
  31930. * @category Object
  31931. * @param {Object} object The object to query.
  31932. * @param {Array|string} path The path of the property to resolve.
  31933. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  31934. * @returns {*} Returns the resolved value.
  31935. * @example
  31936. *
  31937. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  31938. *
  31939. * _.result(object, 'a[0].b.c1');
  31940. * // => 3
  31941. *
  31942. * _.result(object, 'a[0].b.c2');
  31943. * // => 4
  31944. *
  31945. * _.result(object, 'a[0].b.c3', 'default');
  31946. * // => 'default'
  31947. *
  31948. * _.result(object, 'a[0].b.c3', _.constant('default'));
  31949. * // => 'default'
  31950. */
  31951. function result(object, path, defaultValue) {
  31952. path = castPath(path, object);
  31953. var index = -1,
  31954. length = path.length;
  31955. // Ensure the loop is entered when path is empty.
  31956. if (!length) {
  31957. length = 1;
  31958. object = undefined;
  31959. }
  31960. while (++index < length) {
  31961. var value = object == null ? undefined : object[toKey(path[index])];
  31962. if (value === undefined) {
  31963. index = length;
  31964. value = defaultValue;
  31965. }
  31966. object = isFunction(value) ? value.call(object) : value;
  31967. }
  31968. return object;
  31969. }
  31970. /**
  31971. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  31972. * it's created. Arrays are created for missing index properties while objects
  31973. * are created for all other missing properties. Use `_.setWith` to customize
  31974. * `path` creation.
  31975. *
  31976. * **Note:** This method mutates `object`.
  31977. *
  31978. * @static
  31979. * @memberOf _
  31980. * @since 3.7.0
  31981. * @category Object
  31982. * @param {Object} object The object to modify.
  31983. * @param {Array|string} path The path of the property to set.
  31984. * @param {*} value The value to set.
  31985. * @returns {Object} Returns `object`.
  31986. * @example
  31987. *
  31988. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31989. *
  31990. * _.set(object, 'a[0].b.c', 4);
  31991. * console.log(object.a[0].b.c);
  31992. * // => 4
  31993. *
  31994. * _.set(object, ['x', '0', 'y', 'z'], 5);
  31995. * console.log(object.x[0].y.z);
  31996. * // => 5
  31997. */
  31998. function set(object, path, value) {
  31999. return object == null ? object : baseSet(object, path, value);
  32000. }
  32001. /**
  32002. * This method is like `_.set` except that it accepts `customizer` which is
  32003. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  32004. * path creation is handled by the method instead. The `customizer` is invoked
  32005. * with three arguments: (nsValue, key, nsObject).
  32006. *
  32007. * **Note:** This method mutates `object`.
  32008. *
  32009. * @static
  32010. * @memberOf _
  32011. * @since 4.0.0
  32012. * @category Object
  32013. * @param {Object} object The object to modify.
  32014. * @param {Array|string} path The path of the property to set.
  32015. * @param {*} value The value to set.
  32016. * @param {Function} [customizer] The function to customize assigned values.
  32017. * @returns {Object} Returns `object`.
  32018. * @example
  32019. *
  32020. * var object = {};
  32021. *
  32022. * _.setWith(object, '[0][1]', 'a', Object);
  32023. * // => { '0': { '1': 'a' } }
  32024. */
  32025. function setWith(object, path, value, customizer) {
  32026. customizer = typeof customizer == 'function' ? customizer : undefined;
  32027. return object == null ? object : baseSet(object, path, value, customizer);
  32028. }
  32029. /**
  32030. * Creates an array of own enumerable string keyed-value pairs for `object`
  32031. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  32032. * entries are returned.
  32033. *
  32034. * @static
  32035. * @memberOf _
  32036. * @since 4.0.0
  32037. * @alias entries
  32038. * @category Object
  32039. * @param {Object} object The object to query.
  32040. * @returns {Array} Returns the key-value pairs.
  32041. * @example
  32042. *
  32043. * function Foo() {
  32044. * this.a = 1;
  32045. * this.b = 2;
  32046. * }
  32047. *
  32048. * Foo.prototype.c = 3;
  32049. *
  32050. * _.toPairs(new Foo);
  32051. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  32052. */
  32053. var toPairs = createToPairs(keys);
  32054. /**
  32055. * Creates an array of own and inherited enumerable string keyed-value pairs
  32056. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  32057. * or set, its entries are returned.
  32058. *
  32059. * @static
  32060. * @memberOf _
  32061. * @since 4.0.0
  32062. * @alias entriesIn
  32063. * @category Object
  32064. * @param {Object} object The object to query.
  32065. * @returns {Array} Returns the key-value pairs.
  32066. * @example
  32067. *
  32068. * function Foo() {
  32069. * this.a = 1;
  32070. * this.b = 2;
  32071. * }
  32072. *
  32073. * Foo.prototype.c = 3;
  32074. *
  32075. * _.toPairsIn(new Foo);
  32076. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  32077. */
  32078. var toPairsIn = createToPairs(keysIn);
  32079. /**
  32080. * An alternative to `_.reduce`; this method transforms `object` to a new
  32081. * `accumulator` object which is the result of running each of its own
  32082. * enumerable string keyed properties thru `iteratee`, with each invocation
  32083. * potentially mutating the `accumulator` object. If `accumulator` is not
  32084. * provided, a new object with the same `[[Prototype]]` will be used. The
  32085. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  32086. * Iteratee functions may exit iteration early by explicitly returning `false`.
  32087. *
  32088. * @static
  32089. * @memberOf _
  32090. * @since 1.3.0
  32091. * @category Object
  32092. * @param {Object} object The object to iterate over.
  32093. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  32094. * @param {*} [accumulator] The custom accumulator value.
  32095. * @returns {*} Returns the accumulated value.
  32096. * @example
  32097. *
  32098. * _.transform([2, 3, 4], function(result, n) {
  32099. * result.push(n *= n);
  32100. * return n % 2 == 0;
  32101. * }, []);
  32102. * // => [4, 9]
  32103. *
  32104. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  32105. * (result[value] || (result[value] = [])).push(key);
  32106. * }, {});
  32107. * // => { '1': ['a', 'c'], '2': ['b'] }
  32108. */
  32109. function transform(object, iteratee, accumulator) {
  32110. var isArr = isArray(object),
  32111. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  32112. iteratee = getIteratee(iteratee, 4);
  32113. if (accumulator == null) {
  32114. var Ctor = object && object.constructor;
  32115. if (isArrLike) {
  32116. accumulator = isArr ? new Ctor : [];
  32117. }
  32118. else if (isObject(object)) {
  32119. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  32120. }
  32121. else {
  32122. accumulator = {};
  32123. }
  32124. }
  32125. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  32126. return iteratee(accumulator, value, index, object);
  32127. });
  32128. return accumulator;
  32129. }
  32130. /**
  32131. * Removes the property at `path` of `object`.
  32132. *
  32133. * **Note:** This method mutates `object`.
  32134. *
  32135. * @static
  32136. * @memberOf _
  32137. * @since 4.0.0
  32138. * @category Object
  32139. * @param {Object} object The object to modify.
  32140. * @param {Array|string} path The path of the property to unset.
  32141. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  32142. * @example
  32143. *
  32144. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  32145. * _.unset(object, 'a[0].b.c');
  32146. * // => true
  32147. *
  32148. * console.log(object);
  32149. * // => { 'a': [{ 'b': {} }] };
  32150. *
  32151. * _.unset(object, ['a', '0', 'b', 'c']);
  32152. * // => true
  32153. *
  32154. * console.log(object);
  32155. * // => { 'a': [{ 'b': {} }] };
  32156. */
  32157. function unset(object, path) {
  32158. return object == null ? true : baseUnset(object, path);
  32159. }
  32160. /**
  32161. * This method is like `_.set` except that accepts `updater` to produce the
  32162. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  32163. * is invoked with one argument: (value).
  32164. *
  32165. * **Note:** This method mutates `object`.
  32166. *
  32167. * @static
  32168. * @memberOf _
  32169. * @since 4.6.0
  32170. * @category Object
  32171. * @param {Object} object The object to modify.
  32172. * @param {Array|string} path The path of the property to set.
  32173. * @param {Function} updater The function to produce the updated value.
  32174. * @returns {Object} Returns `object`.
  32175. * @example
  32176. *
  32177. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  32178. *
  32179. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  32180. * console.log(object.a[0].b.c);
  32181. * // => 9
  32182. *
  32183. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  32184. * console.log(object.x[0].y.z);
  32185. * // => 0
  32186. */
  32187. function update(object, path, updater) {
  32188. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  32189. }
  32190. /**
  32191. * This method is like `_.update` except that it accepts `customizer` which is
  32192. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  32193. * path creation is handled by the method instead. The `customizer` is invoked
  32194. * with three arguments: (nsValue, key, nsObject).
  32195. *
  32196. * **Note:** This method mutates `object`.
  32197. *
  32198. * @static
  32199. * @memberOf _
  32200. * @since 4.6.0
  32201. * @category Object
  32202. * @param {Object} object The object to modify.
  32203. * @param {Array|string} path The path of the property to set.
  32204. * @param {Function} updater The function to produce the updated value.
  32205. * @param {Function} [customizer] The function to customize assigned values.
  32206. * @returns {Object} Returns `object`.
  32207. * @example
  32208. *
  32209. * var object = {};
  32210. *
  32211. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  32212. * // => { '0': { '1': 'a' } }
  32213. */
  32214. function updateWith(object, path, updater, customizer) {
  32215. customizer = typeof customizer == 'function' ? customizer : undefined;
  32216. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  32217. }
  32218. /**
  32219. * Creates an array of the own enumerable string keyed property values of `object`.
  32220. *
  32221. * **Note:** Non-object values are coerced to objects.
  32222. *
  32223. * @static
  32224. * @since 0.1.0
  32225. * @memberOf _
  32226. * @category Object
  32227. * @param {Object} object The object to query.
  32228. * @returns {Array} Returns the array of property values.
  32229. * @example
  32230. *
  32231. * function Foo() {
  32232. * this.a = 1;
  32233. * this.b = 2;
  32234. * }
  32235. *
  32236. * Foo.prototype.c = 3;
  32237. *
  32238. * _.values(new Foo);
  32239. * // => [1, 2] (iteration order is not guaranteed)
  32240. *
  32241. * _.values('hi');
  32242. * // => ['h', 'i']
  32243. */
  32244. function values(object) {
  32245. return object == null ? [] : baseValues(object, keys(object));
  32246. }
  32247. /**
  32248. * Creates an array of the own and inherited enumerable string keyed property
  32249. * values of `object`.
  32250. *
  32251. * **Note:** Non-object values are coerced to objects.
  32252. *
  32253. * @static
  32254. * @memberOf _
  32255. * @since 3.0.0
  32256. * @category Object
  32257. * @param {Object} object The object to query.
  32258. * @returns {Array} Returns the array of property values.
  32259. * @example
  32260. *
  32261. * function Foo() {
  32262. * this.a = 1;
  32263. * this.b = 2;
  32264. * }
  32265. *
  32266. * Foo.prototype.c = 3;
  32267. *
  32268. * _.valuesIn(new Foo);
  32269. * // => [1, 2, 3] (iteration order is not guaranteed)
  32270. */
  32271. function valuesIn(object) {
  32272. return object == null ? [] : baseValues(object, keysIn(object));
  32273. }
  32274. /*------------------------------------------------------------------------*/
  32275. /**
  32276. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  32277. *
  32278. * @static
  32279. * @memberOf _
  32280. * @since 4.0.0
  32281. * @category Number
  32282. * @param {number} number The number to clamp.
  32283. * @param {number} [lower] The lower bound.
  32284. * @param {number} upper The upper bound.
  32285. * @returns {number} Returns the clamped number.
  32286. * @example
  32287. *
  32288. * _.clamp(-10, -5, 5);
  32289. * // => -5
  32290. *
  32291. * _.clamp(10, -5, 5);
  32292. * // => 5
  32293. */
  32294. function clamp(number, lower, upper) {
  32295. if (upper === undefined) {
  32296. upper = lower;
  32297. lower = undefined;
  32298. }
  32299. if (upper !== undefined) {
  32300. upper = toNumber(upper);
  32301. upper = upper === upper ? upper : 0;
  32302. }
  32303. if (lower !== undefined) {
  32304. lower = toNumber(lower);
  32305. lower = lower === lower ? lower : 0;
  32306. }
  32307. return baseClamp(toNumber(number), lower, upper);
  32308. }
  32309. /**
  32310. * Checks if `n` is between `start` and up to, but not including, `end`. If
  32311. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  32312. * If `start` is greater than `end` the params are swapped to support
  32313. * negative ranges.
  32314. *
  32315. * @static
  32316. * @memberOf _
  32317. * @since 3.3.0
  32318. * @category Number
  32319. * @param {number} number The number to check.
  32320. * @param {number} [start=0] The start of the range.
  32321. * @param {number} end The end of the range.
  32322. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  32323. * @see _.range, _.rangeRight
  32324. * @example
  32325. *
  32326. * _.inRange(3, 2, 4);
  32327. * // => true
  32328. *
  32329. * _.inRange(4, 8);
  32330. * // => true
  32331. *
  32332. * _.inRange(4, 2);
  32333. * // => false
  32334. *
  32335. * _.inRange(2, 2);
  32336. * // => false
  32337. *
  32338. * _.inRange(1.2, 2);
  32339. * // => true
  32340. *
  32341. * _.inRange(5.2, 4);
  32342. * // => false
  32343. *
  32344. * _.inRange(-3, -2, -6);
  32345. * // => true
  32346. */
  32347. function inRange(number, start, end) {
  32348. start = toFinite(start);
  32349. if (end === undefined) {
  32350. end = start;
  32351. start = 0;
  32352. } else {
  32353. end = toFinite(end);
  32354. }
  32355. number = toNumber(number);
  32356. return baseInRange(number, start, end);
  32357. }
  32358. /**
  32359. * Produces a random number between the inclusive `lower` and `upper` bounds.
  32360. * If only one argument is provided a number between `0` and the given number
  32361. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  32362. * floats, a floating-point number is returned instead of an integer.
  32363. *
  32364. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  32365. * floating-point values which can produce unexpected results.
  32366. *
  32367. * @static
  32368. * @memberOf _
  32369. * @since 0.7.0
  32370. * @category Number
  32371. * @param {number} [lower=0] The lower bound.
  32372. * @param {number} [upper=1] The upper bound.
  32373. * @param {boolean} [floating] Specify returning a floating-point number.
  32374. * @returns {number} Returns the random number.
  32375. * @example
  32376. *
  32377. * _.random(0, 5);
  32378. * // => an integer between 0 and 5
  32379. *
  32380. * _.random(5);
  32381. * // => also an integer between 0 and 5
  32382. *
  32383. * _.random(5, true);
  32384. * // => a floating-point number between 0 and 5
  32385. *
  32386. * _.random(1.2, 5.2);
  32387. * // => a floating-point number between 1.2 and 5.2
  32388. */
  32389. function random(lower, upper, floating) {
  32390. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  32391. upper = floating = undefined;
  32392. }
  32393. if (floating === undefined) {
  32394. if (typeof upper == 'boolean') {
  32395. floating = upper;
  32396. upper = undefined;
  32397. }
  32398. else if (typeof lower == 'boolean') {
  32399. floating = lower;
  32400. lower = undefined;
  32401. }
  32402. }
  32403. if (lower === undefined && upper === undefined) {
  32404. lower = 0;
  32405. upper = 1;
  32406. }
  32407. else {
  32408. lower = toFinite(lower);
  32409. if (upper === undefined) {
  32410. upper = lower;
  32411. lower = 0;
  32412. } else {
  32413. upper = toFinite(upper);
  32414. }
  32415. }
  32416. if (lower > upper) {
  32417. var temp = lower;
  32418. lower = upper;
  32419. upper = temp;
  32420. }
  32421. if (floating || lower % 1 || upper % 1) {
  32422. var rand = nativeRandom();
  32423. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  32424. }
  32425. return baseRandom(lower, upper);
  32426. }
  32427. /*------------------------------------------------------------------------*/
  32428. /**
  32429. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  32430. *
  32431. * @static
  32432. * @memberOf _
  32433. * @since 3.0.0
  32434. * @category String
  32435. * @param {string} [string=''] The string to convert.
  32436. * @returns {string} Returns the camel cased string.
  32437. * @example
  32438. *
  32439. * _.camelCase('Foo Bar');
  32440. * // => 'fooBar'
  32441. *
  32442. * _.camelCase('--foo-bar--');
  32443. * // => 'fooBar'
  32444. *
  32445. * _.camelCase('__FOO_BAR__');
  32446. * // => 'fooBar'
  32447. */
  32448. var camelCase = createCompounder(function(result, word, index) {
  32449. word = word.toLowerCase();
  32450. return result + (index ? capitalize(word) : word);
  32451. });
  32452. /**
  32453. * Converts the first character of `string` to upper case and the remaining
  32454. * to lower case.
  32455. *
  32456. * @static
  32457. * @memberOf _
  32458. * @since 3.0.0
  32459. * @category String
  32460. * @param {string} [string=''] The string to capitalize.
  32461. * @returns {string} Returns the capitalized string.
  32462. * @example
  32463. *
  32464. * _.capitalize('FRED');
  32465. * // => 'Fred'
  32466. */
  32467. function capitalize(string) {
  32468. return upperFirst(toString(string).toLowerCase());
  32469. }
  32470. /**
  32471. * Deburrs `string` by converting
  32472. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  32473. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  32474. * letters to basic Latin letters and removing
  32475. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  32476. *
  32477. * @static
  32478. * @memberOf _
  32479. * @since 3.0.0
  32480. * @category String
  32481. * @param {string} [string=''] The string to deburr.
  32482. * @returns {string} Returns the deburred string.
  32483. * @example
  32484. *
  32485. * _.deburr('déjà vu');
  32486. * // => 'deja vu'
  32487. */
  32488. function deburr(string) {
  32489. string = toString(string);
  32490. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  32491. }
  32492. /**
  32493. * Checks if `string` ends with the given target string.
  32494. *
  32495. * @static
  32496. * @memberOf _
  32497. * @since 3.0.0
  32498. * @category String
  32499. * @param {string} [string=''] The string to inspect.
  32500. * @param {string} [target] The string to search for.
  32501. * @param {number} [position=string.length] The position to search up to.
  32502. * @returns {boolean} Returns `true` if `string` ends with `target`,
  32503. * else `false`.
  32504. * @example
  32505. *
  32506. * _.endsWith('abc', 'c');
  32507. * // => true
  32508. *
  32509. * _.endsWith('abc', 'b');
  32510. * // => false
  32511. *
  32512. * _.endsWith('abc', 'b', 2);
  32513. * // => true
  32514. */
  32515. function endsWith(string, target, position) {
  32516. string = toString(string);
  32517. target = baseToString(target);
  32518. var length = string.length;
  32519. position = position === undefined
  32520. ? length
  32521. : baseClamp(toInteger(position), 0, length);
  32522. var end = position;
  32523. position -= target.length;
  32524. return position >= 0 && string.slice(position, end) == target;
  32525. }
  32526. /**
  32527. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  32528. * corresponding HTML entities.
  32529. *
  32530. * **Note:** No other characters are escaped. To escape additional
  32531. * characters use a third-party library like [_he_](https://mths.be/he).
  32532. *
  32533. * Though the ">" character is escaped for symmetry, characters like
  32534. * ">" and "/" don't need escaping in HTML and have no special meaning
  32535. * unless they're part of a tag or unquoted attribute value. See
  32536. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  32537. * (under "semi-related fun fact") for more details.
  32538. *
  32539. * When working with HTML you should always
  32540. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  32541. * XSS vectors.
  32542. *
  32543. * @static
  32544. * @since 0.1.0
  32545. * @memberOf _
  32546. * @category String
  32547. * @param {string} [string=''] The string to escape.
  32548. * @returns {string} Returns the escaped string.
  32549. * @example
  32550. *
  32551. * _.escape('fred, barney, & pebbles');
  32552. * // => 'fred, barney, &amp; pebbles'
  32553. */
  32554. function escape(string) {
  32555. string = toString(string);
  32556. return (string && reHasUnescapedHtml.test(string))
  32557. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  32558. : string;
  32559. }
  32560. /**
  32561. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  32562. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  32563. *
  32564. * @static
  32565. * @memberOf _
  32566. * @since 3.0.0
  32567. * @category String
  32568. * @param {string} [string=''] The string to escape.
  32569. * @returns {string} Returns the escaped string.
  32570. * @example
  32571. *
  32572. * _.escapeRegExp('[lodash](https://lodash.com/)');
  32573. * // => '\[lodash\]\(https://lodash\.com/\)'
  32574. */
  32575. function escapeRegExp(string) {
  32576. string = toString(string);
  32577. return (string && reHasRegExpChar.test(string))
  32578. ? string.replace(reRegExpChar, '\\$&')
  32579. : string;
  32580. }
  32581. /**
  32582. * Converts `string` to
  32583. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  32584. *
  32585. * @static
  32586. * @memberOf _
  32587. * @since 3.0.0
  32588. * @category String
  32589. * @param {string} [string=''] The string to convert.
  32590. * @returns {string} Returns the kebab cased string.
  32591. * @example
  32592. *
  32593. * _.kebabCase('Foo Bar');
  32594. * // => 'foo-bar'
  32595. *
  32596. * _.kebabCase('fooBar');
  32597. * // => 'foo-bar'
  32598. *
  32599. * _.kebabCase('__FOO_BAR__');
  32600. * // => 'foo-bar'
  32601. */
  32602. var kebabCase = createCompounder(function(result, word, index) {
  32603. return result + (index ? '-' : '') + word.toLowerCase();
  32604. });
  32605. /**
  32606. * Converts `string`, as space separated words, to lower case.
  32607. *
  32608. * @static
  32609. * @memberOf _
  32610. * @since 4.0.0
  32611. * @category String
  32612. * @param {string} [string=''] The string to convert.
  32613. * @returns {string} Returns the lower cased string.
  32614. * @example
  32615. *
  32616. * _.lowerCase('--Foo-Bar--');
  32617. * // => 'foo bar'
  32618. *
  32619. * _.lowerCase('fooBar');
  32620. * // => 'foo bar'
  32621. *
  32622. * _.lowerCase('__FOO_BAR__');
  32623. * // => 'foo bar'
  32624. */
  32625. var lowerCase = createCompounder(function(result, word, index) {
  32626. return result + (index ? ' ' : '') + word.toLowerCase();
  32627. });
  32628. /**
  32629. * Converts the first character of `string` to lower case.
  32630. *
  32631. * @static
  32632. * @memberOf _
  32633. * @since 4.0.0
  32634. * @category String
  32635. * @param {string} [string=''] The string to convert.
  32636. * @returns {string} Returns the converted string.
  32637. * @example
  32638. *
  32639. * _.lowerFirst('Fred');
  32640. * // => 'fred'
  32641. *
  32642. * _.lowerFirst('FRED');
  32643. * // => 'fRED'
  32644. */
  32645. var lowerFirst = createCaseFirst('toLowerCase');
  32646. /**
  32647. * Pads `string` on the left and right sides if it's shorter than `length`.
  32648. * Padding characters are truncated if they can't be evenly divided by `length`.
  32649. *
  32650. * @static
  32651. * @memberOf _
  32652. * @since 3.0.0
  32653. * @category String
  32654. * @param {string} [string=''] The string to pad.
  32655. * @param {number} [length=0] The padding length.
  32656. * @param {string} [chars=' '] The string used as padding.
  32657. * @returns {string} Returns the padded string.
  32658. * @example
  32659. *
  32660. * _.pad('abc', 8);
  32661. * // => ' abc '
  32662. *
  32663. * _.pad('abc', 8, '_-');
  32664. * // => '_-abc_-_'
  32665. *
  32666. * _.pad('abc', 3);
  32667. * // => 'abc'
  32668. */
  32669. function pad(string, length, chars) {
  32670. string = toString(string);
  32671. length = toInteger(length);
  32672. var strLength = length ? stringSize(string) : 0;
  32673. if (!length || strLength >= length) {
  32674. return string;
  32675. }
  32676. var mid = (length - strLength) / 2;
  32677. return (
  32678. createPadding(nativeFloor(mid), chars) +
  32679. string +
  32680. createPadding(nativeCeil(mid), chars)
  32681. );
  32682. }
  32683. /**
  32684. * Pads `string` on the right side if it's shorter than `length`. Padding
  32685. * characters are truncated if they exceed `length`.
  32686. *
  32687. * @static
  32688. * @memberOf _
  32689. * @since 4.0.0
  32690. * @category String
  32691. * @param {string} [string=''] The string to pad.
  32692. * @param {number} [length=0] The padding length.
  32693. * @param {string} [chars=' '] The string used as padding.
  32694. * @returns {string} Returns the padded string.
  32695. * @example
  32696. *
  32697. * _.padEnd('abc', 6);
  32698. * // => 'abc '
  32699. *
  32700. * _.padEnd('abc', 6, '_-');
  32701. * // => 'abc_-_'
  32702. *
  32703. * _.padEnd('abc', 3);
  32704. * // => 'abc'
  32705. */
  32706. function padEnd(string, length, chars) {
  32707. string = toString(string);
  32708. length = toInteger(length);
  32709. var strLength = length ? stringSize(string) : 0;
  32710. return (length && strLength < length)
  32711. ? (string + createPadding(length - strLength, chars))
  32712. : string;
  32713. }
  32714. /**
  32715. * Pads `string` on the left side if it's shorter than `length`. Padding
  32716. * characters are truncated if they exceed `length`.
  32717. *
  32718. * @static
  32719. * @memberOf _
  32720. * @since 4.0.0
  32721. * @category String
  32722. * @param {string} [string=''] The string to pad.
  32723. * @param {number} [length=0] The padding length.
  32724. * @param {string} [chars=' '] The string used as padding.
  32725. * @returns {string} Returns the padded string.
  32726. * @example
  32727. *
  32728. * _.padStart('abc', 6);
  32729. * // => ' abc'
  32730. *
  32731. * _.padStart('abc', 6, '_-');
  32732. * // => '_-_abc'
  32733. *
  32734. * _.padStart('abc', 3);
  32735. * // => 'abc'
  32736. */
  32737. function padStart(string, length, chars) {
  32738. string = toString(string);
  32739. length = toInteger(length);
  32740. var strLength = length ? stringSize(string) : 0;
  32741. return (length && strLength < length)
  32742. ? (createPadding(length - strLength, chars) + string)
  32743. : string;
  32744. }
  32745. /**
  32746. * Converts `string` to an integer of the specified radix. If `radix` is
  32747. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  32748. * hexadecimal, in which case a `radix` of `16` is used.
  32749. *
  32750. * **Note:** This method aligns with the
  32751. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  32752. *
  32753. * @static
  32754. * @memberOf _
  32755. * @since 1.1.0
  32756. * @category String
  32757. * @param {string} string The string to convert.
  32758. * @param {number} [radix=10] The radix to interpret `value` by.
  32759. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32760. * @returns {number} Returns the converted integer.
  32761. * @example
  32762. *
  32763. * _.parseInt('08');
  32764. * // => 8
  32765. *
  32766. * _.map(['6', '08', '10'], _.parseInt);
  32767. * // => [6, 8, 10]
  32768. */
  32769. function parseInt(string, radix, guard) {
  32770. if (guard || radix == null) {
  32771. radix = 0;
  32772. } else if (radix) {
  32773. radix = +radix;
  32774. }
  32775. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  32776. }
  32777. /**
  32778. * Repeats the given string `n` times.
  32779. *
  32780. * @static
  32781. * @memberOf _
  32782. * @since 3.0.0
  32783. * @category String
  32784. * @param {string} [string=''] The string to repeat.
  32785. * @param {number} [n=1] The number of times to repeat the string.
  32786. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32787. * @returns {string} Returns the repeated string.
  32788. * @example
  32789. *
  32790. * _.repeat('*', 3);
  32791. * // => '***'
  32792. *
  32793. * _.repeat('abc', 2);
  32794. * // => 'abcabc'
  32795. *
  32796. * _.repeat('abc', 0);
  32797. * // => ''
  32798. */
  32799. function repeat(string, n, guard) {
  32800. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  32801. n = 1;
  32802. } else {
  32803. n = toInteger(n);
  32804. }
  32805. return baseRepeat(toString(string), n);
  32806. }
  32807. /**
  32808. * Replaces matches for `pattern` in `string` with `replacement`.
  32809. *
  32810. * **Note:** This method is based on
  32811. * [`String#replace`](https://mdn.io/String/replace).
  32812. *
  32813. * @static
  32814. * @memberOf _
  32815. * @since 4.0.0
  32816. * @category String
  32817. * @param {string} [string=''] The string to modify.
  32818. * @param {RegExp|string} pattern The pattern to replace.
  32819. * @param {Function|string} replacement The match replacement.
  32820. * @returns {string} Returns the modified string.
  32821. * @example
  32822. *
  32823. * _.replace('Hi Fred', 'Fred', 'Barney');
  32824. * // => 'Hi Barney'
  32825. */
  32826. function replace() {
  32827. var args = arguments,
  32828. string = toString(args[0]);
  32829. return args.length < 3 ? string : string.replace(args[1], args[2]);
  32830. }
  32831. /**
  32832. * Converts `string` to
  32833. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  32834. *
  32835. * @static
  32836. * @memberOf _
  32837. * @since 3.0.0
  32838. * @category String
  32839. * @param {string} [string=''] The string to convert.
  32840. * @returns {string} Returns the snake cased string.
  32841. * @example
  32842. *
  32843. * _.snakeCase('Foo Bar');
  32844. * // => 'foo_bar'
  32845. *
  32846. * _.snakeCase('fooBar');
  32847. * // => 'foo_bar'
  32848. *
  32849. * _.snakeCase('--FOO-BAR--');
  32850. * // => 'foo_bar'
  32851. */
  32852. var snakeCase = createCompounder(function(result, word, index) {
  32853. return result + (index ? '_' : '') + word.toLowerCase();
  32854. });
  32855. /**
  32856. * Splits `string` by `separator`.
  32857. *
  32858. * **Note:** This method is based on
  32859. * [`String#split`](https://mdn.io/String/split).
  32860. *
  32861. * @static
  32862. * @memberOf _
  32863. * @since 4.0.0
  32864. * @category String
  32865. * @param {string} [string=''] The string to split.
  32866. * @param {RegExp|string} separator The separator pattern to split by.
  32867. * @param {number} [limit] The length to truncate results to.
  32868. * @returns {Array} Returns the string segments.
  32869. * @example
  32870. *
  32871. * _.split('a-b-c', '-', 2);
  32872. * // => ['a', 'b']
  32873. */
  32874. function split(string, separator, limit) {
  32875. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  32876. separator = limit = undefined;
  32877. }
  32878. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  32879. if (!limit) {
  32880. return [];
  32881. }
  32882. string = toString(string);
  32883. if (string && (
  32884. typeof separator == 'string' ||
  32885. (separator != null && !isRegExp(separator))
  32886. )) {
  32887. separator = baseToString(separator);
  32888. if (!separator && hasUnicode(string)) {
  32889. return castSlice(stringToArray(string), 0, limit);
  32890. }
  32891. }
  32892. return string.split(separator, limit);
  32893. }
  32894. /**
  32895. * Converts `string` to
  32896. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  32897. *
  32898. * @static
  32899. * @memberOf _
  32900. * @since 3.1.0
  32901. * @category String
  32902. * @param {string} [string=''] The string to convert.
  32903. * @returns {string} Returns the start cased string.
  32904. * @example
  32905. *
  32906. * _.startCase('--foo-bar--');
  32907. * // => 'Foo Bar'
  32908. *
  32909. * _.startCase('fooBar');
  32910. * // => 'Foo Bar'
  32911. *
  32912. * _.startCase('__FOO_BAR__');
  32913. * // => 'FOO BAR'
  32914. */
  32915. var startCase = createCompounder(function(result, word, index) {
  32916. return result + (index ? ' ' : '') + upperFirst(word);
  32917. });
  32918. /**
  32919. * Checks if `string` starts with the given target string.
  32920. *
  32921. * @static
  32922. * @memberOf _
  32923. * @since 3.0.0
  32924. * @category String
  32925. * @param {string} [string=''] The string to inspect.
  32926. * @param {string} [target] The string to search for.
  32927. * @param {number} [position=0] The position to search from.
  32928. * @returns {boolean} Returns `true` if `string` starts with `target`,
  32929. * else `false`.
  32930. * @example
  32931. *
  32932. * _.startsWith('abc', 'a');
  32933. * // => true
  32934. *
  32935. * _.startsWith('abc', 'b');
  32936. * // => false
  32937. *
  32938. * _.startsWith('abc', 'b', 1);
  32939. * // => true
  32940. */
  32941. function startsWith(string, target, position) {
  32942. string = toString(string);
  32943. position = position == null
  32944. ? 0
  32945. : baseClamp(toInteger(position), 0, string.length);
  32946. target = baseToString(target);
  32947. return string.slice(position, position + target.length) == target;
  32948. }
  32949. /**
  32950. * Creates a compiled template function that can interpolate data properties
  32951. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  32952. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  32953. * properties may be accessed as free variables in the template. If a setting
  32954. * object is given, it takes precedence over `_.templateSettings` values.
  32955. *
  32956. * **Note:** In the development build `_.template` utilizes
  32957. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  32958. * for easier debugging.
  32959. *
  32960. * For more information on precompiling templates see
  32961. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  32962. *
  32963. * For more information on Chrome extension sandboxes see
  32964. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  32965. *
  32966. * @static
  32967. * @since 0.1.0
  32968. * @memberOf _
  32969. * @category String
  32970. * @param {string} [string=''] The template string.
  32971. * @param {Object} [options={}] The options object.
  32972. * @param {RegExp} [options.escape=_.templateSettings.escape]
  32973. * The HTML "escape" delimiter.
  32974. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  32975. * The "evaluate" delimiter.
  32976. * @param {Object} [options.imports=_.templateSettings.imports]
  32977. * An object to import into the template as free variables.
  32978. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  32979. * The "interpolate" delimiter.
  32980. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  32981. * The sourceURL of the compiled template.
  32982. * @param {string} [options.variable='obj']
  32983. * The data object variable name.
  32984. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32985. * @returns {Function} Returns the compiled template function.
  32986. * @example
  32987. *
  32988. * // Use the "interpolate" delimiter to create a compiled template.
  32989. * var compiled = _.template('hello <%= user %>!');
  32990. * compiled({ 'user': 'fred' });
  32991. * // => 'hello fred!'
  32992. *
  32993. * // Use the HTML "escape" delimiter to escape data property values.
  32994. * var compiled = _.template('<b><%- value %></b>');
  32995. * compiled({ 'value': '<script>' });
  32996. * // => '<b>&lt;script&gt;</b>'
  32997. *
  32998. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  32999. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  33000. * compiled({ 'users': ['fred', 'barney'] });
  33001. * // => '<li>fred</li><li>barney</li>'
  33002. *
  33003. * // Use the internal `print` function in "evaluate" delimiters.
  33004. * var compiled = _.template('<% print("hello " + user); %>!');
  33005. * compiled({ 'user': 'barney' });
  33006. * // => 'hello barney!'
  33007. *
  33008. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  33009. * // Disable support by replacing the "interpolate" delimiter.
  33010. * var compiled = _.template('hello ${ user }!');
  33011. * compiled({ 'user': 'pebbles' });
  33012. * // => 'hello pebbles!'
  33013. *
  33014. * // Use backslashes to treat delimiters as plain text.
  33015. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  33016. * compiled({ 'value': 'ignored' });
  33017. * // => '<%- value %>'
  33018. *
  33019. * // Use the `imports` option to import `jQuery` as `jq`.
  33020. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  33021. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  33022. * compiled({ 'users': ['fred', 'barney'] });
  33023. * // => '<li>fred</li><li>barney</li>'
  33024. *
  33025. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  33026. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  33027. * compiled(data);
  33028. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  33029. *
  33030. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  33031. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  33032. * compiled.source;
  33033. * // => function(data) {
  33034. * // var __t, __p = '';
  33035. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  33036. * // return __p;
  33037. * // }
  33038. *
  33039. * // Use custom template delimiters.
  33040. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  33041. * var compiled = _.template('hello {{ user }}!');
  33042. * compiled({ 'user': 'mustache' });
  33043. * // => 'hello mustache!'
  33044. *
  33045. * // Use the `source` property to inline compiled templates for meaningful
  33046. * // line numbers in error messages and stack traces.
  33047. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  33048. * var JST = {\
  33049. * "main": ' + _.template(mainText).source + '\
  33050. * };\
  33051. * ');
  33052. */
  33053. function template(string, options, guard) {
  33054. // Based on John Resig's `tmpl` implementation
  33055. // (http://ejohn.org/blog/javascript-micro-templating/)
  33056. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  33057. var settings = lodash.templateSettings;
  33058. if (guard && isIterateeCall(string, options, guard)) {
  33059. options = undefined;
  33060. }
  33061. string = toString(string);
  33062. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  33063. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  33064. importsKeys = keys(imports),
  33065. importsValues = baseValues(imports, importsKeys);
  33066. var isEscaping,
  33067. isEvaluating,
  33068. index = 0,
  33069. interpolate = options.interpolate || reNoMatch,
  33070. source = "__p += '";
  33071. // Compile the regexp to match each delimiter.
  33072. var reDelimiters = RegExp(
  33073. (options.escape || reNoMatch).source + '|' +
  33074. interpolate.source + '|' +
  33075. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  33076. (options.evaluate || reNoMatch).source + '|$'
  33077. , 'g');
  33078. // Use a sourceURL for easier debugging.
  33079. // The sourceURL gets injected into the source that's eval-ed, so be careful
  33080. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  33081. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  33082. var sourceURL = '//# sourceURL=' +
  33083. (hasOwnProperty.call(options, 'sourceURL')
  33084. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  33085. : ('lodash.templateSources[' + (++templateCounter) + ']')
  33086. ) + '\n';
  33087. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  33088. interpolateValue || (interpolateValue = esTemplateValue);
  33089. // Escape characters that can't be included in string literals.
  33090. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  33091. // Replace delimiters with snippets.
  33092. if (escapeValue) {
  33093. isEscaping = true;
  33094. source += "' +\n__e(" + escapeValue + ") +\n'";
  33095. }
  33096. if (evaluateValue) {
  33097. isEvaluating = true;
  33098. source += "';\n" + evaluateValue + ";\n__p += '";
  33099. }
  33100. if (interpolateValue) {
  33101. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  33102. }
  33103. index = offset + match.length;
  33104. // The JS engine embedded in Adobe products needs `match` returned in
  33105. // order to produce the correct `offset` value.
  33106. return match;
  33107. });
  33108. source += "';\n";
  33109. // If `variable` is not specified wrap a with-statement around the generated
  33110. // code to add the data object to the top of the scope chain.
  33111. // Like with sourceURL, we take care to not check the option's prototype,
  33112. // as this configuration is a code injection vector.
  33113. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  33114. if (!variable) {
  33115. source = 'with (obj) {\n' + source + '\n}\n';
  33116. }
  33117. // Cleanup code by stripping empty strings.
  33118. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  33119. .replace(reEmptyStringMiddle, '$1')
  33120. .replace(reEmptyStringTrailing, '$1;');
  33121. // Frame code as the function body.
  33122. source = 'function(' + (variable || 'obj') + ') {\n' +
  33123. (variable
  33124. ? ''
  33125. : 'obj || (obj = {});\n'
  33126. ) +
  33127. "var __t, __p = ''" +
  33128. (isEscaping
  33129. ? ', __e = _.escape'
  33130. : ''
  33131. ) +
  33132. (isEvaluating
  33133. ? ', __j = Array.prototype.join;\n' +
  33134. "function print() { __p += __j.call(arguments, '') }\n"
  33135. : ';\n'
  33136. ) +
  33137. source +
  33138. 'return __p\n}';
  33139. var result = attempt(function() {
  33140. return Function(importsKeys, sourceURL + 'return ' + source)
  33141. .apply(undefined, importsValues);
  33142. });
  33143. // Provide the compiled function's source by its `toString` method or
  33144. // the `source` property as a convenience for inlining compiled templates.
  33145. result.source = source;
  33146. if (isError(result)) {
  33147. throw result;
  33148. }
  33149. return result;
  33150. }
  33151. /**
  33152. * Converts `string`, as a whole, to lower case just like
  33153. * [String#toLowerCase](https://mdn.io/toLowerCase).
  33154. *
  33155. * @static
  33156. * @memberOf _
  33157. * @since 4.0.0
  33158. * @category String
  33159. * @param {string} [string=''] The string to convert.
  33160. * @returns {string} Returns the lower cased string.
  33161. * @example
  33162. *
  33163. * _.toLower('--Foo-Bar--');
  33164. * // => '--foo-bar--'
  33165. *
  33166. * _.toLower('fooBar');
  33167. * // => 'foobar'
  33168. *
  33169. * _.toLower('__FOO_BAR__');
  33170. * // => '__foo_bar__'
  33171. */
  33172. function toLower(value) {
  33173. return toString(value).toLowerCase();
  33174. }
  33175. /**
  33176. * Converts `string`, as a whole, to upper case just like
  33177. * [String#toUpperCase](https://mdn.io/toUpperCase).
  33178. *
  33179. * @static
  33180. * @memberOf _
  33181. * @since 4.0.0
  33182. * @category String
  33183. * @param {string} [string=''] The string to convert.
  33184. * @returns {string} Returns the upper cased string.
  33185. * @example
  33186. *
  33187. * _.toUpper('--foo-bar--');
  33188. * // => '--FOO-BAR--'
  33189. *
  33190. * _.toUpper('fooBar');
  33191. * // => 'FOOBAR'
  33192. *
  33193. * _.toUpper('__foo_bar__');
  33194. * // => '__FOO_BAR__'
  33195. */
  33196. function toUpper(value) {
  33197. return toString(value).toUpperCase();
  33198. }
  33199. /**
  33200. * Removes leading and trailing whitespace or specified characters from `string`.
  33201. *
  33202. * @static
  33203. * @memberOf _
  33204. * @since 3.0.0
  33205. * @category String
  33206. * @param {string} [string=''] The string to trim.
  33207. * @param {string} [chars=whitespace] The characters to trim.
  33208. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  33209. * @returns {string} Returns the trimmed string.
  33210. * @example
  33211. *
  33212. * _.trim(' abc ');
  33213. * // => 'abc'
  33214. *
  33215. * _.trim('-_-abc-_-', '_-');
  33216. * // => 'abc'
  33217. *
  33218. * _.map([' foo ', ' bar '], _.trim);
  33219. * // => ['foo', 'bar']
  33220. */
  33221. function trim(string, chars, guard) {
  33222. string = toString(string);
  33223. if (string && (guard || chars === undefined)) {
  33224. return string.replace(reTrim, '');
  33225. }
  33226. if (!string || !(chars = baseToString(chars))) {
  33227. return string;
  33228. }
  33229. var strSymbols = stringToArray(string),
  33230. chrSymbols = stringToArray(chars),
  33231. start = charsStartIndex(strSymbols, chrSymbols),
  33232. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  33233. return castSlice(strSymbols, start, end).join('');
  33234. }
  33235. /**
  33236. * Removes trailing whitespace or specified characters from `string`.
  33237. *
  33238. * @static
  33239. * @memberOf _
  33240. * @since 4.0.0
  33241. * @category String
  33242. * @param {string} [string=''] The string to trim.
  33243. * @param {string} [chars=whitespace] The characters to trim.
  33244. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  33245. * @returns {string} Returns the trimmed string.
  33246. * @example
  33247. *
  33248. * _.trimEnd(' abc ');
  33249. * // => ' abc'
  33250. *
  33251. * _.trimEnd('-_-abc-_-', '_-');
  33252. * // => '-_-abc'
  33253. */
  33254. function trimEnd(string, chars, guard) {
  33255. string = toString(string);
  33256. if (string && (guard || chars === undefined)) {
  33257. return string.replace(reTrimEnd, '');
  33258. }
  33259. if (!string || !(chars = baseToString(chars))) {
  33260. return string;
  33261. }
  33262. var strSymbols = stringToArray(string),
  33263. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  33264. return castSlice(strSymbols, 0, end).join('');
  33265. }
  33266. /**
  33267. * Removes leading whitespace or specified characters from `string`.
  33268. *
  33269. * @static
  33270. * @memberOf _
  33271. * @since 4.0.0
  33272. * @category String
  33273. * @param {string} [string=''] The string to trim.
  33274. * @param {string} [chars=whitespace] The characters to trim.
  33275. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  33276. * @returns {string} Returns the trimmed string.
  33277. * @example
  33278. *
  33279. * _.trimStart(' abc ');
  33280. * // => 'abc '
  33281. *
  33282. * _.trimStart('-_-abc-_-', '_-');
  33283. * // => 'abc-_-'
  33284. */
  33285. function trimStart(string, chars, guard) {
  33286. string = toString(string);
  33287. if (string && (guard || chars === undefined)) {
  33288. return string.replace(reTrimStart, '');
  33289. }
  33290. if (!string || !(chars = baseToString(chars))) {
  33291. return string;
  33292. }
  33293. var strSymbols = stringToArray(string),
  33294. start = charsStartIndex(strSymbols, stringToArray(chars));
  33295. return castSlice(strSymbols, start).join('');
  33296. }
  33297. /**
  33298. * Truncates `string` if it's longer than the given maximum string length.
  33299. * The last characters of the truncated string are replaced with the omission
  33300. * string which defaults to "...".
  33301. *
  33302. * @static
  33303. * @memberOf _
  33304. * @since 4.0.0
  33305. * @category String
  33306. * @param {string} [string=''] The string to truncate.
  33307. * @param {Object} [options={}] The options object.
  33308. * @param {number} [options.length=30] The maximum string length.
  33309. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  33310. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  33311. * @returns {string} Returns the truncated string.
  33312. * @example
  33313. *
  33314. * _.truncate('hi-diddly-ho there, neighborino');
  33315. * // => 'hi-diddly-ho there, neighbo...'
  33316. *
  33317. * _.truncate('hi-diddly-ho there, neighborino', {
  33318. * 'length': 24,
  33319. * 'separator': ' '
  33320. * });
  33321. * // => 'hi-diddly-ho there,...'
  33322. *
  33323. * _.truncate('hi-diddly-ho there, neighborino', {
  33324. * 'length': 24,
  33325. * 'separator': /,? +/
  33326. * });
  33327. * // => 'hi-diddly-ho there...'
  33328. *
  33329. * _.truncate('hi-diddly-ho there, neighborino', {
  33330. * 'omission': ' [...]'
  33331. * });
  33332. * // => 'hi-diddly-ho there, neig [...]'
  33333. */
  33334. function truncate(string, options) {
  33335. var length = DEFAULT_TRUNC_LENGTH,
  33336. omission = DEFAULT_TRUNC_OMISSION;
  33337. if (isObject(options)) {
  33338. var separator = 'separator' in options ? options.separator : separator;
  33339. length = 'length' in options ? toInteger(options.length) : length;
  33340. omission = 'omission' in options ? baseToString(options.omission) : omission;
  33341. }
  33342. string = toString(string);
  33343. var strLength = string.length;
  33344. if (hasUnicode(string)) {
  33345. var strSymbols = stringToArray(string);
  33346. strLength = strSymbols.length;
  33347. }
  33348. if (length >= strLength) {
  33349. return string;
  33350. }
  33351. var end = length - stringSize(omission);
  33352. if (end < 1) {
  33353. return omission;
  33354. }
  33355. var result = strSymbols
  33356. ? castSlice(strSymbols, 0, end).join('')
  33357. : string.slice(0, end);
  33358. if (separator === undefined) {
  33359. return result + omission;
  33360. }
  33361. if (strSymbols) {
  33362. end += (result.length - end);
  33363. }
  33364. if (isRegExp(separator)) {
  33365. if (string.slice(end).search(separator)) {
  33366. var match,
  33367. substring = result;
  33368. if (!separator.global) {
  33369. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  33370. }
  33371. separator.lastIndex = 0;
  33372. while ((match = separator.exec(substring))) {
  33373. var newEnd = match.index;
  33374. }
  33375. result = result.slice(0, newEnd === undefined ? end : newEnd);
  33376. }
  33377. } else if (string.indexOf(baseToString(separator), end) != end) {
  33378. var index = result.lastIndexOf(separator);
  33379. if (index > -1) {
  33380. result = result.slice(0, index);
  33381. }
  33382. }
  33383. return result + omission;
  33384. }
  33385. /**
  33386. * The inverse of `_.escape`; this method converts the HTML entities
  33387. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  33388. * their corresponding characters.
  33389. *
  33390. * **Note:** No other HTML entities are unescaped. To unescape additional
  33391. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  33392. *
  33393. * @static
  33394. * @memberOf _
  33395. * @since 0.6.0
  33396. * @category String
  33397. * @param {string} [string=''] The string to unescape.
  33398. * @returns {string} Returns the unescaped string.
  33399. * @example
  33400. *
  33401. * _.unescape('fred, barney, &amp; pebbles');
  33402. * // => 'fred, barney, & pebbles'
  33403. */
  33404. function unescape(string) {
  33405. string = toString(string);
  33406. return (string && reHasEscapedHtml.test(string))
  33407. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  33408. : string;
  33409. }
  33410. /**
  33411. * Converts `string`, as space separated words, to upper case.
  33412. *
  33413. * @static
  33414. * @memberOf _
  33415. * @since 4.0.0
  33416. * @category String
  33417. * @param {string} [string=''] The string to convert.
  33418. * @returns {string} Returns the upper cased string.
  33419. * @example
  33420. *
  33421. * _.upperCase('--foo-bar');
  33422. * // => 'FOO BAR'
  33423. *
  33424. * _.upperCase('fooBar');
  33425. * // => 'FOO BAR'
  33426. *
  33427. * _.upperCase('__foo_bar__');
  33428. * // => 'FOO BAR'
  33429. */
  33430. var upperCase = createCompounder(function(result, word, index) {
  33431. return result + (index ? ' ' : '') + word.toUpperCase();
  33432. });
  33433. /**
  33434. * Converts the first character of `string` to upper case.
  33435. *
  33436. * @static
  33437. * @memberOf _
  33438. * @since 4.0.0
  33439. * @category String
  33440. * @param {string} [string=''] The string to convert.
  33441. * @returns {string} Returns the converted string.
  33442. * @example
  33443. *
  33444. * _.upperFirst('fred');
  33445. * // => 'Fred'
  33446. *
  33447. * _.upperFirst('FRED');
  33448. * // => 'FRED'
  33449. */
  33450. var upperFirst = createCaseFirst('toUpperCase');
  33451. /**
  33452. * Splits `string` into an array of its words.
  33453. *
  33454. * @static
  33455. * @memberOf _
  33456. * @since 3.0.0
  33457. * @category String
  33458. * @param {string} [string=''] The string to inspect.
  33459. * @param {RegExp|string} [pattern] The pattern to match words.
  33460. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  33461. * @returns {Array} Returns the words of `string`.
  33462. * @example
  33463. *
  33464. * _.words('fred, barney, & pebbles');
  33465. * // => ['fred', 'barney', 'pebbles']
  33466. *
  33467. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  33468. * // => ['fred', 'barney', '&', 'pebbles']
  33469. */
  33470. function words(string, pattern, guard) {
  33471. string = toString(string);
  33472. pattern = guard ? undefined : pattern;
  33473. if (pattern === undefined) {
  33474. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  33475. }
  33476. return string.match(pattern) || [];
  33477. }
  33478. /*------------------------------------------------------------------------*/
  33479. /**
  33480. * Attempts to invoke `func`, returning either the result or the caught error
  33481. * object. Any additional arguments are provided to `func` when it's invoked.
  33482. *
  33483. * @static
  33484. * @memberOf _
  33485. * @since 3.0.0
  33486. * @category Util
  33487. * @param {Function} func The function to attempt.
  33488. * @param {...*} [args] The arguments to invoke `func` with.
  33489. * @returns {*} Returns the `func` result or error object.
  33490. * @example
  33491. *
  33492. * // Avoid throwing errors for invalid selectors.
  33493. * var elements = _.attempt(function(selector) {
  33494. * return document.querySelectorAll(selector);
  33495. * }, '>_>');
  33496. *
  33497. * if (_.isError(elements)) {
  33498. * elements = [];
  33499. * }
  33500. */
  33501. var attempt = baseRest(function(func, args) {
  33502. try {
  33503. return apply(func, undefined, args);
  33504. } catch (e) {
  33505. return isError(e) ? e : new Error(e);
  33506. }
  33507. });
  33508. /**
  33509. * Binds methods of an object to the object itself, overwriting the existing
  33510. * method.
  33511. *
  33512. * **Note:** This method doesn't set the "length" property of bound functions.
  33513. *
  33514. * @static
  33515. * @since 0.1.0
  33516. * @memberOf _
  33517. * @category Util
  33518. * @param {Object} object The object to bind and assign the bound methods to.
  33519. * @param {...(string|string[])} methodNames The object method names to bind.
  33520. * @returns {Object} Returns `object`.
  33521. * @example
  33522. *
  33523. * var view = {
  33524. * 'label': 'docs',
  33525. * 'click': function() {
  33526. * console.log('clicked ' + this.label);
  33527. * }
  33528. * };
  33529. *
  33530. * _.bindAll(view, ['click']);
  33531. * jQuery(element).on('click', view.click);
  33532. * // => Logs 'clicked docs' when clicked.
  33533. */
  33534. var bindAll = flatRest(function(object, methodNames) {
  33535. arrayEach(methodNames, function(key) {
  33536. key = toKey(key);
  33537. baseAssignValue(object, key, bind(object[key], object));
  33538. });
  33539. return object;
  33540. });
  33541. /**
  33542. * Creates a function that iterates over `pairs` and invokes the corresponding
  33543. * function of the first predicate to return truthy. The predicate-function
  33544. * pairs are invoked with the `this` binding and arguments of the created
  33545. * function.
  33546. *
  33547. * @static
  33548. * @memberOf _
  33549. * @since 4.0.0
  33550. * @category Util
  33551. * @param {Array} pairs The predicate-function pairs.
  33552. * @returns {Function} Returns the new composite function.
  33553. * @example
  33554. *
  33555. * var func = _.cond([
  33556. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  33557. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  33558. * [_.stubTrue, _.constant('no match')]
  33559. * ]);
  33560. *
  33561. * func({ 'a': 1, 'b': 2 });
  33562. * // => 'matches A'
  33563. *
  33564. * func({ 'a': 0, 'b': 1 });
  33565. * // => 'matches B'
  33566. *
  33567. * func({ 'a': '1', 'b': '2' });
  33568. * // => 'no match'
  33569. */
  33570. function cond(pairs) {
  33571. var length = pairs == null ? 0 : pairs.length,
  33572. toIteratee = getIteratee();
  33573. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  33574. if (typeof pair[1] != 'function') {
  33575. throw new TypeError(FUNC_ERROR_TEXT);
  33576. }
  33577. return [toIteratee(pair[0]), pair[1]];
  33578. });
  33579. return baseRest(function(args) {
  33580. var index = -1;
  33581. while (++index < length) {
  33582. var pair = pairs[index];
  33583. if (apply(pair[0], this, args)) {
  33584. return apply(pair[1], this, args);
  33585. }
  33586. }
  33587. });
  33588. }
  33589. /**
  33590. * Creates a function that invokes the predicate properties of `source` with
  33591. * the corresponding property values of a given object, returning `true` if
  33592. * all predicates return truthy, else `false`.
  33593. *
  33594. * **Note:** The created function is equivalent to `_.conformsTo` with
  33595. * `source` partially applied.
  33596. *
  33597. * @static
  33598. * @memberOf _
  33599. * @since 4.0.0
  33600. * @category Util
  33601. * @param {Object} source The object of property predicates to conform to.
  33602. * @returns {Function} Returns the new spec function.
  33603. * @example
  33604. *
  33605. * var objects = [
  33606. * { 'a': 2, 'b': 1 },
  33607. * { 'a': 1, 'b': 2 }
  33608. * ];
  33609. *
  33610. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  33611. * // => [{ 'a': 1, 'b': 2 }]
  33612. */
  33613. function conforms(source) {
  33614. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  33615. }
  33616. /**
  33617. * Creates a function that returns `value`.
  33618. *
  33619. * @static
  33620. * @memberOf _
  33621. * @since 2.4.0
  33622. * @category Util
  33623. * @param {*} value The value to return from the new function.
  33624. * @returns {Function} Returns the new constant function.
  33625. * @example
  33626. *
  33627. * var objects = _.times(2, _.constant({ 'a': 1 }));
  33628. *
  33629. * console.log(objects);
  33630. * // => [{ 'a': 1 }, { 'a': 1 }]
  33631. *
  33632. * console.log(objects[0] === objects[1]);
  33633. * // => true
  33634. */
  33635. function constant(value) {
  33636. return function() {
  33637. return value;
  33638. };
  33639. }
  33640. /**
  33641. * Checks `value` to determine whether a default value should be returned in
  33642. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  33643. * or `undefined`.
  33644. *
  33645. * @static
  33646. * @memberOf _
  33647. * @since 4.14.0
  33648. * @category Util
  33649. * @param {*} value The value to check.
  33650. * @param {*} defaultValue The default value.
  33651. * @returns {*} Returns the resolved value.
  33652. * @example
  33653. *
  33654. * _.defaultTo(1, 10);
  33655. * // => 1
  33656. *
  33657. * _.defaultTo(undefined, 10);
  33658. * // => 10
  33659. */
  33660. function defaultTo(value, defaultValue) {
  33661. return (value == null || value !== value) ? defaultValue : value;
  33662. }
  33663. /**
  33664. * Creates a function that returns the result of invoking the given functions
  33665. * with the `this` binding of the created function, where each successive
  33666. * invocation is supplied the return value of the previous.
  33667. *
  33668. * @static
  33669. * @memberOf _
  33670. * @since 3.0.0
  33671. * @category Util
  33672. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  33673. * @returns {Function} Returns the new composite function.
  33674. * @see _.flowRight
  33675. * @example
  33676. *
  33677. * function square(n) {
  33678. * return n * n;
  33679. * }
  33680. *
  33681. * var addSquare = _.flow([_.add, square]);
  33682. * addSquare(1, 2);
  33683. * // => 9
  33684. */
  33685. var flow = createFlow();
  33686. /**
  33687. * This method is like `_.flow` except that it creates a function that
  33688. * invokes the given functions from right to left.
  33689. *
  33690. * @static
  33691. * @since 3.0.0
  33692. * @memberOf _
  33693. * @category Util
  33694. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  33695. * @returns {Function} Returns the new composite function.
  33696. * @see _.flow
  33697. * @example
  33698. *
  33699. * function square(n) {
  33700. * return n * n;
  33701. * }
  33702. *
  33703. * var addSquare = _.flowRight([square, _.add]);
  33704. * addSquare(1, 2);
  33705. * // => 9
  33706. */
  33707. var flowRight = createFlow(true);
  33708. /**
  33709. * This method returns the first argument it receives.
  33710. *
  33711. * @static
  33712. * @since 0.1.0
  33713. * @memberOf _
  33714. * @category Util
  33715. * @param {*} value Any value.
  33716. * @returns {*} Returns `value`.
  33717. * @example
  33718. *
  33719. * var object = { 'a': 1 };
  33720. *
  33721. * console.log(_.identity(object) === object);
  33722. * // => true
  33723. */
  33724. function identity(value) {
  33725. return value;
  33726. }
  33727. /**
  33728. * Creates a function that invokes `func` with the arguments of the created
  33729. * function. If `func` is a property name, the created function returns the
  33730. * property value for a given element. If `func` is an array or object, the
  33731. * created function returns `true` for elements that contain the equivalent
  33732. * source properties, otherwise it returns `false`.
  33733. *
  33734. * @static
  33735. * @since 4.0.0
  33736. * @memberOf _
  33737. * @category Util
  33738. * @param {*} [func=_.identity] The value to convert to a callback.
  33739. * @returns {Function} Returns the callback.
  33740. * @example
  33741. *
  33742. * var users = [
  33743. * { 'user': 'barney', 'age': 36, 'active': true },
  33744. * { 'user': 'fred', 'age': 40, 'active': false }
  33745. * ];
  33746. *
  33747. * // The `_.matches` iteratee shorthand.
  33748. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  33749. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  33750. *
  33751. * // The `_.matchesProperty` iteratee shorthand.
  33752. * _.filter(users, _.iteratee(['user', 'fred']));
  33753. * // => [{ 'user': 'fred', 'age': 40 }]
  33754. *
  33755. * // The `_.property` iteratee shorthand.
  33756. * _.map(users, _.iteratee('user'));
  33757. * // => ['barney', 'fred']
  33758. *
  33759. * // Create custom iteratee shorthands.
  33760. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  33761. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  33762. * return func.test(string);
  33763. * };
  33764. * });
  33765. *
  33766. * _.filter(['abc', 'def'], /ef/);
  33767. * // => ['def']
  33768. */
  33769. function iteratee(func) {
  33770. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  33771. }
  33772. /**
  33773. * Creates a function that performs a partial deep comparison between a given
  33774. * object and `source`, returning `true` if the given object has equivalent
  33775. * property values, else `false`.
  33776. *
  33777. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  33778. * partially applied.
  33779. *
  33780. * Partial comparisons will match empty array and empty object `source`
  33781. * values against any array or object value, respectively. See `_.isEqual`
  33782. * for a list of supported value comparisons.
  33783. *
  33784. * @static
  33785. * @memberOf _
  33786. * @since 3.0.0
  33787. * @category Util
  33788. * @param {Object} source The object of property values to match.
  33789. * @returns {Function} Returns the new spec function.
  33790. * @example
  33791. *
  33792. * var objects = [
  33793. * { 'a': 1, 'b': 2, 'c': 3 },
  33794. * { 'a': 4, 'b': 5, 'c': 6 }
  33795. * ];
  33796. *
  33797. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  33798. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  33799. */
  33800. function matches(source) {
  33801. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  33802. }
  33803. /**
  33804. * Creates a function that performs a partial deep comparison between the
  33805. * value at `path` of a given object to `srcValue`, returning `true` if the
  33806. * object value is equivalent, else `false`.
  33807. *
  33808. * **Note:** Partial comparisons will match empty array and empty object
  33809. * `srcValue` values against any array or object value, respectively. See
  33810. * `_.isEqual` for a list of supported value comparisons.
  33811. *
  33812. * @static
  33813. * @memberOf _
  33814. * @since 3.2.0
  33815. * @category Util
  33816. * @param {Array|string} path The path of the property to get.
  33817. * @param {*} srcValue The value to match.
  33818. * @returns {Function} Returns the new spec function.
  33819. * @example
  33820. *
  33821. * var objects = [
  33822. * { 'a': 1, 'b': 2, 'c': 3 },
  33823. * { 'a': 4, 'b': 5, 'c': 6 }
  33824. * ];
  33825. *
  33826. * _.find(objects, _.matchesProperty('a', 4));
  33827. * // => { 'a': 4, 'b': 5, 'c': 6 }
  33828. */
  33829. function matchesProperty(path, srcValue) {
  33830. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  33831. }
  33832. /**
  33833. * Creates a function that invokes the method at `path` of a given object.
  33834. * Any additional arguments are provided to the invoked method.
  33835. *
  33836. * @static
  33837. * @memberOf _
  33838. * @since 3.7.0
  33839. * @category Util
  33840. * @param {Array|string} path The path of the method to invoke.
  33841. * @param {...*} [args] The arguments to invoke the method with.
  33842. * @returns {Function} Returns the new invoker function.
  33843. * @example
  33844. *
  33845. * var objects = [
  33846. * { 'a': { 'b': _.constant(2) } },
  33847. * { 'a': { 'b': _.constant(1) } }
  33848. * ];
  33849. *
  33850. * _.map(objects, _.method('a.b'));
  33851. * // => [2, 1]
  33852. *
  33853. * _.map(objects, _.method(['a', 'b']));
  33854. * // => [2, 1]
  33855. */
  33856. var method = baseRest(function(path, args) {
  33857. return function(object) {
  33858. return baseInvoke(object, path, args);
  33859. };
  33860. });
  33861. /**
  33862. * The opposite of `_.method`; this method creates a function that invokes
  33863. * the method at a given path of `object`. Any additional arguments are
  33864. * provided to the invoked method.
  33865. *
  33866. * @static
  33867. * @memberOf _
  33868. * @since 3.7.0
  33869. * @category Util
  33870. * @param {Object} object The object to query.
  33871. * @param {...*} [args] The arguments to invoke the method with.
  33872. * @returns {Function} Returns the new invoker function.
  33873. * @example
  33874. *
  33875. * var array = _.times(3, _.constant),
  33876. * object = { 'a': array, 'b': array, 'c': array };
  33877. *
  33878. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  33879. * // => [2, 0]
  33880. *
  33881. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  33882. * // => [2, 0]
  33883. */
  33884. var methodOf = baseRest(function(object, args) {
  33885. return function(path) {
  33886. return baseInvoke(object, path, args);
  33887. };
  33888. });
  33889. /**
  33890. * Adds all own enumerable string keyed function properties of a source
  33891. * object to the destination object. If `object` is a function, then methods
  33892. * are added to its prototype as well.
  33893. *
  33894. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  33895. * avoid conflicts caused by modifying the original.
  33896. *
  33897. * @static
  33898. * @since 0.1.0
  33899. * @memberOf _
  33900. * @category Util
  33901. * @param {Function|Object} [object=lodash] The destination object.
  33902. * @param {Object} source The object of functions to add.
  33903. * @param {Object} [options={}] The options object.
  33904. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  33905. * @returns {Function|Object} Returns `object`.
  33906. * @example
  33907. *
  33908. * function vowels(string) {
  33909. * return _.filter(string, function(v) {
  33910. * return /[aeiou]/i.test(v);
  33911. * });
  33912. * }
  33913. *
  33914. * _.mixin({ 'vowels': vowels });
  33915. * _.vowels('fred');
  33916. * // => ['e']
  33917. *
  33918. * _('fred').vowels().value();
  33919. * // => ['e']
  33920. *
  33921. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  33922. * _('fred').vowels();
  33923. * // => ['e']
  33924. */
  33925. function mixin(object, source, options) {
  33926. var props = keys(source),
  33927. methodNames = baseFunctions(source, props);
  33928. if (options == null &&
  33929. !(isObject(source) && (methodNames.length || !props.length))) {
  33930. options = source;
  33931. source = object;
  33932. object = this;
  33933. methodNames = baseFunctions(source, keys(source));
  33934. }
  33935. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  33936. isFunc = isFunction(object);
  33937. arrayEach(methodNames, function(methodName) {
  33938. var func = source[methodName];
  33939. object[methodName] = func;
  33940. if (isFunc) {
  33941. object.prototype[methodName] = function() {
  33942. var chainAll = this.__chain__;
  33943. if (chain || chainAll) {
  33944. var result = object(this.__wrapped__),
  33945. actions = result.__actions__ = copyArray(this.__actions__);
  33946. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  33947. result.__chain__ = chainAll;
  33948. return result;
  33949. }
  33950. return func.apply(object, arrayPush([this.value()], arguments));
  33951. };
  33952. }
  33953. });
  33954. return object;
  33955. }
  33956. /**
  33957. * Reverts the `_` variable to its previous value and returns a reference to
  33958. * the `lodash` function.
  33959. *
  33960. * @static
  33961. * @since 0.1.0
  33962. * @memberOf _
  33963. * @category Util
  33964. * @returns {Function} Returns the `lodash` function.
  33965. * @example
  33966. *
  33967. * var lodash = _.noConflict();
  33968. */
  33969. function noConflict() {
  33970. if (root._ === this) {
  33971. root._ = oldDash;
  33972. }
  33973. return this;
  33974. }
  33975. /**
  33976. * This method returns `undefined`.
  33977. *
  33978. * @static
  33979. * @memberOf _
  33980. * @since 2.3.0
  33981. * @category Util
  33982. * @example
  33983. *
  33984. * _.times(2, _.noop);
  33985. * // => [undefined, undefined]
  33986. */
  33987. function noop() {
  33988. // No operation performed.
  33989. }
  33990. /**
  33991. * Creates a function that gets the argument at index `n`. If `n` is negative,
  33992. * the nth argument from the end is returned.
  33993. *
  33994. * @static
  33995. * @memberOf _
  33996. * @since 4.0.0
  33997. * @category Util
  33998. * @param {number} [n=0] The index of the argument to return.
  33999. * @returns {Function} Returns the new pass-thru function.
  34000. * @example
  34001. *
  34002. * var func = _.nthArg(1);
  34003. * func('a', 'b', 'c', 'd');
  34004. * // => 'b'
  34005. *
  34006. * var func = _.nthArg(-2);
  34007. * func('a', 'b', 'c', 'd');
  34008. * // => 'c'
  34009. */
  34010. function nthArg(n) {
  34011. n = toInteger(n);
  34012. return baseRest(function(args) {
  34013. return baseNth(args, n);
  34014. });
  34015. }
  34016. /**
  34017. * Creates a function that invokes `iteratees` with the arguments it receives
  34018. * and returns their results.
  34019. *
  34020. * @static
  34021. * @memberOf _
  34022. * @since 4.0.0
  34023. * @category Util
  34024. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  34025. * The iteratees to invoke.
  34026. * @returns {Function} Returns the new function.
  34027. * @example
  34028. *
  34029. * var func = _.over([Math.max, Math.min]);
  34030. *
  34031. * func(1, 2, 3, 4);
  34032. * // => [4, 1]
  34033. */
  34034. var over = createOver(arrayMap);
  34035. /**
  34036. * Creates a function that checks if **all** of the `predicates` return
  34037. * truthy when invoked with the arguments it receives.
  34038. *
  34039. * @static
  34040. * @memberOf _
  34041. * @since 4.0.0
  34042. * @category Util
  34043. * @param {...(Function|Function[])} [predicates=[_.identity]]
  34044. * The predicates to check.
  34045. * @returns {Function} Returns the new function.
  34046. * @example
  34047. *
  34048. * var func = _.overEvery([Boolean, isFinite]);
  34049. *
  34050. * func('1');
  34051. * // => true
  34052. *
  34053. * func(null);
  34054. * // => false
  34055. *
  34056. * func(NaN);
  34057. * // => false
  34058. */
  34059. var overEvery = createOver(arrayEvery);
  34060. /**
  34061. * Creates a function that checks if **any** of the `predicates` return
  34062. * truthy when invoked with the arguments it receives.
  34063. *
  34064. * @static
  34065. * @memberOf _
  34066. * @since 4.0.0
  34067. * @category Util
  34068. * @param {...(Function|Function[])} [predicates=[_.identity]]
  34069. * The predicates to check.
  34070. * @returns {Function} Returns the new function.
  34071. * @example
  34072. *
  34073. * var func = _.overSome([Boolean, isFinite]);
  34074. *
  34075. * func('1');
  34076. * // => true
  34077. *
  34078. * func(null);
  34079. * // => true
  34080. *
  34081. * func(NaN);
  34082. * // => false
  34083. */
  34084. var overSome = createOver(arraySome);
  34085. /**
  34086. * Creates a function that returns the value at `path` of a given object.
  34087. *
  34088. * @static
  34089. * @memberOf _
  34090. * @since 2.4.0
  34091. * @category Util
  34092. * @param {Array|string} path The path of the property to get.
  34093. * @returns {Function} Returns the new accessor function.
  34094. * @example
  34095. *
  34096. * var objects = [
  34097. * { 'a': { 'b': 2 } },
  34098. * { 'a': { 'b': 1 } }
  34099. * ];
  34100. *
  34101. * _.map(objects, _.property('a.b'));
  34102. * // => [2, 1]
  34103. *
  34104. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  34105. * // => [1, 2]
  34106. */
  34107. function property(path) {
  34108. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  34109. }
  34110. /**
  34111. * The opposite of `_.property`; this method creates a function that returns
  34112. * the value at a given path of `object`.
  34113. *
  34114. * @static
  34115. * @memberOf _
  34116. * @since 3.0.0
  34117. * @category Util
  34118. * @param {Object} object The object to query.
  34119. * @returns {Function} Returns the new accessor function.
  34120. * @example
  34121. *
  34122. * var array = [0, 1, 2],
  34123. * object = { 'a': array, 'b': array, 'c': array };
  34124. *
  34125. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  34126. * // => [2, 0]
  34127. *
  34128. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  34129. * // => [2, 0]
  34130. */
  34131. function propertyOf(object) {
  34132. return function(path) {
  34133. return object == null ? undefined : baseGet(object, path);
  34134. };
  34135. }
  34136. /**
  34137. * Creates an array of numbers (positive and/or negative) progressing from
  34138. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  34139. * `start` is specified without an `end` or `step`. If `end` is not specified,
  34140. * it's set to `start` with `start` then set to `0`.
  34141. *
  34142. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  34143. * floating-point values which can produce unexpected results.
  34144. *
  34145. * @static
  34146. * @since 0.1.0
  34147. * @memberOf _
  34148. * @category Util
  34149. * @param {number} [start=0] The start of the range.
  34150. * @param {number} end The end of the range.
  34151. * @param {number} [step=1] The value to increment or decrement by.
  34152. * @returns {Array} Returns the range of numbers.
  34153. * @see _.inRange, _.rangeRight
  34154. * @example
  34155. *
  34156. * _.range(4);
  34157. * // => [0, 1, 2, 3]
  34158. *
  34159. * _.range(-4);
  34160. * // => [0, -1, -2, -3]
  34161. *
  34162. * _.range(1, 5);
  34163. * // => [1, 2, 3, 4]
  34164. *
  34165. * _.range(0, 20, 5);
  34166. * // => [0, 5, 10, 15]
  34167. *
  34168. * _.range(0, -4, -1);
  34169. * // => [0, -1, -2, -3]
  34170. *
  34171. * _.range(1, 4, 0);
  34172. * // => [1, 1, 1]
  34173. *
  34174. * _.range(0);
  34175. * // => []
  34176. */
  34177. var range = createRange();
  34178. /**
  34179. * This method is like `_.range` except that it populates values in
  34180. * descending order.
  34181. *
  34182. * @static
  34183. * @memberOf _
  34184. * @since 4.0.0
  34185. * @category Util
  34186. * @param {number} [start=0] The start of the range.
  34187. * @param {number} end The end of the range.
  34188. * @param {number} [step=1] The value to increment or decrement by.
  34189. * @returns {Array} Returns the range of numbers.
  34190. * @see _.inRange, _.range
  34191. * @example
  34192. *
  34193. * _.rangeRight(4);
  34194. * // => [3, 2, 1, 0]
  34195. *
  34196. * _.rangeRight(-4);
  34197. * // => [-3, -2, -1, 0]
  34198. *
  34199. * _.rangeRight(1, 5);
  34200. * // => [4, 3, 2, 1]
  34201. *
  34202. * _.rangeRight(0, 20, 5);
  34203. * // => [15, 10, 5, 0]
  34204. *
  34205. * _.rangeRight(0, -4, -1);
  34206. * // => [-3, -2, -1, 0]
  34207. *
  34208. * _.rangeRight(1, 4, 0);
  34209. * // => [1, 1, 1]
  34210. *
  34211. * _.rangeRight(0);
  34212. * // => []
  34213. */
  34214. var rangeRight = createRange(true);
  34215. /**
  34216. * This method returns a new empty array.
  34217. *
  34218. * @static
  34219. * @memberOf _
  34220. * @since 4.13.0
  34221. * @category Util
  34222. * @returns {Array} Returns the new empty array.
  34223. * @example
  34224. *
  34225. * var arrays = _.times(2, _.stubArray);
  34226. *
  34227. * console.log(arrays);
  34228. * // => [[], []]
  34229. *
  34230. * console.log(arrays[0] === arrays[1]);
  34231. * // => false
  34232. */
  34233. function stubArray() {
  34234. return [];
  34235. }
  34236. /**
  34237. * This method returns `false`.
  34238. *
  34239. * @static
  34240. * @memberOf _
  34241. * @since 4.13.0
  34242. * @category Util
  34243. * @returns {boolean} Returns `false`.
  34244. * @example
  34245. *
  34246. * _.times(2, _.stubFalse);
  34247. * // => [false, false]
  34248. */
  34249. function stubFalse() {
  34250. return false;
  34251. }
  34252. /**
  34253. * This method returns a new empty object.
  34254. *
  34255. * @static
  34256. * @memberOf _
  34257. * @since 4.13.0
  34258. * @category Util
  34259. * @returns {Object} Returns the new empty object.
  34260. * @example
  34261. *
  34262. * var objects = _.times(2, _.stubObject);
  34263. *
  34264. * console.log(objects);
  34265. * // => [{}, {}]
  34266. *
  34267. * console.log(objects[0] === objects[1]);
  34268. * // => false
  34269. */
  34270. function stubObject() {
  34271. return {};
  34272. }
  34273. /**
  34274. * This method returns an empty string.
  34275. *
  34276. * @static
  34277. * @memberOf _
  34278. * @since 4.13.0
  34279. * @category Util
  34280. * @returns {string} Returns the empty string.
  34281. * @example
  34282. *
  34283. * _.times(2, _.stubString);
  34284. * // => ['', '']
  34285. */
  34286. function stubString() {
  34287. return '';
  34288. }
  34289. /**
  34290. * This method returns `true`.
  34291. *
  34292. * @static
  34293. * @memberOf _
  34294. * @since 4.13.0
  34295. * @category Util
  34296. * @returns {boolean} Returns `true`.
  34297. * @example
  34298. *
  34299. * _.times(2, _.stubTrue);
  34300. * // => [true, true]
  34301. */
  34302. function stubTrue() {
  34303. return true;
  34304. }
  34305. /**
  34306. * Invokes the iteratee `n` times, returning an array of the results of
  34307. * each invocation. The iteratee is invoked with one argument; (index).
  34308. *
  34309. * @static
  34310. * @since 0.1.0
  34311. * @memberOf _
  34312. * @category Util
  34313. * @param {number} n The number of times to invoke `iteratee`.
  34314. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  34315. * @returns {Array} Returns the array of results.
  34316. * @example
  34317. *
  34318. * _.times(3, String);
  34319. * // => ['0', '1', '2']
  34320. *
  34321. * _.times(4, _.constant(0));
  34322. * // => [0, 0, 0, 0]
  34323. */
  34324. function times(n, iteratee) {
  34325. n = toInteger(n);
  34326. if (n < 1 || n > MAX_SAFE_INTEGER) {
  34327. return [];
  34328. }
  34329. var index = MAX_ARRAY_LENGTH,
  34330. length = nativeMin(n, MAX_ARRAY_LENGTH);
  34331. iteratee = getIteratee(iteratee);
  34332. n -= MAX_ARRAY_LENGTH;
  34333. var result = baseTimes(length, iteratee);
  34334. while (++index < n) {
  34335. iteratee(index);
  34336. }
  34337. return result;
  34338. }
  34339. /**
  34340. * Converts `value` to a property path array.
  34341. *
  34342. * @static
  34343. * @memberOf _
  34344. * @since 4.0.0
  34345. * @category Util
  34346. * @param {*} value The value to convert.
  34347. * @returns {Array} Returns the new property path array.
  34348. * @example
  34349. *
  34350. * _.toPath('a.b.c');
  34351. * // => ['a', 'b', 'c']
  34352. *
  34353. * _.toPath('a[0].b.c');
  34354. * // => ['a', '0', 'b', 'c']
  34355. */
  34356. function toPath(value) {
  34357. if (isArray(value)) {
  34358. return arrayMap(value, toKey);
  34359. }
  34360. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  34361. }
  34362. /**
  34363. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  34364. *
  34365. * @static
  34366. * @since 0.1.0
  34367. * @memberOf _
  34368. * @category Util
  34369. * @param {string} [prefix=''] The value to prefix the ID with.
  34370. * @returns {string} Returns the unique ID.
  34371. * @example
  34372. *
  34373. * _.uniqueId('contact_');
  34374. * // => 'contact_104'
  34375. *
  34376. * _.uniqueId();
  34377. * // => '105'
  34378. */
  34379. function uniqueId(prefix) {
  34380. var id = ++idCounter;
  34381. return toString(prefix) + id;
  34382. }
  34383. /*------------------------------------------------------------------------*/
  34384. /**
  34385. * Adds two numbers.
  34386. *
  34387. * @static
  34388. * @memberOf _
  34389. * @since 3.4.0
  34390. * @category Math
  34391. * @param {number} augend The first number in an addition.
  34392. * @param {number} addend The second number in an addition.
  34393. * @returns {number} Returns the total.
  34394. * @example
  34395. *
  34396. * _.add(6, 4);
  34397. * // => 10
  34398. */
  34399. var add = createMathOperation(function(augend, addend) {
  34400. return augend + addend;
  34401. }, 0);
  34402. /**
  34403. * Computes `number` rounded up to `precision`.
  34404. *
  34405. * @static
  34406. * @memberOf _
  34407. * @since 3.10.0
  34408. * @category Math
  34409. * @param {number} number The number to round up.
  34410. * @param {number} [precision=0] The precision to round up to.
  34411. * @returns {number} Returns the rounded up number.
  34412. * @example
  34413. *
  34414. * _.ceil(4.006);
  34415. * // => 5
  34416. *
  34417. * _.ceil(6.004, 2);
  34418. * // => 6.01
  34419. *
  34420. * _.ceil(6040, -2);
  34421. * // => 6100
  34422. */
  34423. var ceil = createRound('ceil');
  34424. /**
  34425. * Divide two numbers.
  34426. *
  34427. * @static
  34428. * @memberOf _
  34429. * @since 4.7.0
  34430. * @category Math
  34431. * @param {number} dividend The first number in a division.
  34432. * @param {number} divisor The second number in a division.
  34433. * @returns {number} Returns the quotient.
  34434. * @example
  34435. *
  34436. * _.divide(6, 4);
  34437. * // => 1.5
  34438. */
  34439. var divide = createMathOperation(function(dividend, divisor) {
  34440. return dividend / divisor;
  34441. }, 1);
  34442. /**
  34443. * Computes `number` rounded down to `precision`.
  34444. *
  34445. * @static
  34446. * @memberOf _
  34447. * @since 3.10.0
  34448. * @category Math
  34449. * @param {number} number The number to round down.
  34450. * @param {number} [precision=0] The precision to round down to.
  34451. * @returns {number} Returns the rounded down number.
  34452. * @example
  34453. *
  34454. * _.floor(4.006);
  34455. * // => 4
  34456. *
  34457. * _.floor(0.046, 2);
  34458. * // => 0.04
  34459. *
  34460. * _.floor(4060, -2);
  34461. * // => 4000
  34462. */
  34463. var floor = createRound('floor');
  34464. /**
  34465. * Computes the maximum value of `array`. If `array` is empty or falsey,
  34466. * `undefined` is returned.
  34467. *
  34468. * @static
  34469. * @since 0.1.0
  34470. * @memberOf _
  34471. * @category Math
  34472. * @param {Array} array The array to iterate over.
  34473. * @returns {*} Returns the maximum value.
  34474. * @example
  34475. *
  34476. * _.max([4, 2, 8, 6]);
  34477. * // => 8
  34478. *
  34479. * _.max([]);
  34480. * // => undefined
  34481. */
  34482. function max(array) {
  34483. return (array && array.length)
  34484. ? baseExtremum(array, identity, baseGt)
  34485. : undefined;
  34486. }
  34487. /**
  34488. * This method is like `_.max` except that it accepts `iteratee` which is
  34489. * invoked for each element in `array` to generate the criterion by which
  34490. * the value is ranked. The iteratee is invoked with one argument: (value).
  34491. *
  34492. * @static
  34493. * @memberOf _
  34494. * @since 4.0.0
  34495. * @category Math
  34496. * @param {Array} array The array to iterate over.
  34497. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  34498. * @returns {*} Returns the maximum value.
  34499. * @example
  34500. *
  34501. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  34502. *
  34503. * _.maxBy(objects, function(o) { return o.n; });
  34504. * // => { 'n': 2 }
  34505. *
  34506. * // The `_.property` iteratee shorthand.
  34507. * _.maxBy(objects, 'n');
  34508. * // => { 'n': 2 }
  34509. */
  34510. function maxBy(array, iteratee) {
  34511. return (array && array.length)
  34512. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  34513. : undefined;
  34514. }
  34515. /**
  34516. * Computes the mean of the values in `array`.
  34517. *
  34518. * @static
  34519. * @memberOf _
  34520. * @since 4.0.0
  34521. * @category Math
  34522. * @param {Array} array The array to iterate over.
  34523. * @returns {number} Returns the mean.
  34524. * @example
  34525. *
  34526. * _.mean([4, 2, 8, 6]);
  34527. * // => 5
  34528. */
  34529. function mean(array) {
  34530. return baseMean(array, identity);
  34531. }
  34532. /**
  34533. * This method is like `_.mean` except that it accepts `iteratee` which is
  34534. * invoked for each element in `array` to generate the value to be averaged.
  34535. * The iteratee is invoked with one argument: (value).
  34536. *
  34537. * @static
  34538. * @memberOf _
  34539. * @since 4.7.0
  34540. * @category Math
  34541. * @param {Array} array The array to iterate over.
  34542. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  34543. * @returns {number} Returns the mean.
  34544. * @example
  34545. *
  34546. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  34547. *
  34548. * _.meanBy(objects, function(o) { return o.n; });
  34549. * // => 5
  34550. *
  34551. * // The `_.property` iteratee shorthand.
  34552. * _.meanBy(objects, 'n');
  34553. * // => 5
  34554. */
  34555. function meanBy(array, iteratee) {
  34556. return baseMean(array, getIteratee(iteratee, 2));
  34557. }
  34558. /**
  34559. * Computes the minimum value of `array`. If `array` is empty or falsey,
  34560. * `undefined` is returned.
  34561. *
  34562. * @static
  34563. * @since 0.1.0
  34564. * @memberOf _
  34565. * @category Math
  34566. * @param {Array} array The array to iterate over.
  34567. * @returns {*} Returns the minimum value.
  34568. * @example
  34569. *
  34570. * _.min([4, 2, 8, 6]);
  34571. * // => 2
  34572. *
  34573. * _.min([]);
  34574. * // => undefined
  34575. */
  34576. function min(array) {
  34577. return (array && array.length)
  34578. ? baseExtremum(array, identity, baseLt)
  34579. : undefined;
  34580. }
  34581. /**
  34582. * This method is like `_.min` except that it accepts `iteratee` which is
  34583. * invoked for each element in `array` to generate the criterion by which
  34584. * the value is ranked. The iteratee is invoked with one argument: (value).
  34585. *
  34586. * @static
  34587. * @memberOf _
  34588. * @since 4.0.0
  34589. * @category Math
  34590. * @param {Array} array The array to iterate over.
  34591. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  34592. * @returns {*} Returns the minimum value.
  34593. * @example
  34594. *
  34595. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  34596. *
  34597. * _.minBy(objects, function(o) { return o.n; });
  34598. * // => { 'n': 1 }
  34599. *
  34600. * // The `_.property` iteratee shorthand.
  34601. * _.minBy(objects, 'n');
  34602. * // => { 'n': 1 }
  34603. */
  34604. function minBy(array, iteratee) {
  34605. return (array && array.length)
  34606. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  34607. : undefined;
  34608. }
  34609. /**
  34610. * Multiply two numbers.
  34611. *
  34612. * @static
  34613. * @memberOf _
  34614. * @since 4.7.0
  34615. * @category Math
  34616. * @param {number} multiplier The first number in a multiplication.
  34617. * @param {number} multiplicand The second number in a multiplication.
  34618. * @returns {number} Returns the product.
  34619. * @example
  34620. *
  34621. * _.multiply(6, 4);
  34622. * // => 24
  34623. */
  34624. var multiply = createMathOperation(function(multiplier, multiplicand) {
  34625. return multiplier * multiplicand;
  34626. }, 1);
  34627. /**
  34628. * Computes `number` rounded to `precision`.
  34629. *
  34630. * @static
  34631. * @memberOf _
  34632. * @since 3.10.0
  34633. * @category Math
  34634. * @param {number} number The number to round.
  34635. * @param {number} [precision=0] The precision to round to.
  34636. * @returns {number} Returns the rounded number.
  34637. * @example
  34638. *
  34639. * _.round(4.006);
  34640. * // => 4
  34641. *
  34642. * _.round(4.006, 2);
  34643. * // => 4.01
  34644. *
  34645. * _.round(4060, -2);
  34646. * // => 4100
  34647. */
  34648. var round = createRound('round');
  34649. /**
  34650. * Subtract two numbers.
  34651. *
  34652. * @static
  34653. * @memberOf _
  34654. * @since 4.0.0
  34655. * @category Math
  34656. * @param {number} minuend The first number in a subtraction.
  34657. * @param {number} subtrahend The second number in a subtraction.
  34658. * @returns {number} Returns the difference.
  34659. * @example
  34660. *
  34661. * _.subtract(6, 4);
  34662. * // => 2
  34663. */
  34664. var subtract = createMathOperation(function(minuend, subtrahend) {
  34665. return minuend - subtrahend;
  34666. }, 0);
  34667. /**
  34668. * Computes the sum of the values in `array`.
  34669. *
  34670. * @static
  34671. * @memberOf _
  34672. * @since 3.4.0
  34673. * @category Math
  34674. * @param {Array} array The array to iterate over.
  34675. * @returns {number} Returns the sum.
  34676. * @example
  34677. *
  34678. * _.sum([4, 2, 8, 6]);
  34679. * // => 20
  34680. */
  34681. function sum(array) {
  34682. return (array && array.length)
  34683. ? baseSum(array, identity)
  34684. : 0;
  34685. }
  34686. /**
  34687. * This method is like `_.sum` except that it accepts `iteratee` which is
  34688. * invoked for each element in `array` to generate the value to be summed.
  34689. * The iteratee is invoked with one argument: (value).
  34690. *
  34691. * @static
  34692. * @memberOf _
  34693. * @since 4.0.0
  34694. * @category Math
  34695. * @param {Array} array The array to iterate over.
  34696. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  34697. * @returns {number} Returns the sum.
  34698. * @example
  34699. *
  34700. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  34701. *
  34702. * _.sumBy(objects, function(o) { return o.n; });
  34703. * // => 20
  34704. *
  34705. * // The `_.property` iteratee shorthand.
  34706. * _.sumBy(objects, 'n');
  34707. * // => 20
  34708. */
  34709. function sumBy(array, iteratee) {
  34710. return (array && array.length)
  34711. ? baseSum(array, getIteratee(iteratee, 2))
  34712. : 0;
  34713. }
  34714. /*------------------------------------------------------------------------*/
  34715. // Add methods that return wrapped values in chain sequences.
  34716. lodash.after = after;
  34717. lodash.ary = ary;
  34718. lodash.assign = assign;
  34719. lodash.assignIn = assignIn;
  34720. lodash.assignInWith = assignInWith;
  34721. lodash.assignWith = assignWith;
  34722. lodash.at = at;
  34723. lodash.before = before;
  34724. lodash.bind = bind;
  34725. lodash.bindAll = bindAll;
  34726. lodash.bindKey = bindKey;
  34727. lodash.castArray = castArray;
  34728. lodash.chain = chain;
  34729. lodash.chunk = chunk;
  34730. lodash.compact = compact;
  34731. lodash.concat = concat;
  34732. lodash.cond = cond;
  34733. lodash.conforms = conforms;
  34734. lodash.constant = constant;
  34735. lodash.countBy = countBy;
  34736. lodash.create = create;
  34737. lodash.curry = curry;
  34738. lodash.curryRight = curryRight;
  34739. lodash.debounce = debounce;
  34740. lodash.defaults = defaults;
  34741. lodash.defaultsDeep = defaultsDeep;
  34742. lodash.defer = defer;
  34743. lodash.delay = delay;
  34744. lodash.difference = difference;
  34745. lodash.differenceBy = differenceBy;
  34746. lodash.differenceWith = differenceWith;
  34747. lodash.drop = drop;
  34748. lodash.dropRight = dropRight;
  34749. lodash.dropRightWhile = dropRightWhile;
  34750. lodash.dropWhile = dropWhile;
  34751. lodash.fill = fill;
  34752. lodash.filter = filter;
  34753. lodash.flatMap = flatMap;
  34754. lodash.flatMapDeep = flatMapDeep;
  34755. lodash.flatMapDepth = flatMapDepth;
  34756. lodash.flatten = flatten;
  34757. lodash.flattenDeep = flattenDeep;
  34758. lodash.flattenDepth = flattenDepth;
  34759. lodash.flip = flip;
  34760. lodash.flow = flow;
  34761. lodash.flowRight = flowRight;
  34762. lodash.fromPairs = fromPairs;
  34763. lodash.functions = functions;
  34764. lodash.functionsIn = functionsIn;
  34765. lodash.groupBy = groupBy;
  34766. lodash.initial = initial;
  34767. lodash.intersection = intersection;
  34768. lodash.intersectionBy = intersectionBy;
  34769. lodash.intersectionWith = intersectionWith;
  34770. lodash.invert = invert;
  34771. lodash.invertBy = invertBy;
  34772. lodash.invokeMap = invokeMap;
  34773. lodash.iteratee = iteratee;
  34774. lodash.keyBy = keyBy;
  34775. lodash.keys = keys;
  34776. lodash.keysIn = keysIn;
  34777. lodash.map = map;
  34778. lodash.mapKeys = mapKeys;
  34779. lodash.mapValues = mapValues;
  34780. lodash.matches = matches;
  34781. lodash.matchesProperty = matchesProperty;
  34782. lodash.memoize = memoize;
  34783. lodash.merge = merge;
  34784. lodash.mergeWith = mergeWith;
  34785. lodash.method = method;
  34786. lodash.methodOf = methodOf;
  34787. lodash.mixin = mixin;
  34788. lodash.negate = negate;
  34789. lodash.nthArg = nthArg;
  34790. lodash.omit = omit;
  34791. lodash.omitBy = omitBy;
  34792. lodash.once = once;
  34793. lodash.orderBy = orderBy;
  34794. lodash.over = over;
  34795. lodash.overArgs = overArgs;
  34796. lodash.overEvery = overEvery;
  34797. lodash.overSome = overSome;
  34798. lodash.partial = partial;
  34799. lodash.partialRight = partialRight;
  34800. lodash.partition = partition;
  34801. lodash.pick = pick;
  34802. lodash.pickBy = pickBy;
  34803. lodash.property = property;
  34804. lodash.propertyOf = propertyOf;
  34805. lodash.pull = pull;
  34806. lodash.pullAll = pullAll;
  34807. lodash.pullAllBy = pullAllBy;
  34808. lodash.pullAllWith = pullAllWith;
  34809. lodash.pullAt = pullAt;
  34810. lodash.range = range;
  34811. lodash.rangeRight = rangeRight;
  34812. lodash.rearg = rearg;
  34813. lodash.reject = reject;
  34814. lodash.remove = remove;
  34815. lodash.rest = rest;
  34816. lodash.reverse = reverse;
  34817. lodash.sampleSize = sampleSize;
  34818. lodash.set = set;
  34819. lodash.setWith = setWith;
  34820. lodash.shuffle = shuffle;
  34821. lodash.slice = slice;
  34822. lodash.sortBy = sortBy;
  34823. lodash.sortedUniq = sortedUniq;
  34824. lodash.sortedUniqBy = sortedUniqBy;
  34825. lodash.split = split;
  34826. lodash.spread = spread;
  34827. lodash.tail = tail;
  34828. lodash.take = take;
  34829. lodash.takeRight = takeRight;
  34830. lodash.takeRightWhile = takeRightWhile;
  34831. lodash.takeWhile = takeWhile;
  34832. lodash.tap = tap;
  34833. lodash.throttle = throttle;
  34834. lodash.thru = thru;
  34835. lodash.toArray = toArray;
  34836. lodash.toPairs = toPairs;
  34837. lodash.toPairsIn = toPairsIn;
  34838. lodash.toPath = toPath;
  34839. lodash.toPlainObject = toPlainObject;
  34840. lodash.transform = transform;
  34841. lodash.unary = unary;
  34842. lodash.union = union;
  34843. lodash.unionBy = unionBy;
  34844. lodash.unionWith = unionWith;
  34845. lodash.uniq = uniq;
  34846. lodash.uniqBy = uniqBy;
  34847. lodash.uniqWith = uniqWith;
  34848. lodash.unset = unset;
  34849. lodash.unzip = unzip;
  34850. lodash.unzipWith = unzipWith;
  34851. lodash.update = update;
  34852. lodash.updateWith = updateWith;
  34853. lodash.values = values;
  34854. lodash.valuesIn = valuesIn;
  34855. lodash.without = without;
  34856. lodash.words = words;
  34857. lodash.wrap = wrap;
  34858. lodash.xor = xor;
  34859. lodash.xorBy = xorBy;
  34860. lodash.xorWith = xorWith;
  34861. lodash.zip = zip;
  34862. lodash.zipObject = zipObject;
  34863. lodash.zipObjectDeep = zipObjectDeep;
  34864. lodash.zipWith = zipWith;
  34865. // Add aliases.
  34866. lodash.entries = toPairs;
  34867. lodash.entriesIn = toPairsIn;
  34868. lodash.extend = assignIn;
  34869. lodash.extendWith = assignInWith;
  34870. // Add methods to `lodash.prototype`.
  34871. mixin(lodash, lodash);
  34872. /*------------------------------------------------------------------------*/
  34873. // Add methods that return unwrapped values in chain sequences.
  34874. lodash.add = add;
  34875. lodash.attempt = attempt;
  34876. lodash.camelCase = camelCase;
  34877. lodash.capitalize = capitalize;
  34878. lodash.ceil = ceil;
  34879. lodash.clamp = clamp;
  34880. lodash.clone = clone;
  34881. lodash.cloneDeep = cloneDeep;
  34882. lodash.cloneDeepWith = cloneDeepWith;
  34883. lodash.cloneWith = cloneWith;
  34884. lodash.conformsTo = conformsTo;
  34885. lodash.deburr = deburr;
  34886. lodash.defaultTo = defaultTo;
  34887. lodash.divide = divide;
  34888. lodash.endsWith = endsWith;
  34889. lodash.eq = eq;
  34890. lodash.escape = escape;
  34891. lodash.escapeRegExp = escapeRegExp;
  34892. lodash.every = every;
  34893. lodash.find = find;
  34894. lodash.findIndex = findIndex;
  34895. lodash.findKey = findKey;
  34896. lodash.findLast = findLast;
  34897. lodash.findLastIndex = findLastIndex;
  34898. lodash.findLastKey = findLastKey;
  34899. lodash.floor = floor;
  34900. lodash.forEach = forEach;
  34901. lodash.forEachRight = forEachRight;
  34902. lodash.forIn = forIn;
  34903. lodash.forInRight = forInRight;
  34904. lodash.forOwn = forOwn;
  34905. lodash.forOwnRight = forOwnRight;
  34906. lodash.get = get;
  34907. lodash.gt = gt;
  34908. lodash.gte = gte;
  34909. lodash.has = has;
  34910. lodash.hasIn = hasIn;
  34911. lodash.head = head;
  34912. lodash.identity = identity;
  34913. lodash.includes = includes;
  34914. lodash.indexOf = indexOf;
  34915. lodash.inRange = inRange;
  34916. lodash.invoke = invoke;
  34917. lodash.isArguments = isArguments;
  34918. lodash.isArray = isArray;
  34919. lodash.isArrayBuffer = isArrayBuffer;
  34920. lodash.isArrayLike = isArrayLike;
  34921. lodash.isArrayLikeObject = isArrayLikeObject;
  34922. lodash.isBoolean = isBoolean;
  34923. lodash.isBuffer = isBuffer;
  34924. lodash.isDate = isDate;
  34925. lodash.isElement = isElement;
  34926. lodash.isEmpty = isEmpty;
  34927. lodash.isEqual = isEqual;
  34928. lodash.isEqualWith = isEqualWith;
  34929. lodash.isError = isError;
  34930. lodash.isFinite = isFinite;
  34931. lodash.isFunction = isFunction;
  34932. lodash.isInteger = isInteger;
  34933. lodash.isLength = isLength;
  34934. lodash.isMap = isMap;
  34935. lodash.isMatch = isMatch;
  34936. lodash.isMatchWith = isMatchWith;
  34937. lodash.isNaN = isNaN;
  34938. lodash.isNative = isNative;
  34939. lodash.isNil = isNil;
  34940. lodash.isNull = isNull;
  34941. lodash.isNumber = isNumber;
  34942. lodash.isObject = isObject;
  34943. lodash.isObjectLike = isObjectLike;
  34944. lodash.isPlainObject = isPlainObject;
  34945. lodash.isRegExp = isRegExp;
  34946. lodash.isSafeInteger = isSafeInteger;
  34947. lodash.isSet = isSet;
  34948. lodash.isString = isString;
  34949. lodash.isSymbol = isSymbol;
  34950. lodash.isTypedArray = isTypedArray;
  34951. lodash.isUndefined = isUndefined;
  34952. lodash.isWeakMap = isWeakMap;
  34953. lodash.isWeakSet = isWeakSet;
  34954. lodash.join = join;
  34955. lodash.kebabCase = kebabCase;
  34956. lodash.last = last;
  34957. lodash.lastIndexOf = lastIndexOf;
  34958. lodash.lowerCase = lowerCase;
  34959. lodash.lowerFirst = lowerFirst;
  34960. lodash.lt = lt;
  34961. lodash.lte = lte;
  34962. lodash.max = max;
  34963. lodash.maxBy = maxBy;
  34964. lodash.mean = mean;
  34965. lodash.meanBy = meanBy;
  34966. lodash.min = min;
  34967. lodash.minBy = minBy;
  34968. lodash.stubArray = stubArray;
  34969. lodash.stubFalse = stubFalse;
  34970. lodash.stubObject = stubObject;
  34971. lodash.stubString = stubString;
  34972. lodash.stubTrue = stubTrue;
  34973. lodash.multiply = multiply;
  34974. lodash.nth = nth;
  34975. lodash.noConflict = noConflict;
  34976. lodash.noop = noop;
  34977. lodash.now = now;
  34978. lodash.pad = pad;
  34979. lodash.padEnd = padEnd;
  34980. lodash.padStart = padStart;
  34981. lodash.parseInt = parseInt;
  34982. lodash.random = random;
  34983. lodash.reduce = reduce;
  34984. lodash.reduceRight = reduceRight;
  34985. lodash.repeat = repeat;
  34986. lodash.replace = replace;
  34987. lodash.result = result;
  34988. lodash.round = round;
  34989. lodash.runInContext = runInContext;
  34990. lodash.sample = sample;
  34991. lodash.size = size;
  34992. lodash.snakeCase = snakeCase;
  34993. lodash.some = some;
  34994. lodash.sortedIndex = sortedIndex;
  34995. lodash.sortedIndexBy = sortedIndexBy;
  34996. lodash.sortedIndexOf = sortedIndexOf;
  34997. lodash.sortedLastIndex = sortedLastIndex;
  34998. lodash.sortedLastIndexBy = sortedLastIndexBy;
  34999. lodash.sortedLastIndexOf = sortedLastIndexOf;
  35000. lodash.startCase = startCase;
  35001. lodash.startsWith = startsWith;
  35002. lodash.subtract = subtract;
  35003. lodash.sum = sum;
  35004. lodash.sumBy = sumBy;
  35005. lodash.template = template;
  35006. lodash.times = times;
  35007. lodash.toFinite = toFinite;
  35008. lodash.toInteger = toInteger;
  35009. lodash.toLength = toLength;
  35010. lodash.toLower = toLower;
  35011. lodash.toNumber = toNumber;
  35012. lodash.toSafeInteger = toSafeInteger;
  35013. lodash.toString = toString;
  35014. lodash.toUpper = toUpper;
  35015. lodash.trim = trim;
  35016. lodash.trimEnd = trimEnd;
  35017. lodash.trimStart = trimStart;
  35018. lodash.truncate = truncate;
  35019. lodash.unescape = unescape;
  35020. lodash.uniqueId = uniqueId;
  35021. lodash.upperCase = upperCase;
  35022. lodash.upperFirst = upperFirst;
  35023. // Add aliases.
  35024. lodash.each = forEach;
  35025. lodash.eachRight = forEachRight;
  35026. lodash.first = head;
  35027. mixin(lodash, (function() {
  35028. var source = {};
  35029. baseForOwn(lodash, function(func, methodName) {
  35030. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  35031. source[methodName] = func;
  35032. }
  35033. });
  35034. return source;
  35035. }()), { 'chain': false });
  35036. /*------------------------------------------------------------------------*/
  35037. /**
  35038. * The semantic version number.
  35039. *
  35040. * @static
  35041. * @memberOf _
  35042. * @type {string}
  35043. */
  35044. lodash.VERSION = VERSION;
  35045. // Assign default placeholders.
  35046. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  35047. lodash[methodName].placeholder = lodash;
  35048. });
  35049. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  35050. arrayEach(['drop', 'take'], function(methodName, index) {
  35051. LazyWrapper.prototype[methodName] = function(n) {
  35052. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  35053. var result = (this.__filtered__ && !index)
  35054. ? new LazyWrapper(this)
  35055. : this.clone();
  35056. if (result.__filtered__) {
  35057. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  35058. } else {
  35059. result.__views__.push({
  35060. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  35061. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  35062. });
  35063. }
  35064. return result;
  35065. };
  35066. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  35067. return this.reverse()[methodName](n).reverse();
  35068. };
  35069. });
  35070. // Add `LazyWrapper` methods that accept an `iteratee` value.
  35071. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  35072. var type = index + 1,
  35073. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  35074. LazyWrapper.prototype[methodName] = function(iteratee) {
  35075. var result = this.clone();
  35076. result.__iteratees__.push({
  35077. 'iteratee': getIteratee(iteratee, 3),
  35078. 'type': type
  35079. });
  35080. result.__filtered__ = result.__filtered__ || isFilter;
  35081. return result;
  35082. };
  35083. });
  35084. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  35085. arrayEach(['head', 'last'], function(methodName, index) {
  35086. var takeName = 'take' + (index ? 'Right' : '');
  35087. LazyWrapper.prototype[methodName] = function() {
  35088. return this[takeName](1).value()[0];
  35089. };
  35090. });
  35091. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  35092. arrayEach(['initial', 'tail'], function(methodName, index) {
  35093. var dropName = 'drop' + (index ? '' : 'Right');
  35094. LazyWrapper.prototype[methodName] = function() {
  35095. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  35096. };
  35097. });
  35098. LazyWrapper.prototype.compact = function() {
  35099. return this.filter(identity);
  35100. };
  35101. LazyWrapper.prototype.find = function(predicate) {
  35102. return this.filter(predicate).head();
  35103. };
  35104. LazyWrapper.prototype.findLast = function(predicate) {
  35105. return this.reverse().find(predicate);
  35106. };
  35107. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  35108. if (typeof path == 'function') {
  35109. return new LazyWrapper(this);
  35110. }
  35111. return this.map(function(value) {
  35112. return baseInvoke(value, path, args);
  35113. });
  35114. });
  35115. LazyWrapper.prototype.reject = function(predicate) {
  35116. return this.filter(negate(getIteratee(predicate)));
  35117. };
  35118. LazyWrapper.prototype.slice = function(start, end) {
  35119. start = toInteger(start);
  35120. var result = this;
  35121. if (result.__filtered__ && (start > 0 || end < 0)) {
  35122. return new LazyWrapper(result);
  35123. }
  35124. if (start < 0) {
  35125. result = result.takeRight(-start);
  35126. } else if (start) {
  35127. result = result.drop(start);
  35128. }
  35129. if (end !== undefined) {
  35130. end = toInteger(end);
  35131. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  35132. }
  35133. return result;
  35134. };
  35135. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  35136. return this.reverse().takeWhile(predicate).reverse();
  35137. };
  35138. LazyWrapper.prototype.toArray = function() {
  35139. return this.take(MAX_ARRAY_LENGTH);
  35140. };
  35141. // Add `LazyWrapper` methods to `lodash.prototype`.
  35142. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  35143. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  35144. isTaker = /^(?:head|last)$/.test(methodName),
  35145. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  35146. retUnwrapped = isTaker || /^find/.test(methodName);
  35147. if (!lodashFunc) {
  35148. return;
  35149. }
  35150. lodash.prototype[methodName] = function() {
  35151. var value = this.__wrapped__,
  35152. args = isTaker ? [1] : arguments,
  35153. isLazy = value instanceof LazyWrapper,
  35154. iteratee = args[0],
  35155. useLazy = isLazy || isArray(value);
  35156. var interceptor = function(value) {
  35157. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  35158. return (isTaker && chainAll) ? result[0] : result;
  35159. };
  35160. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  35161. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  35162. isLazy = useLazy = false;
  35163. }
  35164. var chainAll = this.__chain__,
  35165. isHybrid = !!this.__actions__.length,
  35166. isUnwrapped = retUnwrapped && !chainAll,
  35167. onlyLazy = isLazy && !isHybrid;
  35168. if (!retUnwrapped && useLazy) {
  35169. value = onlyLazy ? value : new LazyWrapper(this);
  35170. var result = func.apply(value, args);
  35171. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  35172. return new LodashWrapper(result, chainAll);
  35173. }
  35174. if (isUnwrapped && onlyLazy) {
  35175. return func.apply(this, args);
  35176. }
  35177. result = this.thru(interceptor);
  35178. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  35179. };
  35180. });
  35181. // Add `Array` methods to `lodash.prototype`.
  35182. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  35183. var func = arrayProto[methodName],
  35184. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  35185. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  35186. lodash.prototype[methodName] = function() {
  35187. var args = arguments;
  35188. if (retUnwrapped && !this.__chain__) {
  35189. var value = this.value();
  35190. return func.apply(isArray(value) ? value : [], args);
  35191. }
  35192. return this[chainName](function(value) {
  35193. return func.apply(isArray(value) ? value : [], args);
  35194. });
  35195. };
  35196. });
  35197. // Map minified method names to their real names.
  35198. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  35199. var lodashFunc = lodash[methodName];
  35200. if (lodashFunc) {
  35201. var key = lodashFunc.name + '';
  35202. if (!hasOwnProperty.call(realNames, key)) {
  35203. realNames[key] = [];
  35204. }
  35205. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  35206. }
  35207. });
  35208. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  35209. 'name': 'wrapper',
  35210. 'func': undefined
  35211. }];
  35212. // Add methods to `LazyWrapper`.
  35213. LazyWrapper.prototype.clone = lazyClone;
  35214. LazyWrapper.prototype.reverse = lazyReverse;
  35215. LazyWrapper.prototype.value = lazyValue;
  35216. // Add chain sequence methods to the `lodash` wrapper.
  35217. lodash.prototype.at = wrapperAt;
  35218. lodash.prototype.chain = wrapperChain;
  35219. lodash.prototype.commit = wrapperCommit;
  35220. lodash.prototype.next = wrapperNext;
  35221. lodash.prototype.plant = wrapperPlant;
  35222. lodash.prototype.reverse = wrapperReverse;
  35223. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  35224. // Add lazy aliases.
  35225. lodash.prototype.first = lodash.prototype.head;
  35226. if (symIterator) {
  35227. lodash.prototype[symIterator] = wrapperToIterator;
  35228. }
  35229. return lodash;
  35230. });
  35231. /*--------------------------------------------------------------------------*/
  35232. // Export lodash.
  35233. var _ = runInContext();
  35234. // Some AMD build optimizers, like r.js, check for condition patterns like:
  35235. if (true) {
  35236. // Expose Lodash on the global object to prevent errors when Lodash is
  35237. // loaded by a script tag in the presence of an AMD loader.
  35238. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  35239. // Use `_.noConflict` to remove Lodash from the global object.
  35240. root._ = _;
  35241. // Define as an anonymous module so, through path mapping, it can be
  35242. // referenced as the "underscore" module.
  35243. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  35244. return _;
  35245. }).call(exports, __webpack_require__, exports, module),
  35246. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  35247. }
  35248. // Check for `exports` after `define` in case a build optimizer adds it.
  35249. else {}
  35250. }.call(this));
  35251. /* 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)))
  35252. /***/ }),
  35253. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  35254. /*!***************************************************!*\
  35255. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  35256. \***************************************************/
  35257. /*! exports provided: default */
  35258. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  35259. "use strict";
  35260. __webpack_require__.r(__webpack_exports__);
  35261. /* WEBPACK VAR INJECTION */(function(global) {/**!
  35262. * @fileOverview Kickass library to create and place poppers near their reference elements.
  35263. * @version 1.16.1
  35264. * @license
  35265. * Copyright (c) 2016 Federico Zivolo and contributors
  35266. *
  35267. * Permission is hereby granted, free of charge, to any person obtaining a copy
  35268. * of this software and associated documentation files (the "Software"), to deal
  35269. * in the Software without restriction, including without limitation the rights
  35270. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  35271. * copies of the Software, and to permit persons to whom the Software is
  35272. * furnished to do so, subject to the following conditions:
  35273. *
  35274. * The above copyright notice and this permission notice shall be included in all
  35275. * copies or substantial portions of the Software.
  35276. *
  35277. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  35278. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  35279. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  35280. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  35281. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  35282. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  35283. * SOFTWARE.
  35284. */
  35285. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  35286. var timeoutDuration = function () {
  35287. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  35288. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  35289. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  35290. return 1;
  35291. }
  35292. }
  35293. return 0;
  35294. }();
  35295. function microtaskDebounce(fn) {
  35296. var called = false;
  35297. return function () {
  35298. if (called) {
  35299. return;
  35300. }
  35301. called = true;
  35302. window.Promise.resolve().then(function () {
  35303. called = false;
  35304. fn();
  35305. });
  35306. };
  35307. }
  35308. function taskDebounce(fn) {
  35309. var scheduled = false;
  35310. return function () {
  35311. if (!scheduled) {
  35312. scheduled = true;
  35313. setTimeout(function () {
  35314. scheduled = false;
  35315. fn();
  35316. }, timeoutDuration);
  35317. }
  35318. };
  35319. }
  35320. var supportsMicroTasks = isBrowser && window.Promise;
  35321. /**
  35322. * Create a debounced version of a method, that's asynchronously deferred
  35323. * but called in the minimum time possible.
  35324. *
  35325. * @method
  35326. * @memberof Popper.Utils
  35327. * @argument {Function} fn
  35328. * @returns {Function}
  35329. */
  35330. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  35331. /**
  35332. * Check if the given variable is a function
  35333. * @method
  35334. * @memberof Popper.Utils
  35335. * @argument {Any} functionToCheck - variable to check
  35336. * @returns {Boolean} answer to: is a function?
  35337. */
  35338. function isFunction(functionToCheck) {
  35339. var getType = {};
  35340. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  35341. }
  35342. /**
  35343. * Get CSS computed property of the given element
  35344. * @method
  35345. * @memberof Popper.Utils
  35346. * @argument {Eement} element
  35347. * @argument {String} property
  35348. */
  35349. function getStyleComputedProperty(element, property) {
  35350. if (element.nodeType !== 1) {
  35351. return [];
  35352. }
  35353. // NOTE: 1 DOM access here
  35354. var window = element.ownerDocument.defaultView;
  35355. var css = window.getComputedStyle(element, null);
  35356. return property ? css[property] : css;
  35357. }
  35358. /**
  35359. * Returns the parentNode or the host of the element
  35360. * @method
  35361. * @memberof Popper.Utils
  35362. * @argument {Element} element
  35363. * @returns {Element} parent
  35364. */
  35365. function getParentNode(element) {
  35366. if (element.nodeName === 'HTML') {
  35367. return element;
  35368. }
  35369. return element.parentNode || element.host;
  35370. }
  35371. /**
  35372. * Returns the scrolling parent of the given element
  35373. * @method
  35374. * @memberof Popper.Utils
  35375. * @argument {Element} element
  35376. * @returns {Element} scroll parent
  35377. */
  35378. function getScrollParent(element) {
  35379. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  35380. if (!element) {
  35381. return document.body;
  35382. }
  35383. switch (element.nodeName) {
  35384. case 'HTML':
  35385. case 'BODY':
  35386. return element.ownerDocument.body;
  35387. case '#document':
  35388. return element.body;
  35389. }
  35390. // Firefox want us to check `-x` and `-y` variations as well
  35391. var _getStyleComputedProp = getStyleComputedProperty(element),
  35392. overflow = _getStyleComputedProp.overflow,
  35393. overflowX = _getStyleComputedProp.overflowX,
  35394. overflowY = _getStyleComputedProp.overflowY;
  35395. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  35396. return element;
  35397. }
  35398. return getScrollParent(getParentNode(element));
  35399. }
  35400. /**
  35401. * Returns the reference node of the reference object, or the reference object itself.
  35402. * @method
  35403. * @memberof Popper.Utils
  35404. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  35405. * @returns {Element} parent
  35406. */
  35407. function getReferenceNode(reference) {
  35408. return reference && reference.referenceNode ? reference.referenceNode : reference;
  35409. }
  35410. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  35411. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  35412. /**
  35413. * Determines if the browser is Internet Explorer
  35414. * @method
  35415. * @memberof Popper.Utils
  35416. * @param {Number} version to check
  35417. * @returns {Boolean} isIE
  35418. */
  35419. function isIE(version) {
  35420. if (version === 11) {
  35421. return isIE11;
  35422. }
  35423. if (version === 10) {
  35424. return isIE10;
  35425. }
  35426. return isIE11 || isIE10;
  35427. }
  35428. /**
  35429. * Returns the offset parent of the given element
  35430. * @method
  35431. * @memberof Popper.Utils
  35432. * @argument {Element} element
  35433. * @returns {Element} offset parent
  35434. */
  35435. function getOffsetParent(element) {
  35436. if (!element) {
  35437. return document.documentElement;
  35438. }
  35439. var noOffsetParent = isIE(10) ? document.body : null;
  35440. // NOTE: 1 DOM access here
  35441. var offsetParent = element.offsetParent || null;
  35442. // Skip hidden elements which don't have an offsetParent
  35443. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  35444. offsetParent = (element = element.nextElementSibling).offsetParent;
  35445. }
  35446. var nodeName = offsetParent && offsetParent.nodeName;
  35447. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  35448. return element ? element.ownerDocument.documentElement : document.documentElement;
  35449. }
  35450. // .offsetParent will return the closest TH, TD or TABLE in case
  35451. // no offsetParent is present, I hate this job...
  35452. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  35453. return getOffsetParent(offsetParent);
  35454. }
  35455. return offsetParent;
  35456. }
  35457. function isOffsetContainer(element) {
  35458. var nodeName = element.nodeName;
  35459. if (nodeName === 'BODY') {
  35460. return false;
  35461. }
  35462. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  35463. }
  35464. /**
  35465. * Finds the root node (document, shadowDOM root) of the given element
  35466. * @method
  35467. * @memberof Popper.Utils
  35468. * @argument {Element} node
  35469. * @returns {Element} root node
  35470. */
  35471. function getRoot(node) {
  35472. if (node.parentNode !== null) {
  35473. return getRoot(node.parentNode);
  35474. }
  35475. return node;
  35476. }
  35477. /**
  35478. * Finds the offset parent common to the two provided nodes
  35479. * @method
  35480. * @memberof Popper.Utils
  35481. * @argument {Element} element1
  35482. * @argument {Element} element2
  35483. * @returns {Element} common offset parent
  35484. */
  35485. function findCommonOffsetParent(element1, element2) {
  35486. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  35487. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  35488. return document.documentElement;
  35489. }
  35490. // Here we make sure to give as "start" the element that comes first in the DOM
  35491. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  35492. var start = order ? element1 : element2;
  35493. var end = order ? element2 : element1;
  35494. // Get common ancestor container
  35495. var range = document.createRange();
  35496. range.setStart(start, 0);
  35497. range.setEnd(end, 0);
  35498. var commonAncestorContainer = range.commonAncestorContainer;
  35499. // Both nodes are inside #document
  35500. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  35501. if (isOffsetContainer(commonAncestorContainer)) {
  35502. return commonAncestorContainer;
  35503. }
  35504. return getOffsetParent(commonAncestorContainer);
  35505. }
  35506. // one of the nodes is inside shadowDOM, find which one
  35507. var element1root = getRoot(element1);
  35508. if (element1root.host) {
  35509. return findCommonOffsetParent(element1root.host, element2);
  35510. } else {
  35511. return findCommonOffsetParent(element1, getRoot(element2).host);
  35512. }
  35513. }
  35514. /**
  35515. * Gets the scroll value of the given element in the given side (top and left)
  35516. * @method
  35517. * @memberof Popper.Utils
  35518. * @argument {Element} element
  35519. * @argument {String} side `top` or `left`
  35520. * @returns {number} amount of scrolled pixels
  35521. */
  35522. function getScroll(element) {
  35523. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  35524. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  35525. var nodeName = element.nodeName;
  35526. if (nodeName === 'BODY' || nodeName === 'HTML') {
  35527. var html = element.ownerDocument.documentElement;
  35528. var scrollingElement = element.ownerDocument.scrollingElement || html;
  35529. return scrollingElement[upperSide];
  35530. }
  35531. return element[upperSide];
  35532. }
  35533. /*
  35534. * Sum or subtract the element scroll values (left and top) from a given rect object
  35535. * @method
  35536. * @memberof Popper.Utils
  35537. * @param {Object} rect - Rect object you want to change
  35538. * @param {HTMLElement} element - The element from the function reads the scroll values
  35539. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  35540. * @return {Object} rect - The modifier rect object
  35541. */
  35542. function includeScroll(rect, element) {
  35543. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  35544. var scrollTop = getScroll(element, 'top');
  35545. var scrollLeft = getScroll(element, 'left');
  35546. var modifier = subtract ? -1 : 1;
  35547. rect.top += scrollTop * modifier;
  35548. rect.bottom += scrollTop * modifier;
  35549. rect.left += scrollLeft * modifier;
  35550. rect.right += scrollLeft * modifier;
  35551. return rect;
  35552. }
  35553. /*
  35554. * Helper to detect borders of a given element
  35555. * @method
  35556. * @memberof Popper.Utils
  35557. * @param {CSSStyleDeclaration} styles
  35558. * Result of `getStyleComputedProperty` on the given element
  35559. * @param {String} axis - `x` or `y`
  35560. * @return {number} borders - The borders size of the given axis
  35561. */
  35562. function getBordersSize(styles, axis) {
  35563. var sideA = axis === 'x' ? 'Left' : 'Top';
  35564. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  35565. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  35566. }
  35567. function getSize(axis, body, html, computedStyle) {
  35568. 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);
  35569. }
  35570. function getWindowSizes(document) {
  35571. var body = document.body;
  35572. var html = document.documentElement;
  35573. var computedStyle = isIE(10) && getComputedStyle(html);
  35574. return {
  35575. height: getSize('Height', body, html, computedStyle),
  35576. width: getSize('Width', body, html, computedStyle)
  35577. };
  35578. }
  35579. var classCallCheck = function (instance, Constructor) {
  35580. if (!(instance instanceof Constructor)) {
  35581. throw new TypeError("Cannot call a class as a function");
  35582. }
  35583. };
  35584. var createClass = function () {
  35585. function defineProperties(target, props) {
  35586. for (var i = 0; i < props.length; i++) {
  35587. var descriptor = props[i];
  35588. descriptor.enumerable = descriptor.enumerable || false;
  35589. descriptor.configurable = true;
  35590. if ("value" in descriptor) descriptor.writable = true;
  35591. Object.defineProperty(target, descriptor.key, descriptor);
  35592. }
  35593. }
  35594. return function (Constructor, protoProps, staticProps) {
  35595. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  35596. if (staticProps) defineProperties(Constructor, staticProps);
  35597. return Constructor;
  35598. };
  35599. }();
  35600. var defineProperty = function (obj, key, value) {
  35601. if (key in obj) {
  35602. Object.defineProperty(obj, key, {
  35603. value: value,
  35604. enumerable: true,
  35605. configurable: true,
  35606. writable: true
  35607. });
  35608. } else {
  35609. obj[key] = value;
  35610. }
  35611. return obj;
  35612. };
  35613. var _extends = Object.assign || function (target) {
  35614. for (var i = 1; i < arguments.length; i++) {
  35615. var source = arguments[i];
  35616. for (var key in source) {
  35617. if (Object.prototype.hasOwnProperty.call(source, key)) {
  35618. target[key] = source[key];
  35619. }
  35620. }
  35621. }
  35622. return target;
  35623. };
  35624. /**
  35625. * Given element offsets, generate an output similar to getBoundingClientRect
  35626. * @method
  35627. * @memberof Popper.Utils
  35628. * @argument {Object} offsets
  35629. * @returns {Object} ClientRect like output
  35630. */
  35631. function getClientRect(offsets) {
  35632. return _extends({}, offsets, {
  35633. right: offsets.left + offsets.width,
  35634. bottom: offsets.top + offsets.height
  35635. });
  35636. }
  35637. /**
  35638. * Get bounding client rect of given element
  35639. * @method
  35640. * @memberof Popper.Utils
  35641. * @param {HTMLElement} element
  35642. * @return {Object} client rect
  35643. */
  35644. function getBoundingClientRect(element) {
  35645. var rect = {};
  35646. // IE10 10 FIX: Please, don't ask, the element isn't
  35647. // considered in DOM in some circumstances...
  35648. // This isn't reproducible in IE10 compatibility mode of IE11
  35649. try {
  35650. if (isIE(10)) {
  35651. rect = element.getBoundingClientRect();
  35652. var scrollTop = getScroll(element, 'top');
  35653. var scrollLeft = getScroll(element, 'left');
  35654. rect.top += scrollTop;
  35655. rect.left += scrollLeft;
  35656. rect.bottom += scrollTop;
  35657. rect.right += scrollLeft;
  35658. } else {
  35659. rect = element.getBoundingClientRect();
  35660. }
  35661. } catch (e) {}
  35662. var result = {
  35663. left: rect.left,
  35664. top: rect.top,
  35665. width: rect.right - rect.left,
  35666. height: rect.bottom - rect.top
  35667. };
  35668. // subtract scrollbar size from sizes
  35669. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  35670. var width = sizes.width || element.clientWidth || result.width;
  35671. var height = sizes.height || element.clientHeight || result.height;
  35672. var horizScrollbar = element.offsetWidth - width;
  35673. var vertScrollbar = element.offsetHeight - height;
  35674. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  35675. // we make this check conditional for performance reasons
  35676. if (horizScrollbar || vertScrollbar) {
  35677. var styles = getStyleComputedProperty(element);
  35678. horizScrollbar -= getBordersSize(styles, 'x');
  35679. vertScrollbar -= getBordersSize(styles, 'y');
  35680. result.width -= horizScrollbar;
  35681. result.height -= vertScrollbar;
  35682. }
  35683. return getClientRect(result);
  35684. }
  35685. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  35686. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  35687. var isIE10 = isIE(10);
  35688. var isHTML = parent.nodeName === 'HTML';
  35689. var childrenRect = getBoundingClientRect(children);
  35690. var parentRect = getBoundingClientRect(parent);
  35691. var scrollParent = getScrollParent(children);
  35692. var styles = getStyleComputedProperty(parent);
  35693. var borderTopWidth = parseFloat(styles.borderTopWidth);
  35694. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  35695. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  35696. if (fixedPosition && isHTML) {
  35697. parentRect.top = Math.max(parentRect.top, 0);
  35698. parentRect.left = Math.max(parentRect.left, 0);
  35699. }
  35700. var offsets = getClientRect({
  35701. top: childrenRect.top - parentRect.top - borderTopWidth,
  35702. left: childrenRect.left - parentRect.left - borderLeftWidth,
  35703. width: childrenRect.width,
  35704. height: childrenRect.height
  35705. });
  35706. offsets.marginTop = 0;
  35707. offsets.marginLeft = 0;
  35708. // Subtract margins of documentElement in case it's being used as parent
  35709. // we do this only on HTML because it's the only element that behaves
  35710. // differently when margins are applied to it. The margins are included in
  35711. // the box of the documentElement, in the other cases not.
  35712. if (!isIE10 && isHTML) {
  35713. var marginTop = parseFloat(styles.marginTop);
  35714. var marginLeft = parseFloat(styles.marginLeft);
  35715. offsets.top -= borderTopWidth - marginTop;
  35716. offsets.bottom -= borderTopWidth - marginTop;
  35717. offsets.left -= borderLeftWidth - marginLeft;
  35718. offsets.right -= borderLeftWidth - marginLeft;
  35719. // Attach marginTop and marginLeft because in some circumstances we may need them
  35720. offsets.marginTop = marginTop;
  35721. offsets.marginLeft = marginLeft;
  35722. }
  35723. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  35724. offsets = includeScroll(offsets, parent);
  35725. }
  35726. return offsets;
  35727. }
  35728. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  35729. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35730. var html = element.ownerDocument.documentElement;
  35731. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  35732. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  35733. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  35734. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  35735. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  35736. var offset = {
  35737. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  35738. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  35739. width: width,
  35740. height: height
  35741. };
  35742. return getClientRect(offset);
  35743. }
  35744. /**
  35745. * Check if the given element is fixed or is inside a fixed parent
  35746. * @method
  35747. * @memberof Popper.Utils
  35748. * @argument {Element} element
  35749. * @argument {Element} customContainer
  35750. * @returns {Boolean} answer to "isFixed?"
  35751. */
  35752. function isFixed(element) {
  35753. var nodeName = element.nodeName;
  35754. if (nodeName === 'BODY' || nodeName === 'HTML') {
  35755. return false;
  35756. }
  35757. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  35758. return true;
  35759. }
  35760. var parentNode = getParentNode(element);
  35761. if (!parentNode) {
  35762. return false;
  35763. }
  35764. return isFixed(parentNode);
  35765. }
  35766. /**
  35767. * Finds the first parent of an element that has a transformed property defined
  35768. * @method
  35769. * @memberof Popper.Utils
  35770. * @argument {Element} element
  35771. * @returns {Element} first transformed parent or documentElement
  35772. */
  35773. function getFixedPositionOffsetParent(element) {
  35774. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  35775. if (!element || !element.parentElement || isIE()) {
  35776. return document.documentElement;
  35777. }
  35778. var el = element.parentElement;
  35779. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  35780. el = el.parentElement;
  35781. }
  35782. return el || document.documentElement;
  35783. }
  35784. /**
  35785. * Computed the boundaries limits and return them
  35786. * @method
  35787. * @memberof Popper.Utils
  35788. * @param {HTMLElement} popper
  35789. * @param {HTMLElement} reference
  35790. * @param {number} padding
  35791. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  35792. * @param {Boolean} fixedPosition - Is in fixed position mode
  35793. * @returns {Object} Coordinates of the boundaries
  35794. */
  35795. function getBoundaries(popper, reference, padding, boundariesElement) {
  35796. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  35797. // NOTE: 1 DOM access here
  35798. var boundaries = { top: 0, left: 0 };
  35799. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  35800. // Handle viewport case
  35801. if (boundariesElement === 'viewport') {
  35802. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  35803. } else {
  35804. // Handle other cases based on DOM element used as boundaries
  35805. var boundariesNode = void 0;
  35806. if (boundariesElement === 'scrollParent') {
  35807. boundariesNode = getScrollParent(getParentNode(reference));
  35808. if (boundariesNode.nodeName === 'BODY') {
  35809. boundariesNode = popper.ownerDocument.documentElement;
  35810. }
  35811. } else if (boundariesElement === 'window') {
  35812. boundariesNode = popper.ownerDocument.documentElement;
  35813. } else {
  35814. boundariesNode = boundariesElement;
  35815. }
  35816. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  35817. // In case of HTML, we need a different computation
  35818. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  35819. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  35820. height = _getWindowSizes.height,
  35821. width = _getWindowSizes.width;
  35822. boundaries.top += offsets.top - offsets.marginTop;
  35823. boundaries.bottom = height + offsets.top;
  35824. boundaries.left += offsets.left - offsets.marginLeft;
  35825. boundaries.right = width + offsets.left;
  35826. } else {
  35827. // for all the other DOM elements, this one is good
  35828. boundaries = offsets;
  35829. }
  35830. }
  35831. // Add paddings
  35832. padding = padding || 0;
  35833. var isPaddingNumber = typeof padding === 'number';
  35834. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  35835. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  35836. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  35837. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  35838. return boundaries;
  35839. }
  35840. function getArea(_ref) {
  35841. var width = _ref.width,
  35842. height = _ref.height;
  35843. return width * height;
  35844. }
  35845. /**
  35846. * Utility used to transform the `auto` placement to the placement with more
  35847. * available space.
  35848. * @method
  35849. * @memberof Popper.Utils
  35850. * @argument {Object} data - The data object generated by update method
  35851. * @argument {Object} options - Modifiers configuration and options
  35852. * @returns {Object} The data object, properly modified
  35853. */
  35854. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  35855. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  35856. if (placement.indexOf('auto') === -1) {
  35857. return placement;
  35858. }
  35859. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  35860. var rects = {
  35861. top: {
  35862. width: boundaries.width,
  35863. height: refRect.top - boundaries.top
  35864. },
  35865. right: {
  35866. width: boundaries.right - refRect.right,
  35867. height: boundaries.height
  35868. },
  35869. bottom: {
  35870. width: boundaries.width,
  35871. height: boundaries.bottom - refRect.bottom
  35872. },
  35873. left: {
  35874. width: refRect.left - boundaries.left,
  35875. height: boundaries.height
  35876. }
  35877. };
  35878. var sortedAreas = Object.keys(rects).map(function (key) {
  35879. return _extends({
  35880. key: key
  35881. }, rects[key], {
  35882. area: getArea(rects[key])
  35883. });
  35884. }).sort(function (a, b) {
  35885. return b.area - a.area;
  35886. });
  35887. var filteredAreas = sortedAreas.filter(function (_ref2) {
  35888. var width = _ref2.width,
  35889. height = _ref2.height;
  35890. return width >= popper.clientWidth && height >= popper.clientHeight;
  35891. });
  35892. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  35893. var variation = placement.split('-')[1];
  35894. return computedPlacement + (variation ? '-' + variation : '');
  35895. }
  35896. /**
  35897. * Get offsets to the reference element
  35898. * @method
  35899. * @memberof Popper.Utils
  35900. * @param {Object} state
  35901. * @param {Element} popper - the popper element
  35902. * @param {Element} reference - the reference element (the popper will be relative to this)
  35903. * @param {Element} fixedPosition - is in fixed position mode
  35904. * @returns {Object} An object containing the offsets which will be applied to the popper
  35905. */
  35906. function getReferenceOffsets(state, popper, reference) {
  35907. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  35908. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  35909. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  35910. }
  35911. /**
  35912. * Get the outer sizes of the given element (offset size + margins)
  35913. * @method
  35914. * @memberof Popper.Utils
  35915. * @argument {Element} element
  35916. * @returns {Object} object containing width and height properties
  35917. */
  35918. function getOuterSizes(element) {
  35919. var window = element.ownerDocument.defaultView;
  35920. var styles = window.getComputedStyle(element);
  35921. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  35922. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  35923. var result = {
  35924. width: element.offsetWidth + y,
  35925. height: element.offsetHeight + x
  35926. };
  35927. return result;
  35928. }
  35929. /**
  35930. * Get the opposite placement of the given one
  35931. * @method
  35932. * @memberof Popper.Utils
  35933. * @argument {String} placement
  35934. * @returns {String} flipped placement
  35935. */
  35936. function getOppositePlacement(placement) {
  35937. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  35938. return placement.replace(/left|right|bottom|top/g, function (matched) {
  35939. return hash[matched];
  35940. });
  35941. }
  35942. /**
  35943. * Get offsets to the popper
  35944. * @method
  35945. * @memberof Popper.Utils
  35946. * @param {Object} position - CSS position the Popper will get applied
  35947. * @param {HTMLElement} popper - the popper element
  35948. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  35949. * @param {String} placement - one of the valid placement options
  35950. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  35951. */
  35952. function getPopperOffsets(popper, referenceOffsets, placement) {
  35953. placement = placement.split('-')[0];
  35954. // Get popper node sizes
  35955. var popperRect = getOuterSizes(popper);
  35956. // Add position, width and height to our offsets object
  35957. var popperOffsets = {
  35958. width: popperRect.width,
  35959. height: popperRect.height
  35960. };
  35961. // depending by the popper placement we have to compute its offsets slightly differently
  35962. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  35963. var mainSide = isHoriz ? 'top' : 'left';
  35964. var secondarySide = isHoriz ? 'left' : 'top';
  35965. var measurement = isHoriz ? 'height' : 'width';
  35966. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  35967. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  35968. if (placement === secondarySide) {
  35969. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  35970. } else {
  35971. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  35972. }
  35973. return popperOffsets;
  35974. }
  35975. /**
  35976. * Mimics the `find` method of Array
  35977. * @method
  35978. * @memberof Popper.Utils
  35979. * @argument {Array} arr
  35980. * @argument prop
  35981. * @argument value
  35982. * @returns index or -1
  35983. */
  35984. function find(arr, check) {
  35985. // use native find if supported
  35986. if (Array.prototype.find) {
  35987. return arr.find(check);
  35988. }
  35989. // use `filter` to obtain the same behavior of `find`
  35990. return arr.filter(check)[0];
  35991. }
  35992. /**
  35993. * Return the index of the matching object
  35994. * @method
  35995. * @memberof Popper.Utils
  35996. * @argument {Array} arr
  35997. * @argument prop
  35998. * @argument value
  35999. * @returns index or -1
  36000. */
  36001. function findIndex(arr, prop, value) {
  36002. // use native findIndex if supported
  36003. if (Array.prototype.findIndex) {
  36004. return arr.findIndex(function (cur) {
  36005. return cur[prop] === value;
  36006. });
  36007. }
  36008. // use `find` + `indexOf` if `findIndex` isn't supported
  36009. var match = find(arr, function (obj) {
  36010. return obj[prop] === value;
  36011. });
  36012. return arr.indexOf(match);
  36013. }
  36014. /**
  36015. * Loop trough the list of modifiers and run them in order,
  36016. * each of them will then edit the data object.
  36017. * @method
  36018. * @memberof Popper.Utils
  36019. * @param {dataObject} data
  36020. * @param {Array} modifiers
  36021. * @param {String} ends - Optional modifier name used as stopper
  36022. * @returns {dataObject}
  36023. */
  36024. function runModifiers(modifiers, data, ends) {
  36025. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  36026. modifiersToRun.forEach(function (modifier) {
  36027. if (modifier['function']) {
  36028. // eslint-disable-line dot-notation
  36029. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  36030. }
  36031. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  36032. if (modifier.enabled && isFunction(fn)) {
  36033. // Add properties to offsets to make them a complete clientRect object
  36034. // we do this before each modifier to make sure the previous one doesn't
  36035. // mess with these values
  36036. data.offsets.popper = getClientRect(data.offsets.popper);
  36037. data.offsets.reference = getClientRect(data.offsets.reference);
  36038. data = fn(data, modifier);
  36039. }
  36040. });
  36041. return data;
  36042. }
  36043. /**
  36044. * Updates the position of the popper, computing the new offsets and applying
  36045. * the new style.<br />
  36046. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  36047. * @method
  36048. * @memberof Popper
  36049. */
  36050. function update() {
  36051. // if popper is destroyed, don't perform any further update
  36052. if (this.state.isDestroyed) {
  36053. return;
  36054. }
  36055. var data = {
  36056. instance: this,
  36057. styles: {},
  36058. arrowStyles: {},
  36059. attributes: {},
  36060. flipped: false,
  36061. offsets: {}
  36062. };
  36063. // compute reference element offsets
  36064. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  36065. // compute auto placement, store placement inside the data object,
  36066. // modifiers will be able to edit `placement` if needed
  36067. // and refer to originalPlacement to know the original value
  36068. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  36069. // store the computed placement inside `originalPlacement`
  36070. data.originalPlacement = data.placement;
  36071. data.positionFixed = this.options.positionFixed;
  36072. // compute the popper offsets
  36073. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  36074. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  36075. // run the modifiers
  36076. data = runModifiers(this.modifiers, data);
  36077. // the first `update` will call `onCreate` callback
  36078. // the other ones will call `onUpdate` callback
  36079. if (!this.state.isCreated) {
  36080. this.state.isCreated = true;
  36081. this.options.onCreate(data);
  36082. } else {
  36083. this.options.onUpdate(data);
  36084. }
  36085. }
  36086. /**
  36087. * Helper used to know if the given modifier is enabled.
  36088. * @method
  36089. * @memberof Popper.Utils
  36090. * @returns {Boolean}
  36091. */
  36092. function isModifierEnabled(modifiers, modifierName) {
  36093. return modifiers.some(function (_ref) {
  36094. var name = _ref.name,
  36095. enabled = _ref.enabled;
  36096. return enabled && name === modifierName;
  36097. });
  36098. }
  36099. /**
  36100. * Get the prefixed supported property name
  36101. * @method
  36102. * @memberof Popper.Utils
  36103. * @argument {String} property (camelCase)
  36104. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  36105. */
  36106. function getSupportedPropertyName(property) {
  36107. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  36108. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  36109. for (var i = 0; i < prefixes.length; i++) {
  36110. var prefix = prefixes[i];
  36111. var toCheck = prefix ? '' + prefix + upperProp : property;
  36112. if (typeof document.body.style[toCheck] !== 'undefined') {
  36113. return toCheck;
  36114. }
  36115. }
  36116. return null;
  36117. }
  36118. /**
  36119. * Destroys the popper.
  36120. * @method
  36121. * @memberof Popper
  36122. */
  36123. function destroy() {
  36124. this.state.isDestroyed = true;
  36125. // touch DOM only if `applyStyle` modifier is enabled
  36126. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  36127. this.popper.removeAttribute('x-placement');
  36128. this.popper.style.position = '';
  36129. this.popper.style.top = '';
  36130. this.popper.style.left = '';
  36131. this.popper.style.right = '';
  36132. this.popper.style.bottom = '';
  36133. this.popper.style.willChange = '';
  36134. this.popper.style[getSupportedPropertyName('transform')] = '';
  36135. }
  36136. this.disableEventListeners();
  36137. // remove the popper if user explicitly asked for the deletion on destroy
  36138. // do not use `remove` because IE11 doesn't support it
  36139. if (this.options.removeOnDestroy) {
  36140. this.popper.parentNode.removeChild(this.popper);
  36141. }
  36142. return this;
  36143. }
  36144. /**
  36145. * Get the window associated with the element
  36146. * @argument {Element} element
  36147. * @returns {Window}
  36148. */
  36149. function getWindow(element) {
  36150. var ownerDocument = element.ownerDocument;
  36151. return ownerDocument ? ownerDocument.defaultView : window;
  36152. }
  36153. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  36154. var isBody = scrollParent.nodeName === 'BODY';
  36155. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  36156. target.addEventListener(event, callback, { passive: true });
  36157. if (!isBody) {
  36158. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  36159. }
  36160. scrollParents.push(target);
  36161. }
  36162. /**
  36163. * Setup needed event listeners used to update the popper position
  36164. * @method
  36165. * @memberof Popper.Utils
  36166. * @private
  36167. */
  36168. function setupEventListeners(reference, options, state, updateBound) {
  36169. // Resize event listener on window
  36170. state.updateBound = updateBound;
  36171. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  36172. // Scroll event listener on scroll parents
  36173. var scrollElement = getScrollParent(reference);
  36174. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  36175. state.scrollElement = scrollElement;
  36176. state.eventsEnabled = true;
  36177. return state;
  36178. }
  36179. /**
  36180. * It will add resize/scroll events and start recalculating
  36181. * position of the popper element when they are triggered.
  36182. * @method
  36183. * @memberof Popper
  36184. */
  36185. function enableEventListeners() {
  36186. if (!this.state.eventsEnabled) {
  36187. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  36188. }
  36189. }
  36190. /**
  36191. * Remove event listeners used to update the popper position
  36192. * @method
  36193. * @memberof Popper.Utils
  36194. * @private
  36195. */
  36196. function removeEventListeners(reference, state) {
  36197. // Remove resize event listener on window
  36198. getWindow(reference).removeEventListener('resize', state.updateBound);
  36199. // Remove scroll event listener on scroll parents
  36200. state.scrollParents.forEach(function (target) {
  36201. target.removeEventListener('scroll', state.updateBound);
  36202. });
  36203. // Reset state
  36204. state.updateBound = null;
  36205. state.scrollParents = [];
  36206. state.scrollElement = null;
  36207. state.eventsEnabled = false;
  36208. return state;
  36209. }
  36210. /**
  36211. * It will remove resize/scroll events and won't recalculate popper position
  36212. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  36213. * unless you call `update` method manually.
  36214. * @method
  36215. * @memberof Popper
  36216. */
  36217. function disableEventListeners() {
  36218. if (this.state.eventsEnabled) {
  36219. cancelAnimationFrame(this.scheduleUpdate);
  36220. this.state = removeEventListeners(this.reference, this.state);
  36221. }
  36222. }
  36223. /**
  36224. * Tells if a given input is a number
  36225. * @method
  36226. * @memberof Popper.Utils
  36227. * @param {*} input to check
  36228. * @return {Boolean}
  36229. */
  36230. function isNumeric(n) {
  36231. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  36232. }
  36233. /**
  36234. * Set the style to the given popper
  36235. * @method
  36236. * @memberof Popper.Utils
  36237. * @argument {Element} element - Element to apply the style to
  36238. * @argument {Object} styles
  36239. * Object with a list of properties and values which will be applied to the element
  36240. */
  36241. function setStyles(element, styles) {
  36242. Object.keys(styles).forEach(function (prop) {
  36243. var unit = '';
  36244. // add unit if the value is numeric and is one of the following
  36245. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  36246. unit = 'px';
  36247. }
  36248. element.style[prop] = styles[prop] + unit;
  36249. });
  36250. }
  36251. /**
  36252. * Set the attributes to the given popper
  36253. * @method
  36254. * @memberof Popper.Utils
  36255. * @argument {Element} element - Element to apply the attributes to
  36256. * @argument {Object} styles
  36257. * Object with a list of properties and values which will be applied to the element
  36258. */
  36259. function setAttributes(element, attributes) {
  36260. Object.keys(attributes).forEach(function (prop) {
  36261. var value = attributes[prop];
  36262. if (value !== false) {
  36263. element.setAttribute(prop, attributes[prop]);
  36264. } else {
  36265. element.removeAttribute(prop);
  36266. }
  36267. });
  36268. }
  36269. /**
  36270. * @function
  36271. * @memberof Modifiers
  36272. * @argument {Object} data - The data object generated by `update` method
  36273. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  36274. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  36275. * @argument {Object} options - Modifiers configuration and options
  36276. * @returns {Object} The same data object
  36277. */
  36278. function applyStyle(data) {
  36279. // any property present in `data.styles` will be applied to the popper,
  36280. // in this way we can make the 3rd party modifiers add custom styles to it
  36281. // Be aware, modifiers could override the properties defined in the previous
  36282. // lines of this modifier!
  36283. setStyles(data.instance.popper, data.styles);
  36284. // any property present in `data.attributes` will be applied to the popper,
  36285. // they will be set as HTML attributes of the element
  36286. setAttributes(data.instance.popper, data.attributes);
  36287. // if arrowElement is defined and arrowStyles has some properties
  36288. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  36289. setStyles(data.arrowElement, data.arrowStyles);
  36290. }
  36291. return data;
  36292. }
  36293. /**
  36294. * Set the x-placement attribute before everything else because it could be used
  36295. * to add margins to the popper margins needs to be calculated to get the
  36296. * correct popper offsets.
  36297. * @method
  36298. * @memberof Popper.modifiers
  36299. * @param {HTMLElement} reference - The reference element used to position the popper
  36300. * @param {HTMLElement} popper - The HTML element used as popper
  36301. * @param {Object} options - Popper.js options
  36302. */
  36303. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  36304. // compute reference element offsets
  36305. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  36306. // compute auto placement, store placement inside the data object,
  36307. // modifiers will be able to edit `placement` if needed
  36308. // and refer to originalPlacement to know the original value
  36309. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  36310. popper.setAttribute('x-placement', placement);
  36311. // Apply `position` to popper before anything else because
  36312. // without the position applied we can't guarantee correct computations
  36313. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  36314. return options;
  36315. }
  36316. /**
  36317. * @function
  36318. * @memberof Popper.Utils
  36319. * @argument {Object} data - The data object generated by `update` method
  36320. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  36321. * @returns {Object} The popper's position offsets rounded
  36322. *
  36323. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  36324. * good as it can be within reason.
  36325. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  36326. *
  36327. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  36328. * as well on High DPI screens).
  36329. *
  36330. * Firefox prefers no rounding for positioning and does not have blurriness on
  36331. * high DPI screens.
  36332. *
  36333. * Only horizontal placement and left/right values need to be considered.
  36334. */
  36335. function getRoundedOffsets(data, shouldRound) {
  36336. var _data$offsets = data.offsets,
  36337. popper = _data$offsets.popper,
  36338. reference = _data$offsets.reference;
  36339. var round = Math.round,
  36340. floor = Math.floor;
  36341. var noRound = function noRound(v) {
  36342. return v;
  36343. };
  36344. var referenceWidth = round(reference.width);
  36345. var popperWidth = round(popper.width);
  36346. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  36347. var isVariation = data.placement.indexOf('-') !== -1;
  36348. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  36349. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  36350. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  36351. var verticalToInteger = !shouldRound ? noRound : round;
  36352. return {
  36353. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  36354. top: verticalToInteger(popper.top),
  36355. bottom: verticalToInteger(popper.bottom),
  36356. right: horizontalToInteger(popper.right)
  36357. };
  36358. }
  36359. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  36360. /**
  36361. * @function
  36362. * @memberof Modifiers
  36363. * @argument {Object} data - The data object generated by `update` method
  36364. * @argument {Object} options - Modifiers configuration and options
  36365. * @returns {Object} The data object, properly modified
  36366. */
  36367. function computeStyle(data, options) {
  36368. var x = options.x,
  36369. y = options.y;
  36370. var popper = data.offsets.popper;
  36371. // Remove this legacy support in Popper.js v2
  36372. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  36373. return modifier.name === 'applyStyle';
  36374. }).gpuAcceleration;
  36375. if (legacyGpuAccelerationOption !== undefined) {
  36376. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  36377. }
  36378. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  36379. var offsetParent = getOffsetParent(data.instance.popper);
  36380. var offsetParentRect = getBoundingClientRect(offsetParent);
  36381. // Styles
  36382. var styles = {
  36383. position: popper.position
  36384. };
  36385. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  36386. var sideA = x === 'bottom' ? 'top' : 'bottom';
  36387. var sideB = y === 'right' ? 'left' : 'right';
  36388. // if gpuAcceleration is set to `true` and transform is supported,
  36389. // we use `translate3d` to apply the position to the popper we
  36390. // automatically use the supported prefixed version if needed
  36391. var prefixedProperty = getSupportedPropertyName('transform');
  36392. // now, let's make a step back and look at this code closely (wtf?)
  36393. // If the content of the popper grows once it's been positioned, it
  36394. // may happen that the popper gets misplaced because of the new content
  36395. // overflowing its reference element
  36396. // To avoid this problem, we provide two options (x and y), which allow
  36397. // the consumer to define the offset origin.
  36398. // If we position a popper on top of a reference element, we can set
  36399. // `x` to `top` to make the popper grow towards its top instead of
  36400. // its bottom.
  36401. var left = void 0,
  36402. top = void 0;
  36403. if (sideA === 'bottom') {
  36404. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  36405. // and not the bottom of the html element
  36406. if (offsetParent.nodeName === 'HTML') {
  36407. top = -offsetParent.clientHeight + offsets.bottom;
  36408. } else {
  36409. top = -offsetParentRect.height + offsets.bottom;
  36410. }
  36411. } else {
  36412. top = offsets.top;
  36413. }
  36414. if (sideB === 'right') {
  36415. if (offsetParent.nodeName === 'HTML') {
  36416. left = -offsetParent.clientWidth + offsets.right;
  36417. } else {
  36418. left = -offsetParentRect.width + offsets.right;
  36419. }
  36420. } else {
  36421. left = offsets.left;
  36422. }
  36423. if (gpuAcceleration && prefixedProperty) {
  36424. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  36425. styles[sideA] = 0;
  36426. styles[sideB] = 0;
  36427. styles.willChange = 'transform';
  36428. } else {
  36429. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  36430. var invertTop = sideA === 'bottom' ? -1 : 1;
  36431. var invertLeft = sideB === 'right' ? -1 : 1;
  36432. styles[sideA] = top * invertTop;
  36433. styles[sideB] = left * invertLeft;
  36434. styles.willChange = sideA + ', ' + sideB;
  36435. }
  36436. // Attributes
  36437. var attributes = {
  36438. 'x-placement': data.placement
  36439. };
  36440. // Update `data` attributes, styles and arrowStyles
  36441. data.attributes = _extends({}, attributes, data.attributes);
  36442. data.styles = _extends({}, styles, data.styles);
  36443. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  36444. return data;
  36445. }
  36446. /**
  36447. * Helper used to know if the given modifier depends from another one.<br />
  36448. * It checks if the needed modifier is listed and enabled.
  36449. * @method
  36450. * @memberof Popper.Utils
  36451. * @param {Array} modifiers - list of modifiers
  36452. * @param {String} requestingName - name of requesting modifier
  36453. * @param {String} requestedName - name of requested modifier
  36454. * @returns {Boolean}
  36455. */
  36456. function isModifierRequired(modifiers, requestingName, requestedName) {
  36457. var requesting = find(modifiers, function (_ref) {
  36458. var name = _ref.name;
  36459. return name === requestingName;
  36460. });
  36461. var isRequired = !!requesting && modifiers.some(function (modifier) {
  36462. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  36463. });
  36464. if (!isRequired) {
  36465. var _requesting = '`' + requestingName + '`';
  36466. var requested = '`' + requestedName + '`';
  36467. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  36468. }
  36469. return isRequired;
  36470. }
  36471. /**
  36472. * @function
  36473. * @memberof Modifiers
  36474. * @argument {Object} data - The data object generated by update method
  36475. * @argument {Object} options - Modifiers configuration and options
  36476. * @returns {Object} The data object, properly modified
  36477. */
  36478. function arrow(data, options) {
  36479. var _data$offsets$arrow;
  36480. // arrow depends on keepTogether in order to work
  36481. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  36482. return data;
  36483. }
  36484. var arrowElement = options.element;
  36485. // if arrowElement is a string, suppose it's a CSS selector
  36486. if (typeof arrowElement === 'string') {
  36487. arrowElement = data.instance.popper.querySelector(arrowElement);
  36488. // if arrowElement is not found, don't run the modifier
  36489. if (!arrowElement) {
  36490. return data;
  36491. }
  36492. } else {
  36493. // if the arrowElement isn't a query selector we must check that the
  36494. // provided DOM node is child of its popper node
  36495. if (!data.instance.popper.contains(arrowElement)) {
  36496. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  36497. return data;
  36498. }
  36499. }
  36500. var placement = data.placement.split('-')[0];
  36501. var _data$offsets = data.offsets,
  36502. popper = _data$offsets.popper,
  36503. reference = _data$offsets.reference;
  36504. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  36505. var len = isVertical ? 'height' : 'width';
  36506. var sideCapitalized = isVertical ? 'Top' : 'Left';
  36507. var side = sideCapitalized.toLowerCase();
  36508. var altSide = isVertical ? 'left' : 'top';
  36509. var opSide = isVertical ? 'bottom' : 'right';
  36510. var arrowElementSize = getOuterSizes(arrowElement)[len];
  36511. //
  36512. // extends keepTogether behavior making sure the popper and its
  36513. // reference have enough pixels in conjunction
  36514. //
  36515. // top/left side
  36516. if (reference[opSide] - arrowElementSize < popper[side]) {
  36517. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  36518. }
  36519. // bottom/right side
  36520. if (reference[side] + arrowElementSize > popper[opSide]) {
  36521. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  36522. }
  36523. data.offsets.popper = getClientRect(data.offsets.popper);
  36524. // compute center of the popper
  36525. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  36526. // Compute the sideValue using the updated popper offsets
  36527. // take popper margin in account because we don't have this info available
  36528. var css = getStyleComputedProperty(data.instance.popper);
  36529. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  36530. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  36531. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  36532. // prevent arrowElement from being placed not contiguously to its popper
  36533. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  36534. data.arrowElement = arrowElement;
  36535. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  36536. return data;
  36537. }
  36538. /**
  36539. * Get the opposite placement variation of the given one
  36540. * @method
  36541. * @memberof Popper.Utils
  36542. * @argument {String} placement variation
  36543. * @returns {String} flipped placement variation
  36544. */
  36545. function getOppositeVariation(variation) {
  36546. if (variation === 'end') {
  36547. return 'start';
  36548. } else if (variation === 'start') {
  36549. return 'end';
  36550. }
  36551. return variation;
  36552. }
  36553. /**
  36554. * List of accepted placements to use as values of the `placement` option.<br />
  36555. * Valid placements are:
  36556. * - `auto`
  36557. * - `top`
  36558. * - `right`
  36559. * - `bottom`
  36560. * - `left`
  36561. *
  36562. * Each placement can have a variation from this list:
  36563. * - `-start`
  36564. * - `-end`
  36565. *
  36566. * Variations are interpreted easily if you think of them as the left to right
  36567. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  36568. * is right.<br />
  36569. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  36570. *
  36571. * Some valid examples are:
  36572. * - `top-end` (on top of reference, right aligned)
  36573. * - `right-start` (on right of reference, top aligned)
  36574. * - `bottom` (on bottom, centered)
  36575. * - `auto-end` (on the side with more space available, alignment depends by placement)
  36576. *
  36577. * @static
  36578. * @type {Array}
  36579. * @enum {String}
  36580. * @readonly
  36581. * @method placements
  36582. * @memberof Popper
  36583. */
  36584. 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'];
  36585. // Get rid of `auto` `auto-start` and `auto-end`
  36586. var validPlacements = placements.slice(3);
  36587. /**
  36588. * Given an initial placement, returns all the subsequent placements
  36589. * clockwise (or counter-clockwise).
  36590. *
  36591. * @method
  36592. * @memberof Popper.Utils
  36593. * @argument {String} placement - A valid placement (it accepts variations)
  36594. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  36595. * @returns {Array} placements including their variations
  36596. */
  36597. function clockwise(placement) {
  36598. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  36599. var index = validPlacements.indexOf(placement);
  36600. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  36601. return counter ? arr.reverse() : arr;
  36602. }
  36603. var BEHAVIORS = {
  36604. FLIP: 'flip',
  36605. CLOCKWISE: 'clockwise',
  36606. COUNTERCLOCKWISE: 'counterclockwise'
  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 flip(data, options) {
  36616. // if `inner` modifier is enabled, we can't use the `flip` modifier
  36617. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  36618. return data;
  36619. }
  36620. if (data.flipped && data.placement === data.originalPlacement) {
  36621. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  36622. return data;
  36623. }
  36624. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  36625. var placement = data.placement.split('-')[0];
  36626. var placementOpposite = getOppositePlacement(placement);
  36627. var variation = data.placement.split('-')[1] || '';
  36628. var flipOrder = [];
  36629. switch (options.behavior) {
  36630. case BEHAVIORS.FLIP:
  36631. flipOrder = [placement, placementOpposite];
  36632. break;
  36633. case BEHAVIORS.CLOCKWISE:
  36634. flipOrder = clockwise(placement);
  36635. break;
  36636. case BEHAVIORS.COUNTERCLOCKWISE:
  36637. flipOrder = clockwise(placement, true);
  36638. break;
  36639. default:
  36640. flipOrder = options.behavior;
  36641. }
  36642. flipOrder.forEach(function (step, index) {
  36643. if (placement !== step || flipOrder.length === index + 1) {
  36644. return data;
  36645. }
  36646. placement = data.placement.split('-')[0];
  36647. placementOpposite = getOppositePlacement(placement);
  36648. var popperOffsets = data.offsets.popper;
  36649. var refOffsets = data.offsets.reference;
  36650. // using floor because the reference offsets may contain decimals we are not going to consider here
  36651. var floor = Math.floor;
  36652. 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);
  36653. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  36654. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  36655. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  36656. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  36657. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  36658. // flip the variation if required
  36659. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  36660. // flips variation if reference element overflows boundaries
  36661. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  36662. // flips variation if popper content overflows boundaries
  36663. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  36664. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  36665. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  36666. // this boolean to detect any flip loop
  36667. data.flipped = true;
  36668. if (overlapsRef || overflowsBoundaries) {
  36669. placement = flipOrder[index + 1];
  36670. }
  36671. if (flippedVariation) {
  36672. variation = getOppositeVariation(variation);
  36673. }
  36674. data.placement = placement + (variation ? '-' + variation : '');
  36675. // this object contains `position`, we want to preserve it along with
  36676. // any additional property we may add in the future
  36677. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  36678. data = runModifiers(data.instance.modifiers, data, 'flip');
  36679. }
  36680. });
  36681. return data;
  36682. }
  36683. /**
  36684. * @function
  36685. * @memberof Modifiers
  36686. * @argument {Object} data - The data object generated by update method
  36687. * @argument {Object} options - Modifiers configuration and options
  36688. * @returns {Object} The data object, properly modified
  36689. */
  36690. function keepTogether(data) {
  36691. var _data$offsets = data.offsets,
  36692. popper = _data$offsets.popper,
  36693. reference = _data$offsets.reference;
  36694. var placement = data.placement.split('-')[0];
  36695. var floor = Math.floor;
  36696. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  36697. var side = isVertical ? 'right' : 'bottom';
  36698. var opSide = isVertical ? 'left' : 'top';
  36699. var measurement = isVertical ? 'width' : 'height';
  36700. if (popper[side] < floor(reference[opSide])) {
  36701. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  36702. }
  36703. if (popper[opSide] > floor(reference[side])) {
  36704. data.offsets.popper[opSide] = floor(reference[side]);
  36705. }
  36706. return data;
  36707. }
  36708. /**
  36709. * Converts a string containing value + unit into a px value number
  36710. * @function
  36711. * @memberof {modifiers~offset}
  36712. * @private
  36713. * @argument {String} str - Value + unit string
  36714. * @argument {String} measurement - `height` or `width`
  36715. * @argument {Object} popperOffsets
  36716. * @argument {Object} referenceOffsets
  36717. * @returns {Number|String}
  36718. * Value in pixels, or original string if no values were extracted
  36719. */
  36720. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  36721. // separate value from unit
  36722. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  36723. var value = +split[1];
  36724. var unit = split[2];
  36725. // If it's not a number it's an operator, I guess
  36726. if (!value) {
  36727. return str;
  36728. }
  36729. if (unit.indexOf('%') === 0) {
  36730. var element = void 0;
  36731. switch (unit) {
  36732. case '%p':
  36733. element = popperOffsets;
  36734. break;
  36735. case '%':
  36736. case '%r':
  36737. default:
  36738. element = referenceOffsets;
  36739. }
  36740. var rect = getClientRect(element);
  36741. return rect[measurement] / 100 * value;
  36742. } else if (unit === 'vh' || unit === 'vw') {
  36743. // if is a vh or vw, we calculate the size based on the viewport
  36744. var size = void 0;
  36745. if (unit === 'vh') {
  36746. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  36747. } else {
  36748. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  36749. }
  36750. return size / 100 * value;
  36751. } else {
  36752. // if is an explicit pixel unit, we get rid of the unit and keep the value
  36753. // if is an implicit unit, it's px, and we return just the value
  36754. return value;
  36755. }
  36756. }
  36757. /**
  36758. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  36759. * @function
  36760. * @memberof {modifiers~offset}
  36761. * @private
  36762. * @argument {String} offset
  36763. * @argument {Object} popperOffsets
  36764. * @argument {Object} referenceOffsets
  36765. * @argument {String} basePlacement
  36766. * @returns {Array} a two cells array with x and y offsets in numbers
  36767. */
  36768. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  36769. var offsets = [0, 0];
  36770. // Use height if placement is left or right and index is 0 otherwise use width
  36771. // in this way the first offset will use an axis and the second one
  36772. // will use the other one
  36773. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  36774. // Split the offset string to obtain a list of values and operands
  36775. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  36776. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  36777. return frag.trim();
  36778. });
  36779. // Detect if the offset string contains a pair of values or a single one
  36780. // they could be separated by comma or space
  36781. var divider = fragments.indexOf(find(fragments, function (frag) {
  36782. return frag.search(/,|\s/) !== -1;
  36783. }));
  36784. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  36785. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  36786. }
  36787. // If divider is found, we divide the list of values and operands to divide
  36788. // them by ofset X and Y.
  36789. var splitRegex = /\s*,\s*|\s+/;
  36790. 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];
  36791. // Convert the values with units to absolute pixels to allow our computations
  36792. ops = ops.map(function (op, index) {
  36793. // Most of the units rely on the orientation of the popper
  36794. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  36795. var mergeWithPrevious = false;
  36796. return op
  36797. // This aggregates any `+` or `-` sign that aren't considered operators
  36798. // e.g.: 10 + +5 => [10, +, +5]
  36799. .reduce(function (a, b) {
  36800. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  36801. a[a.length - 1] = b;
  36802. mergeWithPrevious = true;
  36803. return a;
  36804. } else if (mergeWithPrevious) {
  36805. a[a.length - 1] += b;
  36806. mergeWithPrevious = false;
  36807. return a;
  36808. } else {
  36809. return a.concat(b);
  36810. }
  36811. }, [])
  36812. // Here we convert the string values into number values (in px)
  36813. .map(function (str) {
  36814. return toValue(str, measurement, popperOffsets, referenceOffsets);
  36815. });
  36816. });
  36817. // Loop trough the offsets arrays and execute the operations
  36818. ops.forEach(function (op, index) {
  36819. op.forEach(function (frag, index2) {
  36820. if (isNumeric(frag)) {
  36821. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  36822. }
  36823. });
  36824. });
  36825. return offsets;
  36826. }
  36827. /**
  36828. * @function
  36829. * @memberof Modifiers
  36830. * @argument {Object} data - The data object generated by update method
  36831. * @argument {Object} options - Modifiers configuration and options
  36832. * @argument {Number|String} options.offset=0
  36833. * The offset value as described in the modifier description
  36834. * @returns {Object} The data object, properly modified
  36835. */
  36836. function offset(data, _ref) {
  36837. var offset = _ref.offset;
  36838. var placement = data.placement,
  36839. _data$offsets = data.offsets,
  36840. popper = _data$offsets.popper,
  36841. reference = _data$offsets.reference;
  36842. var basePlacement = placement.split('-')[0];
  36843. var offsets = void 0;
  36844. if (isNumeric(+offset)) {
  36845. offsets = [+offset, 0];
  36846. } else {
  36847. offsets = parseOffset(offset, popper, reference, basePlacement);
  36848. }
  36849. if (basePlacement === 'left') {
  36850. popper.top += offsets[0];
  36851. popper.left -= offsets[1];
  36852. } else if (basePlacement === 'right') {
  36853. popper.top += offsets[0];
  36854. popper.left += offsets[1];
  36855. } else if (basePlacement === 'top') {
  36856. popper.left += offsets[0];
  36857. popper.top -= offsets[1];
  36858. } else if (basePlacement === 'bottom') {
  36859. popper.left += offsets[0];
  36860. popper.top += offsets[1];
  36861. }
  36862. data.popper = popper;
  36863. return data;
  36864. }
  36865. /**
  36866. * @function
  36867. * @memberof Modifiers
  36868. * @argument {Object} data - The data object generated by `update` method
  36869. * @argument {Object} options - Modifiers configuration and options
  36870. * @returns {Object} The data object, properly modified
  36871. */
  36872. function preventOverflow(data, options) {
  36873. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  36874. // If offsetParent is the reference element, we really want to
  36875. // go one step up and use the next offsetParent as reference to
  36876. // avoid to make this modifier completely useless and look like broken
  36877. if (data.instance.reference === boundariesElement) {
  36878. boundariesElement = getOffsetParent(boundariesElement);
  36879. }
  36880. // NOTE: DOM access here
  36881. // resets the popper's position so that the document size can be calculated excluding
  36882. // the size of the popper element itself
  36883. var transformProp = getSupportedPropertyName('transform');
  36884. var popperStyles = data.instance.popper.style; // assignment to help minification
  36885. var top = popperStyles.top,
  36886. left = popperStyles.left,
  36887. transform = popperStyles[transformProp];
  36888. popperStyles.top = '';
  36889. popperStyles.left = '';
  36890. popperStyles[transformProp] = '';
  36891. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  36892. // NOTE: DOM access here
  36893. // restores the original style properties after the offsets have been computed
  36894. popperStyles.top = top;
  36895. popperStyles.left = left;
  36896. popperStyles[transformProp] = transform;
  36897. options.boundaries = boundaries;
  36898. var order = options.priority;
  36899. var popper = data.offsets.popper;
  36900. var check = {
  36901. primary: function primary(placement) {
  36902. var value = popper[placement];
  36903. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  36904. value = Math.max(popper[placement], boundaries[placement]);
  36905. }
  36906. return defineProperty({}, placement, value);
  36907. },
  36908. secondary: function secondary(placement) {
  36909. var mainSide = placement === 'right' ? 'left' : 'top';
  36910. var value = popper[mainSide];
  36911. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  36912. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  36913. }
  36914. return defineProperty({}, mainSide, value);
  36915. }
  36916. };
  36917. order.forEach(function (placement) {
  36918. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  36919. popper = _extends({}, popper, check[side](placement));
  36920. });
  36921. data.offsets.popper = popper;
  36922. return data;
  36923. }
  36924. /**
  36925. * @function
  36926. * @memberof Modifiers
  36927. * @argument {Object} data - The data object generated by `update` method
  36928. * @argument {Object} options - Modifiers configuration and options
  36929. * @returns {Object} The data object, properly modified
  36930. */
  36931. function shift(data) {
  36932. var placement = data.placement;
  36933. var basePlacement = placement.split('-')[0];
  36934. var shiftvariation = placement.split('-')[1];
  36935. // if shift shiftvariation is specified, run the modifier
  36936. if (shiftvariation) {
  36937. var _data$offsets = data.offsets,
  36938. reference = _data$offsets.reference,
  36939. popper = _data$offsets.popper;
  36940. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  36941. var side = isVertical ? 'left' : 'top';
  36942. var measurement = isVertical ? 'width' : 'height';
  36943. var shiftOffsets = {
  36944. start: defineProperty({}, side, reference[side]),
  36945. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  36946. };
  36947. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  36948. }
  36949. return data;
  36950. }
  36951. /**
  36952. * @function
  36953. * @memberof Modifiers
  36954. * @argument {Object} data - The data object generated by update method
  36955. * @argument {Object} options - Modifiers configuration and options
  36956. * @returns {Object} The data object, properly modified
  36957. */
  36958. function hide(data) {
  36959. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  36960. return data;
  36961. }
  36962. var refRect = data.offsets.reference;
  36963. var bound = find(data.instance.modifiers, function (modifier) {
  36964. return modifier.name === 'preventOverflow';
  36965. }).boundaries;
  36966. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  36967. // Avoid unnecessary DOM access if visibility hasn't changed
  36968. if (data.hide === true) {
  36969. return data;
  36970. }
  36971. data.hide = true;
  36972. data.attributes['x-out-of-boundaries'] = '';
  36973. } else {
  36974. // Avoid unnecessary DOM access if visibility hasn't changed
  36975. if (data.hide === false) {
  36976. return data;
  36977. }
  36978. data.hide = false;
  36979. data.attributes['x-out-of-boundaries'] = false;
  36980. }
  36981. return data;
  36982. }
  36983. /**
  36984. * @function
  36985. * @memberof Modifiers
  36986. * @argument {Object} data - The data object generated by `update` method
  36987. * @argument {Object} options - Modifiers configuration and options
  36988. * @returns {Object} The data object, properly modified
  36989. */
  36990. function inner(data) {
  36991. var placement = data.placement;
  36992. var basePlacement = placement.split('-')[0];
  36993. var _data$offsets = data.offsets,
  36994. popper = _data$offsets.popper,
  36995. reference = _data$offsets.reference;
  36996. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  36997. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  36998. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  36999. data.placement = getOppositePlacement(placement);
  37000. data.offsets.popper = getClientRect(popper);
  37001. return data;
  37002. }
  37003. /**
  37004. * Modifier function, each modifier can have a function of this type assigned
  37005. * to its `fn` property.<br />
  37006. * These functions will be called on each update, this means that you must
  37007. * make sure they are performant enough to avoid performance bottlenecks.
  37008. *
  37009. * @function ModifierFn
  37010. * @argument {dataObject} data - The data object generated by `update` method
  37011. * @argument {Object} options - Modifiers configuration and options
  37012. * @returns {dataObject} The data object, properly modified
  37013. */
  37014. /**
  37015. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  37016. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  37017. * needed by the library.
  37018. *
  37019. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  37020. * All the other properties are configurations that could be tweaked.
  37021. * @namespace modifiers
  37022. */
  37023. var modifiers = {
  37024. /**
  37025. * Modifier used to shift the popper on the start or end of its reference
  37026. * element.<br />
  37027. * It will read the variation of the `placement` property.<br />
  37028. * It can be one either `-end` or `-start`.
  37029. * @memberof modifiers
  37030. * @inner
  37031. */
  37032. shift: {
  37033. /** @prop {number} order=100 - Index used to define the order of execution */
  37034. order: 100,
  37035. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37036. enabled: true,
  37037. /** @prop {ModifierFn} */
  37038. fn: shift
  37039. },
  37040. /**
  37041. * The `offset` modifier can shift your popper on both its axis.
  37042. *
  37043. * It accepts the following units:
  37044. * - `px` or unit-less, interpreted as pixels
  37045. * - `%` or `%r`, percentage relative to the length of the reference element
  37046. * - `%p`, percentage relative to the length of the popper element
  37047. * - `vw`, CSS viewport width unit
  37048. * - `vh`, CSS viewport height unit
  37049. *
  37050. * For length is intended the main axis relative to the placement of the popper.<br />
  37051. * This means that if the placement is `top` or `bottom`, the length will be the
  37052. * `width`. In case of `left` or `right`, it will be the `height`.
  37053. *
  37054. * You can provide a single value (as `Number` or `String`), or a pair of values
  37055. * as `String` divided by a comma or one (or more) white spaces.<br />
  37056. * The latter is a deprecated method because it leads to confusion and will be
  37057. * removed in v2.<br />
  37058. * Additionally, it accepts additions and subtractions between different units.
  37059. * Note that multiplications and divisions aren't supported.
  37060. *
  37061. * Valid examples are:
  37062. * ```
  37063. * 10
  37064. * '10%'
  37065. * '10, 10'
  37066. * '10%, 10'
  37067. * '10 + 10%'
  37068. * '10 - 5vh + 3%'
  37069. * '-10px + 5vh, 5px - 6%'
  37070. * ```
  37071. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  37072. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  37073. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  37074. *
  37075. * @memberof modifiers
  37076. * @inner
  37077. */
  37078. offset: {
  37079. /** @prop {number} order=200 - Index used to define the order of execution */
  37080. order: 200,
  37081. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37082. enabled: true,
  37083. /** @prop {ModifierFn} */
  37084. fn: offset,
  37085. /** @prop {Number|String} offset=0
  37086. * The offset value as described in the modifier description
  37087. */
  37088. offset: 0
  37089. },
  37090. /**
  37091. * Modifier used to prevent the popper from being positioned outside the boundary.
  37092. *
  37093. * A scenario exists where the reference itself is not within the boundaries.<br />
  37094. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  37095. * In this case we need to decide whether the popper should either:
  37096. *
  37097. * - detach from the reference and remain "trapped" in the boundaries, or
  37098. * - if it should ignore the boundary and "escape with its reference"
  37099. *
  37100. * When `escapeWithReference` is set to`true` and reference is completely
  37101. * outside its boundaries, the popper will overflow (or completely leave)
  37102. * the boundaries in order to remain attached to the edge of the reference.
  37103. *
  37104. * @memberof modifiers
  37105. * @inner
  37106. */
  37107. preventOverflow: {
  37108. /** @prop {number} order=300 - Index used to define the order of execution */
  37109. order: 300,
  37110. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37111. enabled: true,
  37112. /** @prop {ModifierFn} */
  37113. fn: preventOverflow,
  37114. /**
  37115. * @prop {Array} [priority=['left','right','top','bottom']]
  37116. * Popper will try to prevent overflow following these priorities by default,
  37117. * then, it could overflow on the left and on top of the `boundariesElement`
  37118. */
  37119. priority: ['left', 'right', 'top', 'bottom'],
  37120. /**
  37121. * @prop {number} padding=5
  37122. * Amount of pixel used to define a minimum distance between the boundaries
  37123. * and the popper. This makes sure the popper always has a little padding
  37124. * between the edges of its container
  37125. */
  37126. padding: 5,
  37127. /**
  37128. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  37129. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  37130. * `viewport` or any DOM element.
  37131. */
  37132. boundariesElement: 'scrollParent'
  37133. },
  37134. /**
  37135. * Modifier used to make sure the reference and its popper stay near each other
  37136. * without leaving any gap between the two. Especially useful when the arrow is
  37137. * enabled and you want to ensure that it points to its reference element.
  37138. * It cares only about the first axis. You can still have poppers with margin
  37139. * between the popper and its reference element.
  37140. * @memberof modifiers
  37141. * @inner
  37142. */
  37143. keepTogether: {
  37144. /** @prop {number} order=400 - Index used to define the order of execution */
  37145. order: 400,
  37146. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37147. enabled: true,
  37148. /** @prop {ModifierFn} */
  37149. fn: keepTogether
  37150. },
  37151. /**
  37152. * This modifier is used to move the `arrowElement` of the popper to make
  37153. * sure it is positioned between the reference element and its popper element.
  37154. * It will read the outer size of the `arrowElement` node to detect how many
  37155. * pixels of conjunction are needed.
  37156. *
  37157. * It has no effect if no `arrowElement` is provided.
  37158. * @memberof modifiers
  37159. * @inner
  37160. */
  37161. arrow: {
  37162. /** @prop {number} order=500 - Index used to define the order of execution */
  37163. order: 500,
  37164. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37165. enabled: true,
  37166. /** @prop {ModifierFn} */
  37167. fn: arrow,
  37168. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  37169. element: '[x-arrow]'
  37170. },
  37171. /**
  37172. * Modifier used to flip the popper's placement when it starts to overlap its
  37173. * reference element.
  37174. *
  37175. * Requires the `preventOverflow` modifier before it in order to work.
  37176. *
  37177. * **NOTE:** this modifier will interrupt the current update cycle and will
  37178. * restart it if it detects the need to flip the placement.
  37179. * @memberof modifiers
  37180. * @inner
  37181. */
  37182. flip: {
  37183. /** @prop {number} order=600 - Index used to define the order of execution */
  37184. order: 600,
  37185. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37186. enabled: true,
  37187. /** @prop {ModifierFn} */
  37188. fn: flip,
  37189. /**
  37190. * @prop {String|Array} behavior='flip'
  37191. * The behavior used to change the popper's placement. It can be one of
  37192. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  37193. * placements (with optional variations)
  37194. */
  37195. behavior: 'flip',
  37196. /**
  37197. * @prop {number} padding=5
  37198. * The popper will flip if it hits the edges of the `boundariesElement`
  37199. */
  37200. padding: 5,
  37201. /**
  37202. * @prop {String|HTMLElement} boundariesElement='viewport'
  37203. * The element which will define the boundaries of the popper position.
  37204. * The popper will never be placed outside of the defined boundaries
  37205. * (except if `keepTogether` is enabled)
  37206. */
  37207. boundariesElement: 'viewport',
  37208. /**
  37209. * @prop {Boolean} flipVariations=false
  37210. * The popper will switch placement variation between `-start` and `-end` when
  37211. * the reference element overlaps its boundaries.
  37212. *
  37213. * The original placement should have a set variation.
  37214. */
  37215. flipVariations: false,
  37216. /**
  37217. * @prop {Boolean} flipVariationsByContent=false
  37218. * The popper will switch placement variation between `-start` and `-end` when
  37219. * the popper element overlaps its reference boundaries.
  37220. *
  37221. * The original placement should have a set variation.
  37222. */
  37223. flipVariationsByContent: false
  37224. },
  37225. /**
  37226. * Modifier used to make the popper flow toward the inner of the reference element.
  37227. * By default, when this modifier is disabled, the popper will be placed outside
  37228. * the reference element.
  37229. * @memberof modifiers
  37230. * @inner
  37231. */
  37232. inner: {
  37233. /** @prop {number} order=700 - Index used to define the order of execution */
  37234. order: 700,
  37235. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  37236. enabled: false,
  37237. /** @prop {ModifierFn} */
  37238. fn: inner
  37239. },
  37240. /**
  37241. * Modifier used to hide the popper when its reference element is outside of the
  37242. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  37243. * be used to hide with a CSS selector the popper when its reference is
  37244. * out of boundaries.
  37245. *
  37246. * Requires the `preventOverflow` modifier before it in order to work.
  37247. * @memberof modifiers
  37248. * @inner
  37249. */
  37250. hide: {
  37251. /** @prop {number} order=800 - Index used to define the order of execution */
  37252. order: 800,
  37253. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37254. enabled: true,
  37255. /** @prop {ModifierFn} */
  37256. fn: hide
  37257. },
  37258. /**
  37259. * Computes the style that will be applied to the popper element to gets
  37260. * properly positioned.
  37261. *
  37262. * Note that this modifier will not touch the DOM, it just prepares the styles
  37263. * so that `applyStyle` modifier can apply it. This separation is useful
  37264. * in case you need to replace `applyStyle` with a custom implementation.
  37265. *
  37266. * This modifier has `850` as `order` value to maintain backward compatibility
  37267. * with previous versions of Popper.js. Expect the modifiers ordering method
  37268. * to change in future major versions of the library.
  37269. *
  37270. * @memberof modifiers
  37271. * @inner
  37272. */
  37273. computeStyle: {
  37274. /** @prop {number} order=850 - Index used to define the order of execution */
  37275. order: 850,
  37276. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37277. enabled: true,
  37278. /** @prop {ModifierFn} */
  37279. fn: computeStyle,
  37280. /**
  37281. * @prop {Boolean} gpuAcceleration=true
  37282. * If true, it uses the CSS 3D transformation to position the popper.
  37283. * Otherwise, it will use the `top` and `left` properties
  37284. */
  37285. gpuAcceleration: true,
  37286. /**
  37287. * @prop {string} [x='bottom']
  37288. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  37289. * Change this if your popper should grow in a direction different from `bottom`
  37290. */
  37291. x: 'bottom',
  37292. /**
  37293. * @prop {string} [x='left']
  37294. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  37295. * Change this if your popper should grow in a direction different from `right`
  37296. */
  37297. y: 'right'
  37298. },
  37299. /**
  37300. * Applies the computed styles to the popper element.
  37301. *
  37302. * All the DOM manipulations are limited to this modifier. This is useful in case
  37303. * you want to integrate Popper.js inside a framework or view library and you
  37304. * want to delegate all the DOM manipulations to it.
  37305. *
  37306. * Note that if you disable this modifier, you must make sure the popper element
  37307. * has its position set to `absolute` before Popper.js can do its work!
  37308. *
  37309. * Just disable this modifier and define your own to achieve the desired effect.
  37310. *
  37311. * @memberof modifiers
  37312. * @inner
  37313. */
  37314. applyStyle: {
  37315. /** @prop {number} order=900 - Index used to define the order of execution */
  37316. order: 900,
  37317. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37318. enabled: true,
  37319. /** @prop {ModifierFn} */
  37320. fn: applyStyle,
  37321. /** @prop {Function} */
  37322. onLoad: applyStyleOnLoad,
  37323. /**
  37324. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  37325. * @prop {Boolean} gpuAcceleration=true
  37326. * If true, it uses the CSS 3D transformation to position the popper.
  37327. * Otherwise, it will use the `top` and `left` properties
  37328. */
  37329. gpuAcceleration: undefined
  37330. }
  37331. };
  37332. /**
  37333. * The `dataObject` is an object containing all the information used by Popper.js.
  37334. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  37335. * @name dataObject
  37336. * @property {Object} data.instance The Popper.js instance
  37337. * @property {String} data.placement Placement applied to popper
  37338. * @property {String} data.originalPlacement Placement originally defined on init
  37339. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  37340. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  37341. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  37342. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  37343. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  37344. * @property {Object} data.boundaries Offsets of the popper boundaries
  37345. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  37346. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  37347. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  37348. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  37349. */
  37350. /**
  37351. * Default options provided to Popper.js constructor.<br />
  37352. * These can be overridden using the `options` argument of Popper.js.<br />
  37353. * To override an option, simply pass an object with the same
  37354. * structure of the `options` object, as the 3rd argument. For example:
  37355. * ```
  37356. * new Popper(ref, pop, {
  37357. * modifiers: {
  37358. * preventOverflow: { enabled: false }
  37359. * }
  37360. * })
  37361. * ```
  37362. * @type {Object}
  37363. * @static
  37364. * @memberof Popper
  37365. */
  37366. var Defaults = {
  37367. /**
  37368. * Popper's placement.
  37369. * @prop {Popper.placements} placement='bottom'
  37370. */
  37371. placement: 'bottom',
  37372. /**
  37373. * Set this to true if you want popper to position it self in 'fixed' mode
  37374. * @prop {Boolean} positionFixed=false
  37375. */
  37376. positionFixed: false,
  37377. /**
  37378. * Whether events (resize, scroll) are initially enabled.
  37379. * @prop {Boolean} eventsEnabled=true
  37380. */
  37381. eventsEnabled: true,
  37382. /**
  37383. * Set to true if you want to automatically remove the popper when
  37384. * you call the `destroy` method.
  37385. * @prop {Boolean} removeOnDestroy=false
  37386. */
  37387. removeOnDestroy: false,
  37388. /**
  37389. * Callback called when the popper is created.<br />
  37390. * By default, it is set to no-op.<br />
  37391. * Access Popper.js instance with `data.instance`.
  37392. * @prop {onCreate}
  37393. */
  37394. onCreate: function onCreate() {},
  37395. /**
  37396. * Callback called when the popper is updated. This callback is not called
  37397. * on the initialization/creation of the popper, but only on subsequent
  37398. * updates.<br />
  37399. * By default, it is set to no-op.<br />
  37400. * Access Popper.js instance with `data.instance`.
  37401. * @prop {onUpdate}
  37402. */
  37403. onUpdate: function onUpdate() {},
  37404. /**
  37405. * List of modifiers used to modify the offsets before they are applied to the popper.
  37406. * They provide most of the functionalities of Popper.js.
  37407. * @prop {modifiers}
  37408. */
  37409. modifiers: modifiers
  37410. };
  37411. /**
  37412. * @callback onCreate
  37413. * @param {dataObject} data
  37414. */
  37415. /**
  37416. * @callback onUpdate
  37417. * @param {dataObject} data
  37418. */
  37419. // Utils
  37420. // Methods
  37421. var Popper = function () {
  37422. /**
  37423. * Creates a new Popper.js instance.
  37424. * @class Popper
  37425. * @param {Element|referenceObject} reference - The reference element used to position the popper
  37426. * @param {Element} popper - The HTML / XML element used as the popper
  37427. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  37428. * @return {Object} instance - The generated Popper.js instance
  37429. */
  37430. function Popper(reference, popper) {
  37431. var _this = this;
  37432. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  37433. classCallCheck(this, Popper);
  37434. this.scheduleUpdate = function () {
  37435. return requestAnimationFrame(_this.update);
  37436. };
  37437. // make update() debounced, so that it only runs at most once-per-tick
  37438. this.update = debounce(this.update.bind(this));
  37439. // with {} we create a new object with the options inside it
  37440. this.options = _extends({}, Popper.Defaults, options);
  37441. // init state
  37442. this.state = {
  37443. isDestroyed: false,
  37444. isCreated: false,
  37445. scrollParents: []
  37446. };
  37447. // get reference and popper elements (allow jQuery wrappers)
  37448. this.reference = reference && reference.jquery ? reference[0] : reference;
  37449. this.popper = popper && popper.jquery ? popper[0] : popper;
  37450. // Deep merge modifiers options
  37451. this.options.modifiers = {};
  37452. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  37453. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  37454. });
  37455. // Refactoring modifiers' list (Object => Array)
  37456. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  37457. return _extends({
  37458. name: name
  37459. }, _this.options.modifiers[name]);
  37460. })
  37461. // sort the modifiers by order
  37462. .sort(function (a, b) {
  37463. return a.order - b.order;
  37464. });
  37465. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  37466. // such code is executed in the same order of its modifier
  37467. // they could add new properties to their options configuration
  37468. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  37469. this.modifiers.forEach(function (modifierOptions) {
  37470. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  37471. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  37472. }
  37473. });
  37474. // fire the first update to position the popper in the right place
  37475. this.update();
  37476. var eventsEnabled = this.options.eventsEnabled;
  37477. if (eventsEnabled) {
  37478. // setup event listeners, they will take care of update the position in specific situations
  37479. this.enableEventListeners();
  37480. }
  37481. this.state.eventsEnabled = eventsEnabled;
  37482. }
  37483. // We can't use class properties because they don't get listed in the
  37484. // class prototype and break stuff like Sinon stubs
  37485. createClass(Popper, [{
  37486. key: 'update',
  37487. value: function update$$1() {
  37488. return update.call(this);
  37489. }
  37490. }, {
  37491. key: 'destroy',
  37492. value: function destroy$$1() {
  37493. return destroy.call(this);
  37494. }
  37495. }, {
  37496. key: 'enableEventListeners',
  37497. value: function enableEventListeners$$1() {
  37498. return enableEventListeners.call(this);
  37499. }
  37500. }, {
  37501. key: 'disableEventListeners',
  37502. value: function disableEventListeners$$1() {
  37503. return disableEventListeners.call(this);
  37504. }
  37505. /**
  37506. * Schedules an update. It will run on the next UI update available.
  37507. * @method scheduleUpdate
  37508. * @memberof Popper
  37509. */
  37510. /**
  37511. * Collection of utilities useful when writing custom modifiers.
  37512. * Starting from version 1.7, this method is available only if you
  37513. * include `popper-utils.js` before `popper.js`.
  37514. *
  37515. * **DEPRECATION**: This way to access PopperUtils is deprecated
  37516. * and will be removed in v2! Use the PopperUtils module directly instead.
  37517. * Due to the high instability of the methods contained in Utils, we can't
  37518. * guarantee them to follow semver. Use them at your own risk!
  37519. * @static
  37520. * @private
  37521. * @type {Object}
  37522. * @deprecated since version 1.8
  37523. * @member Utils
  37524. * @memberof Popper
  37525. */
  37526. }]);
  37527. return Popper;
  37528. }();
  37529. /**
  37530. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  37531. * and lets you use it as replacement of a real DOM node.<br />
  37532. * You can use this method to position a popper relatively to a set of coordinates
  37533. * in case you don't have a DOM node to use as reference.
  37534. *
  37535. * ```
  37536. * new Popper(referenceObject, popperNode);
  37537. * ```
  37538. *
  37539. * NB: This feature isn't supported in Internet Explorer 10.
  37540. * @name referenceObject
  37541. * @property {Function} data.getBoundingClientRect
  37542. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  37543. * @property {number} data.clientWidth
  37544. * An ES6 getter that will return the width of the virtual reference element.
  37545. * @property {number} data.clientHeight
  37546. * An ES6 getter that will return the height of the virtual reference element.
  37547. */
  37548. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  37549. Popper.placements = placements;
  37550. Popper.Defaults = Defaults;
  37551. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  37552. //# sourceMappingURL=popper.js.map
  37553. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  37554. /***/ }),
  37555. /***/ "./node_modules/process/browser.js":
  37556. /*!*****************************************!*\
  37557. !*** ./node_modules/process/browser.js ***!
  37558. \*****************************************/
  37559. /*! no static exports found */
  37560. /***/ (function(module, exports) {
  37561. // shim for using process in browser
  37562. var process = module.exports = {};
  37563. // cached from whatever global is present so that test runners that stub it
  37564. // don't break things. But we need to wrap it in a try catch in case it is
  37565. // wrapped in strict mode code which doesn't define any globals. It's inside a
  37566. // function because try/catches deoptimize in certain engines.
  37567. var cachedSetTimeout;
  37568. var cachedClearTimeout;
  37569. function defaultSetTimout() {
  37570. throw new Error('setTimeout has not been defined');
  37571. }
  37572. function defaultClearTimeout () {
  37573. throw new Error('clearTimeout has not been defined');
  37574. }
  37575. (function () {
  37576. try {
  37577. if (typeof setTimeout === 'function') {
  37578. cachedSetTimeout = setTimeout;
  37579. } else {
  37580. cachedSetTimeout = defaultSetTimout;
  37581. }
  37582. } catch (e) {
  37583. cachedSetTimeout = defaultSetTimout;
  37584. }
  37585. try {
  37586. if (typeof clearTimeout === 'function') {
  37587. cachedClearTimeout = clearTimeout;
  37588. } else {
  37589. cachedClearTimeout = defaultClearTimeout;
  37590. }
  37591. } catch (e) {
  37592. cachedClearTimeout = defaultClearTimeout;
  37593. }
  37594. } ())
  37595. function runTimeout(fun) {
  37596. if (cachedSetTimeout === setTimeout) {
  37597. //normal enviroments in sane situations
  37598. return setTimeout(fun, 0);
  37599. }
  37600. // if setTimeout wasn't available but was latter defined
  37601. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  37602. cachedSetTimeout = setTimeout;
  37603. return setTimeout(fun, 0);
  37604. }
  37605. try {
  37606. // when when somebody has screwed with setTimeout but no I.E. maddness
  37607. return cachedSetTimeout(fun, 0);
  37608. } catch(e){
  37609. try {
  37610. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  37611. return cachedSetTimeout.call(null, fun, 0);
  37612. } catch(e){
  37613. // 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
  37614. return cachedSetTimeout.call(this, fun, 0);
  37615. }
  37616. }
  37617. }
  37618. function runClearTimeout(marker) {
  37619. if (cachedClearTimeout === clearTimeout) {
  37620. //normal enviroments in sane situations
  37621. return clearTimeout(marker);
  37622. }
  37623. // if clearTimeout wasn't available but was latter defined
  37624. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  37625. cachedClearTimeout = clearTimeout;
  37626. return clearTimeout(marker);
  37627. }
  37628. try {
  37629. // when when somebody has screwed with setTimeout but no I.E. maddness
  37630. return cachedClearTimeout(marker);
  37631. } catch (e){
  37632. try {
  37633. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  37634. return cachedClearTimeout.call(null, marker);
  37635. } catch (e){
  37636. // 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.
  37637. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  37638. return cachedClearTimeout.call(this, marker);
  37639. }
  37640. }
  37641. }
  37642. var queue = [];
  37643. var draining = false;
  37644. var currentQueue;
  37645. var queueIndex = -1;
  37646. function cleanUpNextTick() {
  37647. if (!draining || !currentQueue) {
  37648. return;
  37649. }
  37650. draining = false;
  37651. if (currentQueue.length) {
  37652. queue = currentQueue.concat(queue);
  37653. } else {
  37654. queueIndex = -1;
  37655. }
  37656. if (queue.length) {
  37657. drainQueue();
  37658. }
  37659. }
  37660. function drainQueue() {
  37661. if (draining) {
  37662. return;
  37663. }
  37664. var timeout = runTimeout(cleanUpNextTick);
  37665. draining = true;
  37666. var len = queue.length;
  37667. while(len) {
  37668. currentQueue = queue;
  37669. queue = [];
  37670. while (++queueIndex < len) {
  37671. if (currentQueue) {
  37672. currentQueue[queueIndex].run();
  37673. }
  37674. }
  37675. queueIndex = -1;
  37676. len = queue.length;
  37677. }
  37678. currentQueue = null;
  37679. draining = false;
  37680. runClearTimeout(timeout);
  37681. }
  37682. process.nextTick = function (fun) {
  37683. var args = new Array(arguments.length - 1);
  37684. if (arguments.length > 1) {
  37685. for (var i = 1; i < arguments.length; i++) {
  37686. args[i - 1] = arguments[i];
  37687. }
  37688. }
  37689. queue.push(new Item(fun, args));
  37690. if (queue.length === 1 && !draining) {
  37691. runTimeout(drainQueue);
  37692. }
  37693. };
  37694. // v8 likes predictible objects
  37695. function Item(fun, array) {
  37696. this.fun = fun;
  37697. this.array = array;
  37698. }
  37699. Item.prototype.run = function () {
  37700. this.fun.apply(null, this.array);
  37701. };
  37702. process.title = 'browser';
  37703. process.browser = true;
  37704. process.env = {};
  37705. process.argv = [];
  37706. process.version = ''; // empty string to avoid regexp issues
  37707. process.versions = {};
  37708. function noop() {}
  37709. process.on = noop;
  37710. process.addListener = noop;
  37711. process.once = noop;
  37712. process.off = noop;
  37713. process.removeListener = noop;
  37714. process.removeAllListeners = noop;
  37715. process.emit = noop;
  37716. process.prependListener = noop;
  37717. process.prependOnceListener = noop;
  37718. process.listeners = function (name) { return [] }
  37719. process.binding = function (name) {
  37720. throw new Error('process.binding is not supported');
  37721. };
  37722. process.cwd = function () { return '/' };
  37723. process.chdir = function (dir) {
  37724. throw new Error('process.chdir is not supported');
  37725. };
  37726. process.umask = function() { return 0; };
  37727. /***/ }),
  37728. /***/ "./node_modules/pusher-js/dist/web/pusher.js":
  37729. /*!***************************************************!*\
  37730. !*** ./node_modules/pusher-js/dist/web/pusher.js ***!
  37731. \***************************************************/
  37732. /*! no static exports found */
  37733. /***/ (function(module, exports, __webpack_require__) {
  37734. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  37735. * Pusher JavaScript Library v5.0.3
  37736. * https://pusher.com/
  37737. *
  37738. * Copyright 2017, Pusher
  37739. * Released under the MIT licence.
  37740. */
  37741. (function webpackUniversalModuleDefinition(root, factory) {
  37742. if(true)
  37743. module.exports = factory();
  37744. else {}
  37745. })(window, function() {
  37746. return /******/ (function(modules) { // webpackBootstrap
  37747. /******/ // The module cache
  37748. /******/ var installedModules = {};
  37749. /******/
  37750. /******/ // The require function
  37751. /******/ function __webpack_require__(moduleId) {
  37752. /******/
  37753. /******/ // Check if module is in cache
  37754. /******/ if(installedModules[moduleId]) {
  37755. /******/ return installedModules[moduleId].exports;
  37756. /******/ }
  37757. /******/ // Create a new module (and put it into the cache)
  37758. /******/ var module = installedModules[moduleId] = {
  37759. /******/ i: moduleId,
  37760. /******/ l: false,
  37761. /******/ exports: {}
  37762. /******/ };
  37763. /******/
  37764. /******/ // Execute the module function
  37765. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  37766. /******/
  37767. /******/ // Flag the module as loaded
  37768. /******/ module.l = true;
  37769. /******/
  37770. /******/ // Return the exports of the module
  37771. /******/ return module.exports;
  37772. /******/ }
  37773. /******/
  37774. /******/
  37775. /******/ // expose the modules object (__webpack_modules__)
  37776. /******/ __webpack_require__.m = modules;
  37777. /******/
  37778. /******/ // expose the module cache
  37779. /******/ __webpack_require__.c = installedModules;
  37780. /******/
  37781. /******/ // define getter function for harmony exports
  37782. /******/ __webpack_require__.d = function(exports, name, getter) {
  37783. /******/ if(!__webpack_require__.o(exports, name)) {
  37784. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  37785. /******/ }
  37786. /******/ };
  37787. /******/
  37788. /******/ // define __esModule on exports
  37789. /******/ __webpack_require__.r = function(exports) {
  37790. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  37791. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  37792. /******/ }
  37793. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  37794. /******/ };
  37795. /******/
  37796. /******/ // create a fake namespace object
  37797. /******/ // mode & 1: value is a module id, require it
  37798. /******/ // mode & 2: merge all properties of value into the ns
  37799. /******/ // mode & 4: return value when already ns object
  37800. /******/ // mode & 8|1: behave like require
  37801. /******/ __webpack_require__.t = function(value, mode) {
  37802. /******/ if(mode & 1) value = __webpack_require__(value);
  37803. /******/ if(mode & 8) return value;
  37804. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  37805. /******/ var ns = Object.create(null);
  37806. /******/ __webpack_require__.r(ns);
  37807. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  37808. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  37809. /******/ return ns;
  37810. /******/ };
  37811. /******/
  37812. /******/ // getDefaultExport function for compatibility with non-harmony modules
  37813. /******/ __webpack_require__.n = function(module) {
  37814. /******/ var getter = module && module.__esModule ?
  37815. /******/ function getDefault() { return module['default']; } :
  37816. /******/ function getModuleExports() { return module; };
  37817. /******/ __webpack_require__.d(getter, 'a', getter);
  37818. /******/ return getter;
  37819. /******/ };
  37820. /******/
  37821. /******/ // Object.prototype.hasOwnProperty.call
  37822. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  37823. /******/
  37824. /******/ // __webpack_public_path__
  37825. /******/ __webpack_require__.p = "";
  37826. /******/
  37827. /******/
  37828. /******/ // Load entry module and return exports
  37829. /******/ return __webpack_require__(__webpack_require__.s = 2);
  37830. /******/ })
  37831. /************************************************************************/
  37832. /******/ ([
  37833. /* 0 */
  37834. /***/ (function(module, exports, __webpack_require__) {
  37835. (function(nacl) {
  37836. 'use strict';
  37837. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
  37838. // Public domain.
  37839. //
  37840. // Implementation derived from TweetNaCl version 20140427.
  37841. // See for details: http://tweetnacl.cr.yp.to/
  37842. var gf = function(init) {
  37843. var i, r = new Float64Array(16);
  37844. if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
  37845. return r;
  37846. };
  37847. // Pluggable, initialized in high-level API below.
  37848. var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
  37849. var _0 = new Uint8Array(16);
  37850. var _9 = new Uint8Array(32); _9[0] = 9;
  37851. var gf0 = gf(),
  37852. gf1 = gf([1]),
  37853. _121665 = gf([0xdb41, 1]),
  37854. D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
  37855. D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
  37856. X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
  37857. Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
  37858. I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
  37859. function ts64(x, i, h, l) {
  37860. x[i] = (h >> 24) & 0xff;
  37861. x[i+1] = (h >> 16) & 0xff;
  37862. x[i+2] = (h >> 8) & 0xff;
  37863. x[i+3] = h & 0xff;
  37864. x[i+4] = (l >> 24) & 0xff;
  37865. x[i+5] = (l >> 16) & 0xff;
  37866. x[i+6] = (l >> 8) & 0xff;
  37867. x[i+7] = l & 0xff;
  37868. }
  37869. function vn(x, xi, y, yi, n) {
  37870. var i,d = 0;
  37871. for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
  37872. return (1 & ((d - 1) >>> 8)) - 1;
  37873. }
  37874. function crypto_verify_16(x, xi, y, yi) {
  37875. return vn(x,xi,y,yi,16);
  37876. }
  37877. function crypto_verify_32(x, xi, y, yi) {
  37878. return vn(x,xi,y,yi,32);
  37879. }
  37880. function core_salsa20(o, p, k, c) {
  37881. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37882. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37883. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37884. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37885. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37886. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37887. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37888. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37889. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37890. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37891. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37892. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37893. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37894. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37895. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37896. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37897. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37898. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37899. x15 = j15, u;
  37900. for (var i = 0; i < 20; i += 2) {
  37901. u = x0 + x12 | 0;
  37902. x4 ^= u<<7 | u>>>(32-7);
  37903. u = x4 + x0 | 0;
  37904. x8 ^= u<<9 | u>>>(32-9);
  37905. u = x8 + x4 | 0;
  37906. x12 ^= u<<13 | u>>>(32-13);
  37907. u = x12 + x8 | 0;
  37908. x0 ^= u<<18 | u>>>(32-18);
  37909. u = x5 + x1 | 0;
  37910. x9 ^= u<<7 | u>>>(32-7);
  37911. u = x9 + x5 | 0;
  37912. x13 ^= u<<9 | u>>>(32-9);
  37913. u = x13 + x9 | 0;
  37914. x1 ^= u<<13 | u>>>(32-13);
  37915. u = x1 + x13 | 0;
  37916. x5 ^= u<<18 | u>>>(32-18);
  37917. u = x10 + x6 | 0;
  37918. x14 ^= u<<7 | u>>>(32-7);
  37919. u = x14 + x10 | 0;
  37920. x2 ^= u<<9 | u>>>(32-9);
  37921. u = x2 + x14 | 0;
  37922. x6 ^= u<<13 | u>>>(32-13);
  37923. u = x6 + x2 | 0;
  37924. x10 ^= u<<18 | u>>>(32-18);
  37925. u = x15 + x11 | 0;
  37926. x3 ^= u<<7 | u>>>(32-7);
  37927. u = x3 + x15 | 0;
  37928. x7 ^= u<<9 | u>>>(32-9);
  37929. u = x7 + x3 | 0;
  37930. x11 ^= u<<13 | u>>>(32-13);
  37931. u = x11 + x7 | 0;
  37932. x15 ^= u<<18 | u>>>(32-18);
  37933. u = x0 + x3 | 0;
  37934. x1 ^= u<<7 | u>>>(32-7);
  37935. u = x1 + x0 | 0;
  37936. x2 ^= u<<9 | u>>>(32-9);
  37937. u = x2 + x1 | 0;
  37938. x3 ^= u<<13 | u>>>(32-13);
  37939. u = x3 + x2 | 0;
  37940. x0 ^= u<<18 | u>>>(32-18);
  37941. u = x5 + x4 | 0;
  37942. x6 ^= u<<7 | u>>>(32-7);
  37943. u = x6 + x5 | 0;
  37944. x7 ^= u<<9 | u>>>(32-9);
  37945. u = x7 + x6 | 0;
  37946. x4 ^= u<<13 | u>>>(32-13);
  37947. u = x4 + x7 | 0;
  37948. x5 ^= u<<18 | u>>>(32-18);
  37949. u = x10 + x9 | 0;
  37950. x11 ^= u<<7 | u>>>(32-7);
  37951. u = x11 + x10 | 0;
  37952. x8 ^= u<<9 | u>>>(32-9);
  37953. u = x8 + x11 | 0;
  37954. x9 ^= u<<13 | u>>>(32-13);
  37955. u = x9 + x8 | 0;
  37956. x10 ^= u<<18 | u>>>(32-18);
  37957. u = x15 + x14 | 0;
  37958. x12 ^= u<<7 | u>>>(32-7);
  37959. u = x12 + x15 | 0;
  37960. x13 ^= u<<9 | u>>>(32-9);
  37961. u = x13 + x12 | 0;
  37962. x14 ^= u<<13 | u>>>(32-13);
  37963. u = x14 + x13 | 0;
  37964. x15 ^= u<<18 | u>>>(32-18);
  37965. }
  37966. x0 = x0 + j0 | 0;
  37967. x1 = x1 + j1 | 0;
  37968. x2 = x2 + j2 | 0;
  37969. x3 = x3 + j3 | 0;
  37970. x4 = x4 + j4 | 0;
  37971. x5 = x5 + j5 | 0;
  37972. x6 = x6 + j6 | 0;
  37973. x7 = x7 + j7 | 0;
  37974. x8 = x8 + j8 | 0;
  37975. x9 = x9 + j9 | 0;
  37976. x10 = x10 + j10 | 0;
  37977. x11 = x11 + j11 | 0;
  37978. x12 = x12 + j12 | 0;
  37979. x13 = x13 + j13 | 0;
  37980. x14 = x14 + j14 | 0;
  37981. x15 = x15 + j15 | 0;
  37982. o[ 0] = x0 >>> 0 & 0xff;
  37983. o[ 1] = x0 >>> 8 & 0xff;
  37984. o[ 2] = x0 >>> 16 & 0xff;
  37985. o[ 3] = x0 >>> 24 & 0xff;
  37986. o[ 4] = x1 >>> 0 & 0xff;
  37987. o[ 5] = x1 >>> 8 & 0xff;
  37988. o[ 6] = x1 >>> 16 & 0xff;
  37989. o[ 7] = x1 >>> 24 & 0xff;
  37990. o[ 8] = x2 >>> 0 & 0xff;
  37991. o[ 9] = x2 >>> 8 & 0xff;
  37992. o[10] = x2 >>> 16 & 0xff;
  37993. o[11] = x2 >>> 24 & 0xff;
  37994. o[12] = x3 >>> 0 & 0xff;
  37995. o[13] = x3 >>> 8 & 0xff;
  37996. o[14] = x3 >>> 16 & 0xff;
  37997. o[15] = x3 >>> 24 & 0xff;
  37998. o[16] = x4 >>> 0 & 0xff;
  37999. o[17] = x4 >>> 8 & 0xff;
  38000. o[18] = x4 >>> 16 & 0xff;
  38001. o[19] = x4 >>> 24 & 0xff;
  38002. o[20] = x5 >>> 0 & 0xff;
  38003. o[21] = x5 >>> 8 & 0xff;
  38004. o[22] = x5 >>> 16 & 0xff;
  38005. o[23] = x5 >>> 24 & 0xff;
  38006. o[24] = x6 >>> 0 & 0xff;
  38007. o[25] = x6 >>> 8 & 0xff;
  38008. o[26] = x6 >>> 16 & 0xff;
  38009. o[27] = x6 >>> 24 & 0xff;
  38010. o[28] = x7 >>> 0 & 0xff;
  38011. o[29] = x7 >>> 8 & 0xff;
  38012. o[30] = x7 >>> 16 & 0xff;
  38013. o[31] = x7 >>> 24 & 0xff;
  38014. o[32] = x8 >>> 0 & 0xff;
  38015. o[33] = x8 >>> 8 & 0xff;
  38016. o[34] = x8 >>> 16 & 0xff;
  38017. o[35] = x8 >>> 24 & 0xff;
  38018. o[36] = x9 >>> 0 & 0xff;
  38019. o[37] = x9 >>> 8 & 0xff;
  38020. o[38] = x9 >>> 16 & 0xff;
  38021. o[39] = x9 >>> 24 & 0xff;
  38022. o[40] = x10 >>> 0 & 0xff;
  38023. o[41] = x10 >>> 8 & 0xff;
  38024. o[42] = x10 >>> 16 & 0xff;
  38025. o[43] = x10 >>> 24 & 0xff;
  38026. o[44] = x11 >>> 0 & 0xff;
  38027. o[45] = x11 >>> 8 & 0xff;
  38028. o[46] = x11 >>> 16 & 0xff;
  38029. o[47] = x11 >>> 24 & 0xff;
  38030. o[48] = x12 >>> 0 & 0xff;
  38031. o[49] = x12 >>> 8 & 0xff;
  38032. o[50] = x12 >>> 16 & 0xff;
  38033. o[51] = x12 >>> 24 & 0xff;
  38034. o[52] = x13 >>> 0 & 0xff;
  38035. o[53] = x13 >>> 8 & 0xff;
  38036. o[54] = x13 >>> 16 & 0xff;
  38037. o[55] = x13 >>> 24 & 0xff;
  38038. o[56] = x14 >>> 0 & 0xff;
  38039. o[57] = x14 >>> 8 & 0xff;
  38040. o[58] = x14 >>> 16 & 0xff;
  38041. o[59] = x14 >>> 24 & 0xff;
  38042. o[60] = x15 >>> 0 & 0xff;
  38043. o[61] = x15 >>> 8 & 0xff;
  38044. o[62] = x15 >>> 16 & 0xff;
  38045. o[63] = x15 >>> 24 & 0xff;
  38046. }
  38047. function core_hsalsa20(o,p,k,c) {
  38048. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  38049. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  38050. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  38051. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  38052. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  38053. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  38054. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  38055. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  38056. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  38057. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  38058. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  38059. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  38060. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  38061. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  38062. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  38063. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  38064. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  38065. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  38066. x15 = j15, u;
  38067. for (var i = 0; i < 20; i += 2) {
  38068. u = x0 + x12 | 0;
  38069. x4 ^= u<<7 | u>>>(32-7);
  38070. u = x4 + x0 | 0;
  38071. x8 ^= u<<9 | u>>>(32-9);
  38072. u = x8 + x4 | 0;
  38073. x12 ^= u<<13 | u>>>(32-13);
  38074. u = x12 + x8 | 0;
  38075. x0 ^= u<<18 | u>>>(32-18);
  38076. u = x5 + x1 | 0;
  38077. x9 ^= u<<7 | u>>>(32-7);
  38078. u = x9 + x5 | 0;
  38079. x13 ^= u<<9 | u>>>(32-9);
  38080. u = x13 + x9 | 0;
  38081. x1 ^= u<<13 | u>>>(32-13);
  38082. u = x1 + x13 | 0;
  38083. x5 ^= u<<18 | u>>>(32-18);
  38084. u = x10 + x6 | 0;
  38085. x14 ^= u<<7 | u>>>(32-7);
  38086. u = x14 + x10 | 0;
  38087. x2 ^= u<<9 | u>>>(32-9);
  38088. u = x2 + x14 | 0;
  38089. x6 ^= u<<13 | u>>>(32-13);
  38090. u = x6 + x2 | 0;
  38091. x10 ^= u<<18 | u>>>(32-18);
  38092. u = x15 + x11 | 0;
  38093. x3 ^= u<<7 | u>>>(32-7);
  38094. u = x3 + x15 | 0;
  38095. x7 ^= u<<9 | u>>>(32-9);
  38096. u = x7 + x3 | 0;
  38097. x11 ^= u<<13 | u>>>(32-13);
  38098. u = x11 + x7 | 0;
  38099. x15 ^= u<<18 | u>>>(32-18);
  38100. u = x0 + x3 | 0;
  38101. x1 ^= u<<7 | u>>>(32-7);
  38102. u = x1 + x0 | 0;
  38103. x2 ^= u<<9 | u>>>(32-9);
  38104. u = x2 + x1 | 0;
  38105. x3 ^= u<<13 | u>>>(32-13);
  38106. u = x3 + x2 | 0;
  38107. x0 ^= u<<18 | u>>>(32-18);
  38108. u = x5 + x4 | 0;
  38109. x6 ^= u<<7 | u>>>(32-7);
  38110. u = x6 + x5 | 0;
  38111. x7 ^= u<<9 | u>>>(32-9);
  38112. u = x7 + x6 | 0;
  38113. x4 ^= u<<13 | u>>>(32-13);
  38114. u = x4 + x7 | 0;
  38115. x5 ^= u<<18 | u>>>(32-18);
  38116. u = x10 + x9 | 0;
  38117. x11 ^= u<<7 | u>>>(32-7);
  38118. u = x11 + x10 | 0;
  38119. x8 ^= u<<9 | u>>>(32-9);
  38120. u = x8 + x11 | 0;
  38121. x9 ^= u<<13 | u>>>(32-13);
  38122. u = x9 + x8 | 0;
  38123. x10 ^= u<<18 | u>>>(32-18);
  38124. u = x15 + x14 | 0;
  38125. x12 ^= u<<7 | u>>>(32-7);
  38126. u = x12 + x15 | 0;
  38127. x13 ^= u<<9 | u>>>(32-9);
  38128. u = x13 + x12 | 0;
  38129. x14 ^= u<<13 | u>>>(32-13);
  38130. u = x14 + x13 | 0;
  38131. x15 ^= u<<18 | u>>>(32-18);
  38132. }
  38133. o[ 0] = x0 >>> 0 & 0xff;
  38134. o[ 1] = x0 >>> 8 & 0xff;
  38135. o[ 2] = x0 >>> 16 & 0xff;
  38136. o[ 3] = x0 >>> 24 & 0xff;
  38137. o[ 4] = x5 >>> 0 & 0xff;
  38138. o[ 5] = x5 >>> 8 & 0xff;
  38139. o[ 6] = x5 >>> 16 & 0xff;
  38140. o[ 7] = x5 >>> 24 & 0xff;
  38141. o[ 8] = x10 >>> 0 & 0xff;
  38142. o[ 9] = x10 >>> 8 & 0xff;
  38143. o[10] = x10 >>> 16 & 0xff;
  38144. o[11] = x10 >>> 24 & 0xff;
  38145. o[12] = x15 >>> 0 & 0xff;
  38146. o[13] = x15 >>> 8 & 0xff;
  38147. o[14] = x15 >>> 16 & 0xff;
  38148. o[15] = x15 >>> 24 & 0xff;
  38149. o[16] = x6 >>> 0 & 0xff;
  38150. o[17] = x6 >>> 8 & 0xff;
  38151. o[18] = x6 >>> 16 & 0xff;
  38152. o[19] = x6 >>> 24 & 0xff;
  38153. o[20] = x7 >>> 0 & 0xff;
  38154. o[21] = x7 >>> 8 & 0xff;
  38155. o[22] = x7 >>> 16 & 0xff;
  38156. o[23] = x7 >>> 24 & 0xff;
  38157. o[24] = x8 >>> 0 & 0xff;
  38158. o[25] = x8 >>> 8 & 0xff;
  38159. o[26] = x8 >>> 16 & 0xff;
  38160. o[27] = x8 >>> 24 & 0xff;
  38161. o[28] = x9 >>> 0 & 0xff;
  38162. o[29] = x9 >>> 8 & 0xff;
  38163. o[30] = x9 >>> 16 & 0xff;
  38164. o[31] = x9 >>> 24 & 0xff;
  38165. }
  38166. function crypto_core_salsa20(out,inp,k,c) {
  38167. core_salsa20(out,inp,k,c);
  38168. }
  38169. function crypto_core_hsalsa20(out,inp,k,c) {
  38170. core_hsalsa20(out,inp,k,c);
  38171. }
  38172. var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
  38173. // "expand 32-byte k"
  38174. function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  38175. var z = new Uint8Array(16), x = new Uint8Array(64);
  38176. var u, i;
  38177. for (i = 0; i < 16; i++) z[i] = 0;
  38178. for (i = 0; i < 8; i++) z[i] = n[i];
  38179. while (b >= 64) {
  38180. crypto_core_salsa20(x,z,k,sigma);
  38181. for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  38182. u = 1;
  38183. for (i = 8; i < 16; i++) {
  38184. u = u + (z[i] & 0xff) | 0;
  38185. z[i] = u & 0xff;
  38186. u >>>= 8;
  38187. }
  38188. b -= 64;
  38189. cpos += 64;
  38190. mpos += 64;
  38191. }
  38192. if (b > 0) {
  38193. crypto_core_salsa20(x,z,k,sigma);
  38194. for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  38195. }
  38196. return 0;
  38197. }
  38198. function crypto_stream_salsa20(c,cpos,b,n,k) {
  38199. var z = new Uint8Array(16), x = new Uint8Array(64);
  38200. var u, i;
  38201. for (i = 0; i < 16; i++) z[i] = 0;
  38202. for (i = 0; i < 8; i++) z[i] = n[i];
  38203. while (b >= 64) {
  38204. crypto_core_salsa20(x,z,k,sigma);
  38205. for (i = 0; i < 64; i++) c[cpos+i] = x[i];
  38206. u = 1;
  38207. for (i = 8; i < 16; i++) {
  38208. u = u + (z[i] & 0xff) | 0;
  38209. z[i] = u & 0xff;
  38210. u >>>= 8;
  38211. }
  38212. b -= 64;
  38213. cpos += 64;
  38214. }
  38215. if (b > 0) {
  38216. crypto_core_salsa20(x,z,k,sigma);
  38217. for (i = 0; i < b; i++) c[cpos+i] = x[i];
  38218. }
  38219. return 0;
  38220. }
  38221. function crypto_stream(c,cpos,d,n,k) {
  38222. var s = new Uint8Array(32);
  38223. crypto_core_hsalsa20(s,n,k,sigma);
  38224. var sn = new Uint8Array(8);
  38225. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  38226. return crypto_stream_salsa20(c,cpos,d,sn,s);
  38227. }
  38228. function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
  38229. var s = new Uint8Array(32);
  38230. crypto_core_hsalsa20(s,n,k,sigma);
  38231. var sn = new Uint8Array(8);
  38232. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  38233. return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
  38234. }
  38235. /*
  38236. * Port of Andrew Moon's Poly1305-donna-16. Public domain.
  38237. * https://github.com/floodyberry/poly1305-donna
  38238. */
  38239. var poly1305 = function(key) {
  38240. this.buffer = new Uint8Array(16);
  38241. this.r = new Uint16Array(10);
  38242. this.h = new Uint16Array(10);
  38243. this.pad = new Uint16Array(8);
  38244. this.leftover = 0;
  38245. this.fin = 0;
  38246. var t0, t1, t2, t3, t4, t5, t6, t7;
  38247. t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
  38248. t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  38249. t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
  38250. t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  38251. t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
  38252. this.r[5] = ((t4 >>> 1)) & 0x1ffe;
  38253. t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  38254. t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
  38255. t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  38256. this.r[9] = ((t7 >>> 5)) & 0x007f;
  38257. this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  38258. this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  38259. this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  38260. this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  38261. this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  38262. this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  38263. this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  38264. this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
  38265. };
  38266. poly1305.prototype.blocks = function(m, mpos, bytes) {
  38267. var hibit = this.fin ? 0 : (1 << 11);
  38268. var t0, t1, t2, t3, t4, t5, t6, t7, c;
  38269. var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
  38270. var h0 = this.h[0],
  38271. h1 = this.h[1],
  38272. h2 = this.h[2],
  38273. h3 = this.h[3],
  38274. h4 = this.h[4],
  38275. h5 = this.h[5],
  38276. h6 = this.h[6],
  38277. h7 = this.h[7],
  38278. h8 = this.h[8],
  38279. h9 = this.h[9];
  38280. var r0 = this.r[0],
  38281. r1 = this.r[1],
  38282. r2 = this.r[2],
  38283. r3 = this.r[3],
  38284. r4 = this.r[4],
  38285. r5 = this.r[5],
  38286. r6 = this.r[6],
  38287. r7 = this.r[7],
  38288. r8 = this.r[8],
  38289. r9 = this.r[9];
  38290. while (bytes >= 16) {
  38291. t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
  38292. t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  38293. t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
  38294. t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  38295. t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
  38296. h5 += ((t4 >>> 1)) & 0x1fff;
  38297. t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  38298. t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
  38299. t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  38300. h9 += ((t7 >>> 5)) | hibit;
  38301. c = 0;
  38302. d0 = c;
  38303. d0 += h0 * r0;
  38304. d0 += h1 * (5 * r9);
  38305. d0 += h2 * (5 * r8);
  38306. d0 += h3 * (5 * r7);
  38307. d0 += h4 * (5 * r6);
  38308. c = (d0 >>> 13); d0 &= 0x1fff;
  38309. d0 += h5 * (5 * r5);
  38310. d0 += h6 * (5 * r4);
  38311. d0 += h7 * (5 * r3);
  38312. d0 += h8 * (5 * r2);
  38313. d0 += h9 * (5 * r1);
  38314. c += (d0 >>> 13); d0 &= 0x1fff;
  38315. d1 = c;
  38316. d1 += h0 * r1;
  38317. d1 += h1 * r0;
  38318. d1 += h2 * (5 * r9);
  38319. d1 += h3 * (5 * r8);
  38320. d1 += h4 * (5 * r7);
  38321. c = (d1 >>> 13); d1 &= 0x1fff;
  38322. d1 += h5 * (5 * r6);
  38323. d1 += h6 * (5 * r5);
  38324. d1 += h7 * (5 * r4);
  38325. d1 += h8 * (5 * r3);
  38326. d1 += h9 * (5 * r2);
  38327. c += (d1 >>> 13); d1 &= 0x1fff;
  38328. d2 = c;
  38329. d2 += h0 * r2;
  38330. d2 += h1 * r1;
  38331. d2 += h2 * r0;
  38332. d2 += h3 * (5 * r9);
  38333. d2 += h4 * (5 * r8);
  38334. c = (d2 >>> 13); d2 &= 0x1fff;
  38335. d2 += h5 * (5 * r7);
  38336. d2 += h6 * (5 * r6);
  38337. d2 += h7 * (5 * r5);
  38338. d2 += h8 * (5 * r4);
  38339. d2 += h9 * (5 * r3);
  38340. c += (d2 >>> 13); d2 &= 0x1fff;
  38341. d3 = c;
  38342. d3 += h0 * r3;
  38343. d3 += h1 * r2;
  38344. d3 += h2 * r1;
  38345. d3 += h3 * r0;
  38346. d3 += h4 * (5 * r9);
  38347. c = (d3 >>> 13); d3 &= 0x1fff;
  38348. d3 += h5 * (5 * r8);
  38349. d3 += h6 * (5 * r7);
  38350. d3 += h7 * (5 * r6);
  38351. d3 += h8 * (5 * r5);
  38352. d3 += h9 * (5 * r4);
  38353. c += (d3 >>> 13); d3 &= 0x1fff;
  38354. d4 = c;
  38355. d4 += h0 * r4;
  38356. d4 += h1 * r3;
  38357. d4 += h2 * r2;
  38358. d4 += h3 * r1;
  38359. d4 += h4 * r0;
  38360. c = (d4 >>> 13); d4 &= 0x1fff;
  38361. d4 += h5 * (5 * r9);
  38362. d4 += h6 * (5 * r8);
  38363. d4 += h7 * (5 * r7);
  38364. d4 += h8 * (5 * r6);
  38365. d4 += h9 * (5 * r5);
  38366. c += (d4 >>> 13); d4 &= 0x1fff;
  38367. d5 = c;
  38368. d5 += h0 * r5;
  38369. d5 += h1 * r4;
  38370. d5 += h2 * r3;
  38371. d5 += h3 * r2;
  38372. d5 += h4 * r1;
  38373. c = (d5 >>> 13); d5 &= 0x1fff;
  38374. d5 += h5 * r0;
  38375. d5 += h6 * (5 * r9);
  38376. d5 += h7 * (5 * r8);
  38377. d5 += h8 * (5 * r7);
  38378. d5 += h9 * (5 * r6);
  38379. c += (d5 >>> 13); d5 &= 0x1fff;
  38380. d6 = c;
  38381. d6 += h0 * r6;
  38382. d6 += h1 * r5;
  38383. d6 += h2 * r4;
  38384. d6 += h3 * r3;
  38385. d6 += h4 * r2;
  38386. c = (d6 >>> 13); d6 &= 0x1fff;
  38387. d6 += h5 * r1;
  38388. d6 += h6 * r0;
  38389. d6 += h7 * (5 * r9);
  38390. d6 += h8 * (5 * r8);
  38391. d6 += h9 * (5 * r7);
  38392. c += (d6 >>> 13); d6 &= 0x1fff;
  38393. d7 = c;
  38394. d7 += h0 * r7;
  38395. d7 += h1 * r6;
  38396. d7 += h2 * r5;
  38397. d7 += h3 * r4;
  38398. d7 += h4 * r3;
  38399. c = (d7 >>> 13); d7 &= 0x1fff;
  38400. d7 += h5 * r2;
  38401. d7 += h6 * r1;
  38402. d7 += h7 * r0;
  38403. d7 += h8 * (5 * r9);
  38404. d7 += h9 * (5 * r8);
  38405. c += (d7 >>> 13); d7 &= 0x1fff;
  38406. d8 = c;
  38407. d8 += h0 * r8;
  38408. d8 += h1 * r7;
  38409. d8 += h2 * r6;
  38410. d8 += h3 * r5;
  38411. d8 += h4 * r4;
  38412. c = (d8 >>> 13); d8 &= 0x1fff;
  38413. d8 += h5 * r3;
  38414. d8 += h6 * r2;
  38415. d8 += h7 * r1;
  38416. d8 += h8 * r0;
  38417. d8 += h9 * (5 * r9);
  38418. c += (d8 >>> 13); d8 &= 0x1fff;
  38419. d9 = c;
  38420. d9 += h0 * r9;
  38421. d9 += h1 * r8;
  38422. d9 += h2 * r7;
  38423. d9 += h3 * r6;
  38424. d9 += h4 * r5;
  38425. c = (d9 >>> 13); d9 &= 0x1fff;
  38426. d9 += h5 * r4;
  38427. d9 += h6 * r3;
  38428. d9 += h7 * r2;
  38429. d9 += h8 * r1;
  38430. d9 += h9 * r0;
  38431. c += (d9 >>> 13); d9 &= 0x1fff;
  38432. c = (((c << 2) + c)) | 0;
  38433. c = (c + d0) | 0;
  38434. d0 = c & 0x1fff;
  38435. c = (c >>> 13);
  38436. d1 += c;
  38437. h0 = d0;
  38438. h1 = d1;
  38439. h2 = d2;
  38440. h3 = d3;
  38441. h4 = d4;
  38442. h5 = d5;
  38443. h6 = d6;
  38444. h7 = d7;
  38445. h8 = d8;
  38446. h9 = d9;
  38447. mpos += 16;
  38448. bytes -= 16;
  38449. }
  38450. this.h[0] = h0;
  38451. this.h[1] = h1;
  38452. this.h[2] = h2;
  38453. this.h[3] = h3;
  38454. this.h[4] = h4;
  38455. this.h[5] = h5;
  38456. this.h[6] = h6;
  38457. this.h[7] = h7;
  38458. this.h[8] = h8;
  38459. this.h[9] = h9;
  38460. };
  38461. poly1305.prototype.finish = function(mac, macpos) {
  38462. var g = new Uint16Array(10);
  38463. var c, mask, f, i;
  38464. if (this.leftover) {
  38465. i = this.leftover;
  38466. this.buffer[i++] = 1;
  38467. for (; i < 16; i++) this.buffer[i] = 0;
  38468. this.fin = 1;
  38469. this.blocks(this.buffer, 0, 16);
  38470. }
  38471. c = this.h[1] >>> 13;
  38472. this.h[1] &= 0x1fff;
  38473. for (i = 2; i < 10; i++) {
  38474. this.h[i] += c;
  38475. c = this.h[i] >>> 13;
  38476. this.h[i] &= 0x1fff;
  38477. }
  38478. this.h[0] += (c * 5);
  38479. c = this.h[0] >>> 13;
  38480. this.h[0] &= 0x1fff;
  38481. this.h[1] += c;
  38482. c = this.h[1] >>> 13;
  38483. this.h[1] &= 0x1fff;
  38484. this.h[2] += c;
  38485. g[0] = this.h[0] + 5;
  38486. c = g[0] >>> 13;
  38487. g[0] &= 0x1fff;
  38488. for (i = 1; i < 10; i++) {
  38489. g[i] = this.h[i] + c;
  38490. c = g[i] >>> 13;
  38491. g[i] &= 0x1fff;
  38492. }
  38493. g[9] -= (1 << 13);
  38494. mask = (c ^ 1) - 1;
  38495. for (i = 0; i < 10; i++) g[i] &= mask;
  38496. mask = ~mask;
  38497. for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
  38498. this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
  38499. this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
  38500. this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
  38501. this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
  38502. this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
  38503. this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
  38504. this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
  38505. this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
  38506. f = this.h[0] + this.pad[0];
  38507. this.h[0] = f & 0xffff;
  38508. for (i = 1; i < 8; i++) {
  38509. f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
  38510. this.h[i] = f & 0xffff;
  38511. }
  38512. mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
  38513. mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
  38514. mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
  38515. mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
  38516. mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
  38517. mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
  38518. mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
  38519. mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
  38520. mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
  38521. mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
  38522. mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
  38523. mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
  38524. mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
  38525. mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
  38526. mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
  38527. mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
  38528. };
  38529. poly1305.prototype.update = function(m, mpos, bytes) {
  38530. var i, want;
  38531. if (this.leftover) {
  38532. want = (16 - this.leftover);
  38533. if (want > bytes)
  38534. want = bytes;
  38535. for (i = 0; i < want; i++)
  38536. this.buffer[this.leftover + i] = m[mpos+i];
  38537. bytes -= want;
  38538. mpos += want;
  38539. this.leftover += want;
  38540. if (this.leftover < 16)
  38541. return;
  38542. this.blocks(this.buffer, 0, 16);
  38543. this.leftover = 0;
  38544. }
  38545. if (bytes >= 16) {
  38546. want = bytes - (bytes % 16);
  38547. this.blocks(m, mpos, want);
  38548. mpos += want;
  38549. bytes -= want;
  38550. }
  38551. if (bytes) {
  38552. for (i = 0; i < bytes; i++)
  38553. this.buffer[this.leftover + i] = m[mpos+i];
  38554. this.leftover += bytes;
  38555. }
  38556. };
  38557. function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
  38558. var s = new poly1305(k);
  38559. s.update(m, mpos, n);
  38560. s.finish(out, outpos);
  38561. return 0;
  38562. }
  38563. function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
  38564. var x = new Uint8Array(16);
  38565. crypto_onetimeauth(x,0,m,mpos,n,k);
  38566. return crypto_verify_16(h,hpos,x,0);
  38567. }
  38568. function crypto_secretbox(c,m,d,n,k) {
  38569. var i;
  38570. if (d < 32) return -1;
  38571. crypto_stream_xor(c,0,m,0,d,n,k);
  38572. crypto_onetimeauth(c, 16, c, 32, d - 32, c);
  38573. for (i = 0; i < 16; i++) c[i] = 0;
  38574. return 0;
  38575. }
  38576. function crypto_secretbox_open(m,c,d,n,k) {
  38577. var i;
  38578. var x = new Uint8Array(32);
  38579. if (d < 32) return -1;
  38580. crypto_stream(x,0,32,n,k);
  38581. if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
  38582. crypto_stream_xor(m,0,c,0,d,n,k);
  38583. for (i = 0; i < 32; i++) m[i] = 0;
  38584. return 0;
  38585. }
  38586. function set25519(r, a) {
  38587. var i;
  38588. for (i = 0; i < 16; i++) r[i] = a[i]|0;
  38589. }
  38590. function car25519(o) {
  38591. var i, v, c = 1;
  38592. for (i = 0; i < 16; i++) {
  38593. v = o[i] + c + 65535;
  38594. c = Math.floor(v / 65536);
  38595. o[i] = v - c * 65536;
  38596. }
  38597. o[0] += c-1 + 37 * (c-1);
  38598. }
  38599. function sel25519(p, q, b) {
  38600. var t, c = ~(b-1);
  38601. for (var i = 0; i < 16; i++) {
  38602. t = c & (p[i] ^ q[i]);
  38603. p[i] ^= t;
  38604. q[i] ^= t;
  38605. }
  38606. }
  38607. function pack25519(o, n) {
  38608. var i, j, b;
  38609. var m = gf(), t = gf();
  38610. for (i = 0; i < 16; i++) t[i] = n[i];
  38611. car25519(t);
  38612. car25519(t);
  38613. car25519(t);
  38614. for (j = 0; j < 2; j++) {
  38615. m[0] = t[0] - 0xffed;
  38616. for (i = 1; i < 15; i++) {
  38617. m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
  38618. m[i-1] &= 0xffff;
  38619. }
  38620. m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
  38621. b = (m[15]>>16) & 1;
  38622. m[14] &= 0xffff;
  38623. sel25519(t, m, 1-b);
  38624. }
  38625. for (i = 0; i < 16; i++) {
  38626. o[2*i] = t[i] & 0xff;
  38627. o[2*i+1] = t[i]>>8;
  38628. }
  38629. }
  38630. function neq25519(a, b) {
  38631. var c = new Uint8Array(32), d = new Uint8Array(32);
  38632. pack25519(c, a);
  38633. pack25519(d, b);
  38634. return crypto_verify_32(c, 0, d, 0);
  38635. }
  38636. function par25519(a) {
  38637. var d = new Uint8Array(32);
  38638. pack25519(d, a);
  38639. return d[0] & 1;
  38640. }
  38641. function unpack25519(o, n) {
  38642. var i;
  38643. for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
  38644. o[15] &= 0x7fff;
  38645. }
  38646. function A(o, a, b) {
  38647. for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
  38648. }
  38649. function Z(o, a, b) {
  38650. for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
  38651. }
  38652. function M(o, a, b) {
  38653. var v, c,
  38654. t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
  38655. t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
  38656. t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
  38657. t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
  38658. b0 = b[0],
  38659. b1 = b[1],
  38660. b2 = b[2],
  38661. b3 = b[3],
  38662. b4 = b[4],
  38663. b5 = b[5],
  38664. b6 = b[6],
  38665. b7 = b[7],
  38666. b8 = b[8],
  38667. b9 = b[9],
  38668. b10 = b[10],
  38669. b11 = b[11],
  38670. b12 = b[12],
  38671. b13 = b[13],
  38672. b14 = b[14],
  38673. b15 = b[15];
  38674. v = a[0];
  38675. t0 += v * b0;
  38676. t1 += v * b1;
  38677. t2 += v * b2;
  38678. t3 += v * b3;
  38679. t4 += v * b4;
  38680. t5 += v * b5;
  38681. t6 += v * b6;
  38682. t7 += v * b7;
  38683. t8 += v * b8;
  38684. t9 += v * b9;
  38685. t10 += v * b10;
  38686. t11 += v * b11;
  38687. t12 += v * b12;
  38688. t13 += v * b13;
  38689. t14 += v * b14;
  38690. t15 += v * b15;
  38691. v = a[1];
  38692. t1 += v * b0;
  38693. t2 += v * b1;
  38694. t3 += v * b2;
  38695. t4 += v * b3;
  38696. t5 += v * b4;
  38697. t6 += v * b5;
  38698. t7 += v * b6;
  38699. t8 += v * b7;
  38700. t9 += v * b8;
  38701. t10 += v * b9;
  38702. t11 += v * b10;
  38703. t12 += v * b11;
  38704. t13 += v * b12;
  38705. t14 += v * b13;
  38706. t15 += v * b14;
  38707. t16 += v * b15;
  38708. v = a[2];
  38709. t2 += v * b0;
  38710. t3 += v * b1;
  38711. t4 += v * b2;
  38712. t5 += v * b3;
  38713. t6 += v * b4;
  38714. t7 += v * b5;
  38715. t8 += v * b6;
  38716. t9 += v * b7;
  38717. t10 += v * b8;
  38718. t11 += v * b9;
  38719. t12 += v * b10;
  38720. t13 += v * b11;
  38721. t14 += v * b12;
  38722. t15 += v * b13;
  38723. t16 += v * b14;
  38724. t17 += v * b15;
  38725. v = a[3];
  38726. t3 += v * b0;
  38727. t4 += v * b1;
  38728. t5 += v * b2;
  38729. t6 += v * b3;
  38730. t7 += v * b4;
  38731. t8 += v * b5;
  38732. t9 += v * b6;
  38733. t10 += v * b7;
  38734. t11 += v * b8;
  38735. t12 += v * b9;
  38736. t13 += v * b10;
  38737. t14 += v * b11;
  38738. t15 += v * b12;
  38739. t16 += v * b13;
  38740. t17 += v * b14;
  38741. t18 += v * b15;
  38742. v = a[4];
  38743. t4 += v * b0;
  38744. t5 += v * b1;
  38745. t6 += v * b2;
  38746. t7 += v * b3;
  38747. t8 += v * b4;
  38748. t9 += v * b5;
  38749. t10 += v * b6;
  38750. t11 += v * b7;
  38751. t12 += v * b8;
  38752. t13 += v * b9;
  38753. t14 += v * b10;
  38754. t15 += v * b11;
  38755. t16 += v * b12;
  38756. t17 += v * b13;
  38757. t18 += v * b14;
  38758. t19 += v * b15;
  38759. v = a[5];
  38760. t5 += v * b0;
  38761. t6 += v * b1;
  38762. t7 += v * b2;
  38763. t8 += v * b3;
  38764. t9 += v * b4;
  38765. t10 += v * b5;
  38766. t11 += v * b6;
  38767. t12 += v * b7;
  38768. t13 += v * b8;
  38769. t14 += v * b9;
  38770. t15 += v * b10;
  38771. t16 += v * b11;
  38772. t17 += v * b12;
  38773. t18 += v * b13;
  38774. t19 += v * b14;
  38775. t20 += v * b15;
  38776. v = a[6];
  38777. t6 += v * b0;
  38778. t7 += v * b1;
  38779. t8 += v * b2;
  38780. t9 += v * b3;
  38781. t10 += v * b4;
  38782. t11 += v * b5;
  38783. t12 += v * b6;
  38784. t13 += v * b7;
  38785. t14 += v * b8;
  38786. t15 += v * b9;
  38787. t16 += v * b10;
  38788. t17 += v * b11;
  38789. t18 += v * b12;
  38790. t19 += v * b13;
  38791. t20 += v * b14;
  38792. t21 += v * b15;
  38793. v = a[7];
  38794. t7 += v * b0;
  38795. t8 += v * b1;
  38796. t9 += v * b2;
  38797. t10 += v * b3;
  38798. t11 += v * b4;
  38799. t12 += v * b5;
  38800. t13 += v * b6;
  38801. t14 += v * b7;
  38802. t15 += v * b8;
  38803. t16 += v * b9;
  38804. t17 += v * b10;
  38805. t18 += v * b11;
  38806. t19 += v * b12;
  38807. t20 += v * b13;
  38808. t21 += v * b14;
  38809. t22 += v * b15;
  38810. v = a[8];
  38811. t8 += v * b0;
  38812. t9 += v * b1;
  38813. t10 += v * b2;
  38814. t11 += v * b3;
  38815. t12 += v * b4;
  38816. t13 += v * b5;
  38817. t14 += v * b6;
  38818. t15 += v * b7;
  38819. t16 += v * b8;
  38820. t17 += v * b9;
  38821. t18 += v * b10;
  38822. t19 += v * b11;
  38823. t20 += v * b12;
  38824. t21 += v * b13;
  38825. t22 += v * b14;
  38826. t23 += v * b15;
  38827. v = a[9];
  38828. t9 += v * b0;
  38829. t10 += v * b1;
  38830. t11 += v * b2;
  38831. t12 += v * b3;
  38832. t13 += v * b4;
  38833. t14 += v * b5;
  38834. t15 += v * b6;
  38835. t16 += v * b7;
  38836. t17 += v * b8;
  38837. t18 += v * b9;
  38838. t19 += v * b10;
  38839. t20 += v * b11;
  38840. t21 += v * b12;
  38841. t22 += v * b13;
  38842. t23 += v * b14;
  38843. t24 += v * b15;
  38844. v = a[10];
  38845. t10 += v * b0;
  38846. t11 += v * b1;
  38847. t12 += v * b2;
  38848. t13 += v * b3;
  38849. t14 += v * b4;
  38850. t15 += v * b5;
  38851. t16 += v * b6;
  38852. t17 += v * b7;
  38853. t18 += v * b8;
  38854. t19 += v * b9;
  38855. t20 += v * b10;
  38856. t21 += v * b11;
  38857. t22 += v * b12;
  38858. t23 += v * b13;
  38859. t24 += v * b14;
  38860. t25 += v * b15;
  38861. v = a[11];
  38862. t11 += v * b0;
  38863. t12 += v * b1;
  38864. t13 += v * b2;
  38865. t14 += v * b3;
  38866. t15 += v * b4;
  38867. t16 += v * b5;
  38868. t17 += v * b6;
  38869. t18 += v * b7;
  38870. t19 += v * b8;
  38871. t20 += v * b9;
  38872. t21 += v * b10;
  38873. t22 += v * b11;
  38874. t23 += v * b12;
  38875. t24 += v * b13;
  38876. t25 += v * b14;
  38877. t26 += v * b15;
  38878. v = a[12];
  38879. t12 += v * b0;
  38880. t13 += v * b1;
  38881. t14 += v * b2;
  38882. t15 += v * b3;
  38883. t16 += v * b4;
  38884. t17 += v * b5;
  38885. t18 += v * b6;
  38886. t19 += v * b7;
  38887. t20 += v * b8;
  38888. t21 += v * b9;
  38889. t22 += v * b10;
  38890. t23 += v * b11;
  38891. t24 += v * b12;
  38892. t25 += v * b13;
  38893. t26 += v * b14;
  38894. t27 += v * b15;
  38895. v = a[13];
  38896. t13 += v * b0;
  38897. t14 += v * b1;
  38898. t15 += v * b2;
  38899. t16 += v * b3;
  38900. t17 += v * b4;
  38901. t18 += v * b5;
  38902. t19 += v * b6;
  38903. t20 += v * b7;
  38904. t21 += v * b8;
  38905. t22 += v * b9;
  38906. t23 += v * b10;
  38907. t24 += v * b11;
  38908. t25 += v * b12;
  38909. t26 += v * b13;
  38910. t27 += v * b14;
  38911. t28 += v * b15;
  38912. v = a[14];
  38913. t14 += v * b0;
  38914. t15 += v * b1;
  38915. t16 += v * b2;
  38916. t17 += v * b3;
  38917. t18 += v * b4;
  38918. t19 += v * b5;
  38919. t20 += v * b6;
  38920. t21 += v * b7;
  38921. t22 += v * b8;
  38922. t23 += v * b9;
  38923. t24 += v * b10;
  38924. t25 += v * b11;
  38925. t26 += v * b12;
  38926. t27 += v * b13;
  38927. t28 += v * b14;
  38928. t29 += v * b15;
  38929. v = a[15];
  38930. t15 += v * b0;
  38931. t16 += v * b1;
  38932. t17 += v * b2;
  38933. t18 += v * b3;
  38934. t19 += v * b4;
  38935. t20 += v * b5;
  38936. t21 += v * b6;
  38937. t22 += v * b7;
  38938. t23 += v * b8;
  38939. t24 += v * b9;
  38940. t25 += v * b10;
  38941. t26 += v * b11;
  38942. t27 += v * b12;
  38943. t28 += v * b13;
  38944. t29 += v * b14;
  38945. t30 += v * b15;
  38946. t0 += 38 * t16;
  38947. t1 += 38 * t17;
  38948. t2 += 38 * t18;
  38949. t3 += 38 * t19;
  38950. t4 += 38 * t20;
  38951. t5 += 38 * t21;
  38952. t6 += 38 * t22;
  38953. t7 += 38 * t23;
  38954. t8 += 38 * t24;
  38955. t9 += 38 * t25;
  38956. t10 += 38 * t26;
  38957. t11 += 38 * t27;
  38958. t12 += 38 * t28;
  38959. t13 += 38 * t29;
  38960. t14 += 38 * t30;
  38961. // t15 left as is
  38962. // first car
  38963. c = 1;
  38964. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38965. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38966. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38967. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38968. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38969. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38970. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38971. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38972. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38973. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38974. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38975. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38976. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38977. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38978. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38979. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38980. t0 += c-1 + 37 * (c-1);
  38981. // second car
  38982. c = 1;
  38983. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38984. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38985. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38986. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38987. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38988. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38989. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38990. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38991. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38992. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38993. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38994. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38995. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38996. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38997. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38998. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38999. t0 += c-1 + 37 * (c-1);
  39000. o[ 0] = t0;
  39001. o[ 1] = t1;
  39002. o[ 2] = t2;
  39003. o[ 3] = t3;
  39004. o[ 4] = t4;
  39005. o[ 5] = t5;
  39006. o[ 6] = t6;
  39007. o[ 7] = t7;
  39008. o[ 8] = t8;
  39009. o[ 9] = t9;
  39010. o[10] = t10;
  39011. o[11] = t11;
  39012. o[12] = t12;
  39013. o[13] = t13;
  39014. o[14] = t14;
  39015. o[15] = t15;
  39016. }
  39017. function S(o, a) {
  39018. M(o, a, a);
  39019. }
  39020. function inv25519(o, i) {
  39021. var c = gf();
  39022. var a;
  39023. for (a = 0; a < 16; a++) c[a] = i[a];
  39024. for (a = 253; a >= 0; a--) {
  39025. S(c, c);
  39026. if(a !== 2 && a !== 4) M(c, c, i);
  39027. }
  39028. for (a = 0; a < 16; a++) o[a] = c[a];
  39029. }
  39030. function pow2523(o, i) {
  39031. var c = gf();
  39032. var a;
  39033. for (a = 0; a < 16; a++) c[a] = i[a];
  39034. for (a = 250; a >= 0; a--) {
  39035. S(c, c);
  39036. if(a !== 1) M(c, c, i);
  39037. }
  39038. for (a = 0; a < 16; a++) o[a] = c[a];
  39039. }
  39040. function crypto_scalarmult(q, n, p) {
  39041. var z = new Uint8Array(32);
  39042. var x = new Float64Array(80), r, i;
  39043. var a = gf(), b = gf(), c = gf(),
  39044. d = gf(), e = gf(), f = gf();
  39045. for (i = 0; i < 31; i++) z[i] = n[i];
  39046. z[31]=(n[31]&127)|64;
  39047. z[0]&=248;
  39048. unpack25519(x,p);
  39049. for (i = 0; i < 16; i++) {
  39050. b[i]=x[i];
  39051. d[i]=a[i]=c[i]=0;
  39052. }
  39053. a[0]=d[0]=1;
  39054. for (i=254; i>=0; --i) {
  39055. r=(z[i>>>3]>>>(i&7))&1;
  39056. sel25519(a,b,r);
  39057. sel25519(c,d,r);
  39058. A(e,a,c);
  39059. Z(a,a,c);
  39060. A(c,b,d);
  39061. Z(b,b,d);
  39062. S(d,e);
  39063. S(f,a);
  39064. M(a,c,a);
  39065. M(c,b,e);
  39066. A(e,a,c);
  39067. Z(a,a,c);
  39068. S(b,a);
  39069. Z(c,d,f);
  39070. M(a,c,_121665);
  39071. A(a,a,d);
  39072. M(c,c,a);
  39073. M(a,d,f);
  39074. M(d,b,x);
  39075. S(b,e);
  39076. sel25519(a,b,r);
  39077. sel25519(c,d,r);
  39078. }
  39079. for (i = 0; i < 16; i++) {
  39080. x[i+16]=a[i];
  39081. x[i+32]=c[i];
  39082. x[i+48]=b[i];
  39083. x[i+64]=d[i];
  39084. }
  39085. var x32 = x.subarray(32);
  39086. var x16 = x.subarray(16);
  39087. inv25519(x32,x32);
  39088. M(x16,x16,x32);
  39089. pack25519(q,x16);
  39090. return 0;
  39091. }
  39092. function crypto_scalarmult_base(q, n) {
  39093. return crypto_scalarmult(q, n, _9);
  39094. }
  39095. function crypto_box_keypair(y, x) {
  39096. randombytes(x, 32);
  39097. return crypto_scalarmult_base(y, x);
  39098. }
  39099. function crypto_box_beforenm(k, y, x) {
  39100. var s = new Uint8Array(32);
  39101. crypto_scalarmult(s, x, y);
  39102. return crypto_core_hsalsa20(k, _0, s, sigma);
  39103. }
  39104. var crypto_box_afternm = crypto_secretbox;
  39105. var crypto_box_open_afternm = crypto_secretbox_open;
  39106. function crypto_box(c, m, d, n, y, x) {
  39107. var k = new Uint8Array(32);
  39108. crypto_box_beforenm(k, y, x);
  39109. return crypto_box_afternm(c, m, d, n, k);
  39110. }
  39111. function crypto_box_open(m, c, d, n, y, x) {
  39112. var k = new Uint8Array(32);
  39113. crypto_box_beforenm(k, y, x);
  39114. return crypto_box_open_afternm(m, c, d, n, k);
  39115. }
  39116. var K = [
  39117. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  39118. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  39119. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  39120. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  39121. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  39122. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  39123. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  39124. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  39125. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  39126. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  39127. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  39128. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  39129. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  39130. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  39131. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  39132. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  39133. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  39134. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  39135. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  39136. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  39137. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  39138. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  39139. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  39140. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  39141. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  39142. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  39143. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  39144. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  39145. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  39146. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  39147. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  39148. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  39149. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  39150. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  39151. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  39152. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  39153. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  39154. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  39155. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  39156. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  39157. ];
  39158. function crypto_hashblocks_hl(hh, hl, m, n) {
  39159. var wh = new Int32Array(16), wl = new Int32Array(16),
  39160. bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
  39161. bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
  39162. th, tl, i, j, h, l, a, b, c, d;
  39163. var ah0 = hh[0],
  39164. ah1 = hh[1],
  39165. ah2 = hh[2],
  39166. ah3 = hh[3],
  39167. ah4 = hh[4],
  39168. ah5 = hh[5],
  39169. ah6 = hh[6],
  39170. ah7 = hh[7],
  39171. al0 = hl[0],
  39172. al1 = hl[1],
  39173. al2 = hl[2],
  39174. al3 = hl[3],
  39175. al4 = hl[4],
  39176. al5 = hl[5],
  39177. al6 = hl[6],
  39178. al7 = hl[7];
  39179. var pos = 0;
  39180. while (n >= 128) {
  39181. for (i = 0; i < 16; i++) {
  39182. j = 8 * i + pos;
  39183. wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
  39184. wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
  39185. }
  39186. for (i = 0; i < 80; i++) {
  39187. bh0 = ah0;
  39188. bh1 = ah1;
  39189. bh2 = ah2;
  39190. bh3 = ah3;
  39191. bh4 = ah4;
  39192. bh5 = ah5;
  39193. bh6 = ah6;
  39194. bh7 = ah7;
  39195. bl0 = al0;
  39196. bl1 = al1;
  39197. bl2 = al2;
  39198. bl3 = al3;
  39199. bl4 = al4;
  39200. bl5 = al5;
  39201. bl6 = al6;
  39202. bl7 = al7;
  39203. // add
  39204. h = ah7;
  39205. l = al7;
  39206. a = l & 0xffff; b = l >>> 16;
  39207. c = h & 0xffff; d = h >>> 16;
  39208. // Sigma1
  39209. h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
  39210. l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
  39211. a += l & 0xffff; b += l >>> 16;
  39212. c += h & 0xffff; d += h >>> 16;
  39213. // Ch
  39214. h = (ah4 & ah5) ^ (~ah4 & ah6);
  39215. l = (al4 & al5) ^ (~al4 & al6);
  39216. a += l & 0xffff; b += l >>> 16;
  39217. c += h & 0xffff; d += h >>> 16;
  39218. // K
  39219. h = K[i*2];
  39220. l = K[i*2+1];
  39221. a += l & 0xffff; b += l >>> 16;
  39222. c += h & 0xffff; d += h >>> 16;
  39223. // w
  39224. h = wh[i%16];
  39225. l = wl[i%16];
  39226. a += l & 0xffff; b += l >>> 16;
  39227. c += h & 0xffff; d += h >>> 16;
  39228. b += a >>> 16;
  39229. c += b >>> 16;
  39230. d += c >>> 16;
  39231. th = c & 0xffff | d << 16;
  39232. tl = a & 0xffff | b << 16;
  39233. // add
  39234. h = th;
  39235. l = tl;
  39236. a = l & 0xffff; b = l >>> 16;
  39237. c = h & 0xffff; d = h >>> 16;
  39238. // Sigma0
  39239. h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
  39240. l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
  39241. a += l & 0xffff; b += l >>> 16;
  39242. c += h & 0xffff; d += h >>> 16;
  39243. // Maj
  39244. h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
  39245. l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
  39246. a += l & 0xffff; b += l >>> 16;
  39247. c += h & 0xffff; d += h >>> 16;
  39248. b += a >>> 16;
  39249. c += b >>> 16;
  39250. d += c >>> 16;
  39251. bh7 = (c & 0xffff) | (d << 16);
  39252. bl7 = (a & 0xffff) | (b << 16);
  39253. // add
  39254. h = bh3;
  39255. l = bl3;
  39256. a = l & 0xffff; b = l >>> 16;
  39257. c = h & 0xffff; d = h >>> 16;
  39258. h = th;
  39259. l = tl;
  39260. a += l & 0xffff; b += l >>> 16;
  39261. c += h & 0xffff; d += h >>> 16;
  39262. b += a >>> 16;
  39263. c += b >>> 16;
  39264. d += c >>> 16;
  39265. bh3 = (c & 0xffff) | (d << 16);
  39266. bl3 = (a & 0xffff) | (b << 16);
  39267. ah1 = bh0;
  39268. ah2 = bh1;
  39269. ah3 = bh2;
  39270. ah4 = bh3;
  39271. ah5 = bh4;
  39272. ah6 = bh5;
  39273. ah7 = bh6;
  39274. ah0 = bh7;
  39275. al1 = bl0;
  39276. al2 = bl1;
  39277. al3 = bl2;
  39278. al4 = bl3;
  39279. al5 = bl4;
  39280. al6 = bl5;
  39281. al7 = bl6;
  39282. al0 = bl7;
  39283. if (i%16 === 15) {
  39284. for (j = 0; j < 16; j++) {
  39285. // add
  39286. h = wh[j];
  39287. l = wl[j];
  39288. a = l & 0xffff; b = l >>> 16;
  39289. c = h & 0xffff; d = h >>> 16;
  39290. h = wh[(j+9)%16];
  39291. l = wl[(j+9)%16];
  39292. a += l & 0xffff; b += l >>> 16;
  39293. c += h & 0xffff; d += h >>> 16;
  39294. // sigma0
  39295. th = wh[(j+1)%16];
  39296. tl = wl[(j+1)%16];
  39297. h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
  39298. l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
  39299. a += l & 0xffff; b += l >>> 16;
  39300. c += h & 0xffff; d += h >>> 16;
  39301. // sigma1
  39302. th = wh[(j+14)%16];
  39303. tl = wl[(j+14)%16];
  39304. h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
  39305. l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
  39306. a += l & 0xffff; b += l >>> 16;
  39307. c += h & 0xffff; d += h >>> 16;
  39308. b += a >>> 16;
  39309. c += b >>> 16;
  39310. d += c >>> 16;
  39311. wh[j] = (c & 0xffff) | (d << 16);
  39312. wl[j] = (a & 0xffff) | (b << 16);
  39313. }
  39314. }
  39315. }
  39316. // add
  39317. h = ah0;
  39318. l = al0;
  39319. a = l & 0xffff; b = l >>> 16;
  39320. c = h & 0xffff; d = h >>> 16;
  39321. h = hh[0];
  39322. l = hl[0];
  39323. a += l & 0xffff; b += l >>> 16;
  39324. c += h & 0xffff; d += h >>> 16;
  39325. b += a >>> 16;
  39326. c += b >>> 16;
  39327. d += c >>> 16;
  39328. hh[0] = ah0 = (c & 0xffff) | (d << 16);
  39329. hl[0] = al0 = (a & 0xffff) | (b << 16);
  39330. h = ah1;
  39331. l = al1;
  39332. a = l & 0xffff; b = l >>> 16;
  39333. c = h & 0xffff; d = h >>> 16;
  39334. h = hh[1];
  39335. l = hl[1];
  39336. a += l & 0xffff; b += l >>> 16;
  39337. c += h & 0xffff; d += h >>> 16;
  39338. b += a >>> 16;
  39339. c += b >>> 16;
  39340. d += c >>> 16;
  39341. hh[1] = ah1 = (c & 0xffff) | (d << 16);
  39342. hl[1] = al1 = (a & 0xffff) | (b << 16);
  39343. h = ah2;
  39344. l = al2;
  39345. a = l & 0xffff; b = l >>> 16;
  39346. c = h & 0xffff; d = h >>> 16;
  39347. h = hh[2];
  39348. l = hl[2];
  39349. a += l & 0xffff; b += l >>> 16;
  39350. c += h & 0xffff; d += h >>> 16;
  39351. b += a >>> 16;
  39352. c += b >>> 16;
  39353. d += c >>> 16;
  39354. hh[2] = ah2 = (c & 0xffff) | (d << 16);
  39355. hl[2] = al2 = (a & 0xffff) | (b << 16);
  39356. h = ah3;
  39357. l = al3;
  39358. a = l & 0xffff; b = l >>> 16;
  39359. c = h & 0xffff; d = h >>> 16;
  39360. h = hh[3];
  39361. l = hl[3];
  39362. a += l & 0xffff; b += l >>> 16;
  39363. c += h & 0xffff; d += h >>> 16;
  39364. b += a >>> 16;
  39365. c += b >>> 16;
  39366. d += c >>> 16;
  39367. hh[3] = ah3 = (c & 0xffff) | (d << 16);
  39368. hl[3] = al3 = (a & 0xffff) | (b << 16);
  39369. h = ah4;
  39370. l = al4;
  39371. a = l & 0xffff; b = l >>> 16;
  39372. c = h & 0xffff; d = h >>> 16;
  39373. h = hh[4];
  39374. l = hl[4];
  39375. a += l & 0xffff; b += l >>> 16;
  39376. c += h & 0xffff; d += h >>> 16;
  39377. b += a >>> 16;
  39378. c += b >>> 16;
  39379. d += c >>> 16;
  39380. hh[4] = ah4 = (c & 0xffff) | (d << 16);
  39381. hl[4] = al4 = (a & 0xffff) | (b << 16);
  39382. h = ah5;
  39383. l = al5;
  39384. a = l & 0xffff; b = l >>> 16;
  39385. c = h & 0xffff; d = h >>> 16;
  39386. h = hh[5];
  39387. l = hl[5];
  39388. a += l & 0xffff; b += l >>> 16;
  39389. c += h & 0xffff; d += h >>> 16;
  39390. b += a >>> 16;
  39391. c += b >>> 16;
  39392. d += c >>> 16;
  39393. hh[5] = ah5 = (c & 0xffff) | (d << 16);
  39394. hl[5] = al5 = (a & 0xffff) | (b << 16);
  39395. h = ah6;
  39396. l = al6;
  39397. a = l & 0xffff; b = l >>> 16;
  39398. c = h & 0xffff; d = h >>> 16;
  39399. h = hh[6];
  39400. l = hl[6];
  39401. a += l & 0xffff; b += l >>> 16;
  39402. c += h & 0xffff; d += h >>> 16;
  39403. b += a >>> 16;
  39404. c += b >>> 16;
  39405. d += c >>> 16;
  39406. hh[6] = ah6 = (c & 0xffff) | (d << 16);
  39407. hl[6] = al6 = (a & 0xffff) | (b << 16);
  39408. h = ah7;
  39409. l = al7;
  39410. a = l & 0xffff; b = l >>> 16;
  39411. c = h & 0xffff; d = h >>> 16;
  39412. h = hh[7];
  39413. l = hl[7];
  39414. a += l & 0xffff; b += l >>> 16;
  39415. c += h & 0xffff; d += h >>> 16;
  39416. b += a >>> 16;
  39417. c += b >>> 16;
  39418. d += c >>> 16;
  39419. hh[7] = ah7 = (c & 0xffff) | (d << 16);
  39420. hl[7] = al7 = (a & 0xffff) | (b << 16);
  39421. pos += 128;
  39422. n -= 128;
  39423. }
  39424. return n;
  39425. }
  39426. function crypto_hash(out, m, n) {
  39427. var hh = new Int32Array(8),
  39428. hl = new Int32Array(8),
  39429. x = new Uint8Array(256),
  39430. i, b = n;
  39431. hh[0] = 0x6a09e667;
  39432. hh[1] = 0xbb67ae85;
  39433. hh[2] = 0x3c6ef372;
  39434. hh[3] = 0xa54ff53a;
  39435. hh[4] = 0x510e527f;
  39436. hh[5] = 0x9b05688c;
  39437. hh[6] = 0x1f83d9ab;
  39438. hh[7] = 0x5be0cd19;
  39439. hl[0] = 0xf3bcc908;
  39440. hl[1] = 0x84caa73b;
  39441. hl[2] = 0xfe94f82b;
  39442. hl[3] = 0x5f1d36f1;
  39443. hl[4] = 0xade682d1;
  39444. hl[5] = 0x2b3e6c1f;
  39445. hl[6] = 0xfb41bd6b;
  39446. hl[7] = 0x137e2179;
  39447. crypto_hashblocks_hl(hh, hl, m, n);
  39448. n %= 128;
  39449. for (i = 0; i < n; i++) x[i] = m[b-n+i];
  39450. x[n] = 128;
  39451. n = 256-128*(n<112?1:0);
  39452. x[n-9] = 0;
  39453. ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
  39454. crypto_hashblocks_hl(hh, hl, x, n);
  39455. for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
  39456. return 0;
  39457. }
  39458. function add(p, q) {
  39459. var a = gf(), b = gf(), c = gf(),
  39460. d = gf(), e = gf(), f = gf(),
  39461. g = gf(), h = gf(), t = gf();
  39462. Z(a, p[1], p[0]);
  39463. Z(t, q[1], q[0]);
  39464. M(a, a, t);
  39465. A(b, p[0], p[1]);
  39466. A(t, q[0], q[1]);
  39467. M(b, b, t);
  39468. M(c, p[3], q[3]);
  39469. M(c, c, D2);
  39470. M(d, p[2], q[2]);
  39471. A(d, d, d);
  39472. Z(e, b, a);
  39473. Z(f, d, c);
  39474. A(g, d, c);
  39475. A(h, b, a);
  39476. M(p[0], e, f);
  39477. M(p[1], h, g);
  39478. M(p[2], g, f);
  39479. M(p[3], e, h);
  39480. }
  39481. function cswap(p, q, b) {
  39482. var i;
  39483. for (i = 0; i < 4; i++) {
  39484. sel25519(p[i], q[i], b);
  39485. }
  39486. }
  39487. function pack(r, p) {
  39488. var tx = gf(), ty = gf(), zi = gf();
  39489. inv25519(zi, p[2]);
  39490. M(tx, p[0], zi);
  39491. M(ty, p[1], zi);
  39492. pack25519(r, ty);
  39493. r[31] ^= par25519(tx) << 7;
  39494. }
  39495. function scalarmult(p, q, s) {
  39496. var b, i;
  39497. set25519(p[0], gf0);
  39498. set25519(p[1], gf1);
  39499. set25519(p[2], gf1);
  39500. set25519(p[3], gf0);
  39501. for (i = 255; i >= 0; --i) {
  39502. b = (s[(i/8)|0] >> (i&7)) & 1;
  39503. cswap(p, q, b);
  39504. add(q, p);
  39505. add(p, p);
  39506. cswap(p, q, b);
  39507. }
  39508. }
  39509. function scalarbase(p, s) {
  39510. var q = [gf(), gf(), gf(), gf()];
  39511. set25519(q[0], X);
  39512. set25519(q[1], Y);
  39513. set25519(q[2], gf1);
  39514. M(q[3], X, Y);
  39515. scalarmult(p, q, s);
  39516. }
  39517. function crypto_sign_keypair(pk, sk, seeded) {
  39518. var d = new Uint8Array(64);
  39519. var p = [gf(), gf(), gf(), gf()];
  39520. var i;
  39521. if (!seeded) randombytes(sk, 32);
  39522. crypto_hash(d, sk, 32);
  39523. d[0] &= 248;
  39524. d[31] &= 127;
  39525. d[31] |= 64;
  39526. scalarbase(p, d);
  39527. pack(pk, p);
  39528. for (i = 0; i < 32; i++) sk[i+32] = pk[i];
  39529. return 0;
  39530. }
  39531. 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]);
  39532. function modL(r, x) {
  39533. var carry, i, j, k;
  39534. for (i = 63; i >= 32; --i) {
  39535. carry = 0;
  39536. for (j = i - 32, k = i - 12; j < k; ++j) {
  39537. x[j] += carry - 16 * x[i] * L[j - (i - 32)];
  39538. carry = (x[j] + 128) >> 8;
  39539. x[j] -= carry * 256;
  39540. }
  39541. x[j] += carry;
  39542. x[i] = 0;
  39543. }
  39544. carry = 0;
  39545. for (j = 0; j < 32; j++) {
  39546. x[j] += carry - (x[31] >> 4) * L[j];
  39547. carry = x[j] >> 8;
  39548. x[j] &= 255;
  39549. }
  39550. for (j = 0; j < 32; j++) x[j] -= carry * L[j];
  39551. for (i = 0; i < 32; i++) {
  39552. x[i+1] += x[i] >> 8;
  39553. r[i] = x[i] & 255;
  39554. }
  39555. }
  39556. function reduce(r) {
  39557. var x = new Float64Array(64), i;
  39558. for (i = 0; i < 64; i++) x[i] = r[i];
  39559. for (i = 0; i < 64; i++) r[i] = 0;
  39560. modL(r, x);
  39561. }
  39562. // Note: difference from C - smlen returned, not passed as argument.
  39563. function crypto_sign(sm, m, n, sk) {
  39564. var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
  39565. var i, j, x = new Float64Array(64);
  39566. var p = [gf(), gf(), gf(), gf()];
  39567. crypto_hash(d, sk, 32);
  39568. d[0] &= 248;
  39569. d[31] &= 127;
  39570. d[31] |= 64;
  39571. var smlen = n + 64;
  39572. for (i = 0; i < n; i++) sm[64 + i] = m[i];
  39573. for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
  39574. crypto_hash(r, sm.subarray(32), n+32);
  39575. reduce(r);
  39576. scalarbase(p, r);
  39577. pack(sm, p);
  39578. for (i = 32; i < 64; i++) sm[i] = sk[i];
  39579. crypto_hash(h, sm, n + 64);
  39580. reduce(h);
  39581. for (i = 0; i < 64; i++) x[i] = 0;
  39582. for (i = 0; i < 32; i++) x[i] = r[i];
  39583. for (i = 0; i < 32; i++) {
  39584. for (j = 0; j < 32; j++) {
  39585. x[i+j] += h[i] * d[j];
  39586. }
  39587. }
  39588. modL(sm.subarray(32), x);
  39589. return smlen;
  39590. }
  39591. function unpackneg(r, p) {
  39592. var t = gf(), chk = gf(), num = gf(),
  39593. den = gf(), den2 = gf(), den4 = gf(),
  39594. den6 = gf();
  39595. set25519(r[2], gf1);
  39596. unpack25519(r[1], p);
  39597. S(num, r[1]);
  39598. M(den, num, D);
  39599. Z(num, num, r[2]);
  39600. A(den, r[2], den);
  39601. S(den2, den);
  39602. S(den4, den2);
  39603. M(den6, den4, den2);
  39604. M(t, den6, num);
  39605. M(t, t, den);
  39606. pow2523(t, t);
  39607. M(t, t, num);
  39608. M(t, t, den);
  39609. M(t, t, den);
  39610. M(r[0], t, den);
  39611. S(chk, r[0]);
  39612. M(chk, chk, den);
  39613. if (neq25519(chk, num)) M(r[0], r[0], I);
  39614. S(chk, r[0]);
  39615. M(chk, chk, den);
  39616. if (neq25519(chk, num)) return -1;
  39617. if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
  39618. M(r[3], r[0], r[1]);
  39619. return 0;
  39620. }
  39621. function crypto_sign_open(m, sm, n, pk) {
  39622. var i, mlen;
  39623. var t = new Uint8Array(32), h = new Uint8Array(64);
  39624. var p = [gf(), gf(), gf(), gf()],
  39625. q = [gf(), gf(), gf(), gf()];
  39626. mlen = -1;
  39627. if (n < 64) return -1;
  39628. if (unpackneg(q, pk)) return -1;
  39629. for (i = 0; i < n; i++) m[i] = sm[i];
  39630. for (i = 0; i < 32; i++) m[i+32] = pk[i];
  39631. crypto_hash(h, m, n);
  39632. reduce(h);
  39633. scalarmult(p, q, h);
  39634. scalarbase(q, sm.subarray(32));
  39635. add(p, q);
  39636. pack(t, p);
  39637. n -= 64;
  39638. if (crypto_verify_32(sm, 0, t, 0)) {
  39639. for (i = 0; i < n; i++) m[i] = 0;
  39640. return -1;
  39641. }
  39642. for (i = 0; i < n; i++) m[i] = sm[i + 64];
  39643. mlen = n;
  39644. return mlen;
  39645. }
  39646. var crypto_secretbox_KEYBYTES = 32,
  39647. crypto_secretbox_NONCEBYTES = 24,
  39648. crypto_secretbox_ZEROBYTES = 32,
  39649. crypto_secretbox_BOXZEROBYTES = 16,
  39650. crypto_scalarmult_BYTES = 32,
  39651. crypto_scalarmult_SCALARBYTES = 32,
  39652. crypto_box_PUBLICKEYBYTES = 32,
  39653. crypto_box_SECRETKEYBYTES = 32,
  39654. crypto_box_BEFORENMBYTES = 32,
  39655. crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
  39656. crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
  39657. crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
  39658. crypto_sign_BYTES = 64,
  39659. crypto_sign_PUBLICKEYBYTES = 32,
  39660. crypto_sign_SECRETKEYBYTES = 64,
  39661. crypto_sign_SEEDBYTES = 32,
  39662. crypto_hash_BYTES = 64;
  39663. nacl.lowlevel = {
  39664. crypto_core_hsalsa20: crypto_core_hsalsa20,
  39665. crypto_stream_xor: crypto_stream_xor,
  39666. crypto_stream: crypto_stream,
  39667. crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
  39668. crypto_stream_salsa20: crypto_stream_salsa20,
  39669. crypto_onetimeauth: crypto_onetimeauth,
  39670. crypto_onetimeauth_verify: crypto_onetimeauth_verify,
  39671. crypto_verify_16: crypto_verify_16,
  39672. crypto_verify_32: crypto_verify_32,
  39673. crypto_secretbox: crypto_secretbox,
  39674. crypto_secretbox_open: crypto_secretbox_open,
  39675. crypto_scalarmult: crypto_scalarmult,
  39676. crypto_scalarmult_base: crypto_scalarmult_base,
  39677. crypto_box_beforenm: crypto_box_beforenm,
  39678. crypto_box_afternm: crypto_box_afternm,
  39679. crypto_box: crypto_box,
  39680. crypto_box_open: crypto_box_open,
  39681. crypto_box_keypair: crypto_box_keypair,
  39682. crypto_hash: crypto_hash,
  39683. crypto_sign: crypto_sign,
  39684. crypto_sign_keypair: crypto_sign_keypair,
  39685. crypto_sign_open: crypto_sign_open,
  39686. crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
  39687. crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
  39688. crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
  39689. crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
  39690. crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
  39691. crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
  39692. crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
  39693. crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
  39694. crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
  39695. crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
  39696. crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
  39697. crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
  39698. crypto_sign_BYTES: crypto_sign_BYTES,
  39699. crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
  39700. crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
  39701. crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
  39702. crypto_hash_BYTES: crypto_hash_BYTES
  39703. };
  39704. /* High-level API */
  39705. function checkLengths(k, n) {
  39706. if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  39707. if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
  39708. }
  39709. function checkBoxLengths(pk, sk) {
  39710. if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
  39711. if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
  39712. }
  39713. function checkArrayTypes() {
  39714. for (var i = 0; i < arguments.length; i++) {
  39715. if (!(arguments[i] instanceof Uint8Array))
  39716. throw new TypeError('unexpected type, use Uint8Array');
  39717. }
  39718. }
  39719. function cleanup(arr) {
  39720. for (var i = 0; i < arr.length; i++) arr[i] = 0;
  39721. }
  39722. nacl.randomBytes = function(n) {
  39723. var b = new Uint8Array(n);
  39724. randombytes(b, n);
  39725. return b;
  39726. };
  39727. nacl.secretbox = function(msg, nonce, key) {
  39728. checkArrayTypes(msg, nonce, key);
  39729. checkLengths(key, nonce);
  39730. var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
  39731. var c = new Uint8Array(m.length);
  39732. for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
  39733. crypto_secretbox(c, m, m.length, nonce, key);
  39734. return c.subarray(crypto_secretbox_BOXZEROBYTES);
  39735. };
  39736. nacl.secretbox.open = function(box, nonce, key) {
  39737. checkArrayTypes(box, nonce, key);
  39738. checkLengths(key, nonce);
  39739. var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
  39740. var m = new Uint8Array(c.length);
  39741. for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
  39742. if (c.length < 32) return null;
  39743. if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
  39744. return m.subarray(crypto_secretbox_ZEROBYTES);
  39745. };
  39746. nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
  39747. nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
  39748. nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
  39749. nacl.scalarMult = function(n, p) {
  39750. checkArrayTypes(n, p);
  39751. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  39752. if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
  39753. var q = new Uint8Array(crypto_scalarmult_BYTES);
  39754. crypto_scalarmult(q, n, p);
  39755. return q;
  39756. };
  39757. nacl.scalarMult.base = function(n) {
  39758. checkArrayTypes(n);
  39759. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  39760. var q = new Uint8Array(crypto_scalarmult_BYTES);
  39761. crypto_scalarmult_base(q, n);
  39762. return q;
  39763. };
  39764. nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
  39765. nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
  39766. nacl.box = function(msg, nonce, publicKey, secretKey) {
  39767. var k = nacl.box.before(publicKey, secretKey);
  39768. return nacl.secretbox(msg, nonce, k);
  39769. };
  39770. nacl.box.before = function(publicKey, secretKey) {
  39771. checkArrayTypes(publicKey, secretKey);
  39772. checkBoxLengths(publicKey, secretKey);
  39773. var k = new Uint8Array(crypto_box_BEFORENMBYTES);
  39774. crypto_box_beforenm(k, publicKey, secretKey);
  39775. return k;
  39776. };
  39777. nacl.box.after = nacl.secretbox;
  39778. nacl.box.open = function(msg, nonce, publicKey, secretKey) {
  39779. var k = nacl.box.before(publicKey, secretKey);
  39780. return nacl.secretbox.open(msg, nonce, k);
  39781. };
  39782. nacl.box.open.after = nacl.secretbox.open;
  39783. nacl.box.keyPair = function() {
  39784. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  39785. var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
  39786. crypto_box_keypair(pk, sk);
  39787. return {publicKey: pk, secretKey: sk};
  39788. };
  39789. nacl.box.keyPair.fromSecretKey = function(secretKey) {
  39790. checkArrayTypes(secretKey);
  39791. if (secretKey.length !== crypto_box_SECRETKEYBYTES)
  39792. throw new Error('bad secret key size');
  39793. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  39794. crypto_scalarmult_base(pk, secretKey);
  39795. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  39796. };
  39797. nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
  39798. nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
  39799. nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
  39800. nacl.box.nonceLength = crypto_box_NONCEBYTES;
  39801. nacl.box.overheadLength = nacl.secretbox.overheadLength;
  39802. nacl.sign = function(msg, secretKey) {
  39803. checkArrayTypes(msg, secretKey);
  39804. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  39805. throw new Error('bad secret key size');
  39806. var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
  39807. crypto_sign(signedMsg, msg, msg.length, secretKey);
  39808. return signedMsg;
  39809. };
  39810. nacl.sign.open = function(signedMsg, publicKey) {
  39811. checkArrayTypes(signedMsg, publicKey);
  39812. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  39813. throw new Error('bad public key size');
  39814. var tmp = new Uint8Array(signedMsg.length);
  39815. var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
  39816. if (mlen < 0) return null;
  39817. var m = new Uint8Array(mlen);
  39818. for (var i = 0; i < m.length; i++) m[i] = tmp[i];
  39819. return m;
  39820. };
  39821. nacl.sign.detached = function(msg, secretKey) {
  39822. var signedMsg = nacl.sign(msg, secretKey);
  39823. var sig = new Uint8Array(crypto_sign_BYTES);
  39824. for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
  39825. return sig;
  39826. };
  39827. nacl.sign.detached.verify = function(msg, sig, publicKey) {
  39828. checkArrayTypes(msg, sig, publicKey);
  39829. if (sig.length !== crypto_sign_BYTES)
  39830. throw new Error('bad signature size');
  39831. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  39832. throw new Error('bad public key size');
  39833. var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
  39834. var m = new Uint8Array(crypto_sign_BYTES + msg.length);
  39835. var i;
  39836. for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
  39837. for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
  39838. return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
  39839. };
  39840. nacl.sign.keyPair = function() {
  39841. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39842. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  39843. crypto_sign_keypair(pk, sk);
  39844. return {publicKey: pk, secretKey: sk};
  39845. };
  39846. nacl.sign.keyPair.fromSecretKey = function(secretKey) {
  39847. checkArrayTypes(secretKey);
  39848. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  39849. throw new Error('bad secret key size');
  39850. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39851. for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
  39852. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  39853. };
  39854. nacl.sign.keyPair.fromSeed = function(seed) {
  39855. checkArrayTypes(seed);
  39856. if (seed.length !== crypto_sign_SEEDBYTES)
  39857. throw new Error('bad seed size');
  39858. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39859. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  39860. for (var i = 0; i < 32; i++) sk[i] = seed[i];
  39861. crypto_sign_keypair(pk, sk, true);
  39862. return {publicKey: pk, secretKey: sk};
  39863. };
  39864. nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
  39865. nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
  39866. nacl.sign.seedLength = crypto_sign_SEEDBYTES;
  39867. nacl.sign.signatureLength = crypto_sign_BYTES;
  39868. nacl.hash = function(msg) {
  39869. checkArrayTypes(msg);
  39870. var h = new Uint8Array(crypto_hash_BYTES);
  39871. crypto_hash(h, msg, msg.length);
  39872. return h;
  39873. };
  39874. nacl.hash.hashLength = crypto_hash_BYTES;
  39875. nacl.verify = function(x, y) {
  39876. checkArrayTypes(x, y);
  39877. // Zero length arguments are considered not equal.
  39878. if (x.length === 0 || y.length === 0) return false;
  39879. if (x.length !== y.length) return false;
  39880. return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
  39881. };
  39882. nacl.setPRNG = function(fn) {
  39883. randombytes = fn;
  39884. };
  39885. (function() {
  39886. // Initialize PRNG if environment provides CSPRNG.
  39887. // If not, methods calling randombytes will throw.
  39888. var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
  39889. if (crypto && crypto.getRandomValues) {
  39890. // Browsers.
  39891. var QUOTA = 65536;
  39892. nacl.setPRNG(function(x, n) {
  39893. var i, v = new Uint8Array(n);
  39894. for (i = 0; i < n; i += QUOTA) {
  39895. crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
  39896. }
  39897. for (i = 0; i < n; i++) x[i] = v[i];
  39898. cleanup(v);
  39899. });
  39900. } else if (true) {
  39901. // Node.js.
  39902. crypto = __webpack_require__(3);
  39903. if (crypto && crypto.randomBytes) {
  39904. nacl.setPRNG(function(x, n) {
  39905. var i, v = crypto.randomBytes(n);
  39906. for (i = 0; i < n; i++) x[i] = v[i];
  39907. cleanup(v);
  39908. });
  39909. }
  39910. }
  39911. })();
  39912. })( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
  39913. /***/ }),
  39914. /* 1 */
  39915. /***/ (function(module, exports, __webpack_require__) {
  39916. // Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
  39917. // Public domain.
  39918. (function(root, f) {
  39919. 'use strict';
  39920. if ( true && module.exports) module.exports = f();
  39921. else if (root.nacl) root.nacl.util = f();
  39922. else {
  39923. root.nacl = {};
  39924. root.nacl.util = f();
  39925. }
  39926. }(this, function() {
  39927. 'use strict';
  39928. var util = {};
  39929. function validateBase64(s) {
  39930. if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) {
  39931. throw new TypeError('invalid encoding');
  39932. }
  39933. }
  39934. util.decodeUTF8 = function(s) {
  39935. if (typeof s !== 'string') throw new TypeError('expected string');
  39936. var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
  39937. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39938. return b;
  39939. };
  39940. util.encodeUTF8 = function(arr) {
  39941. var i, s = [];
  39942. for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
  39943. return decodeURIComponent(escape(s.join('')));
  39944. };
  39945. if (typeof atob === 'undefined') {
  39946. // Node.js
  39947. if (typeof Buffer.from !== 'undefined') {
  39948. // Node v6 and later
  39949. util.encodeBase64 = function (arr) { // v6 and later
  39950. return Buffer.from(arr).toString('base64');
  39951. };
  39952. util.decodeBase64 = function (s) {
  39953. validateBase64(s);
  39954. return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
  39955. };
  39956. } else {
  39957. // Node earlier than v6
  39958. util.encodeBase64 = function (arr) { // v6 and later
  39959. return (new Buffer(arr)).toString('base64');
  39960. };
  39961. util.decodeBase64 = function(s) {
  39962. validateBase64(s);
  39963. return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
  39964. };
  39965. }
  39966. } else {
  39967. // Browsers
  39968. util.encodeBase64 = function(arr) {
  39969. var i, s = [], len = arr.length;
  39970. for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
  39971. return btoa(s.join(''));
  39972. };
  39973. util.decodeBase64 = function(s) {
  39974. validateBase64(s);
  39975. var i, d = atob(s), b = new Uint8Array(d.length);
  39976. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39977. return b;
  39978. };
  39979. }
  39980. return util;
  39981. }));
  39982. /***/ }),
  39983. /* 2 */
  39984. /***/ (function(module, exports, __webpack_require__) {
  39985. // required so we don't have to do require('pusher').default etc.
  39986. module.exports = __webpack_require__(4).default;
  39987. /***/ }),
  39988. /* 3 */
  39989. /***/ (function(module, exports) {
  39990. /* (ignored) */
  39991. /***/ }),
  39992. /* 4 */
  39993. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  39994. "use strict";
  39995. __webpack_require__.r(__webpack_exports__);
  39996. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
  39997. var ScriptReceiverFactory = (function () {
  39998. function ScriptReceiverFactory(prefix, name) {
  39999. this.lastId = 0;
  40000. this.prefix = prefix;
  40001. this.name = name;
  40002. }
  40003. ScriptReceiverFactory.prototype.create = function (callback) {
  40004. this.lastId++;
  40005. var number = this.lastId;
  40006. var id = this.prefix + number;
  40007. var name = this.name + "[" + number + "]";
  40008. var called = false;
  40009. var callbackWrapper = function () {
  40010. if (!called) {
  40011. callback.apply(null, arguments);
  40012. called = true;
  40013. }
  40014. };
  40015. this[number] = callbackWrapper;
  40016. return { number: number, id: id, name: name, callback: callbackWrapper };
  40017. };
  40018. ScriptReceiverFactory.prototype.remove = function (receiver) {
  40019. delete this[receiver.number];
  40020. };
  40021. return ScriptReceiverFactory;
  40022. }());
  40023. var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
  40024. // CONCATENATED MODULE: ./src/core/defaults.ts
  40025. var Defaults = {
  40026. VERSION: "5.0.3",
  40027. PROTOCOL: 7,
  40028. host: 'ws.pusherapp.com',
  40029. ws_port: 80,
  40030. wss_port: 443,
  40031. ws_path: '',
  40032. sockjs_host: 'sockjs.pusher.com',
  40033. sockjs_http_port: 80,
  40034. sockjs_https_port: 443,
  40035. sockjs_path: '/pusher',
  40036. stats_host: 'stats.pusher.com',
  40037. channel_auth_endpoint: '/pusher/auth',
  40038. channel_auth_transport: 'ajax',
  40039. activity_timeout: 120000,
  40040. pong_timeout: 30000,
  40041. unavailable_timeout: 10000,
  40042. cdn_http: "http://js.pusher.com",
  40043. cdn_https: "https://js.pusher.com",
  40044. dependency_suffix: ""
  40045. };
  40046. /* harmony default export */ var defaults = (Defaults);
  40047. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
  40048. var dependency_loader_DependencyLoader = (function () {
  40049. function DependencyLoader(options) {
  40050. this.options = options;
  40051. this.receivers = options.receivers || ScriptReceivers;
  40052. this.loading = {};
  40053. }
  40054. DependencyLoader.prototype.load = function (name, options, callback) {
  40055. var self = this;
  40056. if (self.loading[name] && self.loading[name].length > 0) {
  40057. self.loading[name].push(callback);
  40058. }
  40059. else {
  40060. self.loading[name] = [callback];
  40061. var request = runtime.createScriptRequest(self.getPath(name, options));
  40062. var receiver = self.receivers.create(function (error) {
  40063. self.receivers.remove(receiver);
  40064. if (self.loading[name]) {
  40065. var callbacks = self.loading[name];
  40066. delete self.loading[name];
  40067. var successCallback = function (wasSuccessful) {
  40068. if (!wasSuccessful) {
  40069. request.cleanup();
  40070. }
  40071. };
  40072. for (var i = 0; i < callbacks.length; i++) {
  40073. callbacks[i](error, successCallback);
  40074. }
  40075. }
  40076. });
  40077. request.send(receiver);
  40078. }
  40079. };
  40080. DependencyLoader.prototype.getRoot = function (options) {
  40081. var cdn;
  40082. var protocol = runtime.getDocument().location.protocol;
  40083. if ((options && options.useTLS) || protocol === "https:") {
  40084. cdn = this.options.cdn_https;
  40085. }
  40086. else {
  40087. cdn = this.options.cdn_http;
  40088. }
  40089. return cdn.replace(/\/*$/, "") + "/" + this.options.version;
  40090. };
  40091. DependencyLoader.prototype.getPath = function (name, options) {
  40092. return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
  40093. };
  40094. ;
  40095. return DependencyLoader;
  40096. }());
  40097. /* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
  40098. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
  40099. var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
  40100. var Dependencies = new dependency_loader({
  40101. cdn_http: defaults.cdn_http,
  40102. cdn_https: defaults.cdn_https,
  40103. version: defaults.VERSION,
  40104. suffix: defaults.dependency_suffix,
  40105. receivers: DependenciesReceivers
  40106. });
  40107. // CONCATENATED MODULE: ./src/core/base64.ts
  40108. function encode(s) {
  40109. return btoa(utob(s));
  40110. }
  40111. var fromCharCode = String.fromCharCode;
  40112. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  40113. var b64tab = {};
  40114. for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
  40115. b64tab[b64chars.charAt(base64_i)] = base64_i;
  40116. }
  40117. var cb_utob = function (c) {
  40118. var cc = c.charCodeAt(0);
  40119. return cc < 0x80
  40120. ? c
  40121. : cc < 0x800
  40122. ? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
  40123. : fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
  40124. fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
  40125. fromCharCode(0x80 | (cc & 0x3f));
  40126. };
  40127. var utob = function (u) {
  40128. return u.replace(/[^\x00-\x7F]/g, cb_utob);
  40129. };
  40130. var cb_encode = function (ccc) {
  40131. var padlen = [0, 2, 1][ccc.length % 3];
  40132. var ord = (ccc.charCodeAt(0) << 16) |
  40133. ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
  40134. (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
  40135. var chars = [
  40136. b64chars.charAt(ord >>> 18),
  40137. b64chars.charAt((ord >>> 12) & 63),
  40138. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  40139. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  40140. ];
  40141. return chars.join('');
  40142. };
  40143. var btoa = window.btoa ||
  40144. function (b) {
  40145. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  40146. };
  40147. // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
  40148. var Timer = (function () {
  40149. function Timer(set, clear, delay, callback) {
  40150. var _this = this;
  40151. this.clear = clear;
  40152. this.timer = set(function () {
  40153. if (_this.timer) {
  40154. _this.timer = callback(_this.timer);
  40155. }
  40156. }, delay);
  40157. }
  40158. Timer.prototype.isRunning = function () {
  40159. return this.timer !== null;
  40160. };
  40161. Timer.prototype.ensureAborted = function () {
  40162. if (this.timer) {
  40163. this.clear(this.timer);
  40164. this.timer = null;
  40165. }
  40166. };
  40167. return Timer;
  40168. }());
  40169. /* harmony default export */ var abstract_timer = (Timer);
  40170. // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
  40171. var __extends = (undefined && undefined.__extends) || (function () {
  40172. var extendStatics = function (d, b) {
  40173. extendStatics = Object.setPrototypeOf ||
  40174. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40175. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40176. return extendStatics(d, b);
  40177. };
  40178. return function (d, b) {
  40179. extendStatics(d, b);
  40180. function __() { this.constructor = d; }
  40181. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40182. };
  40183. })();
  40184. function timers_clearTimeout(timer) {
  40185. window.clearTimeout(timer);
  40186. }
  40187. function timers_clearInterval(timer) {
  40188. window.clearInterval(timer);
  40189. }
  40190. var OneOffTimer = (function (_super) {
  40191. __extends(OneOffTimer, _super);
  40192. function OneOffTimer(delay, callback) {
  40193. return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
  40194. callback();
  40195. return null;
  40196. }) || this;
  40197. }
  40198. return OneOffTimer;
  40199. }(abstract_timer));
  40200. var PeriodicTimer = (function (_super) {
  40201. __extends(PeriodicTimer, _super);
  40202. function PeriodicTimer(delay, callback) {
  40203. return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
  40204. callback();
  40205. return timer;
  40206. }) || this;
  40207. }
  40208. return PeriodicTimer;
  40209. }(abstract_timer));
  40210. // CONCATENATED MODULE: ./src/core/util.ts
  40211. var Util = {
  40212. now: function () {
  40213. if (Date.now) {
  40214. return Date.now();
  40215. }
  40216. else {
  40217. return new Date().valueOf();
  40218. }
  40219. },
  40220. defer: function (callback) {
  40221. return new OneOffTimer(0, callback);
  40222. },
  40223. method: function (name) {
  40224. var args = [];
  40225. for (var _i = 1; _i < arguments.length; _i++) {
  40226. args[_i - 1] = arguments[_i];
  40227. }
  40228. var boundArguments = Array.prototype.slice.call(arguments, 1);
  40229. return function (object) {
  40230. return object[name].apply(object, boundArguments.concat(arguments));
  40231. };
  40232. }
  40233. };
  40234. /* harmony default export */ var util = (Util);
  40235. // CONCATENATED MODULE: ./src/core/utils/collections.ts
  40236. function extend(target) {
  40237. var sources = [];
  40238. for (var _i = 1; _i < arguments.length; _i++) {
  40239. sources[_i - 1] = arguments[_i];
  40240. }
  40241. for (var i = 0; i < sources.length; i++) {
  40242. var extensions = sources[i];
  40243. for (var property in extensions) {
  40244. if (extensions[property] && extensions[property].constructor &&
  40245. extensions[property].constructor === Object) {
  40246. target[property] = extend(target[property] || {}, extensions[property]);
  40247. }
  40248. else {
  40249. target[property] = extensions[property];
  40250. }
  40251. }
  40252. }
  40253. return target;
  40254. }
  40255. function stringify() {
  40256. var m = ["Pusher"];
  40257. for (var i = 0; i < arguments.length; i++) {
  40258. if (typeof arguments[i] === "string") {
  40259. m.push(arguments[i]);
  40260. }
  40261. else {
  40262. m.push(safeJSONStringify(arguments[i]));
  40263. }
  40264. }
  40265. return m.join(" : ");
  40266. }
  40267. function arrayIndexOf(array, item) {
  40268. var nativeIndexOf = Array.prototype.indexOf;
  40269. if (array === null) {
  40270. return -1;
  40271. }
  40272. if (nativeIndexOf && array.indexOf === nativeIndexOf) {
  40273. return array.indexOf(item);
  40274. }
  40275. for (var i = 0, l = array.length; i < l; i++) {
  40276. if (array[i] === item) {
  40277. return i;
  40278. }
  40279. }
  40280. return -1;
  40281. }
  40282. function objectApply(object, f) {
  40283. for (var key in object) {
  40284. if (Object.prototype.hasOwnProperty.call(object, key)) {
  40285. f(object[key], key, object);
  40286. }
  40287. }
  40288. }
  40289. function keys(object) {
  40290. var keys = [];
  40291. objectApply(object, function (_, key) {
  40292. keys.push(key);
  40293. });
  40294. return keys;
  40295. }
  40296. function values(object) {
  40297. var values = [];
  40298. objectApply(object, function (value) {
  40299. values.push(value);
  40300. });
  40301. return values;
  40302. }
  40303. function apply(array, f, context) {
  40304. for (var i = 0; i < array.length; i++) {
  40305. f.call(context || window, array[i], i, array);
  40306. }
  40307. }
  40308. function map(array, f) {
  40309. var result = [];
  40310. for (var i = 0; i < array.length; i++) {
  40311. result.push(f(array[i], i, array, result));
  40312. }
  40313. return result;
  40314. }
  40315. function mapObject(object, f) {
  40316. var result = {};
  40317. objectApply(object, function (value, key) {
  40318. result[key] = f(value);
  40319. });
  40320. return result;
  40321. }
  40322. function filter(array, test) {
  40323. test = test || function (value) { return !!value; };
  40324. var result = [];
  40325. for (var i = 0; i < array.length; i++) {
  40326. if (test(array[i], i, array, result)) {
  40327. result.push(array[i]);
  40328. }
  40329. }
  40330. return result;
  40331. }
  40332. function filterObject(object, test) {
  40333. var result = {};
  40334. objectApply(object, function (value, key) {
  40335. if ((test && test(value, key, object, result)) || Boolean(value)) {
  40336. result[key] = value;
  40337. }
  40338. });
  40339. return result;
  40340. }
  40341. function flatten(object) {
  40342. var result = [];
  40343. objectApply(object, function (value, key) {
  40344. result.push([key, value]);
  40345. });
  40346. return result;
  40347. }
  40348. function any(array, test) {
  40349. for (var i = 0; i < array.length; i++) {
  40350. if (test(array[i], i, array)) {
  40351. return true;
  40352. }
  40353. }
  40354. return false;
  40355. }
  40356. function collections_all(array, test) {
  40357. for (var i = 0; i < array.length; i++) {
  40358. if (!test(array[i], i, array)) {
  40359. return false;
  40360. }
  40361. }
  40362. return true;
  40363. }
  40364. function encodeParamsObject(data) {
  40365. return mapObject(data, function (value) {
  40366. if (typeof value === "object") {
  40367. value = safeJSONStringify(value);
  40368. }
  40369. return encodeURIComponent(encode(value.toString()));
  40370. });
  40371. }
  40372. function buildQueryString(data) {
  40373. var params = filterObject(data, function (value) {
  40374. return value !== undefined;
  40375. });
  40376. var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
  40377. return query;
  40378. }
  40379. function decycleObject(object) {
  40380. var objects = [], paths = [];
  40381. return (function derez(value, path) {
  40382. var i, name, nu;
  40383. switch (typeof value) {
  40384. case 'object':
  40385. if (!value) {
  40386. return null;
  40387. }
  40388. for (i = 0; i < objects.length; i += 1) {
  40389. if (objects[i] === value) {
  40390. return { $ref: paths[i] };
  40391. }
  40392. }
  40393. objects.push(value);
  40394. paths.push(path);
  40395. if (Object.prototype.toString.apply(value) === '[object Array]') {
  40396. nu = [];
  40397. for (i = 0; i < value.length; i += 1) {
  40398. nu[i] = derez(value[i], path + '[' + i + ']');
  40399. }
  40400. }
  40401. else {
  40402. nu = {};
  40403. for (name in value) {
  40404. if (Object.prototype.hasOwnProperty.call(value, name)) {
  40405. nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
  40406. }
  40407. }
  40408. }
  40409. return nu;
  40410. case 'number':
  40411. case 'string':
  40412. case 'boolean':
  40413. return value;
  40414. }
  40415. }(object, '$'));
  40416. }
  40417. function safeJSONStringify(source) {
  40418. try {
  40419. return JSON.stringify(source);
  40420. }
  40421. catch (e) {
  40422. return JSON.stringify(decycleObject(source));
  40423. }
  40424. }
  40425. // CONCATENATED MODULE: ./src/core/logger.ts
  40426. var logger_Logger = (function () {
  40427. function Logger() {
  40428. this.globalLog = function (message) {
  40429. if (window.console && window.console.log) {
  40430. window.console.log(message);
  40431. }
  40432. };
  40433. }
  40434. Logger.prototype.debug = function () {
  40435. var args = [];
  40436. for (var _i = 0; _i < arguments.length; _i++) {
  40437. args[_i] = arguments[_i];
  40438. }
  40439. this.log(this.globalLog, args);
  40440. };
  40441. Logger.prototype.warn = function () {
  40442. var args = [];
  40443. for (var _i = 0; _i < arguments.length; _i++) {
  40444. args[_i] = arguments[_i];
  40445. }
  40446. this.log(this.globalLogWarn, args);
  40447. };
  40448. Logger.prototype.error = function () {
  40449. var args = [];
  40450. for (var _i = 0; _i < arguments.length; _i++) {
  40451. args[_i] = arguments[_i];
  40452. }
  40453. this.log(this.globalLogError, args);
  40454. };
  40455. Logger.prototype.globalLogWarn = function (message) {
  40456. if (window.console && window.console.warn) {
  40457. window.console.warn(message);
  40458. }
  40459. else {
  40460. this.globalLog(message);
  40461. }
  40462. };
  40463. Logger.prototype.globalLogError = function (message) {
  40464. if (window.console && window.console.error) {
  40465. window.console.error(message);
  40466. }
  40467. else {
  40468. this.globalLogWarn(message);
  40469. }
  40470. };
  40471. Logger.prototype.log = function (defaultLoggingFunction) {
  40472. var args = [];
  40473. for (var _i = 1; _i < arguments.length; _i++) {
  40474. args[_i - 1] = arguments[_i];
  40475. }
  40476. var message = stringify.apply(this, arguments);
  40477. if (core_pusher.log) {
  40478. core_pusher.log(message);
  40479. }
  40480. else if (core_pusher.logToConsole) {
  40481. var log = defaultLoggingFunction.bind(this);
  40482. log(message);
  40483. }
  40484. };
  40485. return Logger;
  40486. }());
  40487. /* harmony default export */ var logger = (new logger_Logger());
  40488. // CONCATENATED MODULE: ./src/core/utils/url_store.ts
  40489. var urlStore = {
  40490. baseUrl: "https://pusher.com",
  40491. urls: {
  40492. authenticationEndpoint: {
  40493. path: "/docs/authenticating_users",
  40494. },
  40495. javascriptQuickStart: {
  40496. path: "/docs/javascript_quick_start"
  40497. },
  40498. triggeringClientEvents: {
  40499. path: "/docs/client_api_guide/client_events#trigger-events"
  40500. }
  40501. }
  40502. };
  40503. var buildLogSuffix = function (key) {
  40504. var urlPrefix = "See:";
  40505. var urlObj = urlStore.urls[key];
  40506. if (!urlObj)
  40507. return "";
  40508. var url;
  40509. if (urlObj.fullUrl) {
  40510. url = urlObj.fullUrl;
  40511. }
  40512. else if (urlObj.path) {
  40513. url = urlStore.baseUrl + urlObj.path;
  40514. }
  40515. if (!url)
  40516. return "";
  40517. return urlPrefix + " " + url;
  40518. };
  40519. /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
  40520. // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
  40521. var ajax = function (context, socketId, callback) {
  40522. var self = this, xhr;
  40523. xhr = runtime.createXHR();
  40524. xhr.open("POST", self.options.authEndpoint, true);
  40525. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  40526. for (var headerName in this.authOptions.headers) {
  40527. xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
  40528. }
  40529. xhr.onreadystatechange = function () {
  40530. if (xhr.readyState === 4) {
  40531. if (xhr.status === 200) {
  40532. var data, parsed = false;
  40533. try {
  40534. data = JSON.parse(xhr.responseText);
  40535. parsed = true;
  40536. }
  40537. catch (e) {
  40538. callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
  40539. }
  40540. if (parsed) {
  40541. callback(false, data);
  40542. }
  40543. }
  40544. else {
  40545. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  40546. logger.error('Unable to retrieve auth string from auth endpoint - ' +
  40547. ("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
  40548. ("Clients must be authenticated to join private or presence channels. " + suffix));
  40549. callback(true, xhr.status);
  40550. }
  40551. }
  40552. };
  40553. xhr.send(this.composeQuery(socketId));
  40554. return xhr;
  40555. };
  40556. /* harmony default export */ var xhr_auth = (ajax);
  40557. // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
  40558. var jsonp = function (context, socketId, callback) {
  40559. if (this.authOptions.headers !== undefined) {
  40560. logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
  40561. }
  40562. var callbackName = context.nextAuthCallbackID.toString();
  40563. context.nextAuthCallbackID++;
  40564. var document = context.getDocument();
  40565. var script = document.createElement("script");
  40566. context.auth_callbacks[callbackName] = function (data) {
  40567. callback(false, data);
  40568. };
  40569. var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  40570. script.src = this.options.authEndpoint +
  40571. '?callback=' +
  40572. encodeURIComponent(callback_name) +
  40573. '&' +
  40574. this.composeQuery(socketId);
  40575. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  40576. head.insertBefore(script, head.firstChild);
  40577. };
  40578. /* harmony default export */ var jsonp_auth = (jsonp);
  40579. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
  40580. var ScriptRequest = (function () {
  40581. function ScriptRequest(src) {
  40582. this.src = src;
  40583. }
  40584. ScriptRequest.prototype.send = function (receiver) {
  40585. var self = this;
  40586. var errorString = "Error loading " + self.src;
  40587. self.script = document.createElement("script");
  40588. self.script.id = receiver.id;
  40589. self.script.src = self.src;
  40590. self.script.type = "text/javascript";
  40591. self.script.charset = "UTF-8";
  40592. if (self.script.addEventListener) {
  40593. self.script.onerror = function () {
  40594. receiver.callback(errorString);
  40595. };
  40596. self.script.onload = function () {
  40597. receiver.callback(null);
  40598. };
  40599. }
  40600. else {
  40601. self.script.onreadystatechange = function () {
  40602. if (self.script.readyState === 'loaded' ||
  40603. self.script.readyState === 'complete') {
  40604. receiver.callback(null);
  40605. }
  40606. };
  40607. }
  40608. if (self.script.async === undefined && document.attachEvent &&
  40609. /opera/i.test(navigator.userAgent)) {
  40610. self.errorScript = document.createElement("script");
  40611. self.errorScript.id = receiver.id + "_error";
  40612. self.errorScript.text = receiver.name + "('" + errorString + "');";
  40613. self.script.async = self.errorScript.async = false;
  40614. }
  40615. else {
  40616. self.script.async = true;
  40617. }
  40618. var head = document.getElementsByTagName('head')[0];
  40619. head.insertBefore(self.script, head.firstChild);
  40620. if (self.errorScript) {
  40621. head.insertBefore(self.errorScript, self.script.nextSibling);
  40622. }
  40623. };
  40624. ScriptRequest.prototype.cleanup = function () {
  40625. if (this.script) {
  40626. this.script.onload = this.script.onerror = null;
  40627. this.script.onreadystatechange = null;
  40628. }
  40629. if (this.script && this.script.parentNode) {
  40630. this.script.parentNode.removeChild(this.script);
  40631. }
  40632. if (this.errorScript && this.errorScript.parentNode) {
  40633. this.errorScript.parentNode.removeChild(this.errorScript);
  40634. }
  40635. this.script = null;
  40636. this.errorScript = null;
  40637. };
  40638. return ScriptRequest;
  40639. }());
  40640. /* harmony default export */ var script_request = (ScriptRequest);
  40641. // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
  40642. var jsonp_request_JSONPRequest = (function () {
  40643. function JSONPRequest(url, data) {
  40644. this.url = url;
  40645. this.data = data;
  40646. }
  40647. JSONPRequest.prototype.send = function (receiver) {
  40648. if (this.request) {
  40649. return;
  40650. }
  40651. var query = buildQueryString(this.data);
  40652. var url = this.url + "/" + receiver.number + "?" + query;
  40653. this.request = runtime.createScriptRequest(url);
  40654. this.request.send(receiver);
  40655. };
  40656. JSONPRequest.prototype.cleanup = function () {
  40657. if (this.request) {
  40658. this.request.cleanup();
  40659. }
  40660. };
  40661. return JSONPRequest;
  40662. }());
  40663. /* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
  40664. // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
  40665. var getAgent = function (sender, useTLS) {
  40666. return function (data, callback) {
  40667. var scheme = "http" + (useTLS ? "s" : "") + "://";
  40668. var url = scheme + (sender.host || sender.options.host) + sender.options.path;
  40669. var request = runtime.createJSONPRequest(url, data);
  40670. var receiver = runtime.ScriptReceivers.create(function (error, result) {
  40671. ScriptReceivers.remove(receiver);
  40672. request.cleanup();
  40673. if (result && result.host) {
  40674. sender.host = result.host;
  40675. }
  40676. if (callback) {
  40677. callback(error, result);
  40678. }
  40679. });
  40680. request.send(receiver);
  40681. };
  40682. };
  40683. var jsonp_timeline_jsonp = {
  40684. name: 'jsonp',
  40685. getAgent: getAgent
  40686. };
  40687. /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
  40688. // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
  40689. function getGenericURL(baseScheme, params, path) {
  40690. var scheme = baseScheme + (params.useTLS ? "s" : "");
  40691. var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
  40692. return scheme + "://" + host + path;
  40693. }
  40694. function getGenericPath(key, queryString) {
  40695. var path = "/app/" + key;
  40696. var query = "?protocol=" + defaults.PROTOCOL +
  40697. "&client=js" +
  40698. "&version=" + defaults.VERSION +
  40699. (queryString ? ("&" + queryString) : "");
  40700. return path + query;
  40701. }
  40702. var ws = {
  40703. getInitial: function (key, params) {
  40704. var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
  40705. return getGenericURL("ws", params, path);
  40706. }
  40707. };
  40708. var http = {
  40709. getInitial: function (key, params) {
  40710. var path = (params.httpPath || "/pusher") + getGenericPath(key);
  40711. return getGenericURL("http", params, path);
  40712. }
  40713. };
  40714. var sockjs = {
  40715. getInitial: function (key, params) {
  40716. return getGenericURL("http", params, params.httpPath || "/pusher");
  40717. },
  40718. getPath: function (key, params) {
  40719. return getGenericPath(key);
  40720. }
  40721. };
  40722. // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
  40723. var callback_registry_CallbackRegistry = (function () {
  40724. function CallbackRegistry() {
  40725. this._callbacks = {};
  40726. }
  40727. CallbackRegistry.prototype.get = function (name) {
  40728. return this._callbacks[prefix(name)];
  40729. };
  40730. CallbackRegistry.prototype.add = function (name, callback, context) {
  40731. var prefixedEventName = prefix(name);
  40732. this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
  40733. this._callbacks[prefixedEventName].push({
  40734. fn: callback,
  40735. context: context
  40736. });
  40737. };
  40738. CallbackRegistry.prototype.remove = function (name, callback, context) {
  40739. if (!name && !callback && !context) {
  40740. this._callbacks = {};
  40741. return;
  40742. }
  40743. var names = name ? [prefix(name)] : keys(this._callbacks);
  40744. if (callback || context) {
  40745. this.removeCallback(names, callback, context);
  40746. }
  40747. else {
  40748. this.removeAllCallbacks(names);
  40749. }
  40750. };
  40751. CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
  40752. apply(names, function (name) {
  40753. this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
  40754. return (callback && callback !== binding.fn) ||
  40755. (context && context !== binding.context);
  40756. });
  40757. if (this._callbacks[name].length === 0) {
  40758. delete this._callbacks[name];
  40759. }
  40760. }, this);
  40761. };
  40762. CallbackRegistry.prototype.removeAllCallbacks = function (names) {
  40763. apply(names, function (name) {
  40764. delete this._callbacks[name];
  40765. }, this);
  40766. };
  40767. return CallbackRegistry;
  40768. }());
  40769. /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
  40770. function prefix(name) {
  40771. return "_" + name;
  40772. }
  40773. // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
  40774. var dispatcher_Dispatcher = (function () {
  40775. function Dispatcher(failThrough) {
  40776. this.callbacks = new callback_registry();
  40777. this.global_callbacks = [];
  40778. this.failThrough = failThrough;
  40779. }
  40780. Dispatcher.prototype.bind = function (eventName, callback, context) {
  40781. this.callbacks.add(eventName, callback, context);
  40782. return this;
  40783. };
  40784. Dispatcher.prototype.bind_global = function (callback) {
  40785. this.global_callbacks.push(callback);
  40786. return this;
  40787. };
  40788. Dispatcher.prototype.unbind = function (eventName, callback, context) {
  40789. this.callbacks.remove(eventName, callback, context);
  40790. return this;
  40791. };
  40792. Dispatcher.prototype.unbind_global = function (callback) {
  40793. if (!callback) {
  40794. this.global_callbacks = [];
  40795. return this;
  40796. }
  40797. this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
  40798. return this;
  40799. };
  40800. Dispatcher.prototype.unbind_all = function () {
  40801. this.unbind();
  40802. this.unbind_global();
  40803. return this;
  40804. };
  40805. Dispatcher.prototype.emit = function (eventName, data, metadata) {
  40806. for (var i = 0; i < this.global_callbacks.length; i++) {
  40807. this.global_callbacks[i](eventName, data);
  40808. }
  40809. var callbacks = this.callbacks.get(eventName);
  40810. var args = [];
  40811. if (metadata) {
  40812. args.push(data, metadata);
  40813. }
  40814. else if (data) {
  40815. args.push(data);
  40816. }
  40817. if (callbacks && callbacks.length > 0) {
  40818. for (var i = 0; i < callbacks.length; i++) {
  40819. callbacks[i].fn.apply(callbacks[i].context || window, args);
  40820. }
  40821. }
  40822. else if (this.failThrough) {
  40823. this.failThrough(eventName, data);
  40824. }
  40825. return this;
  40826. };
  40827. return Dispatcher;
  40828. }());
  40829. /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
  40830. // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
  40831. var transport_connection_extends = (undefined && undefined.__extends) || (function () {
  40832. var extendStatics = function (d, b) {
  40833. extendStatics = Object.setPrototypeOf ||
  40834. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40835. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40836. return extendStatics(d, b);
  40837. };
  40838. return function (d, b) {
  40839. extendStatics(d, b);
  40840. function __() { this.constructor = d; }
  40841. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40842. };
  40843. })();
  40844. var transport_connection_TransportConnection = (function (_super) {
  40845. transport_connection_extends(TransportConnection, _super);
  40846. function TransportConnection(hooks, name, priority, key, options) {
  40847. var _this = _super.call(this) || this;
  40848. _this.initialize = runtime.transportConnectionInitializer;
  40849. _this.hooks = hooks;
  40850. _this.name = name;
  40851. _this.priority = priority;
  40852. _this.key = key;
  40853. _this.options = options;
  40854. _this.state = "new";
  40855. _this.timeline = options.timeline;
  40856. _this.activityTimeout = options.activityTimeout;
  40857. _this.id = _this.timeline.generateUniqueID();
  40858. return _this;
  40859. }
  40860. TransportConnection.prototype.handlesActivityChecks = function () {
  40861. return Boolean(this.hooks.handlesActivityChecks);
  40862. };
  40863. TransportConnection.prototype.supportsPing = function () {
  40864. return Boolean(this.hooks.supportsPing);
  40865. };
  40866. TransportConnection.prototype.connect = function () {
  40867. var _this = this;
  40868. if (this.socket || this.state !== "initialized") {
  40869. return false;
  40870. }
  40871. var url = this.hooks.urls.getInitial(this.key, this.options);
  40872. try {
  40873. this.socket = this.hooks.getSocket(url, this.options);
  40874. }
  40875. catch (e) {
  40876. util.defer(function () {
  40877. _this.onError(e);
  40878. _this.changeState("closed");
  40879. });
  40880. return false;
  40881. }
  40882. this.bindListeners();
  40883. logger.debug("Connecting", { transport: this.name, url: url });
  40884. this.changeState("connecting");
  40885. return true;
  40886. };
  40887. TransportConnection.prototype.close = function () {
  40888. if (this.socket) {
  40889. this.socket.close();
  40890. return true;
  40891. }
  40892. else {
  40893. return false;
  40894. }
  40895. };
  40896. TransportConnection.prototype.send = function (data) {
  40897. var _this = this;
  40898. if (this.state === "open") {
  40899. util.defer(function () {
  40900. if (_this.socket) {
  40901. _this.socket.send(data);
  40902. }
  40903. });
  40904. return true;
  40905. }
  40906. else {
  40907. return false;
  40908. }
  40909. };
  40910. TransportConnection.prototype.ping = function () {
  40911. if (this.state === "open" && this.supportsPing()) {
  40912. this.socket.ping();
  40913. }
  40914. };
  40915. TransportConnection.prototype.onOpen = function () {
  40916. if (this.hooks.beforeOpen) {
  40917. this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
  40918. }
  40919. this.changeState("open");
  40920. this.socket.onopen = undefined;
  40921. };
  40922. TransportConnection.prototype.onError = function (error) {
  40923. this.emit("error", { type: 'WebSocketError', error: error });
  40924. this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
  40925. };
  40926. TransportConnection.prototype.onClose = function (closeEvent) {
  40927. if (closeEvent) {
  40928. this.changeState("closed", {
  40929. code: closeEvent.code,
  40930. reason: closeEvent.reason,
  40931. wasClean: closeEvent.wasClean
  40932. });
  40933. }
  40934. else {
  40935. this.changeState("closed");
  40936. }
  40937. this.unbindListeners();
  40938. this.socket = undefined;
  40939. };
  40940. TransportConnection.prototype.onMessage = function (message) {
  40941. this.emit("message", message);
  40942. };
  40943. TransportConnection.prototype.onActivity = function () {
  40944. this.emit("activity");
  40945. };
  40946. TransportConnection.prototype.bindListeners = function () {
  40947. var _this = this;
  40948. this.socket.onopen = function () {
  40949. _this.onOpen();
  40950. };
  40951. this.socket.onerror = function (error) {
  40952. _this.onError(error);
  40953. };
  40954. this.socket.onclose = function (closeEvent) {
  40955. _this.onClose(closeEvent);
  40956. };
  40957. this.socket.onmessage = function (message) {
  40958. _this.onMessage(message);
  40959. };
  40960. if (this.supportsPing()) {
  40961. this.socket.onactivity = function () { _this.onActivity(); };
  40962. }
  40963. };
  40964. TransportConnection.prototype.unbindListeners = function () {
  40965. if (this.socket) {
  40966. this.socket.onopen = undefined;
  40967. this.socket.onerror = undefined;
  40968. this.socket.onclose = undefined;
  40969. this.socket.onmessage = undefined;
  40970. if (this.supportsPing()) {
  40971. this.socket.onactivity = undefined;
  40972. }
  40973. }
  40974. };
  40975. TransportConnection.prototype.changeState = function (state, params) {
  40976. this.state = state;
  40977. this.timeline.info(this.buildTimelineMessage({
  40978. state: state,
  40979. params: params
  40980. }));
  40981. this.emit(state, params);
  40982. };
  40983. TransportConnection.prototype.buildTimelineMessage = function (message) {
  40984. return extend({ cid: this.id }, message);
  40985. };
  40986. return TransportConnection;
  40987. }(dispatcher));
  40988. /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
  40989. // CONCATENATED MODULE: ./src/core/transports/transport.ts
  40990. var transport_Transport = (function () {
  40991. function Transport(hooks) {
  40992. this.hooks = hooks;
  40993. }
  40994. Transport.prototype.isSupported = function (environment) {
  40995. return this.hooks.isSupported(environment);
  40996. };
  40997. Transport.prototype.createConnection = function (name, priority, key, options) {
  40998. return new transport_connection(this.hooks, name, priority, key, options);
  40999. };
  41000. return Transport;
  41001. }());
  41002. /* harmony default export */ var transports_transport = (transport_Transport);
  41003. // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
  41004. var WSTransport = new transports_transport({
  41005. urls: ws,
  41006. handlesActivityChecks: false,
  41007. supportsPing: false,
  41008. isInitialized: function () {
  41009. return Boolean(runtime.getWebSocketAPI());
  41010. },
  41011. isSupported: function () {
  41012. return Boolean(runtime.getWebSocketAPI());
  41013. },
  41014. getSocket: function (url) {
  41015. return runtime.createWebSocket(url);
  41016. }
  41017. });
  41018. var httpConfiguration = {
  41019. urls: http,
  41020. handlesActivityChecks: false,
  41021. supportsPing: true,
  41022. isInitialized: function () {
  41023. return true;
  41024. }
  41025. };
  41026. var streamingConfiguration = extend({ getSocket: function (url) {
  41027. return runtime.HTTPFactory.createStreamingSocket(url);
  41028. }
  41029. }, httpConfiguration);
  41030. var pollingConfiguration = extend({ getSocket: function (url) {
  41031. return runtime.HTTPFactory.createPollingSocket(url);
  41032. }
  41033. }, httpConfiguration);
  41034. var xhrConfiguration = {
  41035. isSupported: function () {
  41036. return runtime.isXHRSupported();
  41037. }
  41038. };
  41039. var XHRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xhrConfiguration));
  41040. var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
  41041. var Transports = {
  41042. ws: WSTransport,
  41043. xhr_streaming: XHRStreamingTransport,
  41044. xhr_polling: XHRPollingTransport
  41045. };
  41046. /* harmony default export */ var transports = (Transports);
  41047. // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
  41048. var SockJSTransport = new transports_transport({
  41049. file: "sockjs",
  41050. urls: sockjs,
  41051. handlesActivityChecks: true,
  41052. supportsPing: false,
  41053. isSupported: function () {
  41054. return true;
  41055. },
  41056. isInitialized: function () {
  41057. return window.SockJS !== undefined;
  41058. },
  41059. getSocket: function (url, options) {
  41060. return new window.SockJS(url, null, {
  41061. js_path: Dependencies.getPath("sockjs", {
  41062. useTLS: options.useTLS
  41063. }),
  41064. ignore_null_origin: options.ignoreNullOrigin
  41065. });
  41066. },
  41067. beforeOpen: function (socket, path) {
  41068. socket.send(JSON.stringify({
  41069. path: path
  41070. }));
  41071. }
  41072. });
  41073. var xdrConfiguration = {
  41074. isSupported: function (environment) {
  41075. var yes = runtime.isXDRSupported(environment.useTLS);
  41076. return yes;
  41077. }
  41078. };
  41079. var XDRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xdrConfiguration));
  41080. var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
  41081. transports.xdr_streaming = XDRStreamingTransport;
  41082. transports.xdr_polling = XDRPollingTransport;
  41083. transports.sockjs = SockJSTransport;
  41084. /* harmony default export */ var transports_transports = (transports);
  41085. // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
  41086. var net_info_extends = (undefined && undefined.__extends) || (function () {
  41087. var extendStatics = function (d, b) {
  41088. extendStatics = Object.setPrototypeOf ||
  41089. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41090. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41091. return extendStatics(d, b);
  41092. };
  41093. return function (d, b) {
  41094. extendStatics(d, b);
  41095. function __() { this.constructor = d; }
  41096. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41097. };
  41098. })();
  41099. var NetInfo = (function (_super) {
  41100. net_info_extends(NetInfo, _super);
  41101. function NetInfo() {
  41102. var _this = _super.call(this) || this;
  41103. var self = _this;
  41104. if (window.addEventListener !== undefined) {
  41105. window.addEventListener("online", function () {
  41106. self.emit('online');
  41107. }, false);
  41108. window.addEventListener("offline", function () {
  41109. self.emit('offline');
  41110. }, false);
  41111. }
  41112. return _this;
  41113. }
  41114. NetInfo.prototype.isOnline = function () {
  41115. if (window.navigator.onLine === undefined) {
  41116. return true;
  41117. }
  41118. else {
  41119. return window.navigator.onLine;
  41120. }
  41121. };
  41122. return NetInfo;
  41123. }(dispatcher));
  41124. var net_info_Network = new NetInfo();
  41125. // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
  41126. var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
  41127. function AssistantToTheTransportManager(manager, transport, options) {
  41128. this.manager = manager;
  41129. this.transport = transport;
  41130. this.minPingDelay = options.minPingDelay;
  41131. this.maxPingDelay = options.maxPingDelay;
  41132. this.pingDelay = undefined;
  41133. }
  41134. AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
  41135. var _this = this;
  41136. options = extend({}, options, {
  41137. activityTimeout: this.pingDelay
  41138. });
  41139. var connection = this.transport.createConnection(name, priority, key, options);
  41140. var openTimestamp = null;
  41141. var onOpen = function () {
  41142. connection.unbind("open", onOpen);
  41143. connection.bind("closed", onClosed);
  41144. openTimestamp = util.now();
  41145. };
  41146. var onClosed = function (closeEvent) {
  41147. connection.unbind("closed", onClosed);
  41148. if (closeEvent.code === 1002 || closeEvent.code === 1003) {
  41149. _this.manager.reportDeath();
  41150. }
  41151. else if (!closeEvent.wasClean && openTimestamp) {
  41152. var lifespan = util.now() - openTimestamp;
  41153. if (lifespan < 2 * _this.maxPingDelay) {
  41154. _this.manager.reportDeath();
  41155. _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
  41156. }
  41157. }
  41158. };
  41159. connection.bind("open", onOpen);
  41160. return connection;
  41161. };
  41162. AssistantToTheTransportManager.prototype.isSupported = function (environment) {
  41163. return this.manager.isAlive() && this.transport.isSupported(environment);
  41164. };
  41165. return AssistantToTheTransportManager;
  41166. }());
  41167. /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
  41168. // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
  41169. var Protocol = {
  41170. decodeMessage: function (messageEvent) {
  41171. try {
  41172. var messageData = JSON.parse(messageEvent.data);
  41173. var pusherEventData = messageData.data;
  41174. if (typeof pusherEventData === 'string') {
  41175. try {
  41176. pusherEventData = JSON.parse(messageData.data);
  41177. }
  41178. catch (e) { }
  41179. }
  41180. var pusherEvent = {
  41181. event: messageData.event,
  41182. channel: messageData.channel,
  41183. data: pusherEventData,
  41184. };
  41185. if (messageData.user_id) {
  41186. pusherEvent.user_id = messageData.user_id;
  41187. }
  41188. return pusherEvent;
  41189. }
  41190. catch (e) {
  41191. throw { type: 'MessageParseError', error: e, data: messageEvent.data };
  41192. }
  41193. },
  41194. encodeMessage: function (event) {
  41195. return JSON.stringify(event);
  41196. },
  41197. processHandshake: function (messageEvent) {
  41198. var message = Protocol.decodeMessage(messageEvent);
  41199. if (message.event === "pusher:connection_established") {
  41200. if (!message.data.activity_timeout) {
  41201. throw "No activity timeout specified in handshake";
  41202. }
  41203. return {
  41204. action: "connected",
  41205. id: message.data.socket_id,
  41206. activityTimeout: message.data.activity_timeout * 1000
  41207. };
  41208. }
  41209. else if (message.event === "pusher:error") {
  41210. return {
  41211. action: this.getCloseAction(message.data),
  41212. error: this.getCloseError(message.data)
  41213. };
  41214. }
  41215. else {
  41216. throw "Invalid handshake";
  41217. }
  41218. },
  41219. getCloseAction: function (closeEvent) {
  41220. if (closeEvent.code < 4000) {
  41221. if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
  41222. return "backoff";
  41223. }
  41224. else {
  41225. return null;
  41226. }
  41227. }
  41228. else if (closeEvent.code === 4000) {
  41229. return "tls_only";
  41230. }
  41231. else if (closeEvent.code < 4100) {
  41232. return "refused";
  41233. }
  41234. else if (closeEvent.code < 4200) {
  41235. return "backoff";
  41236. }
  41237. else if (closeEvent.code < 4300) {
  41238. return "retry";
  41239. }
  41240. else {
  41241. return "refused";
  41242. }
  41243. },
  41244. getCloseError: function (closeEvent) {
  41245. if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
  41246. return {
  41247. type: 'PusherError',
  41248. data: {
  41249. code: closeEvent.code,
  41250. message: closeEvent.reason || closeEvent.message
  41251. }
  41252. };
  41253. }
  41254. else {
  41255. return null;
  41256. }
  41257. }
  41258. };
  41259. /* harmony default export */ var protocol_protocol = (Protocol);
  41260. // CONCATENATED MODULE: ./src/core/connection/connection.ts
  41261. var connection_extends = (undefined && undefined.__extends) || (function () {
  41262. var extendStatics = function (d, b) {
  41263. extendStatics = Object.setPrototypeOf ||
  41264. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41265. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41266. return extendStatics(d, b);
  41267. };
  41268. return function (d, b) {
  41269. extendStatics(d, b);
  41270. function __() { this.constructor = d; }
  41271. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41272. };
  41273. })();
  41274. var connection_Connection = (function (_super) {
  41275. connection_extends(Connection, _super);
  41276. function Connection(id, transport) {
  41277. var _this = _super.call(this) || this;
  41278. _this.id = id;
  41279. _this.transport = transport;
  41280. _this.activityTimeout = transport.activityTimeout;
  41281. _this.bindListeners();
  41282. return _this;
  41283. }
  41284. Connection.prototype.handlesActivityChecks = function () {
  41285. return this.transport.handlesActivityChecks();
  41286. };
  41287. Connection.prototype.send = function (data) {
  41288. return this.transport.send(data);
  41289. };
  41290. Connection.prototype.send_event = function (name, data, channel) {
  41291. var event = { event: name, data: data };
  41292. if (channel) {
  41293. event.channel = channel;
  41294. }
  41295. logger.debug('Event sent', event);
  41296. return this.send(protocol_protocol.encodeMessage(event));
  41297. };
  41298. Connection.prototype.ping = function () {
  41299. if (this.transport.supportsPing()) {
  41300. this.transport.ping();
  41301. }
  41302. else {
  41303. this.send_event('pusher:ping', {});
  41304. }
  41305. };
  41306. Connection.prototype.close = function () {
  41307. this.transport.close();
  41308. };
  41309. Connection.prototype.bindListeners = function () {
  41310. var _this = this;
  41311. var listeners = {
  41312. message: function (messageEvent) {
  41313. var pusherEvent;
  41314. try {
  41315. pusherEvent = protocol_protocol.decodeMessage(messageEvent);
  41316. }
  41317. catch (e) {
  41318. _this.emit('error', {
  41319. type: 'MessageParseError',
  41320. error: e,
  41321. data: messageEvent.data
  41322. });
  41323. }
  41324. if (pusherEvent !== undefined) {
  41325. logger.debug('Event recd', pusherEvent);
  41326. switch (pusherEvent.event) {
  41327. case 'pusher:error':
  41328. _this.emit('error', { type: 'PusherError', data: pusherEvent.data });
  41329. break;
  41330. case 'pusher:ping':
  41331. _this.emit("ping");
  41332. break;
  41333. case 'pusher:pong':
  41334. _this.emit("pong");
  41335. break;
  41336. }
  41337. _this.emit('message', pusherEvent);
  41338. }
  41339. },
  41340. activity: function () {
  41341. _this.emit("activity");
  41342. },
  41343. error: function (error) {
  41344. _this.emit("error", { type: "WebSocketError", error: error });
  41345. },
  41346. closed: function (closeEvent) {
  41347. unbindListeners();
  41348. if (closeEvent && closeEvent.code) {
  41349. _this.handleCloseEvent(closeEvent);
  41350. }
  41351. _this.transport = null;
  41352. _this.emit("closed");
  41353. }
  41354. };
  41355. var unbindListeners = function () {
  41356. objectApply(listeners, function (listener, event) {
  41357. _this.transport.unbind(event, listener);
  41358. });
  41359. };
  41360. objectApply(listeners, function (listener, event) {
  41361. _this.transport.bind(event, listener);
  41362. });
  41363. };
  41364. Connection.prototype.handleCloseEvent = function (closeEvent) {
  41365. var action = protocol_protocol.getCloseAction(closeEvent);
  41366. var error = protocol_protocol.getCloseError(closeEvent);
  41367. if (error) {
  41368. this.emit('error', error);
  41369. }
  41370. if (action) {
  41371. this.emit(action, { action: action, error: error });
  41372. }
  41373. };
  41374. return Connection;
  41375. }(dispatcher));
  41376. /* harmony default export */ var connection_connection = (connection_Connection);
  41377. // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
  41378. var handshake_Handshake = (function () {
  41379. function Handshake(transport, callback) {
  41380. this.transport = transport;
  41381. this.callback = callback;
  41382. this.bindListeners();
  41383. }
  41384. Handshake.prototype.close = function () {
  41385. this.unbindListeners();
  41386. this.transport.close();
  41387. };
  41388. Handshake.prototype.bindListeners = function () {
  41389. var _this = this;
  41390. this.onMessage = function (m) {
  41391. _this.unbindListeners();
  41392. var result;
  41393. try {
  41394. result = protocol_protocol.processHandshake(m);
  41395. }
  41396. catch (e) {
  41397. _this.finish("error", { error: e });
  41398. _this.transport.close();
  41399. return;
  41400. }
  41401. if (result.action === "connected") {
  41402. _this.finish("connected", {
  41403. connection: new connection_connection(result.id, _this.transport),
  41404. activityTimeout: result.activityTimeout
  41405. });
  41406. }
  41407. else {
  41408. _this.finish(result.action, { error: result.error });
  41409. _this.transport.close();
  41410. }
  41411. };
  41412. this.onClosed = function (closeEvent) {
  41413. _this.unbindListeners();
  41414. var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
  41415. var error = protocol_protocol.getCloseError(closeEvent);
  41416. _this.finish(action, { error: error });
  41417. };
  41418. this.transport.bind("message", this.onMessage);
  41419. this.transport.bind("closed", this.onClosed);
  41420. };
  41421. Handshake.prototype.unbindListeners = function () {
  41422. this.transport.unbind("message", this.onMessage);
  41423. this.transport.unbind("closed", this.onClosed);
  41424. };
  41425. Handshake.prototype.finish = function (action, params) {
  41426. this.callback(extend({ transport: this.transport, action: action }, params));
  41427. };
  41428. return Handshake;
  41429. }());
  41430. /* harmony default export */ var connection_handshake = (handshake_Handshake);
  41431. // CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
  41432. var pusher_authorizer_PusherAuthorizer = (function () {
  41433. function PusherAuthorizer(channel, options) {
  41434. this.channel = channel;
  41435. var authTransport = options.authTransport;
  41436. if (typeof runtime.getAuthorizers()[authTransport] === "undefined") {
  41437. throw "'" + authTransport + "' is not a recognized auth transport";
  41438. }
  41439. this.type = authTransport;
  41440. this.options = options;
  41441. this.authOptions = (options || {}).auth || {};
  41442. }
  41443. PusherAuthorizer.prototype.composeQuery = function (socketId) {
  41444. var query = 'socket_id=' + encodeURIComponent(socketId) +
  41445. '&channel_name=' + encodeURIComponent(this.channel.name);
  41446. for (var i in this.authOptions.params) {
  41447. query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]);
  41448. }
  41449. return query;
  41450. };
  41451. PusherAuthorizer.prototype.authorize = function (socketId, callback) {
  41452. PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers();
  41453. return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
  41454. };
  41455. return PusherAuthorizer;
  41456. }());
  41457. /* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
  41458. // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
  41459. var timeline_sender_TimelineSender = (function () {
  41460. function TimelineSender(timeline, options) {
  41461. this.timeline = timeline;
  41462. this.options = options || {};
  41463. }
  41464. TimelineSender.prototype.send = function (useTLS, callback) {
  41465. if (this.timeline.isEmpty()) {
  41466. return;
  41467. }
  41468. this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
  41469. };
  41470. return TimelineSender;
  41471. }());
  41472. /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
  41473. // CONCATENATED MODULE: ./src/core/errors.ts
  41474. var errors_extends = (undefined && undefined.__extends) || (function () {
  41475. var extendStatics = function (d, b) {
  41476. extendStatics = Object.setPrototypeOf ||
  41477. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41478. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41479. return extendStatics(d, b);
  41480. };
  41481. return function (d, b) {
  41482. extendStatics(d, b);
  41483. function __() { this.constructor = d; }
  41484. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41485. };
  41486. })();
  41487. var BadEventName = (function (_super) {
  41488. errors_extends(BadEventName, _super);
  41489. function BadEventName(msg) {
  41490. var _newTarget = this.constructor;
  41491. var _this = _super.call(this, msg) || this;
  41492. Object.setPrototypeOf(_this, _newTarget.prototype);
  41493. return _this;
  41494. }
  41495. return BadEventName;
  41496. }(Error));
  41497. var RequestTimedOut = (function (_super) {
  41498. errors_extends(RequestTimedOut, _super);
  41499. function RequestTimedOut(msg) {
  41500. var _newTarget = this.constructor;
  41501. var _this = _super.call(this, msg) || this;
  41502. Object.setPrototypeOf(_this, _newTarget.prototype);
  41503. return _this;
  41504. }
  41505. return RequestTimedOut;
  41506. }(Error));
  41507. var TransportPriorityTooLow = (function (_super) {
  41508. errors_extends(TransportPriorityTooLow, _super);
  41509. function TransportPriorityTooLow(msg) {
  41510. var _newTarget = this.constructor;
  41511. var _this = _super.call(this, msg) || this;
  41512. Object.setPrototypeOf(_this, _newTarget.prototype);
  41513. return _this;
  41514. }
  41515. return TransportPriorityTooLow;
  41516. }(Error));
  41517. var TransportClosed = (function (_super) {
  41518. errors_extends(TransportClosed, _super);
  41519. function TransportClosed(msg) {
  41520. var _newTarget = this.constructor;
  41521. var _this = _super.call(this, msg) || this;
  41522. Object.setPrototypeOf(_this, _newTarget.prototype);
  41523. return _this;
  41524. }
  41525. return TransportClosed;
  41526. }(Error));
  41527. var UnsupportedFeature = (function (_super) {
  41528. errors_extends(UnsupportedFeature, _super);
  41529. function UnsupportedFeature(msg) {
  41530. var _newTarget = this.constructor;
  41531. var _this = _super.call(this, msg) || this;
  41532. Object.setPrototypeOf(_this, _newTarget.prototype);
  41533. return _this;
  41534. }
  41535. return UnsupportedFeature;
  41536. }(Error));
  41537. var UnsupportedTransport = (function (_super) {
  41538. errors_extends(UnsupportedTransport, _super);
  41539. function UnsupportedTransport(msg) {
  41540. var _newTarget = this.constructor;
  41541. var _this = _super.call(this, msg) || this;
  41542. Object.setPrototypeOf(_this, _newTarget.prototype);
  41543. return _this;
  41544. }
  41545. return UnsupportedTransport;
  41546. }(Error));
  41547. var UnsupportedStrategy = (function (_super) {
  41548. errors_extends(UnsupportedStrategy, _super);
  41549. function UnsupportedStrategy(msg) {
  41550. var _newTarget = this.constructor;
  41551. var _this = _super.call(this, msg) || this;
  41552. Object.setPrototypeOf(_this, _newTarget.prototype);
  41553. return _this;
  41554. }
  41555. return UnsupportedStrategy;
  41556. }(Error));
  41557. // CONCATENATED MODULE: ./src/core/channels/channel.ts
  41558. var channel_extends = (undefined && undefined.__extends) || (function () {
  41559. var extendStatics = function (d, b) {
  41560. extendStatics = Object.setPrototypeOf ||
  41561. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41562. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41563. return extendStatics(d, b);
  41564. };
  41565. return function (d, b) {
  41566. extendStatics(d, b);
  41567. function __() { this.constructor = d; }
  41568. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41569. };
  41570. })();
  41571. var channel_Channel = (function (_super) {
  41572. channel_extends(Channel, _super);
  41573. function Channel(name, pusher) {
  41574. var _this = _super.call(this, function (event, data) {
  41575. logger.debug('No callbacks on ' + name + ' for ' + event);
  41576. }) || this;
  41577. _this.name = name;
  41578. _this.pusher = pusher;
  41579. _this.subscribed = false;
  41580. _this.subscriptionPending = false;
  41581. _this.subscriptionCancelled = false;
  41582. return _this;
  41583. }
  41584. Channel.prototype.authorize = function (socketId, callback) {
  41585. return callback(false, {});
  41586. };
  41587. Channel.prototype.trigger = function (event, data) {
  41588. if (event.indexOf("client-") !== 0) {
  41589. throw new BadEventName("Event '" + event + "' does not start with 'client-'");
  41590. }
  41591. if (!this.subscribed) {
  41592. var suffix = url_store.buildLogSuffix("triggeringClientEvents");
  41593. logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
  41594. }
  41595. return this.pusher.send_event(event, data, this.name);
  41596. };
  41597. Channel.prototype.disconnect = function () {
  41598. this.subscribed = false;
  41599. this.subscriptionPending = false;
  41600. };
  41601. Channel.prototype.handleEvent = function (event) {
  41602. var eventName = event.event;
  41603. var data = event.data;
  41604. if (eventName === "pusher_internal:subscription_succeeded") {
  41605. this.handleSubscriptionSucceededEvent(event);
  41606. }
  41607. else if (eventName.indexOf("pusher_internal:") !== 0) {
  41608. var metadata = {};
  41609. this.emit(eventName, data, metadata);
  41610. }
  41611. };
  41612. Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
  41613. this.subscriptionPending = false;
  41614. this.subscribed = true;
  41615. if (this.subscriptionCancelled) {
  41616. this.pusher.unsubscribe(this.name);
  41617. }
  41618. else {
  41619. this.emit("pusher:subscription_succeeded", event.data);
  41620. }
  41621. };
  41622. Channel.prototype.subscribe = function () {
  41623. var _this = this;
  41624. if (this.subscribed) {
  41625. return;
  41626. }
  41627. this.subscriptionPending = true;
  41628. this.subscriptionCancelled = false;
  41629. this.authorize(this.pusher.connection.socket_id, function (error, data) {
  41630. if (error) {
  41631. logger.error(data);
  41632. _this.emit('pusher:subscription_error', data);
  41633. }
  41634. else {
  41635. _this.pusher.send_event('pusher:subscribe', {
  41636. auth: data.auth,
  41637. channel_data: data.channel_data,
  41638. channel: _this.name
  41639. });
  41640. }
  41641. });
  41642. };
  41643. Channel.prototype.unsubscribe = function () {
  41644. this.subscribed = false;
  41645. this.pusher.send_event('pusher:unsubscribe', {
  41646. channel: this.name
  41647. });
  41648. };
  41649. Channel.prototype.cancelSubscription = function () {
  41650. this.subscriptionCancelled = true;
  41651. };
  41652. Channel.prototype.reinstateSubscription = function () {
  41653. this.subscriptionCancelled = false;
  41654. };
  41655. return Channel;
  41656. }(dispatcher));
  41657. /* harmony default export */ var channels_channel = (channel_Channel);
  41658. // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
  41659. var private_channel_extends = (undefined && undefined.__extends) || (function () {
  41660. var extendStatics = function (d, b) {
  41661. extendStatics = Object.setPrototypeOf ||
  41662. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41663. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41664. return extendStatics(d, b);
  41665. };
  41666. return function (d, b) {
  41667. extendStatics(d, b);
  41668. function __() { this.constructor = d; }
  41669. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41670. };
  41671. })();
  41672. var private_channel_PrivateChannel = (function (_super) {
  41673. private_channel_extends(PrivateChannel, _super);
  41674. function PrivateChannel() {
  41675. return _super !== null && _super.apply(this, arguments) || this;
  41676. }
  41677. PrivateChannel.prototype.authorize = function (socketId, callback) {
  41678. var authorizer = factory.createAuthorizer(this, this.pusher.config);
  41679. return authorizer.authorize(socketId, callback);
  41680. };
  41681. return PrivateChannel;
  41682. }(channels_channel));
  41683. /* harmony default export */ var private_channel = (private_channel_PrivateChannel);
  41684. // CONCATENATED MODULE: ./src/core/channels/members.ts
  41685. var members_Members = (function () {
  41686. function Members() {
  41687. this.reset();
  41688. }
  41689. Members.prototype.get = function (id) {
  41690. if (Object.prototype.hasOwnProperty.call(this.members, id)) {
  41691. return {
  41692. id: id,
  41693. info: this.members[id]
  41694. };
  41695. }
  41696. else {
  41697. return null;
  41698. }
  41699. };
  41700. Members.prototype.each = function (callback) {
  41701. var _this = this;
  41702. objectApply(this.members, function (member, id) {
  41703. callback(_this.get(id));
  41704. });
  41705. };
  41706. Members.prototype.setMyID = function (id) {
  41707. this.myID = id;
  41708. };
  41709. Members.prototype.onSubscription = function (subscriptionData) {
  41710. this.members = subscriptionData.presence.hash;
  41711. this.count = subscriptionData.presence.count;
  41712. this.me = this.get(this.myID);
  41713. };
  41714. Members.prototype.addMember = function (memberData) {
  41715. if (this.get(memberData.user_id) === null) {
  41716. this.count++;
  41717. }
  41718. this.members[memberData.user_id] = memberData.user_info;
  41719. return this.get(memberData.user_id);
  41720. };
  41721. Members.prototype.removeMember = function (memberData) {
  41722. var member = this.get(memberData.user_id);
  41723. if (member) {
  41724. delete this.members[memberData.user_id];
  41725. this.count--;
  41726. }
  41727. return member;
  41728. };
  41729. Members.prototype.reset = function () {
  41730. this.members = {};
  41731. this.count = 0;
  41732. this.myID = null;
  41733. this.me = null;
  41734. };
  41735. return Members;
  41736. }());
  41737. /* harmony default export */ var members = (members_Members);
  41738. // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
  41739. var presence_channel_extends = (undefined && undefined.__extends) || (function () {
  41740. var extendStatics = function (d, b) {
  41741. extendStatics = Object.setPrototypeOf ||
  41742. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41743. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41744. return extendStatics(d, b);
  41745. };
  41746. return function (d, b) {
  41747. extendStatics(d, b);
  41748. function __() { this.constructor = d; }
  41749. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41750. };
  41751. })();
  41752. var presence_channel_PresenceChannel = (function (_super) {
  41753. presence_channel_extends(PresenceChannel, _super);
  41754. function PresenceChannel(name, pusher) {
  41755. var _this = _super.call(this, name, pusher) || this;
  41756. _this.members = new members();
  41757. return _this;
  41758. }
  41759. PresenceChannel.prototype.authorize = function (socketId, callback) {
  41760. var _this = this;
  41761. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  41762. if (!error) {
  41763. if (authData.channel_data === undefined) {
  41764. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  41765. logger.error("Invalid auth response for channel '" + _this.name + "'," +
  41766. ("expected 'channel_data' field. " + suffix));
  41767. callback("Invalid auth response");
  41768. return;
  41769. }
  41770. var channelData = JSON.parse(authData.channel_data);
  41771. _this.members.setMyID(channelData.user_id);
  41772. }
  41773. callback(error, authData);
  41774. });
  41775. };
  41776. PresenceChannel.prototype.handleEvent = function (event) {
  41777. var eventName = event.event;
  41778. if (eventName.indexOf("pusher_internal:") === 0) {
  41779. this.handleInternalEvent(event);
  41780. }
  41781. else {
  41782. var data = event.data;
  41783. var metadata = {};
  41784. if (event.user_id) {
  41785. metadata.user_id = event.user_id;
  41786. }
  41787. this.emit(eventName, data, metadata);
  41788. }
  41789. };
  41790. PresenceChannel.prototype.handleInternalEvent = function (event) {
  41791. var eventName = event.event;
  41792. var data = event.data;
  41793. switch (eventName) {
  41794. case "pusher_internal:subscription_succeeded":
  41795. this.handleSubscriptionSucceededEvent(event);
  41796. break;
  41797. case "pusher_internal:member_added":
  41798. var addedMember = this.members.addMember(data);
  41799. this.emit('pusher:member_added', addedMember);
  41800. break;
  41801. case "pusher_internal:member_removed":
  41802. var removedMember = this.members.removeMember(data);
  41803. if (removedMember) {
  41804. this.emit('pusher:member_removed', removedMember);
  41805. }
  41806. break;
  41807. }
  41808. };
  41809. PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
  41810. this.subscriptionPending = false;
  41811. this.subscribed = true;
  41812. if (this.subscriptionCancelled) {
  41813. this.pusher.unsubscribe(this.name);
  41814. }
  41815. else {
  41816. this.members.onSubscription(event.data);
  41817. this.emit("pusher:subscription_succeeded", this.members);
  41818. }
  41819. };
  41820. PresenceChannel.prototype.disconnect = function () {
  41821. this.members.reset();
  41822. _super.prototype.disconnect.call(this);
  41823. };
  41824. return PresenceChannel;
  41825. }(private_channel));
  41826. /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
  41827. // EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
  41828. var nacl_fast = __webpack_require__(0);
  41829. // EXTERNAL MODULE: ./node_modules/tweetnacl-util/nacl-util.js
  41830. var nacl_util = __webpack_require__(1);
  41831. // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
  41832. var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
  41833. var extendStatics = function (d, b) {
  41834. extendStatics = Object.setPrototypeOf ||
  41835. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41836. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41837. return extendStatics(d, b);
  41838. };
  41839. return function (d, b) {
  41840. extendStatics(d, b);
  41841. function __() { this.constructor = d; }
  41842. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41843. };
  41844. })();
  41845. var encrypted_channel_EncryptedChannel = (function (_super) {
  41846. encrypted_channel_extends(EncryptedChannel, _super);
  41847. function EncryptedChannel() {
  41848. var _this = _super !== null && _super.apply(this, arguments) || this;
  41849. _this.key = null;
  41850. return _this;
  41851. }
  41852. EncryptedChannel.prototype.authorize = function (socketId, callback) {
  41853. var _this = this;
  41854. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  41855. if (error) {
  41856. callback(true, authData);
  41857. return;
  41858. }
  41859. var sharedSecret = authData["shared_secret"];
  41860. if (!sharedSecret) {
  41861. var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
  41862. callback(true, errorMsg);
  41863. return;
  41864. }
  41865. _this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
  41866. delete authData["shared_secret"];
  41867. callback(false, authData);
  41868. });
  41869. };
  41870. EncryptedChannel.prototype.trigger = function (event, data) {
  41871. throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
  41872. };
  41873. EncryptedChannel.prototype.handleEvent = function (event) {
  41874. var eventName = event.event;
  41875. var data = event.data;
  41876. if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
  41877. _super.prototype.handleEvent.call(this, event);
  41878. return;
  41879. }
  41880. this.handleEncryptedEvent(eventName, data);
  41881. };
  41882. EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
  41883. var _this = this;
  41884. if (!this.key) {
  41885. logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
  41886. return;
  41887. }
  41888. if (!data.ciphertext || !data.nonce) {
  41889. logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
  41890. return;
  41891. }
  41892. var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
  41893. if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
  41894. logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
  41895. return;
  41896. }
  41897. var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
  41898. if (nonce.length < nacl_fast["secretbox"].nonceLength) {
  41899. logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
  41900. return;
  41901. }
  41902. var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
  41903. if (bytes === null) {
  41904. logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
  41905. this.authorize(this.pusher.connection.socket_id, function (error, authData) {
  41906. if (error) {
  41907. logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
  41908. return;
  41909. }
  41910. bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
  41911. if (bytes === null) {
  41912. logger.error("Failed to decrypt event with new key. Dropping encrypted event");
  41913. return;
  41914. }
  41915. _this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41916. return;
  41917. });
  41918. return;
  41919. }
  41920. this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41921. };
  41922. EncryptedChannel.prototype.emitJSON = function (eventName, data) {
  41923. try {
  41924. this.emit(eventName, JSON.parse(data));
  41925. }
  41926. catch (e) {
  41927. this.emit(eventName, data);
  41928. }
  41929. return this;
  41930. };
  41931. return EncryptedChannel;
  41932. }(private_channel));
  41933. /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
  41934. // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
  41935. var connection_manager_extends = (undefined && undefined.__extends) || (function () {
  41936. var extendStatics = function (d, b) {
  41937. extendStatics = Object.setPrototypeOf ||
  41938. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41939. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41940. return extendStatics(d, b);
  41941. };
  41942. return function (d, b) {
  41943. extendStatics(d, b);
  41944. function __() { this.constructor = d; }
  41945. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41946. };
  41947. })();
  41948. var connection_manager_ConnectionManager = (function (_super) {
  41949. connection_manager_extends(ConnectionManager, _super);
  41950. function ConnectionManager(key, options) {
  41951. var _this = _super.call(this) || this;
  41952. _this.key = key;
  41953. _this.options = options || {};
  41954. _this.state = "initialized";
  41955. _this.connection = null;
  41956. _this.usingTLS = !!options.useTLS;
  41957. _this.timeline = _this.options.timeline;
  41958. _this.errorCallbacks = _this.buildErrorCallbacks();
  41959. _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
  41960. _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
  41961. var Network = runtime.getNetwork();
  41962. Network.bind("online", function () {
  41963. _this.timeline.info({ netinfo: "online" });
  41964. if (_this.state === "connecting" || _this.state === "unavailable") {
  41965. _this.retryIn(0);
  41966. }
  41967. });
  41968. Network.bind("offline", function () {
  41969. _this.timeline.info({ netinfo: "offline" });
  41970. if (_this.connection) {
  41971. _this.sendActivityCheck();
  41972. }
  41973. });
  41974. _this.updateStrategy();
  41975. return _this;
  41976. }
  41977. ConnectionManager.prototype.connect = function () {
  41978. if (this.connection || this.runner) {
  41979. return;
  41980. }
  41981. if (!this.strategy.isSupported()) {
  41982. this.updateState("failed");
  41983. return;
  41984. }
  41985. this.updateState("connecting");
  41986. this.startConnecting();
  41987. this.setUnavailableTimer();
  41988. };
  41989. ;
  41990. ConnectionManager.prototype.send = function (data) {
  41991. if (this.connection) {
  41992. return this.connection.send(data);
  41993. }
  41994. else {
  41995. return false;
  41996. }
  41997. };
  41998. ;
  41999. ConnectionManager.prototype.send_event = function (name, data, channel) {
  42000. if (this.connection) {
  42001. return this.connection.send_event(name, data, channel);
  42002. }
  42003. else {
  42004. return false;
  42005. }
  42006. };
  42007. ;
  42008. ConnectionManager.prototype.disconnect = function () {
  42009. this.disconnectInternally();
  42010. this.updateState("disconnected");
  42011. };
  42012. ;
  42013. ConnectionManager.prototype.isUsingTLS = function () {
  42014. return this.usingTLS;
  42015. };
  42016. ;
  42017. ConnectionManager.prototype.startConnecting = function () {
  42018. var _this = this;
  42019. var callback = function (error, handshake) {
  42020. if (error) {
  42021. _this.runner = _this.strategy.connect(0, callback);
  42022. }
  42023. else {
  42024. if (handshake.action === "error") {
  42025. _this.emit("error", { type: "HandshakeError", error: handshake.error });
  42026. _this.timeline.error({ handshakeError: handshake.error });
  42027. }
  42028. else {
  42029. _this.abortConnecting();
  42030. _this.handshakeCallbacks[handshake.action](handshake);
  42031. }
  42032. }
  42033. };
  42034. this.runner = this.strategy.connect(0, callback);
  42035. };
  42036. ;
  42037. ConnectionManager.prototype.abortConnecting = function () {
  42038. if (this.runner) {
  42039. this.runner.abort();
  42040. this.runner = null;
  42041. }
  42042. };
  42043. ;
  42044. ConnectionManager.prototype.disconnectInternally = function () {
  42045. this.abortConnecting();
  42046. this.clearRetryTimer();
  42047. this.clearUnavailableTimer();
  42048. if (this.connection) {
  42049. var connection = this.abandonConnection();
  42050. connection.close();
  42051. }
  42052. };
  42053. ;
  42054. ConnectionManager.prototype.updateStrategy = function () {
  42055. this.strategy = this.options.getStrategy({
  42056. key: this.key,
  42057. timeline: this.timeline,
  42058. useTLS: this.usingTLS
  42059. });
  42060. };
  42061. ;
  42062. ConnectionManager.prototype.retryIn = function (delay) {
  42063. var _this = this;
  42064. this.timeline.info({ action: "retry", delay: delay });
  42065. if (delay > 0) {
  42066. this.emit("connecting_in", Math.round(delay / 1000));
  42067. }
  42068. this.retryTimer = new OneOffTimer(delay || 0, function () {
  42069. _this.disconnectInternally();
  42070. _this.connect();
  42071. });
  42072. };
  42073. ;
  42074. ConnectionManager.prototype.clearRetryTimer = function () {
  42075. if (this.retryTimer) {
  42076. this.retryTimer.ensureAborted();
  42077. this.retryTimer = null;
  42078. }
  42079. };
  42080. ;
  42081. ConnectionManager.prototype.setUnavailableTimer = function () {
  42082. var _this = this;
  42083. this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
  42084. _this.updateState("unavailable");
  42085. });
  42086. };
  42087. ;
  42088. ConnectionManager.prototype.clearUnavailableTimer = function () {
  42089. if (this.unavailableTimer) {
  42090. this.unavailableTimer.ensureAborted();
  42091. }
  42092. };
  42093. ;
  42094. ConnectionManager.prototype.sendActivityCheck = function () {
  42095. var _this = this;
  42096. this.stopActivityCheck();
  42097. this.connection.ping();
  42098. this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
  42099. _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
  42100. _this.retryIn(0);
  42101. });
  42102. };
  42103. ;
  42104. ConnectionManager.prototype.resetActivityCheck = function () {
  42105. var _this = this;
  42106. this.stopActivityCheck();
  42107. if (this.connection && !this.connection.handlesActivityChecks()) {
  42108. this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
  42109. _this.sendActivityCheck();
  42110. });
  42111. }
  42112. };
  42113. ;
  42114. ConnectionManager.prototype.stopActivityCheck = function () {
  42115. if (this.activityTimer) {
  42116. this.activityTimer.ensureAborted();
  42117. }
  42118. };
  42119. ;
  42120. ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
  42121. var _this = this;
  42122. return extend({}, errorCallbacks, {
  42123. message: function (message) {
  42124. _this.resetActivityCheck();
  42125. _this.emit('message', message);
  42126. },
  42127. ping: function () {
  42128. _this.send_event('pusher:pong', {});
  42129. },
  42130. activity: function () {
  42131. _this.resetActivityCheck();
  42132. },
  42133. error: function (error) {
  42134. _this.emit("error", { type: "WebSocketError", error: error });
  42135. },
  42136. closed: function () {
  42137. _this.abandonConnection();
  42138. if (_this.shouldRetry()) {
  42139. _this.retryIn(1000);
  42140. }
  42141. }
  42142. });
  42143. };
  42144. ;
  42145. ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
  42146. var _this = this;
  42147. return extend({}, errorCallbacks, {
  42148. connected: function (handshake) {
  42149. _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
  42150. _this.clearUnavailableTimer();
  42151. _this.setConnection(handshake.connection);
  42152. _this.socket_id = _this.connection.id;
  42153. _this.updateState("connected", { socket_id: _this.socket_id });
  42154. }
  42155. });
  42156. };
  42157. ;
  42158. ConnectionManager.prototype.buildErrorCallbacks = function () {
  42159. var _this = this;
  42160. var withErrorEmitted = function (callback) {
  42161. return function (result) {
  42162. if (result.error) {
  42163. _this.emit("error", { type: "WebSocketError", error: result.error });
  42164. }
  42165. callback(result);
  42166. };
  42167. };
  42168. return {
  42169. tls_only: withErrorEmitted(function () {
  42170. _this.usingTLS = true;
  42171. _this.updateStrategy();
  42172. _this.retryIn(0);
  42173. }),
  42174. refused: withErrorEmitted(function () {
  42175. _this.disconnect();
  42176. }),
  42177. backoff: withErrorEmitted(function () {
  42178. _this.retryIn(1000);
  42179. }),
  42180. retry: withErrorEmitted(function () {
  42181. _this.retryIn(0);
  42182. })
  42183. };
  42184. };
  42185. ;
  42186. ConnectionManager.prototype.setConnection = function (connection) {
  42187. this.connection = connection;
  42188. for (var event in this.connectionCallbacks) {
  42189. this.connection.bind(event, this.connectionCallbacks[event]);
  42190. }
  42191. this.resetActivityCheck();
  42192. };
  42193. ;
  42194. ConnectionManager.prototype.abandonConnection = function () {
  42195. if (!this.connection) {
  42196. return;
  42197. }
  42198. this.stopActivityCheck();
  42199. for (var event in this.connectionCallbacks) {
  42200. this.connection.unbind(event, this.connectionCallbacks[event]);
  42201. }
  42202. var connection = this.connection;
  42203. this.connection = null;
  42204. return connection;
  42205. };
  42206. ConnectionManager.prototype.updateState = function (newState, data) {
  42207. var previousState = this.state;
  42208. this.state = newState;
  42209. if (previousState !== newState) {
  42210. var newStateDescription = newState;
  42211. if (newStateDescription === "connected") {
  42212. newStateDescription += " with new socket ID " + data.socket_id;
  42213. }
  42214. logger.debug('State changed', previousState + ' -> ' + newStateDescription);
  42215. this.timeline.info({ state: newState, params: data });
  42216. this.emit('state_change', { previous: previousState, current: newState });
  42217. this.emit(newState, data);
  42218. }
  42219. };
  42220. ConnectionManager.prototype.shouldRetry = function () {
  42221. return this.state === "connecting" || this.state === "connected";
  42222. };
  42223. return ConnectionManager;
  42224. }(dispatcher));
  42225. /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
  42226. // CONCATENATED MODULE: ./src/core/channels/channels.ts
  42227. var channels_Channels = (function () {
  42228. function Channels() {
  42229. this.channels = {};
  42230. }
  42231. Channels.prototype.add = function (name, pusher) {
  42232. if (!this.channels[name]) {
  42233. this.channels[name] = createChannel(name, pusher);
  42234. }
  42235. return this.channels[name];
  42236. };
  42237. Channels.prototype.all = function () {
  42238. return values(this.channels);
  42239. };
  42240. Channels.prototype.find = function (name) {
  42241. return this.channels[name];
  42242. };
  42243. Channels.prototype.remove = function (name) {
  42244. var channel = this.channels[name];
  42245. delete this.channels[name];
  42246. return channel;
  42247. };
  42248. Channels.prototype.disconnect = function () {
  42249. objectApply(this.channels, function (channel) {
  42250. channel.disconnect();
  42251. });
  42252. };
  42253. return Channels;
  42254. }());
  42255. /* harmony default export */ var channels = (channels_Channels);
  42256. function createChannel(name, pusher) {
  42257. if (name.indexOf('private-encrypted-') === 0) {
  42258. if (false) { var errorMsg; }
  42259. return factory.createEncryptedChannel(name, pusher);
  42260. }
  42261. else if (name.indexOf('private-') === 0) {
  42262. return factory.createPrivateChannel(name, pusher);
  42263. }
  42264. else if (name.indexOf('presence-') === 0) {
  42265. return factory.createPresenceChannel(name, pusher);
  42266. }
  42267. else {
  42268. return factory.createChannel(name, pusher);
  42269. }
  42270. }
  42271. // CONCATENATED MODULE: ./src/core/utils/factory.ts
  42272. var Factory = {
  42273. createChannels: function () {
  42274. return new channels();
  42275. },
  42276. createConnectionManager: function (key, options) {
  42277. return new connection_manager(key, options);
  42278. },
  42279. createChannel: function (name, pusher) {
  42280. return new channels_channel(name, pusher);
  42281. },
  42282. createPrivateChannel: function (name, pusher) {
  42283. return new private_channel(name, pusher);
  42284. },
  42285. createPresenceChannel: function (name, pusher) {
  42286. return new presence_channel(name, pusher);
  42287. },
  42288. createEncryptedChannel: function (name, pusher) {
  42289. return new encrypted_channel(name, pusher);
  42290. },
  42291. createTimelineSender: function (timeline, options) {
  42292. return new timeline_sender(timeline, options);
  42293. },
  42294. createAuthorizer: function (channel, options) {
  42295. if (options.authorizer) {
  42296. return options.authorizer(channel, options);
  42297. }
  42298. return new pusher_authorizer(channel, options);
  42299. },
  42300. createHandshake: function (transport, callback) {
  42301. return new connection_handshake(transport, callback);
  42302. },
  42303. createAssistantToTheTransportManager: function (manager, transport, options) {
  42304. return new assistant_to_the_transport_manager(manager, transport, options);
  42305. }
  42306. };
  42307. /* harmony default export */ var factory = (Factory);
  42308. // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
  42309. var transport_manager_TransportManager = (function () {
  42310. function TransportManager(options) {
  42311. this.options = options || {};
  42312. this.livesLeft = this.options.lives || Infinity;
  42313. }
  42314. TransportManager.prototype.getAssistant = function (transport) {
  42315. return factory.createAssistantToTheTransportManager(this, transport, {
  42316. minPingDelay: this.options.minPingDelay,
  42317. maxPingDelay: this.options.maxPingDelay
  42318. });
  42319. };
  42320. TransportManager.prototype.isAlive = function () {
  42321. return this.livesLeft > 0;
  42322. };
  42323. TransportManager.prototype.reportDeath = function () {
  42324. this.livesLeft -= 1;
  42325. };
  42326. return TransportManager;
  42327. }());
  42328. /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
  42329. // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
  42330. var sequential_strategy_SequentialStrategy = (function () {
  42331. function SequentialStrategy(strategies, options) {
  42332. this.strategies = strategies;
  42333. this.loop = Boolean(options.loop);
  42334. this.failFast = Boolean(options.failFast);
  42335. this.timeout = options.timeout;
  42336. this.timeoutLimit = options.timeoutLimit;
  42337. }
  42338. SequentialStrategy.prototype.isSupported = function () {
  42339. return any(this.strategies, util.method("isSupported"));
  42340. };
  42341. SequentialStrategy.prototype.connect = function (minPriority, callback) {
  42342. var _this = this;
  42343. var strategies = this.strategies;
  42344. var current = 0;
  42345. var timeout = this.timeout;
  42346. var runner = null;
  42347. var tryNextStrategy = function (error, handshake) {
  42348. if (handshake) {
  42349. callback(null, handshake);
  42350. }
  42351. else {
  42352. current = current + 1;
  42353. if (_this.loop) {
  42354. current = current % strategies.length;
  42355. }
  42356. if (current < strategies.length) {
  42357. if (timeout) {
  42358. timeout = timeout * 2;
  42359. if (_this.timeoutLimit) {
  42360. timeout = Math.min(timeout, _this.timeoutLimit);
  42361. }
  42362. }
  42363. runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
  42364. }
  42365. else {
  42366. callback(true);
  42367. }
  42368. }
  42369. };
  42370. runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
  42371. return {
  42372. abort: function () {
  42373. runner.abort();
  42374. },
  42375. forceMinPriority: function (p) {
  42376. minPriority = p;
  42377. if (runner) {
  42378. runner.forceMinPriority(p);
  42379. }
  42380. }
  42381. };
  42382. };
  42383. SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
  42384. var timer = null;
  42385. var runner = null;
  42386. if (options.timeout > 0) {
  42387. timer = new OneOffTimer(options.timeout, function () {
  42388. runner.abort();
  42389. callback(true);
  42390. });
  42391. }
  42392. runner = strategy.connect(minPriority, function (error, handshake) {
  42393. if (error && timer && timer.isRunning() && !options.failFast) {
  42394. return;
  42395. }
  42396. if (timer) {
  42397. timer.ensureAborted();
  42398. }
  42399. callback(error, handshake);
  42400. });
  42401. return {
  42402. abort: function () {
  42403. if (timer) {
  42404. timer.ensureAborted();
  42405. }
  42406. runner.abort();
  42407. },
  42408. forceMinPriority: function (p) {
  42409. runner.forceMinPriority(p);
  42410. }
  42411. };
  42412. };
  42413. return SequentialStrategy;
  42414. }());
  42415. /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
  42416. // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
  42417. var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
  42418. function BestConnectedEverStrategy(strategies) {
  42419. this.strategies = strategies;
  42420. }
  42421. BestConnectedEverStrategy.prototype.isSupported = function () {
  42422. return any(this.strategies, util.method("isSupported"));
  42423. };
  42424. BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
  42425. return connect(this.strategies, minPriority, function (i, runners) {
  42426. return function (error, handshake) {
  42427. runners[i].error = error;
  42428. if (error) {
  42429. if (allRunnersFailed(runners)) {
  42430. callback(true);
  42431. }
  42432. return;
  42433. }
  42434. apply(runners, function (runner) {
  42435. runner.forceMinPriority(handshake.transport.priority);
  42436. });
  42437. callback(null, handshake);
  42438. };
  42439. });
  42440. };
  42441. return BestConnectedEverStrategy;
  42442. }());
  42443. /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
  42444. function connect(strategies, minPriority, callbackBuilder) {
  42445. var runners = map(strategies, function (strategy, i, _, rs) {
  42446. return strategy.connect(minPriority, callbackBuilder(i, rs));
  42447. });
  42448. return {
  42449. abort: function () {
  42450. apply(runners, abortRunner);
  42451. },
  42452. forceMinPriority: function (p) {
  42453. apply(runners, function (runner) {
  42454. runner.forceMinPriority(p);
  42455. });
  42456. }
  42457. };
  42458. }
  42459. function allRunnersFailed(runners) {
  42460. return collections_all(runners, function (runner) {
  42461. return Boolean(runner.error);
  42462. });
  42463. }
  42464. function abortRunner(runner) {
  42465. if (!runner.error && !runner.aborted) {
  42466. runner.abort();
  42467. runner.aborted = true;
  42468. }
  42469. }
  42470. // CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
  42471. var cached_strategy_CachedStrategy = (function () {
  42472. function CachedStrategy(strategy, transports, options) {
  42473. this.strategy = strategy;
  42474. this.transports = transports;
  42475. this.ttl = options.ttl || 1800 * 1000;
  42476. this.usingTLS = options.useTLS;
  42477. this.timeline = options.timeline;
  42478. }
  42479. CachedStrategy.prototype.isSupported = function () {
  42480. return this.strategy.isSupported();
  42481. };
  42482. CachedStrategy.prototype.connect = function (minPriority, callback) {
  42483. var usingTLS = this.usingTLS;
  42484. var info = fetchTransportCache(usingTLS);
  42485. var strategies = [this.strategy];
  42486. if (info && info.timestamp + this.ttl >= util.now()) {
  42487. var transport = this.transports[info.transport];
  42488. if (transport) {
  42489. this.timeline.info({
  42490. cached: true,
  42491. transport: info.transport,
  42492. latency: info.latency
  42493. });
  42494. strategies.push(new sequential_strategy([transport], {
  42495. timeout: info.latency * 2 + 1000,
  42496. failFast: true
  42497. }));
  42498. }
  42499. }
  42500. var startTimestamp = util.now();
  42501. var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
  42502. if (error) {
  42503. flushTransportCache(usingTLS);
  42504. if (strategies.length > 0) {
  42505. startTimestamp = util.now();
  42506. runner = strategies.pop().connect(minPriority, cb);
  42507. }
  42508. else {
  42509. callback(error);
  42510. }
  42511. }
  42512. else {
  42513. storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
  42514. callback(null, handshake);
  42515. }
  42516. });
  42517. return {
  42518. abort: function () {
  42519. runner.abort();
  42520. },
  42521. forceMinPriority: function (p) {
  42522. minPriority = p;
  42523. if (runner) {
  42524. runner.forceMinPriority(p);
  42525. }
  42526. }
  42527. };
  42528. };
  42529. return CachedStrategy;
  42530. }());
  42531. /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
  42532. function getTransportCacheKey(usingTLS) {
  42533. return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
  42534. }
  42535. function fetchTransportCache(usingTLS) {
  42536. var storage = runtime.getLocalStorage();
  42537. if (storage) {
  42538. try {
  42539. var serializedCache = storage[getTransportCacheKey(usingTLS)];
  42540. if (serializedCache) {
  42541. return JSON.parse(serializedCache);
  42542. }
  42543. }
  42544. catch (e) {
  42545. flushTransportCache(usingTLS);
  42546. }
  42547. }
  42548. return null;
  42549. }
  42550. function storeTransportCache(usingTLS, transport, latency) {
  42551. var storage = runtime.getLocalStorage();
  42552. if (storage) {
  42553. try {
  42554. storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
  42555. timestamp: util.now(),
  42556. transport: transport,
  42557. latency: latency
  42558. });
  42559. }
  42560. catch (e) {
  42561. }
  42562. }
  42563. }
  42564. function flushTransportCache(usingTLS) {
  42565. var storage = runtime.getLocalStorage();
  42566. if (storage) {
  42567. try {
  42568. delete storage[getTransportCacheKey(usingTLS)];
  42569. }
  42570. catch (e) {
  42571. }
  42572. }
  42573. }
  42574. // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
  42575. var delayed_strategy_DelayedStrategy = (function () {
  42576. function DelayedStrategy(strategy, _a) {
  42577. var number = _a.delay;
  42578. this.strategy = strategy;
  42579. this.options = { delay: number };
  42580. }
  42581. DelayedStrategy.prototype.isSupported = function () {
  42582. return this.strategy.isSupported();
  42583. };
  42584. DelayedStrategy.prototype.connect = function (minPriority, callback) {
  42585. var strategy = this.strategy;
  42586. var runner;
  42587. var timer = new OneOffTimer(this.options.delay, function () {
  42588. runner = strategy.connect(minPriority, callback);
  42589. });
  42590. return {
  42591. abort: function () {
  42592. timer.ensureAborted();
  42593. if (runner) {
  42594. runner.abort();
  42595. }
  42596. },
  42597. forceMinPriority: function (p) {
  42598. minPriority = p;
  42599. if (runner) {
  42600. runner.forceMinPriority(p);
  42601. }
  42602. }
  42603. };
  42604. };
  42605. return DelayedStrategy;
  42606. }());
  42607. /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
  42608. // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
  42609. var IfStrategy = (function () {
  42610. function IfStrategy(test, trueBranch, falseBranch) {
  42611. this.test = test;
  42612. this.trueBranch = trueBranch;
  42613. this.falseBranch = falseBranch;
  42614. }
  42615. IfStrategy.prototype.isSupported = function () {
  42616. var branch = this.test() ? this.trueBranch : this.falseBranch;
  42617. return branch.isSupported();
  42618. };
  42619. IfStrategy.prototype.connect = function (minPriority, callback) {
  42620. var branch = this.test() ? this.trueBranch : this.falseBranch;
  42621. return branch.connect(minPriority, callback);
  42622. };
  42623. return IfStrategy;
  42624. }());
  42625. /* harmony default export */ var if_strategy = (IfStrategy);
  42626. // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
  42627. var FirstConnectedStrategy = (function () {
  42628. function FirstConnectedStrategy(strategy) {
  42629. this.strategy = strategy;
  42630. }
  42631. FirstConnectedStrategy.prototype.isSupported = function () {
  42632. return this.strategy.isSupported();
  42633. };
  42634. FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
  42635. var runner = this.strategy.connect(minPriority, function (error, handshake) {
  42636. if (handshake) {
  42637. runner.abort();
  42638. }
  42639. callback(error, handshake);
  42640. });
  42641. return runner;
  42642. };
  42643. return FirstConnectedStrategy;
  42644. }());
  42645. /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
  42646. // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
  42647. function testSupportsStrategy(strategy) {
  42648. return function () {
  42649. return strategy.isSupported();
  42650. };
  42651. }
  42652. var getDefaultStrategy = function (config, defineTransport) {
  42653. var definedTransports = {};
  42654. function defineTransportStrategy(name, type, priority, options, manager) {
  42655. var transport = defineTransport(config, name, type, priority, options, manager);
  42656. definedTransports[name] = transport;
  42657. return transport;
  42658. }
  42659. var ws_options = {
  42660. hostNonTLS: config.wsHost + ":" + config.wsPort,
  42661. hostTLS: config.wsHost + ":" + config.wssPort,
  42662. httpPath: config.wsPath
  42663. };
  42664. var wss_options = extend({}, ws_options, {
  42665. useTLS: true
  42666. });
  42667. var sockjs_options = {
  42668. hostNonTLS: config.httpHost + ":" + config.httpPort,
  42669. hostTLS: config.httpHost + ":" + config.httpsPort,
  42670. httpPath: config.httpPath
  42671. };
  42672. var timeouts = {
  42673. loop: true,
  42674. timeout: 15000,
  42675. timeoutLimit: 60000
  42676. };
  42677. var ws_manager = new transport_manager({
  42678. lives: 2,
  42679. minPingDelay: 10000,
  42680. maxPingDelay: config.activity_timeout
  42681. });
  42682. var streaming_manager = new transport_manager({
  42683. lives: 2,
  42684. minPingDelay: 10000,
  42685. maxPingDelay: config.activity_timeout
  42686. });
  42687. var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
  42688. var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
  42689. var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
  42690. var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
  42691. var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
  42692. var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
  42693. var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
  42694. var ws_loop = new sequential_strategy([ws_transport], timeouts);
  42695. var wss_loop = new sequential_strategy([wss_transport], timeouts);
  42696. var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
  42697. var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts);
  42698. var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts);
  42699. 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);
  42700. var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
  42701. var wsStrategy;
  42702. if (config.useTLS) {
  42703. wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]);
  42704. }
  42705. else {
  42706. wsStrategy = new best_connected_ever_strategy([
  42707. ws_loop,
  42708. new delayed_strategy(wss_loop, { delay: 2000 }),
  42709. new delayed_strategy(http_fallback_loop, { delay: 5000 })
  42710. ]);
  42711. }
  42712. return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
  42713. ttl: 1800000,
  42714. timeline: config.timeline,
  42715. useTLS: config.useTLS
  42716. });
  42717. };
  42718. /* harmony default export */ var default_strategy = (getDefaultStrategy);
  42719. // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
  42720. /* harmony default export */ var transport_connection_initializer = (function () {
  42721. var self = this;
  42722. self.timeline.info(self.buildTimelineMessage({
  42723. transport: self.name + (self.options.useTLS ? "s" : "")
  42724. }));
  42725. if (self.hooks.isInitialized()) {
  42726. self.changeState("initialized");
  42727. }
  42728. else if (self.hooks.file) {
  42729. self.changeState("initializing");
  42730. Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
  42731. if (self.hooks.isInitialized()) {
  42732. self.changeState("initialized");
  42733. callback(true);
  42734. }
  42735. else {
  42736. if (error) {
  42737. self.onError(error);
  42738. }
  42739. self.onClose();
  42740. callback(false);
  42741. }
  42742. });
  42743. }
  42744. else {
  42745. self.onClose();
  42746. }
  42747. });
  42748. // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
  42749. var http_xdomain_request_hooks = {
  42750. getRequest: function (socket) {
  42751. var xdr = new window.XDomainRequest();
  42752. xdr.ontimeout = function () {
  42753. socket.emit("error", new RequestTimedOut());
  42754. socket.close();
  42755. };
  42756. xdr.onerror = function (e) {
  42757. socket.emit("error", e);
  42758. socket.close();
  42759. };
  42760. xdr.onprogress = function () {
  42761. if (xdr.responseText && xdr.responseText.length > 0) {
  42762. socket.onChunk(200, xdr.responseText);
  42763. }
  42764. };
  42765. xdr.onload = function () {
  42766. if (xdr.responseText && xdr.responseText.length > 0) {
  42767. socket.onChunk(200, xdr.responseText);
  42768. }
  42769. socket.emit("finished", 200);
  42770. socket.close();
  42771. };
  42772. return xdr;
  42773. },
  42774. abortRequest: function (xdr) {
  42775. xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
  42776. xdr.abort();
  42777. }
  42778. };
  42779. /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
  42780. // CONCATENATED MODULE: ./src/core/http/http_request.ts
  42781. var http_request_extends = (undefined && undefined.__extends) || (function () {
  42782. var extendStatics = function (d, b) {
  42783. extendStatics = Object.setPrototypeOf ||
  42784. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  42785. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  42786. return extendStatics(d, b);
  42787. };
  42788. return function (d, b) {
  42789. extendStatics(d, b);
  42790. function __() { this.constructor = d; }
  42791. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  42792. };
  42793. })();
  42794. var MAX_BUFFER_LENGTH = 256 * 1024;
  42795. var http_request_HTTPRequest = (function (_super) {
  42796. http_request_extends(HTTPRequest, _super);
  42797. function HTTPRequest(hooks, method, url) {
  42798. var _this = _super.call(this) || this;
  42799. _this.hooks = hooks;
  42800. _this.method = method;
  42801. _this.url = url;
  42802. return _this;
  42803. }
  42804. HTTPRequest.prototype.start = function (payload) {
  42805. var _this = this;
  42806. this.position = 0;
  42807. this.xhr = this.hooks.getRequest(this);
  42808. this.unloader = function () {
  42809. _this.close();
  42810. };
  42811. runtime.addUnloadListener(this.unloader);
  42812. this.xhr.open(this.method, this.url, true);
  42813. if (this.xhr.setRequestHeader) {
  42814. this.xhr.setRequestHeader("Content-Type", "application/json");
  42815. }
  42816. this.xhr.send(payload);
  42817. };
  42818. HTTPRequest.prototype.close = function () {
  42819. if (this.unloader) {
  42820. runtime.removeUnloadListener(this.unloader);
  42821. this.unloader = null;
  42822. }
  42823. if (this.xhr) {
  42824. this.hooks.abortRequest(this.xhr);
  42825. this.xhr = null;
  42826. }
  42827. };
  42828. HTTPRequest.prototype.onChunk = function (status, data) {
  42829. while (true) {
  42830. var chunk = this.advanceBuffer(data);
  42831. if (chunk) {
  42832. this.emit("chunk", { status: status, data: chunk });
  42833. }
  42834. else {
  42835. break;
  42836. }
  42837. }
  42838. if (this.isBufferTooLong(data)) {
  42839. this.emit("buffer_too_long");
  42840. }
  42841. };
  42842. HTTPRequest.prototype.advanceBuffer = function (buffer) {
  42843. var unreadData = buffer.slice(this.position);
  42844. var endOfLinePosition = unreadData.indexOf("\n");
  42845. if (endOfLinePosition !== -1) {
  42846. this.position += endOfLinePosition + 1;
  42847. return unreadData.slice(0, endOfLinePosition);
  42848. }
  42849. else {
  42850. return null;
  42851. }
  42852. };
  42853. HTTPRequest.prototype.isBufferTooLong = function (buffer) {
  42854. return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
  42855. };
  42856. return HTTPRequest;
  42857. }(dispatcher));
  42858. /* harmony default export */ var http_request = (http_request_HTTPRequest);
  42859. // CONCATENATED MODULE: ./src/core/http/state.ts
  42860. var State;
  42861. (function (State) {
  42862. State[State["CONNECTING"] = 0] = "CONNECTING";
  42863. State[State["OPEN"] = 1] = "OPEN";
  42864. State[State["CLOSED"] = 3] = "CLOSED";
  42865. })(State || (State = {}));
  42866. /* harmony default export */ var state = (State);
  42867. // CONCATENATED MODULE: ./src/core/http/http_socket.ts
  42868. var autoIncrement = 1;
  42869. var http_socket_HTTPSocket = (function () {
  42870. function HTTPSocket(hooks, url) {
  42871. this.hooks = hooks;
  42872. this.session = randomNumber(1000) + "/" + randomString(8);
  42873. this.location = getLocation(url);
  42874. this.readyState = state.CONNECTING;
  42875. this.openStream();
  42876. }
  42877. HTTPSocket.prototype.send = function (payload) {
  42878. return this.sendRaw(JSON.stringify([payload]));
  42879. };
  42880. HTTPSocket.prototype.ping = function () {
  42881. this.hooks.sendHeartbeat(this);
  42882. };
  42883. HTTPSocket.prototype.close = function (code, reason) {
  42884. this.onClose(code, reason, true);
  42885. };
  42886. HTTPSocket.prototype.sendRaw = function (payload) {
  42887. if (this.readyState === state.OPEN) {
  42888. try {
  42889. runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
  42890. return true;
  42891. }
  42892. catch (e) {
  42893. return false;
  42894. }
  42895. }
  42896. else {
  42897. return false;
  42898. }
  42899. };
  42900. HTTPSocket.prototype.reconnect = function () {
  42901. this.closeStream();
  42902. this.openStream();
  42903. };
  42904. ;
  42905. HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
  42906. this.closeStream();
  42907. this.readyState = state.CLOSED;
  42908. if (this.onclose) {
  42909. this.onclose({
  42910. code: code,
  42911. reason: reason,
  42912. wasClean: wasClean
  42913. });
  42914. }
  42915. };
  42916. HTTPSocket.prototype.onChunk = function (chunk) {
  42917. if (chunk.status !== 200) {
  42918. return;
  42919. }
  42920. if (this.readyState === state.OPEN) {
  42921. this.onActivity();
  42922. }
  42923. var payload;
  42924. var type = chunk.data.slice(0, 1);
  42925. switch (type) {
  42926. case 'o':
  42927. payload = JSON.parse(chunk.data.slice(1) || '{}');
  42928. this.onOpen(payload);
  42929. break;
  42930. case 'a':
  42931. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42932. for (var i = 0; i < payload.length; i++) {
  42933. this.onEvent(payload[i]);
  42934. }
  42935. break;
  42936. case 'm':
  42937. payload = JSON.parse(chunk.data.slice(1) || 'null');
  42938. this.onEvent(payload);
  42939. break;
  42940. case 'h':
  42941. this.hooks.onHeartbeat(this);
  42942. break;
  42943. case 'c':
  42944. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42945. this.onClose(payload[0], payload[1], true);
  42946. break;
  42947. }
  42948. };
  42949. HTTPSocket.prototype.onOpen = function (options) {
  42950. if (this.readyState === state.CONNECTING) {
  42951. if (options && options.hostname) {
  42952. this.location.base = replaceHost(this.location.base, options.hostname);
  42953. }
  42954. this.readyState = state.OPEN;
  42955. if (this.onopen) {
  42956. this.onopen();
  42957. }
  42958. }
  42959. else {
  42960. this.onClose(1006, "Server lost session", true);
  42961. }
  42962. };
  42963. HTTPSocket.prototype.onEvent = function (event) {
  42964. if (this.readyState === state.OPEN && this.onmessage) {
  42965. this.onmessage({ data: event });
  42966. }
  42967. };
  42968. HTTPSocket.prototype.onActivity = function () {
  42969. if (this.onactivity) {
  42970. this.onactivity();
  42971. }
  42972. };
  42973. HTTPSocket.prototype.onError = function (error) {
  42974. if (this.onerror) {
  42975. this.onerror(error);
  42976. }
  42977. };
  42978. HTTPSocket.prototype.openStream = function () {
  42979. var _this = this;
  42980. this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
  42981. this.stream.bind("chunk", function (chunk) {
  42982. _this.onChunk(chunk);
  42983. });
  42984. this.stream.bind("finished", function (status) {
  42985. _this.hooks.onFinished(_this, status);
  42986. });
  42987. this.stream.bind("buffer_too_long", function () {
  42988. _this.reconnect();
  42989. });
  42990. try {
  42991. this.stream.start();
  42992. }
  42993. catch (error) {
  42994. util.defer(function () {
  42995. _this.onError(error);
  42996. _this.onClose(1006, "Could not start streaming", false);
  42997. });
  42998. }
  42999. };
  43000. HTTPSocket.prototype.closeStream = function () {
  43001. if (this.stream) {
  43002. this.stream.unbind_all();
  43003. this.stream.close();
  43004. this.stream = null;
  43005. }
  43006. };
  43007. return HTTPSocket;
  43008. }());
  43009. function getLocation(url) {
  43010. var parts = /([^\?]*)\/*(\??.*)/.exec(url);
  43011. return {
  43012. base: parts[1],
  43013. queryString: parts[2]
  43014. };
  43015. }
  43016. function getSendURL(url, session) {
  43017. return url.base + "/" + session + "/xhr_send";
  43018. }
  43019. function getUniqueURL(url) {
  43020. var separator = (url.indexOf('?') === -1) ? "?" : "&";
  43021. return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++;
  43022. }
  43023. function replaceHost(url, hostname) {
  43024. var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
  43025. return urlParts[1] + hostname + urlParts[3];
  43026. }
  43027. function randomNumber(max) {
  43028. return Math.floor(Math.random() * max);
  43029. }
  43030. function randomString(length) {
  43031. var result = [];
  43032. for (var i = 0; i < length; i++) {
  43033. result.push(randomNumber(32).toString(32));
  43034. }
  43035. return result.join('');
  43036. }
  43037. /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
  43038. // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
  43039. var http_streaming_socket_hooks = {
  43040. getReceiveURL: function (url, session) {
  43041. return url.base + "/" + session + "/xhr_streaming" + url.queryString;
  43042. },
  43043. onHeartbeat: function (socket) {
  43044. socket.sendRaw("[]");
  43045. },
  43046. sendHeartbeat: function (socket) {
  43047. socket.sendRaw("[]");
  43048. },
  43049. onFinished: function (socket, status) {
  43050. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  43051. }
  43052. };
  43053. /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
  43054. // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
  43055. var http_polling_socket_hooks = {
  43056. getReceiveURL: function (url, session) {
  43057. return url.base + "/" + session + "/xhr" + url.queryString;
  43058. },
  43059. onHeartbeat: function () {
  43060. },
  43061. sendHeartbeat: function (socket) {
  43062. socket.sendRaw("[]");
  43063. },
  43064. onFinished: function (socket, status) {
  43065. if (status === 200) {
  43066. socket.reconnect();
  43067. }
  43068. else {
  43069. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  43070. }
  43071. }
  43072. };
  43073. /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
  43074. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
  43075. var http_xhr_request_hooks = {
  43076. getRequest: function (socket) {
  43077. var Constructor = runtime.getXHRAPI();
  43078. var xhr = new Constructor();
  43079. xhr.onreadystatechange = xhr.onprogress = function () {
  43080. switch (xhr.readyState) {
  43081. case 3:
  43082. if (xhr.responseText && xhr.responseText.length > 0) {
  43083. socket.onChunk(xhr.status, xhr.responseText);
  43084. }
  43085. break;
  43086. case 4:
  43087. if (xhr.responseText && xhr.responseText.length > 0) {
  43088. socket.onChunk(xhr.status, xhr.responseText);
  43089. }
  43090. socket.emit("finished", xhr.status);
  43091. socket.close();
  43092. break;
  43093. }
  43094. };
  43095. return xhr;
  43096. },
  43097. abortRequest: function (xhr) {
  43098. xhr.onreadystatechange = null;
  43099. xhr.abort();
  43100. }
  43101. };
  43102. /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
  43103. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
  43104. var HTTP = {
  43105. createStreamingSocket: function (url) {
  43106. return this.createSocket(http_streaming_socket, url);
  43107. },
  43108. createPollingSocket: function (url) {
  43109. return this.createSocket(http_polling_socket, url);
  43110. },
  43111. createSocket: function (hooks, url) {
  43112. return new http_socket(hooks, url);
  43113. },
  43114. createXHR: function (method, url) {
  43115. return this.createRequest(http_xhr_request, method, url);
  43116. },
  43117. createRequest: function (hooks, method, url) {
  43118. return new http_request(hooks, method, url);
  43119. }
  43120. };
  43121. /* harmony default export */ var http_http = (HTTP);
  43122. // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
  43123. http_http.createXDR = function (method, url) {
  43124. return this.createRequest(http_xdomain_request, method, url);
  43125. };
  43126. /* harmony default export */ var web_http_http = (http_http);
  43127. // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
  43128. var Runtime = {
  43129. nextAuthCallbackID: 1,
  43130. auth_callbacks: {},
  43131. ScriptReceivers: ScriptReceivers,
  43132. DependenciesReceivers: DependenciesReceivers,
  43133. getDefaultStrategy: default_strategy,
  43134. Transports: transports_transports,
  43135. transportConnectionInitializer: transport_connection_initializer,
  43136. HTTPFactory: web_http_http,
  43137. TimelineTransport: jsonp_timeline,
  43138. getXHRAPI: function () {
  43139. return window.XMLHttpRequest;
  43140. },
  43141. getWebSocketAPI: function () {
  43142. return window.WebSocket || window.MozWebSocket;
  43143. },
  43144. setup: function (PusherClass) {
  43145. var _this = this;
  43146. window.Pusher = PusherClass;
  43147. var initializeOnDocumentBody = function () {
  43148. _this.onDocumentBody(PusherClass.ready);
  43149. };
  43150. if (!window.JSON) {
  43151. Dependencies.load("json2", {}, initializeOnDocumentBody);
  43152. }
  43153. else {
  43154. initializeOnDocumentBody();
  43155. }
  43156. },
  43157. getDocument: function () {
  43158. return document;
  43159. },
  43160. getProtocol: function () {
  43161. return this.getDocument().location.protocol;
  43162. },
  43163. getAuthorizers: function () {
  43164. return { ajax: xhr_auth, jsonp: jsonp_auth };
  43165. },
  43166. onDocumentBody: function (callback) {
  43167. var _this = this;
  43168. if (document.body) {
  43169. callback();
  43170. }
  43171. else {
  43172. setTimeout(function () {
  43173. _this.onDocumentBody(callback);
  43174. }, 0);
  43175. }
  43176. },
  43177. createJSONPRequest: function (url, data) {
  43178. return new jsonp_request(url, data);
  43179. },
  43180. createScriptRequest: function (src) {
  43181. return new script_request(src);
  43182. },
  43183. getLocalStorage: function () {
  43184. try {
  43185. return window.localStorage;
  43186. }
  43187. catch (e) {
  43188. return undefined;
  43189. }
  43190. },
  43191. createXHR: function () {
  43192. if (this.getXHRAPI()) {
  43193. return this.createXMLHttpRequest();
  43194. }
  43195. else {
  43196. return this.createMicrosoftXHR();
  43197. }
  43198. },
  43199. createXMLHttpRequest: function () {
  43200. var Constructor = this.getXHRAPI();
  43201. return new Constructor();
  43202. },
  43203. createMicrosoftXHR: function () {
  43204. return new ActiveXObject("Microsoft.XMLHTTP");
  43205. },
  43206. getNetwork: function () {
  43207. return net_info_Network;
  43208. },
  43209. createWebSocket: function (url) {
  43210. var Constructor = this.getWebSocketAPI();
  43211. return new Constructor(url);
  43212. },
  43213. createSocketRequest: function (method, url) {
  43214. if (this.isXHRSupported()) {
  43215. return this.HTTPFactory.createXHR(method, url);
  43216. }
  43217. else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
  43218. return this.HTTPFactory.createXDR(method, url);
  43219. }
  43220. else {
  43221. throw "Cross-origin HTTP requests are not supported";
  43222. }
  43223. },
  43224. isXHRSupported: function () {
  43225. var Constructor = this.getXHRAPI();
  43226. return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined;
  43227. },
  43228. isXDRSupported: function (useTLS) {
  43229. var protocol = useTLS ? "https:" : "http:";
  43230. var documentProtocol = this.getProtocol();
  43231. return Boolean((window['XDomainRequest'])) && documentProtocol === protocol;
  43232. },
  43233. addUnloadListener: function (listener) {
  43234. if (window.addEventListener !== undefined) {
  43235. window.addEventListener("unload", listener, false);
  43236. }
  43237. else if (window.attachEvent !== undefined) {
  43238. window.attachEvent("onunload", listener);
  43239. }
  43240. },
  43241. removeUnloadListener: function (listener) {
  43242. if (window.addEventListener !== undefined) {
  43243. window.removeEventListener("unload", listener, false);
  43244. }
  43245. else if (window.detachEvent !== undefined) {
  43246. window.detachEvent("onunload", listener);
  43247. }
  43248. }
  43249. };
  43250. /* harmony default export */ var runtime = (Runtime);
  43251. // CONCATENATED MODULE: ./src/core/timeline/level.ts
  43252. var TimelineLevel;
  43253. (function (TimelineLevel) {
  43254. TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
  43255. TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
  43256. TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
  43257. })(TimelineLevel || (TimelineLevel = {}));
  43258. /* harmony default export */ var timeline_level = (TimelineLevel);
  43259. // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
  43260. var timeline_Timeline = (function () {
  43261. function Timeline(key, session, options) {
  43262. this.key = key;
  43263. this.session = session;
  43264. this.events = [];
  43265. this.options = options || {};
  43266. this.sent = 0;
  43267. this.uniqueID = 0;
  43268. }
  43269. Timeline.prototype.log = function (level, event) {
  43270. if (level <= this.options.level) {
  43271. this.events.push(extend({}, event, { timestamp: util.now() }));
  43272. if (this.options.limit && this.events.length > this.options.limit) {
  43273. this.events.shift();
  43274. }
  43275. }
  43276. };
  43277. Timeline.prototype.error = function (event) {
  43278. this.log(timeline_level.ERROR, event);
  43279. };
  43280. Timeline.prototype.info = function (event) {
  43281. this.log(timeline_level.INFO, event);
  43282. };
  43283. Timeline.prototype.debug = function (event) {
  43284. this.log(timeline_level.DEBUG, event);
  43285. };
  43286. Timeline.prototype.isEmpty = function () {
  43287. return this.events.length === 0;
  43288. };
  43289. Timeline.prototype.send = function (sendfn, callback) {
  43290. var _this = this;
  43291. var data = extend({
  43292. session: this.session,
  43293. bundle: this.sent + 1,
  43294. key: this.key,
  43295. lib: "js",
  43296. version: this.options.version,
  43297. cluster: this.options.cluster,
  43298. features: this.options.features,
  43299. timeline: this.events
  43300. }, this.options.params);
  43301. this.events = [];
  43302. sendfn(data, function (error, result) {
  43303. if (!error) {
  43304. _this.sent++;
  43305. }
  43306. if (callback) {
  43307. callback(error, result);
  43308. }
  43309. });
  43310. return true;
  43311. };
  43312. Timeline.prototype.generateUniqueID = function () {
  43313. this.uniqueID++;
  43314. return this.uniqueID;
  43315. };
  43316. return Timeline;
  43317. }());
  43318. /* harmony default export */ var timeline_timeline = (timeline_Timeline);
  43319. // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
  43320. var transport_strategy_TransportStrategy = (function () {
  43321. function TransportStrategy(name, priority, transport, options) {
  43322. this.name = name;
  43323. this.priority = priority;
  43324. this.transport = transport;
  43325. this.options = options || {};
  43326. }
  43327. TransportStrategy.prototype.isSupported = function () {
  43328. return this.transport.isSupported({
  43329. useTLS: this.options.useTLS
  43330. });
  43331. };
  43332. TransportStrategy.prototype.connect = function (minPriority, callback) {
  43333. var _this = this;
  43334. if (!this.isSupported()) {
  43335. return failAttempt(new UnsupportedStrategy(), callback);
  43336. }
  43337. else if (this.priority < minPriority) {
  43338. return failAttempt(new TransportPriorityTooLow(), callback);
  43339. }
  43340. var connected = false;
  43341. var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
  43342. var handshake = null;
  43343. var onInitialized = function () {
  43344. transport.unbind("initialized", onInitialized);
  43345. transport.connect();
  43346. };
  43347. var onOpen = function () {
  43348. handshake = factory.createHandshake(transport, function (result) {
  43349. connected = true;
  43350. unbindListeners();
  43351. callback(null, result);
  43352. });
  43353. };
  43354. var onError = function (error) {
  43355. unbindListeners();
  43356. callback(error);
  43357. };
  43358. var onClosed = function () {
  43359. unbindListeners();
  43360. var serializedTransport;
  43361. serializedTransport = safeJSONStringify(transport);
  43362. callback(new TransportClosed(serializedTransport));
  43363. };
  43364. var unbindListeners = function () {
  43365. transport.unbind("initialized", onInitialized);
  43366. transport.unbind("open", onOpen);
  43367. transport.unbind("error", onError);
  43368. transport.unbind("closed", onClosed);
  43369. };
  43370. transport.bind("initialized", onInitialized);
  43371. transport.bind("open", onOpen);
  43372. transport.bind("error", onError);
  43373. transport.bind("closed", onClosed);
  43374. transport.initialize();
  43375. return {
  43376. abort: function () {
  43377. if (connected) {
  43378. return;
  43379. }
  43380. unbindListeners();
  43381. if (handshake) {
  43382. handshake.close();
  43383. }
  43384. else {
  43385. transport.close();
  43386. }
  43387. },
  43388. forceMinPriority: function (p) {
  43389. if (connected) {
  43390. return;
  43391. }
  43392. if (_this.priority < p) {
  43393. if (handshake) {
  43394. handshake.close();
  43395. }
  43396. else {
  43397. transport.close();
  43398. }
  43399. }
  43400. }
  43401. };
  43402. };
  43403. return TransportStrategy;
  43404. }());
  43405. /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
  43406. function failAttempt(error, callback) {
  43407. util.defer(function () {
  43408. callback(error);
  43409. });
  43410. return {
  43411. abort: function () { },
  43412. forceMinPriority: function () { }
  43413. };
  43414. }
  43415. // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
  43416. var strategy_builder_Transports = runtime.Transports;
  43417. var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
  43418. var transportClass = strategy_builder_Transports[type];
  43419. if (!transportClass) {
  43420. throw new UnsupportedTransport(type);
  43421. }
  43422. var enabled = (!config.enabledTransports ||
  43423. arrayIndexOf(config.enabledTransports, name) !== -1) &&
  43424. (!config.disabledTransports ||
  43425. arrayIndexOf(config.disabledTransports, name) === -1);
  43426. var transport;
  43427. if (enabled) {
  43428. transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, extend({
  43429. key: config.key,
  43430. useTLS: config.useTLS,
  43431. timeline: config.timeline,
  43432. ignoreNullOrigin: config.ignoreNullOrigin
  43433. }, options));
  43434. }
  43435. else {
  43436. transport = strategy_builder_UnsupportedStrategy;
  43437. }
  43438. return transport;
  43439. };
  43440. var strategy_builder_UnsupportedStrategy = {
  43441. isSupported: function () {
  43442. return false;
  43443. },
  43444. connect: function (_, callback) {
  43445. var deferred = util.defer(function () {
  43446. callback(new UnsupportedStrategy());
  43447. });
  43448. return {
  43449. abort: function () {
  43450. deferred.ensureAborted();
  43451. },
  43452. forceMinPriority: function () { }
  43453. };
  43454. }
  43455. };
  43456. // CONCATENATED MODULE: ./src/core/config.ts
  43457. var getGlobalConfig = function () {
  43458. return {
  43459. wsHost: defaults.host,
  43460. wsPort: defaults.ws_port,
  43461. wssPort: defaults.wss_port,
  43462. wsPath: defaults.ws_path,
  43463. httpHost: defaults.sockjs_host,
  43464. httpPort: defaults.sockjs_http_port,
  43465. httpsPort: defaults.sockjs_https_port,
  43466. httpPath: defaults.sockjs_path,
  43467. statsHost: defaults.stats_host,
  43468. authEndpoint: defaults.channel_auth_endpoint,
  43469. authTransport: defaults.channel_auth_transport,
  43470. activity_timeout: defaults.activity_timeout,
  43471. pong_timeout: defaults.pong_timeout,
  43472. unavailable_timeout: defaults.unavailable_timeout
  43473. };
  43474. };
  43475. var getClusterConfig = function (clusterName) {
  43476. return {
  43477. wsHost: 'ws-' + clusterName + '.pusher.com',
  43478. httpHost: 'sockjs-' + clusterName + '.pusher.com'
  43479. };
  43480. };
  43481. // CONCATENATED MODULE: ./src/core/pusher.ts
  43482. var pusher_Pusher = (function () {
  43483. function Pusher(app_key, options) {
  43484. var _this = this;
  43485. checkAppKey(app_key);
  43486. options = options || {};
  43487. if (!options.cluster && !(options.wsHost || options.httpHost)) {
  43488. var suffix = url_store.buildLogSuffix('javascriptQuickStart');
  43489. logger.warn("You should always specify a cluster when connecting. " + suffix);
  43490. }
  43491. this.key = app_key;
  43492. this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options);
  43493. this.channels = factory.createChannels();
  43494. this.global_emitter = new dispatcher();
  43495. this.sessionID = Math.floor(Math.random() * 1000000000);
  43496. this.timeline = new timeline_timeline(this.key, this.sessionID, {
  43497. cluster: this.config.cluster,
  43498. features: Pusher.getClientFeatures(),
  43499. params: this.config.timelineParams || {},
  43500. limit: 50,
  43501. level: timeline_level.INFO,
  43502. version: defaults.VERSION
  43503. });
  43504. if (!this.config.disableStats) {
  43505. this.timelineSender = factory.createTimelineSender(this.timeline, {
  43506. host: this.config.statsHost,
  43507. path: '/timeline/v2/' + runtime.TimelineTransport.name
  43508. });
  43509. }
  43510. var getStrategy = function (options) {
  43511. var config = extend({}, _this.config, options);
  43512. return runtime.getDefaultStrategy(config, strategy_builder_defineTransport);
  43513. };
  43514. this.connection = factory.createConnectionManager(this.key, extend({
  43515. getStrategy: getStrategy,
  43516. timeline: this.timeline,
  43517. activityTimeout: this.config.activity_timeout,
  43518. pongTimeout: this.config.pong_timeout,
  43519. unavailableTimeout: this.config.unavailable_timeout
  43520. }, this.config, { useTLS: this.shouldUseTLS() }));
  43521. this.connection.bind('connected', function () {
  43522. _this.subscribeAll();
  43523. if (_this.timelineSender) {
  43524. _this.timelineSender.send(_this.connection.isUsingTLS());
  43525. }
  43526. });
  43527. this.connection.bind('message', function (event) {
  43528. var eventName = event.event;
  43529. var internal = eventName.indexOf('pusher_internal:') === 0;
  43530. if (event.channel) {
  43531. var channel = _this.channel(event.channel);
  43532. if (channel) {
  43533. channel.handleEvent(event);
  43534. }
  43535. }
  43536. if (!internal) {
  43537. _this.global_emitter.emit(event.event, event.data);
  43538. }
  43539. });
  43540. this.connection.bind('connecting', function () {
  43541. _this.channels.disconnect();
  43542. });
  43543. this.connection.bind('disconnected', function () {
  43544. _this.channels.disconnect();
  43545. });
  43546. this.connection.bind('error', function (err) {
  43547. logger.warn(err);
  43548. });
  43549. Pusher.instances.push(this);
  43550. this.timeline.info({ instances: Pusher.instances.length });
  43551. if (Pusher.isReady) {
  43552. this.connect();
  43553. }
  43554. }
  43555. Pusher.ready = function () {
  43556. Pusher.isReady = true;
  43557. for (var i = 0, l = Pusher.instances.length; i < l; i++) {
  43558. Pusher.instances[i].connect();
  43559. }
  43560. };
  43561. Pusher.getClientFeatures = function () {
  43562. return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
  43563. return t.isSupported({});
  43564. }));
  43565. };
  43566. Pusher.prototype.channel = function (name) {
  43567. return this.channels.find(name);
  43568. };
  43569. Pusher.prototype.allChannels = function () {
  43570. return this.channels.all();
  43571. };
  43572. Pusher.prototype.connect = function () {
  43573. this.connection.connect();
  43574. if (this.timelineSender) {
  43575. if (!this.timelineSenderTimer) {
  43576. var usingTLS = this.connection.isUsingTLS();
  43577. var timelineSender = this.timelineSender;
  43578. this.timelineSenderTimer = new PeriodicTimer(60000, function () {
  43579. timelineSender.send(usingTLS);
  43580. });
  43581. }
  43582. }
  43583. };
  43584. Pusher.prototype.disconnect = function () {
  43585. this.connection.disconnect();
  43586. if (this.timelineSenderTimer) {
  43587. this.timelineSenderTimer.ensureAborted();
  43588. this.timelineSenderTimer = null;
  43589. }
  43590. };
  43591. Pusher.prototype.bind = function (event_name, callback, context) {
  43592. this.global_emitter.bind(event_name, callback, context);
  43593. return this;
  43594. };
  43595. Pusher.prototype.unbind = function (event_name, callback, context) {
  43596. this.global_emitter.unbind(event_name, callback, context);
  43597. return this;
  43598. };
  43599. Pusher.prototype.bind_global = function (callback) {
  43600. this.global_emitter.bind_global(callback);
  43601. return this;
  43602. };
  43603. Pusher.prototype.unbind_global = function (callback) {
  43604. this.global_emitter.unbind_global(callback);
  43605. return this;
  43606. };
  43607. Pusher.prototype.unbind_all = function (callback) {
  43608. this.global_emitter.unbind_all();
  43609. return this;
  43610. };
  43611. Pusher.prototype.subscribeAll = function () {
  43612. var channelName;
  43613. for (channelName in this.channels.channels) {
  43614. if (this.channels.channels.hasOwnProperty(channelName)) {
  43615. this.subscribe(channelName);
  43616. }
  43617. }
  43618. };
  43619. Pusher.prototype.subscribe = function (channel_name) {
  43620. var channel = this.channels.add(channel_name, this);
  43621. if (channel.subscriptionPending && channel.subscriptionCancelled) {
  43622. channel.reinstateSubscription();
  43623. }
  43624. else if (!channel.subscriptionPending &&
  43625. this.connection.state === 'connected') {
  43626. channel.subscribe();
  43627. }
  43628. return channel;
  43629. };
  43630. Pusher.prototype.unsubscribe = function (channel_name) {
  43631. var channel = this.channels.find(channel_name);
  43632. if (channel && channel.subscriptionPending) {
  43633. channel.cancelSubscription();
  43634. }
  43635. else {
  43636. channel = this.channels.remove(channel_name);
  43637. if (channel && this.connection.state === 'connected') {
  43638. channel.unsubscribe();
  43639. }
  43640. }
  43641. };
  43642. Pusher.prototype.send_event = function (event_name, data, channel) {
  43643. return this.connection.send_event(event_name, data, channel);
  43644. };
  43645. Pusher.prototype.shouldUseTLS = function () {
  43646. if (runtime.getProtocol() === 'https:') {
  43647. return true;
  43648. }
  43649. else if (this.config.forceTLS === true) {
  43650. return true;
  43651. }
  43652. else {
  43653. return Boolean(this.config.encrypted);
  43654. }
  43655. };
  43656. Pusher.instances = [];
  43657. Pusher.isReady = false;
  43658. Pusher.logToConsole = false;
  43659. Pusher.Runtime = runtime;
  43660. Pusher.ScriptReceivers = runtime.ScriptReceivers;
  43661. Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
  43662. Pusher.auth_callbacks = runtime.auth_callbacks;
  43663. return Pusher;
  43664. }());
  43665. /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
  43666. function checkAppKey(key) {
  43667. if (key === null || key === undefined) {
  43668. throw 'You must pass your app key when you instantiate Pusher.';
  43669. }
  43670. }
  43671. runtime.setup(pusher_Pusher);
  43672. /***/ })
  43673. /******/ ]);
  43674. });
  43675. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  43676. /***/ }),
  43677. /***/ "./node_modules/setimmediate/setImmediate.js":
  43678. /*!***************************************************!*\
  43679. !*** ./node_modules/setimmediate/setImmediate.js ***!
  43680. \***************************************************/
  43681. /*! no static exports found */
  43682. /***/ (function(module, exports, __webpack_require__) {
  43683. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  43684. "use strict";
  43685. if (global.setImmediate) {
  43686. return;
  43687. }
  43688. var nextHandle = 1; // Spec says greater than zero
  43689. var tasksByHandle = {};
  43690. var currentlyRunningATask = false;
  43691. var doc = global.document;
  43692. var registerImmediate;
  43693. function setImmediate(callback) {
  43694. // Callback can either be a function or a string
  43695. if (typeof callback !== "function") {
  43696. callback = new Function("" + callback);
  43697. }
  43698. // Copy function arguments
  43699. var args = new Array(arguments.length - 1);
  43700. for (var i = 0; i < args.length; i++) {
  43701. args[i] = arguments[i + 1];
  43702. }
  43703. // Store and register the task
  43704. var task = { callback: callback, args: args };
  43705. tasksByHandle[nextHandle] = task;
  43706. registerImmediate(nextHandle);
  43707. return nextHandle++;
  43708. }
  43709. function clearImmediate(handle) {
  43710. delete tasksByHandle[handle];
  43711. }
  43712. function run(task) {
  43713. var callback = task.callback;
  43714. var args = task.args;
  43715. switch (args.length) {
  43716. case 0:
  43717. callback();
  43718. break;
  43719. case 1:
  43720. callback(args[0]);
  43721. break;
  43722. case 2:
  43723. callback(args[0], args[1]);
  43724. break;
  43725. case 3:
  43726. callback(args[0], args[1], args[2]);
  43727. break;
  43728. default:
  43729. callback.apply(undefined, args);
  43730. break;
  43731. }
  43732. }
  43733. function runIfPresent(handle) {
  43734. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  43735. // So if we're currently running a task, we'll need to delay this invocation.
  43736. if (currentlyRunningATask) {
  43737. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  43738. // "too much recursion" error.
  43739. setTimeout(runIfPresent, 0, handle);
  43740. } else {
  43741. var task = tasksByHandle[handle];
  43742. if (task) {
  43743. currentlyRunningATask = true;
  43744. try {
  43745. run(task);
  43746. } finally {
  43747. clearImmediate(handle);
  43748. currentlyRunningATask = false;
  43749. }
  43750. }
  43751. }
  43752. }
  43753. function installNextTickImplementation() {
  43754. registerImmediate = function(handle) {
  43755. process.nextTick(function () { runIfPresent(handle); });
  43756. };
  43757. }
  43758. function canUsePostMessage() {
  43759. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  43760. // where `global.postMessage` means something completely different and can't be used for this purpose.
  43761. if (global.postMessage && !global.importScripts) {
  43762. var postMessageIsAsynchronous = true;
  43763. var oldOnMessage = global.onmessage;
  43764. global.onmessage = function() {
  43765. postMessageIsAsynchronous = false;
  43766. };
  43767. global.postMessage("", "*");
  43768. global.onmessage = oldOnMessage;
  43769. return postMessageIsAsynchronous;
  43770. }
  43771. }
  43772. function installPostMessageImplementation() {
  43773. // Installs an event handler on `global` for the `message` event: see
  43774. // * https://developer.mozilla.org/en/DOM/window.postMessage
  43775. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  43776. var messagePrefix = "setImmediate$" + Math.random() + "$";
  43777. var onGlobalMessage = function(event) {
  43778. if (event.source === global &&
  43779. typeof event.data === "string" &&
  43780. event.data.indexOf(messagePrefix) === 0) {
  43781. runIfPresent(+event.data.slice(messagePrefix.length));
  43782. }
  43783. };
  43784. if (global.addEventListener) {
  43785. global.addEventListener("message", onGlobalMessage, false);
  43786. } else {
  43787. global.attachEvent("onmessage", onGlobalMessage);
  43788. }
  43789. registerImmediate = function(handle) {
  43790. global.postMessage(messagePrefix + handle, "*");
  43791. };
  43792. }
  43793. function installMessageChannelImplementation() {
  43794. var channel = new MessageChannel();
  43795. channel.port1.onmessage = function(event) {
  43796. var handle = event.data;
  43797. runIfPresent(handle);
  43798. };
  43799. registerImmediate = function(handle) {
  43800. channel.port2.postMessage(handle);
  43801. };
  43802. }
  43803. function installReadyStateChangeImplementation() {
  43804. var html = doc.documentElement;
  43805. registerImmediate = function(handle) {
  43806. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  43807. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  43808. var script = doc.createElement("script");
  43809. script.onreadystatechange = function () {
  43810. runIfPresent(handle);
  43811. script.onreadystatechange = null;
  43812. html.removeChild(script);
  43813. script = null;
  43814. };
  43815. html.appendChild(script);
  43816. };
  43817. }
  43818. function installSetTimeoutImplementation() {
  43819. registerImmediate = function(handle) {
  43820. setTimeout(runIfPresent, 0, handle);
  43821. };
  43822. }
  43823. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  43824. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  43825. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  43826. // Don't get fooled by e.g. browserify environments.
  43827. if ({}.toString.call(global.process) === "[object process]") {
  43828. // For Node.js before 0.9
  43829. installNextTickImplementation();
  43830. } else if (canUsePostMessage()) {
  43831. // For non-IE10 modern browsers
  43832. installPostMessageImplementation();
  43833. } else if (global.MessageChannel) {
  43834. // For web workers, where supported
  43835. installMessageChannelImplementation();
  43836. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  43837. // For IE 6–8
  43838. installReadyStateChangeImplementation();
  43839. } else {
  43840. // For older browsers
  43841. installSetTimeoutImplementation();
  43842. }
  43843. attachTo.setImmediate = setImmediate;
  43844. attachTo.clearImmediate = clearImmediate;
  43845. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  43846. /* 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")))
  43847. /***/ }),
  43848. /***/ "./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&":
  43849. /*!***********************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
  43850. !*** ./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& ***!
  43851. \***********************************************************************************************************************************************************************************************************************************************************************************************************************************/
  43852. /*! no static exports found */
  43853. /***/ (function(module, exports, __webpack_require__) {
  43854. 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&");
  43855. if(typeof content === 'string') content = [[module.i, content, '']];
  43856. var transform;
  43857. var insertInto;
  43858. var options = {"hmr":true}
  43859. options.transform = transform
  43860. options.insertInto = undefined;
  43861. var update = __webpack_require__(/*! ../../../node_modules/style-loader/lib/addStyles.js */ "./node_modules/style-loader/lib/addStyles.js")(content, options);
  43862. if(content.locals) module.exports = content.locals;
  43863. if(false) {}
  43864. /***/ }),
  43865. /***/ "./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&":
  43866. /*!************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
  43867. !*** ./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& ***!
  43868. \************************************************************************************************************************************************************************************************************************************************************************************************************************/
  43869. /*! no static exports found */
  43870. /***/ (function(module, exports, __webpack_require__) {
  43871. 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&");
  43872. if(typeof content === 'string') content = [[module.i, content, '']];
  43873. var transform;
  43874. var insertInto;
  43875. var options = {"hmr":true}
  43876. options.transform = transform
  43877. options.insertInto = undefined;
  43878. var update = __webpack_require__(/*! ../../../node_modules/style-loader/lib/addStyles.js */ "./node_modules/style-loader/lib/addStyles.js")(content, options);
  43879. if(content.locals) module.exports = content.locals;
  43880. if(false) {}
  43881. /***/ }),
  43882. /***/ "./node_modules/style-loader/lib/addStyles.js":
  43883. /*!****************************************************!*\
  43884. !*** ./node_modules/style-loader/lib/addStyles.js ***!
  43885. \****************************************************/
  43886. /*! no static exports found */
  43887. /***/ (function(module, exports, __webpack_require__) {
  43888. /*
  43889. MIT License http://www.opensource.org/licenses/mit-license.php
  43890. Author Tobias Koppers @sokra
  43891. */
  43892. var stylesInDom = {};
  43893. var memoize = function (fn) {
  43894. var memo;
  43895. return function () {
  43896. if (typeof memo === "undefined") memo = fn.apply(this, arguments);
  43897. return memo;
  43898. };
  43899. };
  43900. var isOldIE = memoize(function () {
  43901. // Test for IE <= 9 as proposed by Browserhacks
  43902. // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
  43903. // Tests for existence of standard globals is to allow style-loader
  43904. // to operate correctly into non-standard environments
  43905. // @see https://github.com/webpack-contrib/style-loader/issues/177
  43906. return window && document && document.all && !window.atob;
  43907. });
  43908. var getTarget = function (target, parent) {
  43909. if (parent){
  43910. return parent.querySelector(target);
  43911. }
  43912. return document.querySelector(target);
  43913. };
  43914. var getElement = (function (fn) {
  43915. var memo = {};
  43916. return function(target, parent) {
  43917. // If passing function in options, then use it for resolve "head" element.
  43918. // Useful for Shadow Root style i.e
  43919. // {
  43920. // insertInto: function () { return document.querySelector("#foo").shadowRoot }
  43921. // }
  43922. if (typeof target === 'function') {
  43923. return target();
  43924. }
  43925. if (typeof memo[target] === "undefined") {
  43926. var styleTarget = getTarget.call(this, target, parent);
  43927. // Special case to return head of iframe instead of iframe itself
  43928. if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
  43929. try {
  43930. // This will throw an exception if access to iframe is blocked
  43931. // due to cross-origin restrictions
  43932. styleTarget = styleTarget.contentDocument.head;
  43933. } catch(e) {
  43934. styleTarget = null;
  43935. }
  43936. }
  43937. memo[target] = styleTarget;
  43938. }
  43939. return memo[target]
  43940. };
  43941. })();
  43942. var singleton = null;
  43943. var singletonCounter = 0;
  43944. var stylesInsertedAtTop = [];
  43945. var fixUrls = __webpack_require__(/*! ./urls */ "./node_modules/style-loader/lib/urls.js");
  43946. module.exports = function(list, options) {
  43947. if (typeof DEBUG !== "undefined" && DEBUG) {
  43948. if (typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
  43949. }
  43950. options = options || {};
  43951. options.attrs = typeof options.attrs === "object" ? options.attrs : {};
  43952. // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
  43953. // tags it will allow on a page
  43954. if (!options.singleton && typeof options.singleton !== "boolean") options.singleton = isOldIE();
  43955. // By default, add <style> tags to the <head> element
  43956. if (!options.insertInto) options.insertInto = "head";
  43957. // By default, add <style> tags to the bottom of the target
  43958. if (!options.insertAt) options.insertAt = "bottom";
  43959. var styles = listToStyles(list, options);
  43960. addStylesToDom(styles, options);
  43961. return function update (newList) {
  43962. var mayRemove = [];
  43963. for (var i = 0; i < styles.length; i++) {
  43964. var item = styles[i];
  43965. var domStyle = stylesInDom[item.id];
  43966. domStyle.refs--;
  43967. mayRemove.push(domStyle);
  43968. }
  43969. if(newList) {
  43970. var newStyles = listToStyles(newList, options);
  43971. addStylesToDom(newStyles, options);
  43972. }
  43973. for (var i = 0; i < mayRemove.length; i++) {
  43974. var domStyle = mayRemove[i];
  43975. if(domStyle.refs === 0) {
  43976. for (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j]();
  43977. delete stylesInDom[domStyle.id];
  43978. }
  43979. }
  43980. };
  43981. };
  43982. function addStylesToDom (styles, options) {
  43983. for (var i = 0; i < styles.length; i++) {
  43984. var item = styles[i];
  43985. var domStyle = stylesInDom[item.id];
  43986. if(domStyle) {
  43987. domStyle.refs++;
  43988. for(var j = 0; j < domStyle.parts.length; j++) {
  43989. domStyle.parts[j](item.parts[j]);
  43990. }
  43991. for(; j < item.parts.length; j++) {
  43992. domStyle.parts.push(addStyle(item.parts[j], options));
  43993. }
  43994. } else {
  43995. var parts = [];
  43996. for(var j = 0; j < item.parts.length; j++) {
  43997. parts.push(addStyle(item.parts[j], options));
  43998. }
  43999. stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
  44000. }
  44001. }
  44002. }
  44003. function listToStyles (list, options) {
  44004. var styles = [];
  44005. var newStyles = {};
  44006. for (var i = 0; i < list.length; i++) {
  44007. var item = list[i];
  44008. var id = options.base ? item[0] + options.base : item[0];
  44009. var css = item[1];
  44010. var media = item[2];
  44011. var sourceMap = item[3];
  44012. var part = {css: css, media: media, sourceMap: sourceMap};
  44013. if(!newStyles[id]) styles.push(newStyles[id] = {id: id, parts: [part]});
  44014. else newStyles[id].parts.push(part);
  44015. }
  44016. return styles;
  44017. }
  44018. function insertStyleElement (options, style) {
  44019. var target = getElement(options.insertInto)
  44020. if (!target) {
  44021. throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");
  44022. }
  44023. var lastStyleElementInsertedAtTop = stylesInsertedAtTop[stylesInsertedAtTop.length - 1];
  44024. if (options.insertAt === "top") {
  44025. if (!lastStyleElementInsertedAtTop) {
  44026. target.insertBefore(style, target.firstChild);
  44027. } else if (lastStyleElementInsertedAtTop.nextSibling) {
  44028. target.insertBefore(style, lastStyleElementInsertedAtTop.nextSibling);
  44029. } else {
  44030. target.appendChild(style);
  44031. }
  44032. stylesInsertedAtTop.push(style);
  44033. } else if (options.insertAt === "bottom") {
  44034. target.appendChild(style);
  44035. } else if (typeof options.insertAt === "object" && options.insertAt.before) {
  44036. var nextSibling = getElement(options.insertAt.before, target);
  44037. target.insertBefore(style, nextSibling);
  44038. } else {
  44039. 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");
  44040. }
  44041. }
  44042. function removeStyleElement (style) {
  44043. if (style.parentNode === null) return false;
  44044. style.parentNode.removeChild(style);
  44045. var idx = stylesInsertedAtTop.indexOf(style);
  44046. if(idx >= 0) {
  44047. stylesInsertedAtTop.splice(idx, 1);
  44048. }
  44049. }
  44050. function createStyleElement (options) {
  44051. var style = document.createElement("style");
  44052. if(options.attrs.type === undefined) {
  44053. options.attrs.type = "text/css";
  44054. }
  44055. if(options.attrs.nonce === undefined) {
  44056. var nonce = getNonce();
  44057. if (nonce) {
  44058. options.attrs.nonce = nonce;
  44059. }
  44060. }
  44061. addAttrs(style, options.attrs);
  44062. insertStyleElement(options, style);
  44063. return style;
  44064. }
  44065. function createLinkElement (options) {
  44066. var link = document.createElement("link");
  44067. if(options.attrs.type === undefined) {
  44068. options.attrs.type = "text/css";
  44069. }
  44070. options.attrs.rel = "stylesheet";
  44071. addAttrs(link, options.attrs);
  44072. insertStyleElement(options, link);
  44073. return link;
  44074. }
  44075. function addAttrs (el, attrs) {
  44076. Object.keys(attrs).forEach(function (key) {
  44077. el.setAttribute(key, attrs[key]);
  44078. });
  44079. }
  44080. function getNonce() {
  44081. if (false) {}
  44082. return __webpack_require__.nc;
  44083. }
  44084. function addStyle (obj, options) {
  44085. var style, update, remove, result;
  44086. // If a transform function was defined, run it on the css
  44087. if (options.transform && obj.css) {
  44088. result = typeof options.transform === 'function'
  44089. ? options.transform(obj.css)
  44090. : options.transform.default(obj.css);
  44091. if (result) {
  44092. // If transform returns a value, use that instead of the original css.
  44093. // This allows running runtime transformations on the css.
  44094. obj.css = result;
  44095. } else {
  44096. // If the transform function returns a falsy value, don't add this css.
  44097. // This allows conditional loading of css
  44098. return function() {
  44099. // noop
  44100. };
  44101. }
  44102. }
  44103. if (options.singleton) {
  44104. var styleIndex = singletonCounter++;
  44105. style = singleton || (singleton = createStyleElement(options));
  44106. update = applyToSingletonTag.bind(null, style, styleIndex, false);
  44107. remove = applyToSingletonTag.bind(null, style, styleIndex, true);
  44108. } else if (
  44109. obj.sourceMap &&
  44110. typeof URL === "function" &&
  44111. typeof URL.createObjectURL === "function" &&
  44112. typeof URL.revokeObjectURL === "function" &&
  44113. typeof Blob === "function" &&
  44114. typeof btoa === "function"
  44115. ) {
  44116. style = createLinkElement(options);
  44117. update = updateLink.bind(null, style, options);
  44118. remove = function () {
  44119. removeStyleElement(style);
  44120. if(style.href) URL.revokeObjectURL(style.href);
  44121. };
  44122. } else {
  44123. style = createStyleElement(options);
  44124. update = applyToTag.bind(null, style);
  44125. remove = function () {
  44126. removeStyleElement(style);
  44127. };
  44128. }
  44129. update(obj);
  44130. return function updateStyle (newObj) {
  44131. if (newObj) {
  44132. if (
  44133. newObj.css === obj.css &&
  44134. newObj.media === obj.media &&
  44135. newObj.sourceMap === obj.sourceMap
  44136. ) {
  44137. return;
  44138. }
  44139. update(obj = newObj);
  44140. } else {
  44141. remove();
  44142. }
  44143. };
  44144. }
  44145. var replaceText = (function () {
  44146. var textStore = [];
  44147. return function (index, replacement) {
  44148. textStore[index] = replacement;
  44149. return textStore.filter(Boolean).join('\n');
  44150. };
  44151. })();
  44152. function applyToSingletonTag (style, index, remove, obj) {
  44153. var css = remove ? "" : obj.css;
  44154. if (style.styleSheet) {
  44155. style.styleSheet.cssText = replaceText(index, css);
  44156. } else {
  44157. var cssNode = document.createTextNode(css);
  44158. var childNodes = style.childNodes;
  44159. if (childNodes[index]) style.removeChild(childNodes[index]);
  44160. if (childNodes.length) {
  44161. style.insertBefore(cssNode, childNodes[index]);
  44162. } else {
  44163. style.appendChild(cssNode);
  44164. }
  44165. }
  44166. }
  44167. function applyToTag (style, obj) {
  44168. var css = obj.css;
  44169. var media = obj.media;
  44170. if(media) {
  44171. style.setAttribute("media", media)
  44172. }
  44173. if(style.styleSheet) {
  44174. style.styleSheet.cssText = css;
  44175. } else {
  44176. while(style.firstChild) {
  44177. style.removeChild(style.firstChild);
  44178. }
  44179. style.appendChild(document.createTextNode(css));
  44180. }
  44181. }
  44182. function updateLink (link, options, obj) {
  44183. var css = obj.css;
  44184. var sourceMap = obj.sourceMap;
  44185. /*
  44186. If convertToAbsoluteUrls isn't defined, but sourcemaps are enabled
  44187. and there is no publicPath defined then lets turn convertToAbsoluteUrls
  44188. on by default. Otherwise default to the convertToAbsoluteUrls option
  44189. directly
  44190. */
  44191. var autoFixUrls = options.convertToAbsoluteUrls === undefined && sourceMap;
  44192. if (options.convertToAbsoluteUrls || autoFixUrls) {
  44193. css = fixUrls(css);
  44194. }
  44195. if (sourceMap) {
  44196. // http://stackoverflow.com/a/26603875
  44197. css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
  44198. }
  44199. var blob = new Blob([css], { type: "text/css" });
  44200. var oldSrc = link.href;
  44201. link.href = URL.createObjectURL(blob);
  44202. if(oldSrc) URL.revokeObjectURL(oldSrc);
  44203. }
  44204. /***/ }),
  44205. /***/ "./node_modules/style-loader/lib/urls.js":
  44206. /*!***********************************************!*\
  44207. !*** ./node_modules/style-loader/lib/urls.js ***!
  44208. \***********************************************/
  44209. /*! no static exports found */
  44210. /***/ (function(module, exports) {
  44211. /**
  44212. * When source maps are enabled, `style-loader` uses a link element with a data-uri to
  44213. * embed the css on the page. This breaks all relative urls because now they are relative to a
  44214. * bundle instead of the current page.
  44215. *
  44216. * One solution is to only use full urls, but that may be impossible.
  44217. *
  44218. * Instead, this function "fixes" the relative urls to be absolute according to the current page location.
  44219. *
  44220. * A rudimentary test suite is located at `test/fixUrls.js` and can be run via the `npm test` command.
  44221. *
  44222. */
  44223. module.exports = function (css) {
  44224. // get current location
  44225. var location = typeof window !== "undefined" && window.location;
  44226. if (!location) {
  44227. throw new Error("fixUrls requires window.location");
  44228. }
  44229. // blank or null?
  44230. if (!css || typeof css !== "string") {
  44231. return css;
  44232. }
  44233. var baseUrl = location.protocol + "//" + location.host;
  44234. var currentDir = baseUrl + location.pathname.replace(/\/[^\/]*$/, "/");
  44235. // convert each url(...)
  44236. /*
  44237. This regular expression is just a way to recursively match brackets within
  44238. a string.
  44239. /url\s*\( = Match on the word "url" with any whitespace after it and then a parens
  44240. ( = Start a capturing group
  44241. (?: = Start a non-capturing group
  44242. [^)(] = Match anything that isn't a parentheses
  44243. | = OR
  44244. \( = Match a start parentheses
  44245. (?: = Start another non-capturing groups
  44246. [^)(]+ = Match anything that isn't a parentheses
  44247. | = OR
  44248. \( = Match a start parentheses
  44249. [^)(]* = Match anything that isn't a parentheses
  44250. \) = Match a end parentheses
  44251. ) = End Group
  44252. *\) = Match anything and then a close parens
  44253. ) = Close non-capturing group
  44254. * = Match anything
  44255. ) = Close capturing group
  44256. \) = Match a close parens
  44257. /gi = Get all matches, not the first. Be case insensitive.
  44258. */
  44259. var fixedCss = css.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function(fullMatch, origUrl) {
  44260. // strip quotes (if they exist)
  44261. var unquotedOrigUrl = origUrl
  44262. .trim()
  44263. .replace(/^"(.*)"$/, function(o, $1){ return $1; })
  44264. .replace(/^'(.*)'$/, function(o, $1){ return $1; });
  44265. // already a full url? no change
  44266. if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(unquotedOrigUrl)) {
  44267. return fullMatch;
  44268. }
  44269. // convert the url to a full url
  44270. var newUrl;
  44271. if (unquotedOrigUrl.indexOf("//") === 0) {
  44272. //TODO: should we add protocol?
  44273. newUrl = unquotedOrigUrl;
  44274. } else if (unquotedOrigUrl.indexOf("/") === 0) {
  44275. // path should be relative to the base url
  44276. newUrl = baseUrl + unquotedOrigUrl; // already starts with '/'
  44277. } else {
  44278. // path should be relative to current directory
  44279. newUrl = currentDir + unquotedOrigUrl.replace(/^\.\//, ""); // Strip leading './'
  44280. }
  44281. // send back the fixed url(...)
  44282. return "url(" + JSON.stringify(newUrl) + ")";
  44283. });
  44284. // send back the fixed css
  44285. return fixedCss;
  44286. };
  44287. /***/ }),
  44288. /***/ "./node_modules/timers-browserify/main.js":
  44289. /*!************************************************!*\
  44290. !*** ./node_modules/timers-browserify/main.js ***!
  44291. \************************************************/
  44292. /*! no static exports found */
  44293. /***/ (function(module, exports, __webpack_require__) {
  44294. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  44295. (typeof self !== "undefined" && self) ||
  44296. window;
  44297. var apply = Function.prototype.apply;
  44298. // DOM APIs, for completeness
  44299. exports.setTimeout = function() {
  44300. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  44301. };
  44302. exports.setInterval = function() {
  44303. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  44304. };
  44305. exports.clearTimeout =
  44306. exports.clearInterval = function(timeout) {
  44307. if (timeout) {
  44308. timeout.close();
  44309. }
  44310. };
  44311. function Timeout(id, clearFn) {
  44312. this._id = id;
  44313. this._clearFn = clearFn;
  44314. }
  44315. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  44316. Timeout.prototype.close = function() {
  44317. this._clearFn.call(scope, this._id);
  44318. };
  44319. // Does not start the time, just sets up the members needed.
  44320. exports.enroll = function(item, msecs) {
  44321. clearTimeout(item._idleTimeoutId);
  44322. item._idleTimeout = msecs;
  44323. };
  44324. exports.unenroll = function(item) {
  44325. clearTimeout(item._idleTimeoutId);
  44326. item._idleTimeout = -1;
  44327. };
  44328. exports._unrefActive = exports.active = function(item) {
  44329. clearTimeout(item._idleTimeoutId);
  44330. var msecs = item._idleTimeout;
  44331. if (msecs >= 0) {
  44332. item._idleTimeoutId = setTimeout(function onTimeout() {
  44333. if (item._onTimeout)
  44334. item._onTimeout();
  44335. }, msecs);
  44336. }
  44337. };
  44338. // setimmediate attaches itself to the global object
  44339. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  44340. // On some exotic environments, it's not clear which object `setimmediate` was
  44341. // able to install onto. Search each possibility in the same order as the
  44342. // `setimmediate` library.
  44343. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  44344. (typeof global !== "undefined" && global.setImmediate) ||
  44345. (this && this.setImmediate);
  44346. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  44347. (typeof global !== "undefined" && global.clearImmediate) ||
  44348. (this && this.clearImmediate);
  44349. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  44350. /***/ }),
  44351. /***/ "./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&":
  44352. /*!************************************************************************************************************************************************************************************************************!*\
  44353. !*** ./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& ***!
  44354. \************************************************************************************************************************************************************************************************************/
  44355. /*! exports provided: render, staticRenderFns */
  44356. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44357. "use strict";
  44358. __webpack_require__.r(__webpack_exports__);
  44359. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44360. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44361. var render = function() {
  44362. var _vm = this
  44363. var _h = _vm.$createElement
  44364. var _c = _vm._self._c || _h
  44365. return _c(
  44366. "div",
  44367. [
  44368. _c("asset-info-edit-modal", {
  44369. attrs: {
  44370. "modal-id": "asset" + _vm.asset.pcid + "editModal",
  44371. "populate-with": _vm.asset
  44372. }
  44373. }),
  44374. _vm._v(" "),
  44375. _c("h4", { staticClass: "text-center" }, [
  44376. _vm._v(
  44377. _vm._s(this.asset.pcmanu) + " " + _vm._s(this.asset.pcmake) + " - "
  44378. ),
  44379. _c("small", { staticClass: "text-muted" }, [
  44380. _vm._v(_vm._s(this.asset.pcnickname))
  44381. ])
  44382. ]),
  44383. _vm._v(" "),
  44384. _c("p", [_vm._v("OS: " + _vm._s(this.asset.pcextra[2]))]),
  44385. _vm._v(" "),
  44386. _c("p", [_vm._v("S/N: " + _vm._s(this.asset.pcextra[104]))]),
  44387. _vm._v(" "),
  44388. _c("p", [_vm._v("CPU: " + _vm._s(this.asset.pcextra[101]))]),
  44389. _vm._v(" "),
  44390. _c("p", [_vm._v("RAM: " + _vm._s(this.asset.pcextra[100]))]),
  44391. _vm._v(" "),
  44392. _c("p", [_vm._v("Graphics: " + _vm._s(this.asset.pcextra[4]))]),
  44393. _vm._v(" "),
  44394. _c(
  44395. "button",
  44396. {
  44397. staticClass: "btn btn-primary",
  44398. attrs: {
  44399. type: "button",
  44400. "data-toggle": "modal",
  44401. "data-target": "#asset" + _vm.asset.pcid + "editModal"
  44402. }
  44403. },
  44404. [_vm._v("Edit")]
  44405. )
  44406. ],
  44407. 1
  44408. )
  44409. }
  44410. var staticRenderFns = []
  44411. render._withStripped = true
  44412. /***/ }),
  44413. /***/ "./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&":
  44414. /*!*********************************************************************************************************************************************************************************************************************!*\
  44415. !*** ./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& ***!
  44416. \*********************************************************************************************************************************************************************************************************************/
  44417. /*! exports provided: render, staticRenderFns */
  44418. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44419. "use strict";
  44420. __webpack_require__.r(__webpack_exports__);
  44421. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44422. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44423. var render = function() {
  44424. var _vm = this
  44425. var _h = _vm.$createElement
  44426. var _c = _vm._self._c || _h
  44427. return _c(
  44428. "modal",
  44429. {
  44430. attrs: {
  44431. id: _vm.modalId,
  44432. tabindex: "-1",
  44433. role: "dialog",
  44434. "aria-labelledby": _vm.modalId + "Label"
  44435. }
  44436. },
  44437. [
  44438. _c(
  44439. "h5",
  44440. {
  44441. staticClass: "modal-title",
  44442. attrs: { slot: "header", id: _vm.modalId + "Label" },
  44443. slot: "header"
  44444. },
  44445. [_vm._v("\n Edit Work Order Information\n ")]
  44446. ),
  44447. _vm._v(" "),
  44448. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44449. _c("div", { staticClass: "form-group" }, [
  44450. _c("label", { attrs: { for: "manufacturer" } }, [
  44451. _vm._v("Manufacturer")
  44452. ]),
  44453. _vm._v(" "),
  44454. _c("input", {
  44455. directives: [
  44456. {
  44457. name: "model",
  44458. rawName: "v-model",
  44459. value: _vm.asset.pcmanu,
  44460. expression: "asset.pcmanu"
  44461. }
  44462. ],
  44463. staticClass: "form-control",
  44464. attrs: { type: "text", name: "manufacturer", id: "manufacturer" },
  44465. domProps: { value: _vm.asset.pcmanu },
  44466. on: {
  44467. input: function($event) {
  44468. if ($event.target.composing) {
  44469. return
  44470. }
  44471. _vm.$set(_vm.asset, "pcmanu", $event.target.value)
  44472. }
  44473. }
  44474. })
  44475. ]),
  44476. _vm._v(" "),
  44477. _c("div", { staticClass: "form-group" }, [
  44478. _c("label", { attrs: { for: "make" } }, [_vm._v("Make")]),
  44479. _vm._v(" "),
  44480. _c("input", {
  44481. directives: [
  44482. {
  44483. name: "model",
  44484. rawName: "v-model",
  44485. value: _vm.asset.pcmake,
  44486. expression: "asset.pcmake"
  44487. }
  44488. ],
  44489. staticClass: "form-control",
  44490. attrs: { type: "text", name: "make", id: "make" },
  44491. domProps: { value: _vm.asset.pcmake },
  44492. on: {
  44493. input: function($event) {
  44494. if ($event.target.composing) {
  44495. return
  44496. }
  44497. _vm.$set(_vm.asset, "pcmake", $event.target.value)
  44498. }
  44499. }
  44500. })
  44501. ]),
  44502. _vm._v(" "),
  44503. _c("div", { staticClass: "form-group" }, [
  44504. _c("label", { attrs: { for: "nickname" } }, [_vm._v("Nickname")]),
  44505. _vm._v(" "),
  44506. _c("input", {
  44507. directives: [
  44508. {
  44509. name: "model",
  44510. rawName: "v-model",
  44511. value: _vm.asset.pcnickname,
  44512. expression: "asset.pcnickname"
  44513. }
  44514. ],
  44515. staticClass: "form-control",
  44516. attrs: { type: "text", name: "nickname", id: "nickname" },
  44517. domProps: { value: _vm.asset.pcnickname },
  44518. on: {
  44519. input: function($event) {
  44520. if ($event.target.composing) {
  44521. return
  44522. }
  44523. _vm.$set(_vm.asset, "pcnickname", $event.target.value)
  44524. }
  44525. }
  44526. })
  44527. ]),
  44528. _vm._v(" "),
  44529. _c("div", { staticClass: "form-group" }, [
  44530. _c("label", { attrs: { for: "os" } }, [_vm._v("OS")]),
  44531. _vm._v(" "),
  44532. _c("input", {
  44533. directives: [
  44534. {
  44535. name: "model",
  44536. rawName: "v-model",
  44537. value: _vm.asset.pcextra[2],
  44538. expression: "asset.pcextra[2]"
  44539. }
  44540. ],
  44541. staticClass: "form-control",
  44542. attrs: { type: "text", name: "os", id: "os" },
  44543. domProps: { value: _vm.asset.pcextra[2] },
  44544. on: {
  44545. input: function($event) {
  44546. if ($event.target.composing) {
  44547. return
  44548. }
  44549. _vm.$set(_vm.asset.pcextra, 2, $event.target.value)
  44550. }
  44551. }
  44552. })
  44553. ]),
  44554. _vm._v(" "),
  44555. _c("div", { staticClass: "form-group" }, [
  44556. _c("label", { attrs: { for: "serial" } }, [_vm._v("Serial Number")]),
  44557. _vm._v(" "),
  44558. _c("input", {
  44559. directives: [
  44560. {
  44561. name: "model",
  44562. rawName: "v-model",
  44563. value: _vm.asset.pcextra[104],
  44564. expression: "asset.pcextra[104]"
  44565. }
  44566. ],
  44567. staticClass: "form-control",
  44568. attrs: { type: "text", id: "serial", name: "serial" },
  44569. domProps: { value: _vm.asset.pcextra[104] },
  44570. on: {
  44571. input: function($event) {
  44572. if ($event.target.composing) {
  44573. return
  44574. }
  44575. _vm.$set(_vm.asset.pcextra, 104, $event.target.value)
  44576. }
  44577. }
  44578. })
  44579. ]),
  44580. _vm._v(" "),
  44581. _c("div", { staticClass: "form-group" }, [
  44582. _c("label", { attrs: { for: "cpu" } }, [_vm._v("CPU")]),
  44583. _vm._v(" "),
  44584. _c("input", {
  44585. directives: [
  44586. {
  44587. name: "model",
  44588. rawName: "v-model",
  44589. value: _vm.asset.pcextra[101],
  44590. expression: "asset.pcextra[101]"
  44591. }
  44592. ],
  44593. staticClass: "form-control",
  44594. attrs: { type: "text", id: "cpu", name: "cpu" },
  44595. domProps: { value: _vm.asset.pcextra[101] },
  44596. on: {
  44597. input: function($event) {
  44598. if ($event.target.composing) {
  44599. return
  44600. }
  44601. _vm.$set(_vm.asset.pcextra, 101, $event.target.value)
  44602. }
  44603. }
  44604. })
  44605. ]),
  44606. _vm._v(" "),
  44607. _c("div", { staticClass: "form-group" }, [
  44608. _c("label", { attrs: { for: "ram" } }, [_vm._v("RAM")]),
  44609. _vm._v(" "),
  44610. _c("input", {
  44611. directives: [
  44612. {
  44613. name: "model",
  44614. rawName: "v-model",
  44615. value: _vm.asset.pcextra[100],
  44616. expression: "asset.pcextra[100]"
  44617. }
  44618. ],
  44619. staticClass: "form-control",
  44620. attrs: { type: "text", name: "ram", id: "ram" },
  44621. domProps: { value: _vm.asset.pcextra[100] },
  44622. on: {
  44623. input: function($event) {
  44624. if ($event.target.composing) {
  44625. return
  44626. }
  44627. _vm.$set(_vm.asset.pcextra, 100, $event.target.value)
  44628. }
  44629. }
  44630. })
  44631. ]),
  44632. _vm._v(" "),
  44633. _c("div", { staticClass: "form-group" }, [
  44634. _c("label", { attrs: { for: "graphics" } }, [_vm._v("Graphics")]),
  44635. _vm._v(" "),
  44636. _c("input", {
  44637. directives: [
  44638. {
  44639. name: "model",
  44640. rawName: "v-model",
  44641. value: _vm.asset.pcextra[4],
  44642. expression: "asset.pcextra[4]"
  44643. }
  44644. ],
  44645. staticClass: "form-control",
  44646. attrs: { type: "text", name: "graphics", id: "grapics" },
  44647. domProps: { value: _vm.asset.pcextra[4] },
  44648. on: {
  44649. input: function($event) {
  44650. if ($event.target.composing) {
  44651. return
  44652. }
  44653. _vm.$set(_vm.asset.pcextra, 4, $event.target.value)
  44654. }
  44655. }
  44656. })
  44657. ])
  44658. ]),
  44659. _vm._v(" "),
  44660. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44661. _c(
  44662. "button",
  44663. {
  44664. staticClass: "btn btn-secondary",
  44665. attrs: { type: "button", "data-dismiss": "modal" }
  44666. },
  44667. [_vm._v("Close")]
  44668. ),
  44669. _vm._v(" "),
  44670. _c(
  44671. "button",
  44672. {
  44673. staticClass: "btn btn-primary",
  44674. attrs: { type: "button" },
  44675. on: {
  44676. click: function($event) {
  44677. return _vm.updateAsset()
  44678. }
  44679. }
  44680. },
  44681. [
  44682. !_vm.assetSaving
  44683. ? _c("div", [_vm._v("Save")])
  44684. : _c("circle-spinner", { attrs: { size: 2 } })
  44685. ],
  44686. 1
  44687. )
  44688. ])
  44689. ]
  44690. )
  44691. }
  44692. var staticRenderFns = []
  44693. render._withStripped = true
  44694. /***/ }),
  44695. /***/ "./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&":
  44696. /*!*****************************************************************************************************************************************************************************************************************************!*\
  44697. !*** ./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& ***!
  44698. \*****************************************************************************************************************************************************************************************************************************/
  44699. /*! exports provided: render, staticRenderFns */
  44700. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44701. "use strict";
  44702. __webpack_require__.r(__webpack_exports__);
  44703. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44704. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44705. var render = function() {
  44706. var _vm = this
  44707. var _h = _vm.$createElement
  44708. var _c = _vm._self._c || _h
  44709. return _c("div", { staticClass: "dropdown", class: { open: _vm.open } }, [
  44710. _c("div", { staticClass: "input-group" }, [
  44711. _c("input", {
  44712. directives: [
  44713. {
  44714. name: "model",
  44715. rawName: "v-model",
  44716. value: _vm.searchText,
  44717. expression: "searchText"
  44718. }
  44719. ],
  44720. staticClass: "form-control",
  44721. attrs: { type: "text" },
  44722. domProps: { value: _vm.searchText },
  44723. on: {
  44724. input: [
  44725. function($event) {
  44726. if ($event.target.composing) {
  44727. return
  44728. }
  44729. _vm.searchText = $event.target.value
  44730. },
  44731. _vm.searchChanged
  44732. ]
  44733. }
  44734. }),
  44735. _vm._v(" "),
  44736. _c("div", { staticClass: "form-group-append" }, [
  44737. _c(
  44738. "a",
  44739. {
  44740. staticClass: "toggle input-group-text bg-primary text-light",
  44741. on: {
  44742. mousedown: function($event) {
  44743. $event.preventDefault()
  44744. },
  44745. click: function($event) {
  44746. return _vm.setOpen(!_vm.open)
  44747. }
  44748. }
  44749. },
  44750. [
  44751. _c("span", { staticClass: "arrow-up" }, [_vm._v("▲")]),
  44752. _vm._v(" "),
  44753. _c("span", { staticClass: "arrow-down" }, [_vm._v("▼")])
  44754. ]
  44755. )
  44756. ])
  44757. ]),
  44758. _vm._v(" "),
  44759. _c(
  44760. "ul",
  44761. { staticClass: "suggestion-list list-unstyled" },
  44762. _vm._l(_vm.matches, function(suggestion, index) {
  44763. return _c(
  44764. "li",
  44765. {
  44766. key: index,
  44767. on: {
  44768. mousedown: function($event) {
  44769. $event.preventDefault()
  44770. },
  44771. click: function($event) {
  44772. return _vm.suggestionSelected(suggestion)
  44773. }
  44774. }
  44775. },
  44776. [_vm._v("\n " + _vm._s(suggestion[1]) + "\n ")]
  44777. )
  44778. }),
  44779. 0
  44780. )
  44781. ])
  44782. }
  44783. var staticRenderFns = []
  44784. render._withStripped = true
  44785. /***/ }),
  44786. /***/ "./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&":
  44787. /*!****************************************************************************************************************************************************************************************************************************!*\
  44788. !*** ./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& ***!
  44789. \****************************************************************************************************************************************************************************************************************************/
  44790. /*! exports provided: render, staticRenderFns */
  44791. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44792. "use strict";
  44793. __webpack_require__.r(__webpack_exports__);
  44794. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44795. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44796. var render = function() {
  44797. var _vm = this
  44798. var _h = _vm.$createElement
  44799. var _c = _vm._self._c || _h
  44800. return _c(
  44801. "div",
  44802. {
  44803. staticClass: "loader",
  44804. style: {
  44805. fontSize: _vm.size + "px",
  44806. borderLeft: "1.1em solid " + _vm.color
  44807. }
  44808. },
  44809. [_vm._v("Loading...")]
  44810. )
  44811. }
  44812. var staticRenderFns = []
  44813. render._withStripped = true
  44814. /***/ }),
  44815. /***/ "./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&":
  44816. /*!*************************************************************************************************************************************************************************************************************!*\
  44817. !*** ./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& ***!
  44818. \*************************************************************************************************************************************************************************************************************/
  44819. /*! exports provided: render, staticRenderFns */
  44820. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44821. "use strict";
  44822. __webpack_require__.r(__webpack_exports__);
  44823. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44824. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44825. var render = function() {
  44826. var _vm = this
  44827. var _h = _vm.$createElement
  44828. var _c = _vm._self._c || _h
  44829. return _c(
  44830. "div",
  44831. { staticClass: "bg-lightgray m-1 p-2 border rounded container-fluid" },
  44832. [
  44833. _c("credential-form-modal", {
  44834. attrs: {
  44835. descriptions: _vm.creddescList,
  44836. "modal-id": "credential" + this.data.credid + "editModal",
  44837. populateWith: this.data
  44838. }
  44839. }),
  44840. _vm._v(" "),
  44841. _c(
  44842. "modal",
  44843. {
  44844. attrs: {
  44845. id: "credential" + this.data.credid + "deleteModal",
  44846. tabindex: "-1"
  44847. }
  44848. },
  44849. [
  44850. _c(
  44851. "h5",
  44852. {
  44853. staticClass: "modal-title",
  44854. attrs: {
  44855. slot: "header",
  44856. id: "credential" + this.data.credid + "deleteModalLabel"
  44857. },
  44858. slot: "header"
  44859. },
  44860. [_vm._v("\r\n Delete Credential\r\n ")]
  44861. ),
  44862. _vm._v(" "),
  44863. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44864. _vm._v("\r\n Are you sure?\r\n ")
  44865. ]),
  44866. _vm._v(" "),
  44867. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44868. _c(
  44869. "button",
  44870. {
  44871. staticClass: "btn btn-secondary",
  44872. attrs: { type: "button", "data-dismiss": "modal" }
  44873. },
  44874. [_vm._v("Cancel")]
  44875. ),
  44876. _vm._v(" "),
  44877. _c(
  44878. "button",
  44879. {
  44880. staticClass: "btn btn-danger",
  44881. attrs: { type: "button" },
  44882. on: {
  44883. click: function($event) {
  44884. return _vm.deleteCredential()
  44885. }
  44886. }
  44887. },
  44888. [
  44889. !_vm.credentialDeleting
  44890. ? _c("div", [_vm._v("Confirm")])
  44891. : _c("circle-spinner", { attrs: { size: 2 } })
  44892. ],
  44893. 1
  44894. )
  44895. ])
  44896. ]
  44897. ),
  44898. _vm._v(" "),
  44899. _c("div", { staticClass: "row no-gutters" }, [
  44900. _c("div", { staticClass: "h5 col-3 text-left" }, [
  44901. _vm._v(_vm._s(this.data.creddesc))
  44902. ]),
  44903. _vm._v(" "),
  44904. _c("div", { staticClass: "col-9 text-right" }, [
  44905. _vm._v(_vm._s(this.data.creddate))
  44906. ])
  44907. ]),
  44908. _vm._v(" "),
  44909. _c("div", { staticClass: "row" }, [
  44910. _c("div", { staticClass: "col-lg-9" }, [
  44911. _c("div", [
  44912. _vm._m(0),
  44913. _vm._v(" "),
  44914. _c("input", {
  44915. staticClass: "border-0 credential",
  44916. attrs: {
  44917. type: "text",
  44918. id: "username" + this.data.credid,
  44919. readonly: ""
  44920. },
  44921. domProps: { value: this.data.creduser }
  44922. }),
  44923. _vm._v(" "),
  44924. _c(
  44925. "button",
  44926. {
  44927. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  44928. attrs: {
  44929. id: "btn-username" + this.data.credid,
  44930. "data-clipboard-target": "#username" + this.data.credid
  44931. }
  44932. },
  44933. [_c("i", { staticClass: "far fa-clone" })]
  44934. )
  44935. ]),
  44936. _vm._v(" "),
  44937. _c("div", [
  44938. _vm._m(1),
  44939. _vm._v(" "),
  44940. _c("input", {
  44941. staticClass: "border-0 credential",
  44942. attrs: {
  44943. type: "text",
  44944. id: "password" + this.data.credid,
  44945. readonly: ""
  44946. },
  44947. domProps: { value: this.data.credpass }
  44948. }),
  44949. _vm._v(" "),
  44950. _c(
  44951. "button",
  44952. {
  44953. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  44954. attrs: {
  44955. id: "btn-password" + this.data.credid,
  44956. "data-clipboard-target": "#password" + this.data.credid
  44957. }
  44958. },
  44959. [_c("i", { staticClass: "far fa-clone" })]
  44960. )
  44961. ])
  44962. ]),
  44963. _vm._v(" "),
  44964. _c(
  44965. "div",
  44966. {
  44967. staticClass: "btn-group col-lg-2 align-self-end w-25 w-lg-auto",
  44968. attrs: { role: "group", "aria-label": "Edit and Delete" }
  44969. },
  44970. [
  44971. _c(
  44972. "button",
  44973. {
  44974. staticClass: "btn btn-sm btn-secondary p-lg-1",
  44975. attrs: {
  44976. type: "button",
  44977. "data-toggle": "modal",
  44978. "data-target": "#credential" + this.data.credid + "editModal"
  44979. }
  44980. },
  44981. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  44982. ),
  44983. _vm._v(" "),
  44984. _c(
  44985. "button",
  44986. {
  44987. staticClass: "btn btn-sm btn-danger p-lg-1",
  44988. attrs: {
  44989. type: "button",
  44990. "data-toggle": "modal",
  44991. "data-target":
  44992. "#credential" + this.data.credid + "deleteModal"
  44993. }
  44994. },
  44995. [_c("i", { staticClass: "fas fa-fw fa-trash-alt" })]
  44996. )
  44997. ]
  44998. )
  44999. ])
  45000. ],
  45001. 1
  45002. )
  45003. }
  45004. var staticRenderFns = [
  45005. function() {
  45006. var _vm = this
  45007. var _h = _vm.$createElement
  45008. var _c = _vm._self._c || _h
  45009. return _c("label", { attrs: { for: "username" } }, [
  45010. _c("i", { staticClass: "fas fa-fw fa-user" })
  45011. ])
  45012. },
  45013. function() {
  45014. var _vm = this
  45015. var _h = _vm.$createElement
  45016. var _c = _vm._self._c || _h
  45017. return _c("label", { attrs: { for: "password" } }, [
  45018. _c("i", { staticClass: "fas fa-fw fa-key" })
  45019. ])
  45020. }
  45021. ]
  45022. render._withStripped = true
  45023. /***/ }),
  45024. /***/ "./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&":
  45025. /*!**********************************************************************************************************************************************************************************************************************!*\
  45026. !*** ./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& ***!
  45027. \**********************************************************************************************************************************************************************************************************************/
  45028. /*! exports provided: render, staticRenderFns */
  45029. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45030. "use strict";
  45031. __webpack_require__.r(__webpack_exports__);
  45032. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45033. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45034. var render = function() {
  45035. var _vm = this
  45036. var _h = _vm.$createElement
  45037. var _c = _vm._self._c || _h
  45038. return _c(
  45039. "modal",
  45040. {
  45041. attrs: {
  45042. id: _vm.id,
  45043. tabindex: "-1",
  45044. role: "dialog",
  45045. "aria-labelledby": _vm.id + "Label"
  45046. }
  45047. },
  45048. [
  45049. _c(
  45050. "h5",
  45051. {
  45052. staticClass: "modal-title",
  45053. attrs: { slot: "header", id: _vm.id + "Label" },
  45054. slot: "header"
  45055. },
  45056. [_vm._v("\n Edit Credential\n ")]
  45057. ),
  45058. _vm._v(" "),
  45059. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  45060. _c(
  45061. "div",
  45062. { staticClass: "form" },
  45063. [
  45064. _c("autocomplete-custom-dropdown", {
  45065. attrs: {
  45066. options: _vm.descriptions,
  45067. value: _vm.creddesc,
  45068. "allow-custom": true
  45069. },
  45070. model: {
  45071. value: _vm.creddesc,
  45072. callback: function($$v) {
  45073. _vm.creddesc = $$v
  45074. },
  45075. expression: "creddesc"
  45076. }
  45077. })
  45078. ],
  45079. 1
  45080. ),
  45081. _vm._v(" "),
  45082. _c("div", { staticClass: "form-group" }, [
  45083. _c("label", { attrs: { for: "newusername" } }, [_vm._v("Username")]),
  45084. _vm._v(" "),
  45085. _c("input", {
  45086. directives: [
  45087. {
  45088. name: "model",
  45089. rawName: "v-model",
  45090. value: _vm.data.creduser,
  45091. expression: "data.creduser"
  45092. }
  45093. ],
  45094. staticClass: "form-control credential",
  45095. attrs: {
  45096. type: "text",
  45097. name: "newusername" + _vm.data.credid,
  45098. id: "newusername" + _vm.data.credid
  45099. },
  45100. domProps: { value: _vm.data.creduser },
  45101. on: {
  45102. input: function($event) {
  45103. if ($event.target.composing) {
  45104. return
  45105. }
  45106. _vm.$set(_vm.data, "creduser", $event.target.value)
  45107. }
  45108. }
  45109. })
  45110. ]),
  45111. _vm._v(" "),
  45112. _c("div", { staticClass: "form-group" }, [
  45113. _c("label", { attrs: { for: "newpassword" } }, [_vm._v("Password")]),
  45114. _vm._v(" "),
  45115. _c("input", {
  45116. directives: [
  45117. {
  45118. name: "model",
  45119. rawName: "v-model",
  45120. value: _vm.data.credpass,
  45121. expression: "data.credpass"
  45122. }
  45123. ],
  45124. staticClass: "form-control credential",
  45125. attrs: {
  45126. type: "text",
  45127. name: "newpassword" + _vm.data.credid,
  45128. id: "newpassword" + _vm.data.credid
  45129. },
  45130. domProps: { value: _vm.data.credpass },
  45131. on: {
  45132. input: function($event) {
  45133. if ($event.target.composing) {
  45134. return
  45135. }
  45136. _vm.$set(_vm.data, "credpass", $event.target.value)
  45137. }
  45138. }
  45139. }),
  45140. _vm._v(" "),
  45141. _c(
  45142. "button",
  45143. {
  45144. staticClass: "btn btn-secondary",
  45145. attrs: { type: "button" },
  45146. on: {
  45147. click: function($event) {
  45148. return _vm.getRandomPassword(_vm.data.credid)
  45149. }
  45150. }
  45151. },
  45152. [_vm._v("Generate Random")]
  45153. )
  45154. ]),
  45155. _vm._v(" "),
  45156. _c("div", { staticClass: "form-group" })
  45157. ]),
  45158. _vm._v(" "),
  45159. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  45160. _c(
  45161. "button",
  45162. {
  45163. staticClass: "btn btn-secondary",
  45164. attrs: { type: "button", "data-dismiss": "modal" }
  45165. },
  45166. [_vm._v("Close")]
  45167. ),
  45168. _vm._v(" "),
  45169. _c(
  45170. "button",
  45171. {
  45172. staticClass: "btn btn-primary",
  45173. attrs: { type: "button" },
  45174. on: {
  45175. click: function($event) {
  45176. return _vm.updateCredential()
  45177. }
  45178. }
  45179. },
  45180. [
  45181. !_vm.credentialSaving
  45182. ? _c("div", [_vm._v("Save")])
  45183. : _c("circle-spinner", { attrs: { size: 2 } })
  45184. ],
  45185. 1
  45186. )
  45187. ])
  45188. ]
  45189. )
  45190. }
  45191. var staticRenderFns = []
  45192. render._withStripped = true
  45193. /***/ }),
  45194. /***/ "./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&":
  45195. /*!*****************************************************************************************************************************************************************************************************************!*\
  45196. !*** ./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& ***!
  45197. \*****************************************************************************************************************************************************************************************************************/
  45198. /*! exports provided: render, staticRenderFns */
  45199. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45200. "use strict";
  45201. __webpack_require__.r(__webpack_exports__);
  45202. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45203. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45204. var render = function() {
  45205. var _vm = this
  45206. var _h = _vm.$createElement
  45207. var _c = _vm._self._c || _h
  45208. return _c(
  45209. "div",
  45210. [
  45211. _c("credential-form-modal", {
  45212. attrs: {
  45213. "modal-id": "newCredentialModal",
  45214. descriptions: _vm.creddescList,
  45215. create: true,
  45216. pcid: _vm.pcid
  45217. }
  45218. }),
  45219. _vm._v(" "),
  45220. _c(
  45221. "button",
  45222. {
  45223. staticClass: "btn btn-primary",
  45224. attrs: {
  45225. type: "button",
  45226. "data-toggle": "modal",
  45227. "data-target": "#newCredentialModal"
  45228. }
  45229. },
  45230. [_vm._v("New Credential")]
  45231. ),
  45232. _vm._v(" "),
  45233. _vm._l(_vm.credentials, function(credential) {
  45234. return _c(
  45235. "div",
  45236. { key: credential.credid },
  45237. [
  45238. _c("credential", {
  45239. attrs: { credential: credential, descriptions: _vm.creddescList }
  45240. })
  45241. ],
  45242. 1
  45243. )
  45244. })
  45245. ],
  45246. 2
  45247. )
  45248. }
  45249. var staticRenderFns = []
  45250. render._withStripped = true
  45251. /***/ }),
  45252. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ErrorList.vue?vue&type=template&id=48c089eb&":
  45253. /*!************************************************************************************************************************************************************************************************************!*\
  45254. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/ErrorList.vue?vue&type=template&id=48c089eb& ***!
  45255. \************************************************************************************************************************************************************************************************************/
  45256. /*! exports provided: render, staticRenderFns */
  45257. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45258. "use strict";
  45259. __webpack_require__.r(__webpack_exports__);
  45260. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45261. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45262. var render = function() {
  45263. var _vm = this
  45264. var _h = _vm.$createElement
  45265. var _c = _vm._self._c || _h
  45266. return _c(
  45267. "ul",
  45268. { staticClass: "list-unstyled" },
  45269. _vm._l(_vm.errorList, function(error) {
  45270. return _c("li", { key: error, staticClass: "text-danger" }, [
  45271. _vm._v(" " + _vm._s(error) + " ")
  45272. ])
  45273. }),
  45274. 0
  45275. )
  45276. }
  45277. var staticRenderFns = []
  45278. render._withStripped = true
  45279. /***/ }),
  45280. /***/ "./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&":
  45281. /*!********************************************************************************************************************************************************************************************************!*\
  45282. !*** ./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& ***!
  45283. \********************************************************************************************************************************************************************************************************/
  45284. /*! exports provided: render, staticRenderFns */
  45285. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45286. "use strict";
  45287. __webpack_require__.r(__webpack_exports__);
  45288. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45289. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45290. var render = function() {
  45291. var _vm = this
  45292. var _h = _vm.$createElement
  45293. var _c = _vm._self._c || _h
  45294. return _c("div", { staticClass: "modal fade" }, [
  45295. _c(
  45296. "div",
  45297. { staticClass: "modal-dialog modal-lg", attrs: { role: "document" } },
  45298. [
  45299. _c("div", { staticClass: "modal-content" }, [
  45300. _c(
  45301. "div",
  45302. { staticClass: "modal-header" },
  45303. [_vm._m(0), _vm._v(" "), _vm._t("header")],
  45304. 2
  45305. ),
  45306. _vm._v(" "),
  45307. _c("div", { staticClass: "modal-body" }, [_vm._t("body")], 2),
  45308. _vm._v(" "),
  45309. _c("div", { staticClass: "modal-footer" }, [_vm._t("footer")], 2)
  45310. ])
  45311. ]
  45312. )
  45313. ])
  45314. }
  45315. var staticRenderFns = [
  45316. function() {
  45317. var _vm = this
  45318. var _h = _vm.$createElement
  45319. var _c = _vm._self._c || _h
  45320. return _c(
  45321. "button",
  45322. {
  45323. staticClass: "close",
  45324. attrs: {
  45325. type: "button",
  45326. "data-dismiss": "modal",
  45327. "aria-label": "Close"
  45328. }
  45329. },
  45330. [_c("span", { attrs: { "aria-hidden": "true" } }, [_vm._v("×")])]
  45331. )
  45332. }
  45333. ]
  45334. render._withStripped = true
  45335. /***/ }),
  45336. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/NoteFormModal.vue?vue&type=template&id=1391a09c&":
  45337. /*!****************************************************************************************************************************************************************************************************************!*\
  45338. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/NoteFormModal.vue?vue&type=template&id=1391a09c& ***!
  45339. \****************************************************************************************************************************************************************************************************************/
  45340. /*! exports provided: render, staticRenderFns */
  45341. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45342. "use strict";
  45343. __webpack_require__.r(__webpack_exports__);
  45344. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45345. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45346. var render = function() {
  45347. var _vm = this
  45348. var _h = _vm.$createElement
  45349. var _c = _vm._self._c || _h
  45350. return _c(
  45351. "modal",
  45352. {
  45353. attrs: {
  45354. id: _vm.modalId,
  45355. tabindex: "-1",
  45356. role: "dialog",
  45357. "aria-labelledby": _vm.modalId + "Label"
  45358. }
  45359. },
  45360. [
  45361. _c(
  45362. "h5",
  45363. {
  45364. staticClass: "modal-title",
  45365. attrs: { slot: "header", id: _vm.modalId + "Label" },
  45366. slot: "header"
  45367. },
  45368. [_vm._v("\n Edit Note\n ")]
  45369. ),
  45370. _vm._v(" "),
  45371. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  45372. _c("div", { staticClass: "form-group" }, [
  45373. _c("label", { attrs: { for: "content" } }, [_vm._v("Content")]),
  45374. _vm._v(" "),
  45375. _c("textarea", {
  45376. directives: [
  45377. {
  45378. name: "model",
  45379. rawName: "v-model",
  45380. value: _vm.note.thenote,
  45381. expression: "note.thenote"
  45382. }
  45383. ],
  45384. staticClass: "form-control",
  45385. attrs: {
  45386. name: "content" + _vm.note.noteid,
  45387. id: "content" + _vm.note.noteid
  45388. },
  45389. domProps: { value: _vm.note.thenote },
  45390. on: {
  45391. input: function($event) {
  45392. if ($event.target.composing) {
  45393. return
  45394. }
  45395. _vm.$set(_vm.note, "thenote", $event.target.value)
  45396. }
  45397. }
  45398. })
  45399. ])
  45400. ]),
  45401. _vm._v(" "),
  45402. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  45403. _c(
  45404. "button",
  45405. {
  45406. staticClass: "btn btn-secondary",
  45407. attrs: { type: "button", "data-dismiss": "modal" }
  45408. },
  45409. [_vm._v("Close")]
  45410. ),
  45411. _vm._v(" "),
  45412. _c(
  45413. "button",
  45414. {
  45415. staticClass: "btn btn-primary",
  45416. attrs: { type: "button" },
  45417. on: {
  45418. click: function($event) {
  45419. return _vm.updateNote(_vm.note)
  45420. }
  45421. }
  45422. },
  45423. [
  45424. !_vm.noteSaving
  45425. ? _c("div", [_vm._v("Save")])
  45426. : _c("circle-spinner", { attrs: { size: 2 } })
  45427. ],
  45428. 1
  45429. )
  45430. ])
  45431. ]
  45432. )
  45433. }
  45434. var staticRenderFns = []
  45435. render._withStripped = true
  45436. /***/ }),
  45437. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/Notes.vue?vue&type=template&id=3d897ee6&":
  45438. /*!********************************************************************************************************************************************************************************************************!*\
  45439. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/Notes.vue?vue&type=template&id=3d897ee6& ***!
  45440. \********************************************************************************************************************************************************************************************************/
  45441. /*! exports provided: render, staticRenderFns */
  45442. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45443. "use strict";
  45444. __webpack_require__.r(__webpack_exports__);
  45445. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45446. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45447. var render = function() {
  45448. var _vm = this
  45449. var _h = _vm.$createElement
  45450. var _c = _vm._self._c || _h
  45451. return _c(
  45452. "ul",
  45453. { staticClass: "list-unstyled" },
  45454. [
  45455. _c("div", { staticClass: "row" }, [
  45456. _c(
  45457. "div",
  45458. {
  45459. staticClass:
  45460. "col-md-2 d-flex justify-content-center justify-content-md-start"
  45461. },
  45462. [
  45463. _c(
  45464. "button",
  45465. {
  45466. staticClass: "btn btn-primary m-2",
  45467. attrs: {
  45468. type: "button",
  45469. "data-toggle": "collapse",
  45470. "data-target": "#note" + _vm.noteType + "add"
  45471. }
  45472. },
  45473. [
  45474. _c("i", { staticClass: "fas fa-fw fa-plus" }),
  45475. _vm._v(" Add New Note")
  45476. ]
  45477. )
  45478. ]
  45479. ),
  45480. _vm._v(" "),
  45481. _c("div", { staticClass: "col-md-10" }, [
  45482. _c(
  45483. "div",
  45484. {
  45485. staticClass: "collapse",
  45486. attrs: { id: "note" + _vm.noteType + "add" }
  45487. },
  45488. [
  45489. _c(
  45490. "div",
  45491. {
  45492. staticClass:
  45493. "d-flex flex-wrap flex-md-nowrap justify-content-center"
  45494. },
  45495. [
  45496. _c("textarea", {
  45497. directives: [
  45498. {
  45499. name: "model",
  45500. rawName: "v-model",
  45501. value: _vm.newNote.thenote,
  45502. expression: "newNote.thenote"
  45503. }
  45504. ],
  45505. staticClass: "form-control",
  45506. attrs: {
  45507. name: "newnote" + _vm.noteType,
  45508. id: "newnote" + _vm.noteType
  45509. },
  45510. domProps: { value: _vm.newNote.thenote },
  45511. on: {
  45512. input: function($event) {
  45513. if ($event.target.composing) {
  45514. return
  45515. }
  45516. _vm.$set(_vm.newNote, "thenote", $event.target.value)
  45517. }
  45518. }
  45519. }),
  45520. _vm._v(" "),
  45521. _c(
  45522. "button",
  45523. {
  45524. staticClass: "btn btn-secondary m-2",
  45525. attrs: { type: "button" },
  45526. on: {
  45527. click: function($event) {
  45528. return _vm.createNote()
  45529. }
  45530. }
  45531. },
  45532. [
  45533. !_vm.noteSaving
  45534. ? _c("div", [_vm._v("Save")])
  45535. : _c("circle-spinner", { attrs: { size: 2 } })
  45536. ],
  45537. 1
  45538. )
  45539. ]
  45540. )
  45541. ]
  45542. )
  45543. ])
  45544. ]),
  45545. _vm._v(" "),
  45546. _vm._l(this.notes, function(note, index) {
  45547. return _c(
  45548. "li",
  45549. { key: index, staticClass: "row no-gutters mb-2" },
  45550. [
  45551. _c("note-form-modal", {
  45552. attrs: {
  45553. "modal-id": "note" + note.noteid + "editModal",
  45554. "populate-with": note
  45555. }
  45556. }),
  45557. _vm._v(" "),
  45558. _c(
  45559. "div",
  45560. {
  45561. staticClass: "col-md-1 d-flex flex-column mx-md-3",
  45562. class: _vm.noteOrders[index]
  45563. },
  45564. [
  45565. _c("div", { staticClass: "text-center p-0 m-0" }, [
  45566. _vm._v(_vm._s(note.noteuser))
  45567. ]),
  45568. _vm._v(" "),
  45569. _c(
  45570. "div",
  45571. { staticClass: "text-muted text-small text-center p-0 m-0" },
  45572. [_vm._v(_vm._s(_vm.getHRDate(note.notetime)))]
  45573. ),
  45574. _vm._v(" "),
  45575. _c(
  45576. "div",
  45577. { staticClass: "btn-group justify-content-center p-0 m-0" },
  45578. [
  45579. _vm.authusername === note.noteuser ||
  45580. _vm.authusername === "admin"
  45581. ? [
  45582. _c(
  45583. "button",
  45584. {
  45585. staticClass: "btn btn-sm btn-primary m-1",
  45586. attrs: {
  45587. "data-toggle": "modal",
  45588. "data-target":
  45589. "#note" + note.noteid + "editModal"
  45590. }
  45591. },
  45592. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  45593. ),
  45594. _vm._v(" "),
  45595. _vm._m(0, true),
  45596. _vm._v(" "),
  45597. _vm._m(1, true)
  45598. ]
  45599. : _vm._e()
  45600. ],
  45601. 2
  45602. )
  45603. ]
  45604. ),
  45605. _vm._v(" "),
  45606. _c("div", { staticClass: "col-md-10" }, [
  45607. _c("div", { staticClass: "card m-2" }, [
  45608. _c("div", { staticClass: "card-body p-2" }, [
  45609. _vm._v(
  45610. "\n " +
  45611. _vm._s(note.thenote) +
  45612. "\n "
  45613. )
  45614. ])
  45615. ])
  45616. ])
  45617. ],
  45618. 1
  45619. )
  45620. })
  45621. ],
  45622. 2
  45623. )
  45624. }
  45625. var staticRenderFns = [
  45626. function() {
  45627. var _vm = this
  45628. var _h = _vm.$createElement
  45629. var _c = _vm._self._c || _h
  45630. return _c("button", { staticClass: "btn btn-sm btn-danger m-1" }, [
  45631. _c("i", { staticClass: "fas fa-fw fa-trash-alt" })
  45632. ])
  45633. },
  45634. function() {
  45635. var _vm = this
  45636. var _h = _vm.$createElement
  45637. var _c = _vm._self._c || _h
  45638. return _c("button", { staticClass: "btn btn-sm btn-primary m-1" }, [
  45639. _c("i", { staticClass: "fa fa-fw fa-random" })
  45640. ])
  45641. }
  45642. ]
  45643. render._withStripped = true
  45644. /***/ }),
  45645. /***/ "./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&":
  45646. /*!******************************************************************************************************************************************************************************************************************!*\
  45647. !*** ./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& ***!
  45648. \******************************************************************************************************************************************************************************************************************/
  45649. /*! exports provided: render, staticRenderFns */
  45650. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45651. "use strict";
  45652. __webpack_require__.r(__webpack_exports__);
  45653. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45654. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45655. var render = function() {
  45656. var _vm = this
  45657. var _h = _vm.$createElement
  45658. var _c = _vm._self._c || _h
  45659. return _c(
  45660. "modal",
  45661. {
  45662. attrs: {
  45663. id: _vm.id,
  45664. tabindex: "-1",
  45665. role: "dialog",
  45666. "aria-labelledby": _vm.id + "Label"
  45667. }
  45668. },
  45669. [
  45670. _c(
  45671. "h5",
  45672. {
  45673. staticClass: "modal-title",
  45674. attrs: { slot: "header", id: _vm.id + "Label" },
  45675. slot: "header"
  45676. },
  45677. [_vm._v("\r\n Edit Work Order Information\r\n ")]
  45678. ),
  45679. _vm._v(" "),
  45680. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  45681. _c(
  45682. "div",
  45683. { staticClass: "form-group" },
  45684. [
  45685. _c("label", { attrs: { for: "probdesc" } }, [
  45686. _vm._v("Problem Description")
  45687. ]),
  45688. _vm._v(" "),
  45689. _c("textarea", {
  45690. directives: [
  45691. {
  45692. name: "model",
  45693. rawName: "v-model",
  45694. value: _vm.data.probdesc,
  45695. expression: "data.probdesc"
  45696. }
  45697. ],
  45698. class: {
  45699. "form-control": true,
  45700. "is-invalid": _vm.errors.probdesc
  45701. },
  45702. attrs: { id: "probdesc", name: "probdesc" },
  45703. domProps: { value: _vm.data.probdesc },
  45704. on: {
  45705. input: function($event) {
  45706. if ($event.target.composing) {
  45707. return
  45708. }
  45709. _vm.$set(_vm.data, "probdesc", $event.target.value)
  45710. }
  45711. }
  45712. }),
  45713. _vm._v(" "),
  45714. _c("error-list", { attrs: { errors: _vm.errors.probdesc } })
  45715. ],
  45716. 1
  45717. ),
  45718. _vm._v(" "),
  45719. _c(
  45720. "div",
  45721. { staticClass: "form-group" },
  45722. [
  45723. _c("label", { attrs: { for: "suggested" } }, [
  45724. _vm._v("Suggested Solution")
  45725. ]),
  45726. _vm._v(" "),
  45727. _c("textarea", {
  45728. directives: [
  45729. {
  45730. name: "model",
  45731. rawName: "v-model",
  45732. value: _vm.data.suggested,
  45733. expression: "data.suggested"
  45734. }
  45735. ],
  45736. class: {
  45737. "form-control": true,
  45738. "is-invalid": _vm.errors.suggested
  45739. },
  45740. attrs: { id: "suggested", name: "suggested" },
  45741. domProps: { value: _vm.data.suggested },
  45742. on: {
  45743. input: function($event) {
  45744. if ($event.target.composing) {
  45745. return
  45746. }
  45747. _vm.$set(_vm.data, "suggested", $event.target.value)
  45748. }
  45749. }
  45750. }),
  45751. _vm._v(" "),
  45752. _c("error-list", { attrs: { errors: _vm.errors.suggested } })
  45753. ],
  45754. 1
  45755. ),
  45756. _vm._v(" "),
  45757. _c(
  45758. "div",
  45759. { staticClass: "form-group" },
  45760. [
  45761. _c("label", { attrs: { for: "storelist" } }, [_vm._v("Store")]),
  45762. _vm._v(" "),
  45763. _c("autocomplete-custom-dropdown", {
  45764. attrs: { options: _vm.storeList, value: this.store },
  45765. model: {
  45766. value: _vm.store,
  45767. callback: function($$v) {
  45768. _vm.store = $$v
  45769. },
  45770. expression: "store"
  45771. }
  45772. })
  45773. ],
  45774. 1
  45775. )
  45776. ]),
  45777. _vm._v(" "),
  45778. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  45779. _c(
  45780. "button",
  45781. {
  45782. staticClass: "btn btn-secondary",
  45783. attrs: { type: "button", "data-dismiss": "modal" }
  45784. },
  45785. [_vm._v("Close")]
  45786. ),
  45787. _vm._v(" "),
  45788. _c(
  45789. "button",
  45790. {
  45791. staticClass: "btn btn-primary",
  45792. attrs: { type: "button" },
  45793. on: {
  45794. click: function($event) {
  45795. return _vm.updateWorkOrder()
  45796. }
  45797. }
  45798. },
  45799. [
  45800. !_vm.woInfoSaving
  45801. ? _c("div", [_vm._v("Save")])
  45802. : _c("circle-spinner", { attrs: { size: 2 } })
  45803. ],
  45804. 1
  45805. )
  45806. ])
  45807. ]
  45808. )
  45809. }
  45810. var staticRenderFns = []
  45811. render._withStripped = true
  45812. /***/ }),
  45813. /***/ "./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&":
  45814. /*!****************************************************************************************************************************************************************************************************************!*\
  45815. !*** ./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& ***!
  45816. \****************************************************************************************************************************************************************************************************************/
  45817. /*! exports provided: render, staticRenderFns */
  45818. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45819. "use strict";
  45820. __webpack_require__.r(__webpack_exports__);
  45821. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45822. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45823. var render = function() {
  45824. var _vm = this
  45825. var _h = _vm.$createElement
  45826. var _c = _vm._self._c || _h
  45827. return _c(
  45828. "div",
  45829. [
  45830. _c("wo-info-edit-modal", {
  45831. attrs: {
  45832. "modal-id": "workordereditModal",
  45833. "populate-with": _vm.workOrder,
  45834. "store-list": this.storeList
  45835. }
  45836. }),
  45837. _vm._v(" "),
  45838. _c("p", [
  45839. _c("i", { staticClass: "fas fa-fw fa-info-circle" }),
  45840. _vm._v(" "),
  45841. _c("span", {
  45842. domProps: { textContent: _vm._s(_vm.workOrder.probdesc) }
  45843. })
  45844. ]),
  45845. _vm._v(" "),
  45846. _c("p", [
  45847. _c("i", { staticClass: "far fa-fw fa-lightbulb" }),
  45848. _vm._v(" "),
  45849. _c("span", {
  45850. domProps: { textContent: _vm._s(_vm.workOrder.suggested) }
  45851. })
  45852. ]),
  45853. _vm._v(" "),
  45854. _c("p", [
  45855. _c("i", { staticClass: "fas fa-fw fa-paste" }),
  45856. _vm._v(" "),
  45857. _c("span", { domProps: { textContent: _vm._s(_vm.workOrder.woid) } })
  45858. ]),
  45859. _vm._v(" "),
  45860. _c("p", [
  45861. _c("i", { staticClass: "fas fa-fw fa-building" }),
  45862. _vm._v(" "),
  45863. _c("span", [_vm._v(_vm._s(_vm.storeList[_vm.workOrder.storeid]))])
  45864. ]),
  45865. _vm._v(" "),
  45866. _c("p", [
  45867. _c("i", { staticClass: "fas fa-fw fa-sign-in-alt" }),
  45868. _vm._v(" "),
  45869. _c(
  45870. "span",
  45871. {
  45872. staticClass: "dashed-underline",
  45873. attrs: {
  45874. "data-toggle": "tooltip",
  45875. "data-placement": "bottom",
  45876. title: this.getHRDate(_vm.workOrder.dropdate)
  45877. }
  45878. },
  45879. [
  45880. _vm._v(
  45881. "\n " +
  45882. _vm._s(
  45883. Math.floor(this.daysSinceToday(_vm.workOrder.dropdate))
  45884. ) +
  45885. " days ago\n "
  45886. )
  45887. ]
  45888. )
  45889. ]),
  45890. _vm._v(" "),
  45891. _c("p", [
  45892. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  45893. _vm._v(" "),
  45894. !this.isZero(_vm.workOrder.pickupdate)
  45895. ? _c(
  45896. "span",
  45897. {
  45898. staticClass: "dashed-underline",
  45899. attrs: {
  45900. "data-toggle": "tooltip",
  45901. "data-placement": "bottom",
  45902. title: this.getHRDate(_vm.workOrder.pickupdate)
  45903. }
  45904. },
  45905. [
  45906. _vm._v(
  45907. "\n " +
  45908. _vm._s(
  45909. Math.floor(this.daysSinceToday(_vm.workOrder.pickupdate))
  45910. ) +
  45911. " days ago\n "
  45912. )
  45913. ]
  45914. )
  45915. : _vm._e()
  45916. ]),
  45917. _vm._v(" "),
  45918. _c(
  45919. "button",
  45920. {
  45921. staticClass: "btn btn-primary",
  45922. attrs: {
  45923. type: "button",
  45924. "data-toggle": "modal",
  45925. "data-target": "#workordereditModal"
  45926. }
  45927. },
  45928. [_vm._v("Edit")]
  45929. )
  45930. ],
  45931. 1
  45932. )
  45933. }
  45934. var staticRenderFns = []
  45935. render._withStripped = true
  45936. /***/ }),
  45937. /***/ "./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&":
  45938. /*!*************************************************************************************************************************************************************************************************!*\
  45939. !*** ./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& ***!
  45940. \*************************************************************************************************************************************************************************************************/
  45941. /*! exports provided: render, staticRenderFns */
  45942. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45943. "use strict";
  45944. __webpack_require__.r(__webpack_exports__);
  45945. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45946. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45947. var render = function() {
  45948. var _vm = this
  45949. var _h = _vm.$createElement
  45950. var _c = _vm._self._c || _h
  45951. return _c("div", [
  45952. _c(
  45953. "nav",
  45954. {
  45955. staticClass:
  45956. "navbar navbar-expand navbar-dark bg-primary text-light shadow-sm"
  45957. },
  45958. [
  45959. _c(
  45960. "div",
  45961. { staticClass: "container-fluid" },
  45962. [
  45963. _c(
  45964. "router-link",
  45965. { staticClass: "navbar-brand", attrs: { to: { name: "home" } } },
  45966. [_vm._v("\n UPCCRT\n ")]
  45967. ),
  45968. _vm._v(" "),
  45969. _vm._m(0),
  45970. _vm._v(" "),
  45971. _c(
  45972. "div",
  45973. {
  45974. staticClass: "collapse navbar-collapse",
  45975. attrs: { id: "navbarSupportedContent" }
  45976. },
  45977. [
  45978. _c("ul", { staticClass: "navbar-nav mr-auto text-center" }, [
  45979. _vm._m(1),
  45980. _vm._v(" "),
  45981. _vm._m(2),
  45982. _vm._v(" "),
  45983. _c(
  45984. "li",
  45985. { staticClass: "nav-item" },
  45986. [
  45987. _c(
  45988. "router-link",
  45989. {
  45990. staticClass: "nav-link",
  45991. attrs: { to: { name: "dashboard" } }
  45992. },
  45993. [
  45994. _c("i", { staticClass: "fas fa-tachometer-alt" }),
  45995. _vm._v(" "),
  45996. _c(
  45997. "span",
  45998. { staticClass: "d-none d-sm-block d-md-inline" },
  45999. [_vm._v("Dashboard")]
  46000. )
  46001. ]
  46002. )
  46003. ],
  46004. 1
  46005. ),
  46006. _vm._v(" "),
  46007. _vm._m(3)
  46008. ]),
  46009. _vm._v(" "),
  46010. _c(
  46011. "ul",
  46012. { staticClass: "navbar-nav ml-auto" },
  46013. [
  46014. !_vm.isLoggedIn
  46015. ? _c(
  46016. "router-link",
  46017. {
  46018. staticClass: "nav-link",
  46019. attrs: { to: { name: "login" } }
  46020. },
  46021. [_vm._v("Login")]
  46022. )
  46023. : _vm._e(),
  46024. _vm._v(" "),
  46025. _vm.isLoggedIn
  46026. ? _c("li", { staticClass: "nav-link" }, [
  46027. _vm._v(_vm._s(_vm.username))
  46028. ])
  46029. : _vm._e(),
  46030. _vm._v(" "),
  46031. _vm.isLoggedIn
  46032. ? _c(
  46033. "router-link",
  46034. {
  46035. staticClass: "nav-link",
  46036. attrs: { to: { name: "home" } }
  46037. },
  46038. [_vm._v("Home")]
  46039. )
  46040. : _vm._e()
  46041. ],
  46042. 1
  46043. )
  46044. ]
  46045. )
  46046. ],
  46047. 1
  46048. )
  46049. ]
  46050. ),
  46051. _vm._v(" "),
  46052. _c("main", { staticClass: "py-4" }, [_c("router-view")], 1)
  46053. ])
  46054. }
  46055. var staticRenderFns = [
  46056. function() {
  46057. var _vm = this
  46058. var _h = _vm.$createElement
  46059. var _c = _vm._self._c || _h
  46060. return _c(
  46061. "button",
  46062. {
  46063. staticClass: "navbar-toggler",
  46064. attrs: {
  46065. type: "button",
  46066. "data-toggle": "collapse",
  46067. "data-target": "#navbarSupportedContent",
  46068. "aria-controls": "navbarSupportedContent",
  46069. "aria-expanded": "false"
  46070. }
  46071. },
  46072. [_c("span", { staticClass: "navbar-toggler-icon" })]
  46073. )
  46074. },
  46075. function() {
  46076. var _vm = this
  46077. var _h = _vm.$createElement
  46078. var _c = _vm._self._c || _h
  46079. return _c("li", { staticClass: "nav-item" }, [
  46080. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  46081. _c("i", { staticClass: "fas fa-sign-in-alt" }),
  46082. _vm._v(" "),
  46083. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  46084. _vm._v("Check-In")
  46085. ])
  46086. ])
  46087. ])
  46088. },
  46089. function() {
  46090. var _vm = this
  46091. var _h = _vm.$createElement
  46092. var _c = _vm._self._c || _h
  46093. return _c("li", { staticClass: "nav-item" }, [
  46094. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  46095. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  46096. _vm._v(" "),
  46097. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  46098. _vm._v("Check-Out")
  46099. ])
  46100. ])
  46101. ])
  46102. },
  46103. function() {
  46104. var _vm = this
  46105. var _h = _vm.$createElement
  46106. var _c = _vm._self._c || _h
  46107. return _c("li", { staticClass: "nav-item" }, [
  46108. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  46109. _c("i", { staticClass: "fas fa-chart-bar" }),
  46110. _vm._v(" "),
  46111. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  46112. _vm._v("Reports")
  46113. ])
  46114. ])
  46115. ])
  46116. }
  46117. ]
  46118. render._withStripped = true
  46119. /***/ }),
  46120. /***/ "./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&":
  46121. /*!*******************************************************************************************************************************************************************************************************!*\
  46122. !*** ./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& ***!
  46123. \*******************************************************************************************************************************************************************************************************/
  46124. /*! exports provided: render, staticRenderFns */
  46125. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46126. "use strict";
  46127. __webpack_require__.r(__webpack_exports__);
  46128. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  46129. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  46130. var render = function() {
  46131. var _vm = this
  46132. var _h = _vm.$createElement
  46133. var _c = _vm._self._c || _h
  46134. return _c("div", { staticClass: "container" }, [
  46135. _c("div", { staticClass: "row justify-content-center" }, [
  46136. !_vm.isLoading
  46137. ? _c(
  46138. "div",
  46139. { staticClass: "col-md-12" },
  46140. _vm._l(_vm.workOrders, function(workOrder, index) {
  46141. return _c(
  46142. "div",
  46143. { key: workOrder.woid, staticClass: "col-md-4" },
  46144. [
  46145. _c("div", { staticClass: "card" }, [
  46146. _c(
  46147. "div",
  46148. { staticClass: "card-header" },
  46149. [
  46150. _c(
  46151. "router-link",
  46152. {
  46153. staticClass: "h4 card-title",
  46154. attrs: {
  46155. to: {
  46156. name: "workorders",
  46157. params: { id: workOrder.woid }
  46158. }
  46159. }
  46160. },
  46161. [_vm._v(_vm._s(workOrder.woid))]
  46162. )
  46163. ],
  46164. 1
  46165. ),
  46166. _vm._v(" "),
  46167. _c("div", { staticClass: "card-body card-body-dark" }, [
  46168. _c("div", [
  46169. _vm._v(
  46170. "\n " +
  46171. _vm._s(workOrder.probdesc) +
  46172. "\n "
  46173. )
  46174. ]),
  46175. _vm._v(" "),
  46176. _c("div", [
  46177. _vm._v(
  46178. "\n " +
  46179. _vm._s(workOrder.suggested) +
  46180. "\n "
  46181. )
  46182. ])
  46183. ])
  46184. ])
  46185. ]
  46186. )
  46187. }),
  46188. 0
  46189. )
  46190. : _c(
  46191. "div",
  46192. { staticClass: "col-md-12" },
  46193. [_c("circle-spinner", { attrs: { color: "#663399" } })],
  46194. 1
  46195. )
  46196. ])
  46197. ])
  46198. }
  46199. var staticRenderFns = []
  46200. render._withStripped = true
  46201. /***/ }),
  46202. /***/ "./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&":
  46203. /*!***************************************************************************************************************************************************************************************************!*\
  46204. !*** ./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& ***!
  46205. \***************************************************************************************************************************************************************************************************/
  46206. /*! exports provided: render, staticRenderFns */
  46207. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46208. "use strict";
  46209. __webpack_require__.r(__webpack_exports__);
  46210. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  46211. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  46212. var render = function() {
  46213. var _vm = this
  46214. var _h = _vm.$createElement
  46215. var _c = _vm._self._c || _h
  46216. return _c("div", { staticClass: "container" }, [
  46217. _c("div", { staticClass: "row justify-content-center" }, [
  46218. _c("div", { staticClass: "col-md-8" }, [
  46219. _c("div", { staticClass: "card card-default" }, [
  46220. _c("div", { staticClass: "card-header" }, [_vm._v("Login")]),
  46221. _vm._v(" "),
  46222. _c("div", { staticClass: "card-body" }, [
  46223. _c("form", { attrs: { method: "POST", action: "/login" } }, [
  46224. _c("div", { staticClass: "form-group row" }, [
  46225. _c(
  46226. "label",
  46227. {
  46228. staticClass: "col-sm-4 col-form-label text-md-right",
  46229. attrs: { for: "username" }
  46230. },
  46231. [_vm._v("Username")]
  46232. ),
  46233. _vm._v(" "),
  46234. _c("div", { staticClass: "col-md-6" }, [
  46235. _c("input", {
  46236. directives: [
  46237. {
  46238. name: "model",
  46239. rawName: "v-model",
  46240. value: _vm.username,
  46241. expression: "username"
  46242. }
  46243. ],
  46244. staticClass: "form-control",
  46245. attrs: {
  46246. id: "username",
  46247. type: "username",
  46248. required: "",
  46249. autofocus: ""
  46250. },
  46251. domProps: { value: _vm.username },
  46252. on: {
  46253. input: function($event) {
  46254. if ($event.target.composing) {
  46255. return
  46256. }
  46257. _vm.username = $event.target.value
  46258. }
  46259. }
  46260. })
  46261. ])
  46262. ]),
  46263. _vm._v(" "),
  46264. _c("div", { staticClass: "form-group row" }, [
  46265. _c(
  46266. "label",
  46267. {
  46268. staticClass: "col-md-4 col-form-label text-md-right",
  46269. attrs: { for: "password" }
  46270. },
  46271. [_vm._v("Password")]
  46272. ),
  46273. _vm._v(" "),
  46274. _c("div", { staticClass: "col-md-6" }, [
  46275. _c("input", {
  46276. directives: [
  46277. {
  46278. name: "model",
  46279. rawName: "v-model",
  46280. value: _vm.password,
  46281. expression: "password"
  46282. }
  46283. ],
  46284. staticClass: "form-control",
  46285. attrs: { id: "password", type: "password", required: "" },
  46286. domProps: { value: _vm.password },
  46287. on: {
  46288. input: function($event) {
  46289. if ($event.target.composing) {
  46290. return
  46291. }
  46292. _vm.password = $event.target.value
  46293. }
  46294. }
  46295. })
  46296. ])
  46297. ]),
  46298. _vm._v(" "),
  46299. _c("div", { staticClass: "form-group row mb-0" }, [
  46300. _c("div", { staticClass: "col-md-8 offset-md-4" }, [
  46301. _c(
  46302. "button",
  46303. {
  46304. staticClass: "btn btn-primary",
  46305. attrs: { type: "submit" },
  46306. on: { click: _vm.handleSubmit }
  46307. },
  46308. [
  46309. _vm._v(
  46310. "\n Login\n "
  46311. )
  46312. ]
  46313. )
  46314. ])
  46315. ])
  46316. ])
  46317. ])
  46318. ])
  46319. ])
  46320. ])
  46321. ])
  46322. }
  46323. var staticRenderFns = []
  46324. render._withStripped = true
  46325. /***/ }),
  46326. /***/ "./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&":
  46327. /*!*****************************************************************************************************************************************************************************************************************!*\
  46328. !*** ./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& ***!
  46329. \*****************************************************************************************************************************************************************************************************************/
  46330. /*! exports provided: render, staticRenderFns */
  46331. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46332. "use strict";
  46333. __webpack_require__.r(__webpack_exports__);
  46334. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  46335. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  46336. var render = function() {
  46337. var _vm = this
  46338. var _h = _vm.$createElement
  46339. var _c = _vm._self._c || _h
  46340. return _vm._m(0)
  46341. }
  46342. var staticRenderFns = [
  46343. function() {
  46344. var _vm = this
  46345. var _h = _vm.$createElement
  46346. var _c = _vm._self._c || _h
  46347. return _c("div", { staticClass: "flex-center position-ref full-height" }, [
  46348. _c("div", { staticClass: "content" }, [
  46349. _c("div", { staticClass: "m-b-md" }, [
  46350. _c("h2", { staticClass: "title m-b-md" }, [
  46351. _vm._v("\n UPCCRT\n ")
  46352. ]),
  46353. _vm._v(" "),
  46354. _c("h3", [
  46355. _vm._v(
  46356. "\n University PC Care Repair Tracker\n "
  46357. )
  46358. ])
  46359. ])
  46360. ])
  46361. ])
  46362. }
  46363. ]
  46364. render._withStripped = true
  46365. /***/ }),
  46366. /***/ "./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&":
  46367. /*!*******************************************************************************************************************************************************************************************************!*\
  46368. !*** ./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& ***!
  46369. \*******************************************************************************************************************************************************************************************************/
  46370. /*! exports provided: render, staticRenderFns */
  46371. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46372. "use strict";
  46373. __webpack_require__.r(__webpack_exports__);
  46374. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  46375. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  46376. var render = function() {
  46377. var _vm = this
  46378. var _h = _vm.$createElement
  46379. var _c = _vm._self._c || _h
  46380. return _c("div", { staticClass: "container-fluid" }, [
  46381. _c("div", { staticClass: "row my-3" }, [
  46382. _c("div", { staticClass: "col-lg-6" }, [
  46383. _c("div", { staticClass: "card h-100" }, [
  46384. _vm._m(0),
  46385. _vm._v(" "),
  46386. _c("div", { staticClass: "card-body" }, [
  46387. _c("div", { staticClass: "tab-content" }, [
  46388. _c(
  46389. "div",
  46390. {
  46391. staticClass: "tab-pane active",
  46392. attrs: {
  46393. id: "assetinfo",
  46394. role: "tabpanel",
  46395. "aria-labelledby": "assetinfo-tab"
  46396. }
  46397. },
  46398. [
  46399. !_vm.assetLoading
  46400. ? _c("asset-info", { attrs: { asset: _vm.asset } })
  46401. : _c("circle-spinner", { attrs: { color: "#663399" } })
  46402. ],
  46403. 1
  46404. ),
  46405. _vm._v(" "),
  46406. _c(
  46407. "div",
  46408. {
  46409. staticClass: "tab-pane",
  46410. attrs: {
  46411. id: "credentials",
  46412. role: "tabpanel",
  46413. "aria-labelledby": "credentials-tab"
  46414. }
  46415. },
  46416. [
  46417. !_vm.credentialsLoading && !_vm.credentialDescriptionsLoading
  46418. ? _c("credential-list", {
  46419. attrs: {
  46420. credentials: _vm.credentials,
  46421. descriptions: _vm.credentialDescriptions,
  46422. pcid: _vm.asset.pcid
  46423. }
  46424. })
  46425. : _c("circle-spinner", { attrs: { color: "#663399" } })
  46426. ],
  46427. 1
  46428. )
  46429. ])
  46430. ])
  46431. ])
  46432. ]),
  46433. _vm._v(" "),
  46434. _c("div", { staticClass: "col-lg-6" }, [
  46435. _c("div", { staticClass: "card h-100" }, [
  46436. _vm._m(1),
  46437. _vm._v(" "),
  46438. _c("div", { staticClass: "card-body" }, [
  46439. _c("div", { staticClass: "tab-content" }, [
  46440. _c(
  46441. "div",
  46442. {
  46443. staticClass: "tab-pane active",
  46444. attrs: {
  46445. id: "workordersumm",
  46446. role: "tabpanel",
  46447. "aria-labelledby": "workordersumm-tab"
  46448. }
  46449. },
  46450. [
  46451. !_vm.woLoading && !_vm.storesLoading
  46452. ? _c("work-order-info", {
  46453. attrs: {
  46454. "work-order": _vm.workOrder,
  46455. stores: _vm.stores
  46456. }
  46457. })
  46458. : _c("circle-spinner", { attrs: { color: "#663399" } })
  46459. ],
  46460. 1
  46461. ),
  46462. _vm._v(" "),
  46463. _c(
  46464. "div",
  46465. {
  46466. staticClass: "tab-pane",
  46467. attrs: {
  46468. id: "attachments",
  46469. role: "tabpanel",
  46470. "aria-labelledby": "attachments-tab"
  46471. }
  46472. },
  46473. [
  46474. _vm._v(
  46475. "\n TODO 2\n "
  46476. )
  46477. ]
  46478. )
  46479. ])
  46480. ])
  46481. ])
  46482. ])
  46483. ]),
  46484. _vm._v(" "),
  46485. _c("div", { staticClass: "row my-3 no-gutters" }, [
  46486. _c("div", { staticClass: "col-12" }, [
  46487. _c("div", { staticClass: "card" }, [
  46488. _c(
  46489. "div",
  46490. { staticClass: "card-body" },
  46491. [
  46492. _c("h5", { staticClass: "card-title" }, [
  46493. _vm._v("Customer Notes")
  46494. ]),
  46495. _vm._v(" "),
  46496. !_vm.workOrderNotesLoading
  46497. ? _c("notes", {
  46498. attrs: {
  46499. notes: _vm.publicNotes,
  46500. authusername: _vm.authUser,
  46501. "note-type": 0,
  46502. woid: _vm.id
  46503. }
  46504. })
  46505. : _c("circle-spinner", { attrs: { color: "#663399" } })
  46506. ],
  46507. 1
  46508. )
  46509. ])
  46510. ])
  46511. ]),
  46512. _vm._v(" "),
  46513. _c("div", { staticClass: "row my-3 no-gutters" }, [
  46514. _c("div", { staticClass: "col-12" }, [
  46515. _c("div", { staticClass: "card" }, [
  46516. _c(
  46517. "div",
  46518. { staticClass: "card-body" },
  46519. [
  46520. _c("h5", { staticClass: "card-title" }, [
  46521. _vm._v("Private/Billing Notes")
  46522. ]),
  46523. _vm._v(" "),
  46524. !_vm.workOrderNotesLoading
  46525. ? _c("notes", {
  46526. attrs: {
  46527. notes: _vm.privateNotes,
  46528. authusername: _vm.authUser,
  46529. "note-type": 1,
  46530. woid: _vm.id
  46531. }
  46532. })
  46533. : _c("circle-spinner", { attrs: { color: "#663399" } })
  46534. ],
  46535. 1
  46536. )
  46537. ])
  46538. ])
  46539. ])
  46540. ])
  46541. }
  46542. var staticRenderFns = [
  46543. function() {
  46544. var _vm = this
  46545. var _h = _vm.$createElement
  46546. var _c = _vm._self._c || _h
  46547. return _c("div", { staticClass: "card-header text-right" }, [
  46548. _c(
  46549. "button",
  46550. {
  46551. staticClass: "btn btn-default xs-toggle",
  46552. attrs: {
  46553. type: "button",
  46554. "data-toggle": "collapse",
  46555. "data-target": "#assetTab"
  46556. }
  46557. },
  46558. [
  46559. _c("span", { staticClass: "sr-only" }, [_vm._v("Toggle Navigation")]),
  46560. _vm._v(" "),
  46561. _c("span", { staticClass: "icon-bar" }),
  46562. _vm._v(" "),
  46563. _c("span", { staticClass: "icon-bar" }),
  46564. _vm._v(" "),
  46565. _c("span", { staticClass: "icon-bar" })
  46566. ]
  46567. ),
  46568. _vm._v(" "),
  46569. _c(
  46570. "ul",
  46571. {
  46572. staticClass:
  46573. "nav nav-pills card-header-pills nav-justified xs-collapse collapse",
  46574. attrs: { id: "assetTab", role: "tablist" }
  46575. },
  46576. [
  46577. _c("li", { staticClass: "nav-item" }, [
  46578. _c(
  46579. "a",
  46580. {
  46581. staticClass: "nav-link active",
  46582. attrs: {
  46583. id: "assetinfo-tab",
  46584. "data-toggle": "pill",
  46585. href: "#assetinfo",
  46586. role: "tab",
  46587. "aria-controls": "assetinfo",
  46588. "aria-selected": "true"
  46589. }
  46590. },
  46591. [_vm._v("Hardware")]
  46592. )
  46593. ]),
  46594. _vm._v(" "),
  46595. _c("li", { staticClass: "nav-item" }, [
  46596. _c(
  46597. "a",
  46598. {
  46599. staticClass: "nav-link",
  46600. attrs: {
  46601. id: "credentials-tab",
  46602. "data-toggle": "pill",
  46603. href: "#credentials",
  46604. role: "tab",
  46605. "aria-controls": "credentials",
  46606. "aria-selected": "false"
  46607. }
  46608. },
  46609. [_vm._v("Credentials")]
  46610. )
  46611. ])
  46612. ]
  46613. )
  46614. ])
  46615. },
  46616. function() {
  46617. var _vm = this
  46618. var _h = _vm.$createElement
  46619. var _c = _vm._self._c || _h
  46620. return _c("div", { staticClass: "card-header text-right" }, [
  46621. _c(
  46622. "button",
  46623. {
  46624. staticClass: "btn btn-default xs-toggle",
  46625. attrs: {
  46626. type: "button",
  46627. "data-toggle": "collapse",
  46628. "data-target": "#workorderTab"
  46629. }
  46630. },
  46631. [
  46632. _c("span", { staticClass: "sr-only" }, [_vm._v("Toggle Navigation")]),
  46633. _vm._v(" "),
  46634. _c("span", { staticClass: "icon-bar" }),
  46635. _vm._v(" "),
  46636. _c("span", { staticClass: "icon-bar" }),
  46637. _vm._v(" "),
  46638. _c("span", { staticClass: "icon-bar" })
  46639. ]
  46640. ),
  46641. _vm._v(" "),
  46642. _c(
  46643. "ul",
  46644. {
  46645. staticClass:
  46646. "nav nav-pills card-header-pills nav-justified xs-collapse collapse",
  46647. attrs: { id: "workorderTab", role: "tablist" }
  46648. },
  46649. [
  46650. _c("li", { staticClass: "nav-item" }, [
  46651. _c(
  46652. "a",
  46653. {
  46654. staticClass: "nav-link active",
  46655. attrs: {
  46656. id: "workordersumm-tab",
  46657. "data-toggle": "pill",
  46658. href: "#workordersumm",
  46659. role: "tab",
  46660. "aria-controls": "workordersumm",
  46661. "aria-selected": "true"
  46662. }
  46663. },
  46664. [_vm._v("Summary")]
  46665. )
  46666. ]),
  46667. _vm._v(" "),
  46668. _c("li", { staticClass: "nav-item" }, [
  46669. _c(
  46670. "a",
  46671. {
  46672. staticClass: "nav-link",
  46673. attrs: {
  46674. id: "attachments-tab",
  46675. "data-toggle": "pill",
  46676. href: "#attachments",
  46677. role: "tab",
  46678. "aria-controls": "attachments",
  46679. "aria-selected": "false"
  46680. }
  46681. },
  46682. [_vm._v("Attachments")]
  46683. )
  46684. ])
  46685. ]
  46686. )
  46687. ])
  46688. }
  46689. ]
  46690. render._withStripped = true
  46691. /***/ }),
  46692. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  46693. /*!********************************************************************!*\
  46694. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  46695. \********************************************************************/
  46696. /*! exports provided: default */
  46697. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46698. "use strict";
  46699. __webpack_require__.r(__webpack_exports__);
  46700. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  46701. /* globals __VUE_SSR_CONTEXT__ */
  46702. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  46703. // This module is a runtime utility for cleaner component module output and will
  46704. // be included in the final webpack user bundle.
  46705. function normalizeComponent (
  46706. scriptExports,
  46707. render,
  46708. staticRenderFns,
  46709. functionalTemplate,
  46710. injectStyles,
  46711. scopeId,
  46712. moduleIdentifier, /* server only */
  46713. shadowMode /* vue-cli only */
  46714. ) {
  46715. // Vue.extend constructor export interop
  46716. var options = typeof scriptExports === 'function'
  46717. ? scriptExports.options
  46718. : scriptExports
  46719. // render functions
  46720. if (render) {
  46721. options.render = render
  46722. options.staticRenderFns = staticRenderFns
  46723. options._compiled = true
  46724. }
  46725. // functional template
  46726. if (functionalTemplate) {
  46727. options.functional = true
  46728. }
  46729. // scopedId
  46730. if (scopeId) {
  46731. options._scopeId = 'data-v-' + scopeId
  46732. }
  46733. var hook
  46734. if (moduleIdentifier) { // server build
  46735. hook = function (context) {
  46736. // 2.3 injection
  46737. context =
  46738. context || // cached call
  46739. (this.$vnode && this.$vnode.ssrContext) || // stateful
  46740. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  46741. // 2.2 with runInNewContext: true
  46742. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  46743. context = __VUE_SSR_CONTEXT__
  46744. }
  46745. // inject component styles
  46746. if (injectStyles) {
  46747. injectStyles.call(this, context)
  46748. }
  46749. // register component module identifier for async chunk inferrence
  46750. if (context && context._registeredComponents) {
  46751. context._registeredComponents.add(moduleIdentifier)
  46752. }
  46753. }
  46754. // used by ssr in case component is cached and beforeCreate
  46755. // never gets called
  46756. options._ssrRegister = hook
  46757. } else if (injectStyles) {
  46758. hook = shadowMode
  46759. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  46760. : injectStyles
  46761. }
  46762. if (hook) {
  46763. if (options.functional) {
  46764. // for template-only hot-reload because in that case the render fn doesn't
  46765. // go through the normalizer
  46766. options._injectStyles = hook
  46767. // register for functioal component in vue file
  46768. var originalRender = options.render
  46769. options.render = function renderWithStyleInjection (h, context) {
  46770. hook.call(context)
  46771. return originalRender(h, context)
  46772. }
  46773. } else {
  46774. // inject component registration as beforeCreate hook
  46775. var existing = options.beforeCreate
  46776. options.beforeCreate = existing
  46777. ? [].concat(existing, hook)
  46778. : [hook]
  46779. }
  46780. }
  46781. return {
  46782. exports: scriptExports,
  46783. options: options
  46784. }
  46785. }
  46786. /***/ }),
  46787. /***/ "./node_modules/vue-router/dist/vue-router.esm.js":
  46788. /*!********************************************************!*\
  46789. !*** ./node_modules/vue-router/dist/vue-router.esm.js ***!
  46790. \********************************************************/
  46791. /*! exports provided: default */
  46792. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46793. "use strict";
  46794. __webpack_require__.r(__webpack_exports__);
  46795. /*!
  46796. * vue-router v3.1.6
  46797. * (c) 2020 Evan You
  46798. * @license MIT
  46799. */
  46800. /* */
  46801. function assert (condition, message) {
  46802. if (!condition) {
  46803. throw new Error(("[vue-router] " + message))
  46804. }
  46805. }
  46806. function warn (condition, message) {
  46807. if ( true && !condition) {
  46808. typeof console !== 'undefined' && console.warn(("[vue-router] " + message));
  46809. }
  46810. }
  46811. function isError (err) {
  46812. return Object.prototype.toString.call(err).indexOf('Error') > -1
  46813. }
  46814. function isExtendedError (constructor, err) {
  46815. return (
  46816. err instanceof constructor ||
  46817. // _name is to support IE9 too
  46818. (err && (err.name === constructor.name || err._name === constructor._name))
  46819. )
  46820. }
  46821. function extend (a, b) {
  46822. for (var key in b) {
  46823. a[key] = b[key];
  46824. }
  46825. return a
  46826. }
  46827. var View = {
  46828. name: 'RouterView',
  46829. functional: true,
  46830. props: {
  46831. name: {
  46832. type: String,
  46833. default: 'default'
  46834. }
  46835. },
  46836. render: function render (_, ref) {
  46837. var props = ref.props;
  46838. var children = ref.children;
  46839. var parent = ref.parent;
  46840. var data = ref.data;
  46841. // used by devtools to display a router-view badge
  46842. data.routerView = true;
  46843. // directly use parent context's createElement() function
  46844. // so that components rendered by router-view can resolve named slots
  46845. var h = parent.$createElement;
  46846. var name = props.name;
  46847. var route = parent.$route;
  46848. var cache = parent._routerViewCache || (parent._routerViewCache = {});
  46849. // determine current view depth, also check to see if the tree
  46850. // has been toggled inactive but kept-alive.
  46851. var depth = 0;
  46852. var inactive = false;
  46853. while (parent && parent._routerRoot !== parent) {
  46854. var vnodeData = parent.$vnode ? parent.$vnode.data : {};
  46855. if (vnodeData.routerView) {
  46856. depth++;
  46857. }
  46858. if (vnodeData.keepAlive && parent._directInactive && parent._inactive) {
  46859. inactive = true;
  46860. }
  46861. parent = parent.$parent;
  46862. }
  46863. data.routerViewDepth = depth;
  46864. // render previous view if the tree is inactive and kept-alive
  46865. if (inactive) {
  46866. var cachedData = cache[name];
  46867. var cachedComponent = cachedData && cachedData.component;
  46868. if (cachedComponent) {
  46869. // #2301
  46870. // pass props
  46871. if (cachedData.configProps) {
  46872. fillPropsinData(cachedComponent, data, cachedData.route, cachedData.configProps);
  46873. }
  46874. return h(cachedComponent, data, children)
  46875. } else {
  46876. // render previous empty view
  46877. return h()
  46878. }
  46879. }
  46880. var matched = route.matched[depth];
  46881. var component = matched && matched.components[name];
  46882. // render empty node if no matched route or no config component
  46883. if (!matched || !component) {
  46884. cache[name] = null;
  46885. return h()
  46886. }
  46887. // cache component
  46888. cache[name] = { component: component };
  46889. // attach instance registration hook
  46890. // this will be called in the instance's injected lifecycle hooks
  46891. data.registerRouteInstance = function (vm, val) {
  46892. // val could be undefined for unregistration
  46893. var current = matched.instances[name];
  46894. if (
  46895. (val && current !== vm) ||
  46896. (!val && current === vm)
  46897. ) {
  46898. matched.instances[name] = val;
  46899. }
  46900. }
  46901. // also register instance in prepatch hook
  46902. // in case the same component instance is reused across different routes
  46903. ;(data.hook || (data.hook = {})).prepatch = function (_, vnode) {
  46904. matched.instances[name] = vnode.componentInstance;
  46905. };
  46906. // register instance in init hook
  46907. // in case kept-alive component be actived when routes changed
  46908. data.hook.init = function (vnode) {
  46909. if (vnode.data.keepAlive &&
  46910. vnode.componentInstance &&
  46911. vnode.componentInstance !== matched.instances[name]
  46912. ) {
  46913. matched.instances[name] = vnode.componentInstance;
  46914. }
  46915. };
  46916. var configProps = matched.props && matched.props[name];
  46917. // save route and configProps in cachce
  46918. if (configProps) {
  46919. extend(cache[name], {
  46920. route: route,
  46921. configProps: configProps
  46922. });
  46923. fillPropsinData(component, data, route, configProps);
  46924. }
  46925. return h(component, data, children)
  46926. }
  46927. };
  46928. function fillPropsinData (component, data, route, configProps) {
  46929. // resolve props
  46930. var propsToPass = data.props = resolveProps(route, configProps);
  46931. if (propsToPass) {
  46932. // clone to prevent mutation
  46933. propsToPass = data.props = extend({}, propsToPass);
  46934. // pass non-declared props as attrs
  46935. var attrs = data.attrs = data.attrs || {};
  46936. for (var key in propsToPass) {
  46937. if (!component.props || !(key in component.props)) {
  46938. attrs[key] = propsToPass[key];
  46939. delete propsToPass[key];
  46940. }
  46941. }
  46942. }
  46943. }
  46944. function resolveProps (route, config) {
  46945. switch (typeof config) {
  46946. case 'undefined':
  46947. return
  46948. case 'object':
  46949. return config
  46950. case 'function':
  46951. return config(route)
  46952. case 'boolean':
  46953. return config ? route.params : undefined
  46954. default:
  46955. if (true) {
  46956. warn(
  46957. false,
  46958. "props in \"" + (route.path) + "\" is a " + (typeof config) + ", " +
  46959. "expecting an object, function or boolean."
  46960. );
  46961. }
  46962. }
  46963. }
  46964. /* */
  46965. var encodeReserveRE = /[!'()*]/g;
  46966. var encodeReserveReplacer = function (c) { return '%' + c.charCodeAt(0).toString(16); };
  46967. var commaRE = /%2C/g;
  46968. // fixed encodeURIComponent which is more conformant to RFC3986:
  46969. // - escapes [!'()*]
  46970. // - preserve commas
  46971. var encode = function (str) { return encodeURIComponent(str)
  46972. .replace(encodeReserveRE, encodeReserveReplacer)
  46973. .replace(commaRE, ','); };
  46974. var decode = decodeURIComponent;
  46975. function resolveQuery (
  46976. query,
  46977. extraQuery,
  46978. _parseQuery
  46979. ) {
  46980. if ( extraQuery === void 0 ) extraQuery = {};
  46981. var parse = _parseQuery || parseQuery;
  46982. var parsedQuery;
  46983. try {
  46984. parsedQuery = parse(query || '');
  46985. } catch (e) {
  46986. true && warn(false, e.message);
  46987. parsedQuery = {};
  46988. }
  46989. for (var key in extraQuery) {
  46990. parsedQuery[key] = extraQuery[key];
  46991. }
  46992. return parsedQuery
  46993. }
  46994. function parseQuery (query) {
  46995. var res = {};
  46996. query = query.trim().replace(/^(\?|#|&)/, '');
  46997. if (!query) {
  46998. return res
  46999. }
  47000. query.split('&').forEach(function (param) {
  47001. var parts = param.replace(/\+/g, ' ').split('=');
  47002. var key = decode(parts.shift());
  47003. var val = parts.length > 0
  47004. ? decode(parts.join('='))
  47005. : null;
  47006. if (res[key] === undefined) {
  47007. res[key] = val;
  47008. } else if (Array.isArray(res[key])) {
  47009. res[key].push(val);
  47010. } else {
  47011. res[key] = [res[key], val];
  47012. }
  47013. });
  47014. return res
  47015. }
  47016. function stringifyQuery (obj) {
  47017. var res = obj ? Object.keys(obj).map(function (key) {
  47018. var val = obj[key];
  47019. if (val === undefined) {
  47020. return ''
  47021. }
  47022. if (val === null) {
  47023. return encode(key)
  47024. }
  47025. if (Array.isArray(val)) {
  47026. var result = [];
  47027. val.forEach(function (val2) {
  47028. if (val2 === undefined) {
  47029. return
  47030. }
  47031. if (val2 === null) {
  47032. result.push(encode(key));
  47033. } else {
  47034. result.push(encode(key) + '=' + encode(val2));
  47035. }
  47036. });
  47037. return result.join('&')
  47038. }
  47039. return encode(key) + '=' + encode(val)
  47040. }).filter(function (x) { return x.length > 0; }).join('&') : null;
  47041. return res ? ("?" + res) : ''
  47042. }
  47043. /* */
  47044. var trailingSlashRE = /\/?$/;
  47045. function createRoute (
  47046. record,
  47047. location,
  47048. redirectedFrom,
  47049. router
  47050. ) {
  47051. var stringifyQuery = router && router.options.stringifyQuery;
  47052. var query = location.query || {};
  47053. try {
  47054. query = clone(query);
  47055. } catch (e) {}
  47056. var route = {
  47057. name: location.name || (record && record.name),
  47058. meta: (record && record.meta) || {},
  47059. path: location.path || '/',
  47060. hash: location.hash || '',
  47061. query: query,
  47062. params: location.params || {},
  47063. fullPath: getFullPath(location, stringifyQuery),
  47064. matched: record ? formatMatch(record) : []
  47065. };
  47066. if (redirectedFrom) {
  47067. route.redirectedFrom = getFullPath(redirectedFrom, stringifyQuery);
  47068. }
  47069. return Object.freeze(route)
  47070. }
  47071. function clone (value) {
  47072. if (Array.isArray(value)) {
  47073. return value.map(clone)
  47074. } else if (value && typeof value === 'object') {
  47075. var res = {};
  47076. for (var key in value) {
  47077. res[key] = clone(value[key]);
  47078. }
  47079. return res
  47080. } else {
  47081. return value
  47082. }
  47083. }
  47084. // the starting route that represents the initial state
  47085. var START = createRoute(null, {
  47086. path: '/'
  47087. });
  47088. function formatMatch (record) {
  47089. var res = [];
  47090. while (record) {
  47091. res.unshift(record);
  47092. record = record.parent;
  47093. }
  47094. return res
  47095. }
  47096. function getFullPath (
  47097. ref,
  47098. _stringifyQuery
  47099. ) {
  47100. var path = ref.path;
  47101. var query = ref.query; if ( query === void 0 ) query = {};
  47102. var hash = ref.hash; if ( hash === void 0 ) hash = '';
  47103. var stringify = _stringifyQuery || stringifyQuery;
  47104. return (path || '/') + stringify(query) + hash
  47105. }
  47106. function isSameRoute (a, b) {
  47107. if (b === START) {
  47108. return a === b
  47109. } else if (!b) {
  47110. return false
  47111. } else if (a.path && b.path) {
  47112. return (
  47113. a.path.replace(trailingSlashRE, '') === b.path.replace(trailingSlashRE, '') &&
  47114. a.hash === b.hash &&
  47115. isObjectEqual(a.query, b.query)
  47116. )
  47117. } else if (a.name && b.name) {
  47118. return (
  47119. a.name === b.name &&
  47120. a.hash === b.hash &&
  47121. isObjectEqual(a.query, b.query) &&
  47122. isObjectEqual(a.params, b.params)
  47123. )
  47124. } else {
  47125. return false
  47126. }
  47127. }
  47128. function isObjectEqual (a, b) {
  47129. if ( a === void 0 ) a = {};
  47130. if ( b === void 0 ) b = {};
  47131. // handle null value #1566
  47132. if (!a || !b) { return a === b }
  47133. var aKeys = Object.keys(a);
  47134. var bKeys = Object.keys(b);
  47135. if (aKeys.length !== bKeys.length) {
  47136. return false
  47137. }
  47138. return aKeys.every(function (key) {
  47139. var aVal = a[key];
  47140. var bVal = b[key];
  47141. // check nested equality
  47142. if (typeof aVal === 'object' && typeof bVal === 'object') {
  47143. return isObjectEqual(aVal, bVal)
  47144. }
  47145. return String(aVal) === String(bVal)
  47146. })
  47147. }
  47148. function isIncludedRoute (current, target) {
  47149. return (
  47150. current.path.replace(trailingSlashRE, '/').indexOf(
  47151. target.path.replace(trailingSlashRE, '/')
  47152. ) === 0 &&
  47153. (!target.hash || current.hash === target.hash) &&
  47154. queryIncludes(current.query, target.query)
  47155. )
  47156. }
  47157. function queryIncludes (current, target) {
  47158. for (var key in target) {
  47159. if (!(key in current)) {
  47160. return false
  47161. }
  47162. }
  47163. return true
  47164. }
  47165. /* */
  47166. function resolvePath (
  47167. relative,
  47168. base,
  47169. append
  47170. ) {
  47171. var firstChar = relative.charAt(0);
  47172. if (firstChar === '/') {
  47173. return relative
  47174. }
  47175. if (firstChar === '?' || firstChar === '#') {
  47176. return base + relative
  47177. }
  47178. var stack = base.split('/');
  47179. // remove trailing segment if:
  47180. // - not appending
  47181. // - appending to trailing slash (last segment is empty)
  47182. if (!append || !stack[stack.length - 1]) {
  47183. stack.pop();
  47184. }
  47185. // resolve relative path
  47186. var segments = relative.replace(/^\//, '').split('/');
  47187. for (var i = 0; i < segments.length; i++) {
  47188. var segment = segments[i];
  47189. if (segment === '..') {
  47190. stack.pop();
  47191. } else if (segment !== '.') {
  47192. stack.push(segment);
  47193. }
  47194. }
  47195. // ensure leading slash
  47196. if (stack[0] !== '') {
  47197. stack.unshift('');
  47198. }
  47199. return stack.join('/')
  47200. }
  47201. function parsePath (path) {
  47202. var hash = '';
  47203. var query = '';
  47204. var hashIndex = path.indexOf('#');
  47205. if (hashIndex >= 0) {
  47206. hash = path.slice(hashIndex);
  47207. path = path.slice(0, hashIndex);
  47208. }
  47209. var queryIndex = path.indexOf('?');
  47210. if (queryIndex >= 0) {
  47211. query = path.slice(queryIndex + 1);
  47212. path = path.slice(0, queryIndex);
  47213. }
  47214. return {
  47215. path: path,
  47216. query: query,
  47217. hash: hash
  47218. }
  47219. }
  47220. function cleanPath (path) {
  47221. return path.replace(/\/\//g, '/')
  47222. }
  47223. var isarray = Array.isArray || function (arr) {
  47224. return Object.prototype.toString.call(arr) == '[object Array]';
  47225. };
  47226. /**
  47227. * Expose `pathToRegexp`.
  47228. */
  47229. var pathToRegexp_1 = pathToRegexp;
  47230. var parse_1 = parse;
  47231. var compile_1 = compile;
  47232. var tokensToFunction_1 = tokensToFunction;
  47233. var tokensToRegExp_1 = tokensToRegExp;
  47234. /**
  47235. * The main path matching regexp utility.
  47236. *
  47237. * @type {RegExp}
  47238. */
  47239. var PATH_REGEXP = new RegExp([
  47240. // Match escaped characters that would otherwise appear in future matches.
  47241. // This allows the user to escape special characters that won't transform.
  47242. '(\\\\.)',
  47243. // Match Express-style parameters and un-named parameters with a prefix
  47244. // and optional suffixes. Matches appear as:
  47245. //
  47246. // "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined]
  47247. // "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined]
  47248. // "/*" => ["/", undefined, undefined, undefined, undefined, "*"]
  47249. '([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))'
  47250. ].join('|'), 'g');
  47251. /**
  47252. * Parse a string for the raw tokens.
  47253. *
  47254. * @param {string} str
  47255. * @param {Object=} options
  47256. * @return {!Array}
  47257. */
  47258. function parse (str, options) {
  47259. var tokens = [];
  47260. var key = 0;
  47261. var index = 0;
  47262. var path = '';
  47263. var defaultDelimiter = options && options.delimiter || '/';
  47264. var res;
  47265. while ((res = PATH_REGEXP.exec(str)) != null) {
  47266. var m = res[0];
  47267. var escaped = res[1];
  47268. var offset = res.index;
  47269. path += str.slice(index, offset);
  47270. index = offset + m.length;
  47271. // Ignore already escaped sequences.
  47272. if (escaped) {
  47273. path += escaped[1];
  47274. continue
  47275. }
  47276. var next = str[index];
  47277. var prefix = res[2];
  47278. var name = res[3];
  47279. var capture = res[4];
  47280. var group = res[5];
  47281. var modifier = res[6];
  47282. var asterisk = res[7];
  47283. // Push the current path onto the tokens.
  47284. if (path) {
  47285. tokens.push(path);
  47286. path = '';
  47287. }
  47288. var partial = prefix != null && next != null && next !== prefix;
  47289. var repeat = modifier === '+' || modifier === '*';
  47290. var optional = modifier === '?' || modifier === '*';
  47291. var delimiter = res[2] || defaultDelimiter;
  47292. var pattern = capture || group;
  47293. tokens.push({
  47294. name: name || key++,
  47295. prefix: prefix || '',
  47296. delimiter: delimiter,
  47297. optional: optional,
  47298. repeat: repeat,
  47299. partial: partial,
  47300. asterisk: !!asterisk,
  47301. pattern: pattern ? escapeGroup(pattern) : (asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?')
  47302. });
  47303. }
  47304. // Match any characters still remaining.
  47305. if (index < str.length) {
  47306. path += str.substr(index);
  47307. }
  47308. // If the path exists, push it onto the end.
  47309. if (path) {
  47310. tokens.push(path);
  47311. }
  47312. return tokens
  47313. }
  47314. /**
  47315. * Compile a string to a template function for the path.
  47316. *
  47317. * @param {string} str
  47318. * @param {Object=} options
  47319. * @return {!function(Object=, Object=)}
  47320. */
  47321. function compile (str, options) {
  47322. return tokensToFunction(parse(str, options))
  47323. }
  47324. /**
  47325. * Prettier encoding of URI path segments.
  47326. *
  47327. * @param {string}
  47328. * @return {string}
  47329. */
  47330. function encodeURIComponentPretty (str) {
  47331. return encodeURI(str).replace(/[\/?#]/g, function (c) {
  47332. return '%' + c.charCodeAt(0).toString(16).toUpperCase()
  47333. })
  47334. }
  47335. /**
  47336. * Encode the asterisk parameter. Similar to `pretty`, but allows slashes.
  47337. *
  47338. * @param {string}
  47339. * @return {string}
  47340. */
  47341. function encodeAsterisk (str) {
  47342. return encodeURI(str).replace(/[?#]/g, function (c) {
  47343. return '%' + c.charCodeAt(0).toString(16).toUpperCase()
  47344. })
  47345. }
  47346. /**
  47347. * Expose a method for transforming tokens into the path function.
  47348. */
  47349. function tokensToFunction (tokens) {
  47350. // Compile all the tokens into regexps.
  47351. var matches = new Array(tokens.length);
  47352. // Compile all the patterns before compilation.
  47353. for (var i = 0; i < tokens.length; i++) {
  47354. if (typeof tokens[i] === 'object') {
  47355. matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');
  47356. }
  47357. }
  47358. return function (obj, opts) {
  47359. var path = '';
  47360. var data = obj || {};
  47361. var options = opts || {};
  47362. var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;
  47363. for (var i = 0; i < tokens.length; i++) {
  47364. var token = tokens[i];
  47365. if (typeof token === 'string') {
  47366. path += token;
  47367. continue
  47368. }
  47369. var value = data[token.name];
  47370. var segment;
  47371. if (value == null) {
  47372. if (token.optional) {
  47373. // Prepend partial segment prefixes.
  47374. if (token.partial) {
  47375. path += token.prefix;
  47376. }
  47377. continue
  47378. } else {
  47379. throw new TypeError('Expected "' + token.name + '" to be defined')
  47380. }
  47381. }
  47382. if (isarray(value)) {
  47383. if (!token.repeat) {
  47384. throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`')
  47385. }
  47386. if (value.length === 0) {
  47387. if (token.optional) {
  47388. continue
  47389. } else {
  47390. throw new TypeError('Expected "' + token.name + '" to not be empty')
  47391. }
  47392. }
  47393. for (var j = 0; j < value.length; j++) {
  47394. segment = encode(value[j]);
  47395. if (!matches[i].test(segment)) {
  47396. throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`')
  47397. }
  47398. path += (j === 0 ? token.prefix : token.delimiter) + segment;
  47399. }
  47400. continue
  47401. }
  47402. segment = token.asterisk ? encodeAsterisk(value) : encode(value);
  47403. if (!matches[i].test(segment)) {
  47404. throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"')
  47405. }
  47406. path += token.prefix + segment;
  47407. }
  47408. return path
  47409. }
  47410. }
  47411. /**
  47412. * Escape a regular expression string.
  47413. *
  47414. * @param {string} str
  47415. * @return {string}
  47416. */
  47417. function escapeString (str) {
  47418. return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1')
  47419. }
  47420. /**
  47421. * Escape the capturing group by escaping special characters and meaning.
  47422. *
  47423. * @param {string} group
  47424. * @return {string}
  47425. */
  47426. function escapeGroup (group) {
  47427. return group.replace(/([=!:$\/()])/g, '\\$1')
  47428. }
  47429. /**
  47430. * Attach the keys as a property of the regexp.
  47431. *
  47432. * @param {!RegExp} re
  47433. * @param {Array} keys
  47434. * @return {!RegExp}
  47435. */
  47436. function attachKeys (re, keys) {
  47437. re.keys = keys;
  47438. return re
  47439. }
  47440. /**
  47441. * Get the flags for a regexp from the options.
  47442. *
  47443. * @param {Object} options
  47444. * @return {string}
  47445. */
  47446. function flags (options) {
  47447. return options.sensitive ? '' : 'i'
  47448. }
  47449. /**
  47450. * Pull out keys from a regexp.
  47451. *
  47452. * @param {!RegExp} path
  47453. * @param {!Array} keys
  47454. * @return {!RegExp}
  47455. */
  47456. function regexpToRegexp (path, keys) {
  47457. // Use a negative lookahead to match only capturing groups.
  47458. var groups = path.source.match(/\((?!\?)/g);
  47459. if (groups) {
  47460. for (var i = 0; i < groups.length; i++) {
  47461. keys.push({
  47462. name: i,
  47463. prefix: null,
  47464. delimiter: null,
  47465. optional: false,
  47466. repeat: false,
  47467. partial: false,
  47468. asterisk: false,
  47469. pattern: null
  47470. });
  47471. }
  47472. }
  47473. return attachKeys(path, keys)
  47474. }
  47475. /**
  47476. * Transform an array into a regexp.
  47477. *
  47478. * @param {!Array} path
  47479. * @param {Array} keys
  47480. * @param {!Object} options
  47481. * @return {!RegExp}
  47482. */
  47483. function arrayToRegexp (path, keys, options) {
  47484. var parts = [];
  47485. for (var i = 0; i < path.length; i++) {
  47486. parts.push(pathToRegexp(path[i], keys, options).source);
  47487. }
  47488. var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options));
  47489. return attachKeys(regexp, keys)
  47490. }
  47491. /**
  47492. * Create a path regexp from string input.
  47493. *
  47494. * @param {string} path
  47495. * @param {!Array} keys
  47496. * @param {!Object} options
  47497. * @return {!RegExp}
  47498. */
  47499. function stringToRegexp (path, keys, options) {
  47500. return tokensToRegExp(parse(path, options), keys, options)
  47501. }
  47502. /**
  47503. * Expose a function for taking tokens and returning a RegExp.
  47504. *
  47505. * @param {!Array} tokens
  47506. * @param {(Array|Object)=} keys
  47507. * @param {Object=} options
  47508. * @return {!RegExp}
  47509. */
  47510. function tokensToRegExp (tokens, keys, options) {
  47511. if (!isarray(keys)) {
  47512. options = /** @type {!Object} */ (keys || options);
  47513. keys = [];
  47514. }
  47515. options = options || {};
  47516. var strict = options.strict;
  47517. var end = options.end !== false;
  47518. var route = '';
  47519. // Iterate over the tokens and create our regexp string.
  47520. for (var i = 0; i < tokens.length; i++) {
  47521. var token = tokens[i];
  47522. if (typeof token === 'string') {
  47523. route += escapeString(token);
  47524. } else {
  47525. var prefix = escapeString(token.prefix);
  47526. var capture = '(?:' + token.pattern + ')';
  47527. keys.push(token);
  47528. if (token.repeat) {
  47529. capture += '(?:' + prefix + capture + ')*';
  47530. }
  47531. if (token.optional) {
  47532. if (!token.partial) {
  47533. capture = '(?:' + prefix + '(' + capture + '))?';
  47534. } else {
  47535. capture = prefix + '(' + capture + ')?';
  47536. }
  47537. } else {
  47538. capture = prefix + '(' + capture + ')';
  47539. }
  47540. route += capture;
  47541. }
  47542. }
  47543. var delimiter = escapeString(options.delimiter || '/');
  47544. var endsWithDelimiter = route.slice(-delimiter.length) === delimiter;
  47545. // In non-strict mode we allow a slash at the end of match. If the path to
  47546. // match already ends with a slash, we remove it for consistency. The slash
  47547. // is valid at the end of a path match, not in the middle. This is important
  47548. // in non-ending mode, where "/test/" shouldn't match "/test//route".
  47549. if (!strict) {
  47550. route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?';
  47551. }
  47552. if (end) {
  47553. route += '$';
  47554. } else {
  47555. // In non-ending mode, we need the capturing groups to match as much as
  47556. // possible by using a positive lookahead to the end or next path segment.
  47557. route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)';
  47558. }
  47559. return attachKeys(new RegExp('^' + route, flags(options)), keys)
  47560. }
  47561. /**
  47562. * Normalize the given path string, returning a regular expression.
  47563. *
  47564. * An empty array can be passed in for the keys, which will hold the
  47565. * placeholder key descriptions. For example, using `/user/:id`, `keys` will
  47566. * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.
  47567. *
  47568. * @param {(string|RegExp|Array)} path
  47569. * @param {(Array|Object)=} keys
  47570. * @param {Object=} options
  47571. * @return {!RegExp}
  47572. */
  47573. function pathToRegexp (path, keys, options) {
  47574. if (!isarray(keys)) {
  47575. options = /** @type {!Object} */ (keys || options);
  47576. keys = [];
  47577. }
  47578. options = options || {};
  47579. if (path instanceof RegExp) {
  47580. return regexpToRegexp(path, /** @type {!Array} */ (keys))
  47581. }
  47582. if (isarray(path)) {
  47583. return arrayToRegexp(/** @type {!Array} */ (path), /** @type {!Array} */ (keys), options)
  47584. }
  47585. return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options)
  47586. }
  47587. pathToRegexp_1.parse = parse_1;
  47588. pathToRegexp_1.compile = compile_1;
  47589. pathToRegexp_1.tokensToFunction = tokensToFunction_1;
  47590. pathToRegexp_1.tokensToRegExp = tokensToRegExp_1;
  47591. /* */
  47592. // $flow-disable-line
  47593. var regexpCompileCache = Object.create(null);
  47594. function fillParams (
  47595. path,
  47596. params,
  47597. routeMsg
  47598. ) {
  47599. params = params || {};
  47600. try {
  47601. var filler =
  47602. regexpCompileCache[path] ||
  47603. (regexpCompileCache[path] = pathToRegexp_1.compile(path));
  47604. // Fix #2505 resolving asterisk routes { name: 'not-found', params: { pathMatch: '/not-found' }}
  47605. // and fix #3106 so that you can work with location descriptor object having params.pathMatch equal to empty string
  47606. if (typeof params.pathMatch === 'string') { params[0] = params.pathMatch; }
  47607. return filler(params, { pretty: true })
  47608. } catch (e) {
  47609. if (true) {
  47610. // Fix #3072 no warn if `pathMatch` is string
  47611. warn(typeof params.pathMatch === 'string', ("missing param for " + routeMsg + ": " + (e.message)));
  47612. }
  47613. return ''
  47614. } finally {
  47615. // delete the 0 if it was added
  47616. delete params[0];
  47617. }
  47618. }
  47619. /* */
  47620. function normalizeLocation (
  47621. raw,
  47622. current,
  47623. append,
  47624. router
  47625. ) {
  47626. var next = typeof raw === 'string' ? { path: raw } : raw;
  47627. // named target
  47628. if (next._normalized) {
  47629. return next
  47630. } else if (next.name) {
  47631. next = extend({}, raw);
  47632. var params = next.params;
  47633. if (params && typeof params === 'object') {
  47634. next.params = extend({}, params);
  47635. }
  47636. return next
  47637. }
  47638. // relative params
  47639. if (!next.path && next.params && current) {
  47640. next = extend({}, next);
  47641. next._normalized = true;
  47642. var params$1 = extend(extend({}, current.params), next.params);
  47643. if (current.name) {
  47644. next.name = current.name;
  47645. next.params = params$1;
  47646. } else if (current.matched.length) {
  47647. var rawPath = current.matched[current.matched.length - 1].path;
  47648. next.path = fillParams(rawPath, params$1, ("path " + (current.path)));
  47649. } else if (true) {
  47650. warn(false, "relative params navigation requires a current route.");
  47651. }
  47652. return next
  47653. }
  47654. var parsedPath = parsePath(next.path || '');
  47655. var basePath = (current && current.path) || '/';
  47656. var path = parsedPath.path
  47657. ? resolvePath(parsedPath.path, basePath, append || next.append)
  47658. : basePath;
  47659. var query = resolveQuery(
  47660. parsedPath.query,
  47661. next.query,
  47662. router && router.options.parseQuery
  47663. );
  47664. var hash = next.hash || parsedPath.hash;
  47665. if (hash && hash.charAt(0) !== '#') {
  47666. hash = "#" + hash;
  47667. }
  47668. return {
  47669. _normalized: true,
  47670. path: path,
  47671. query: query,
  47672. hash: hash
  47673. }
  47674. }
  47675. /* */
  47676. // work around weird flow bug
  47677. var toTypes = [String, Object];
  47678. var eventTypes = [String, Array];
  47679. var noop = function () {};
  47680. var Link = {
  47681. name: 'RouterLink',
  47682. props: {
  47683. to: {
  47684. type: toTypes,
  47685. required: true
  47686. },
  47687. tag: {
  47688. type: String,
  47689. default: 'a'
  47690. },
  47691. exact: Boolean,
  47692. append: Boolean,
  47693. replace: Boolean,
  47694. activeClass: String,
  47695. exactActiveClass: String,
  47696. event: {
  47697. type: eventTypes,
  47698. default: 'click'
  47699. }
  47700. },
  47701. render: function render (h) {
  47702. var this$1 = this;
  47703. var router = this.$router;
  47704. var current = this.$route;
  47705. var ref = router.resolve(
  47706. this.to,
  47707. current,
  47708. this.append
  47709. );
  47710. var location = ref.location;
  47711. var route = ref.route;
  47712. var href = ref.href;
  47713. var classes = {};
  47714. var globalActiveClass = router.options.linkActiveClass;
  47715. var globalExactActiveClass = router.options.linkExactActiveClass;
  47716. // Support global empty active class
  47717. var activeClassFallback =
  47718. globalActiveClass == null ? 'router-link-active' : globalActiveClass;
  47719. var exactActiveClassFallback =
  47720. globalExactActiveClass == null
  47721. ? 'router-link-exact-active'
  47722. : globalExactActiveClass;
  47723. var activeClass =
  47724. this.activeClass == null ? activeClassFallback : this.activeClass;
  47725. var exactActiveClass =
  47726. this.exactActiveClass == null
  47727. ? exactActiveClassFallback
  47728. : this.exactActiveClass;
  47729. var compareTarget = route.redirectedFrom
  47730. ? createRoute(null, normalizeLocation(route.redirectedFrom), null, router)
  47731. : route;
  47732. classes[exactActiveClass] = isSameRoute(current, compareTarget);
  47733. classes[activeClass] = this.exact
  47734. ? classes[exactActiveClass]
  47735. : isIncludedRoute(current, compareTarget);
  47736. var handler = function (e) {
  47737. if (guardEvent(e)) {
  47738. if (this$1.replace) {
  47739. router.replace(location, noop);
  47740. } else {
  47741. router.push(location, noop);
  47742. }
  47743. }
  47744. };
  47745. var on = { click: guardEvent };
  47746. if (Array.isArray(this.event)) {
  47747. this.event.forEach(function (e) {
  47748. on[e] = handler;
  47749. });
  47750. } else {
  47751. on[this.event] = handler;
  47752. }
  47753. var data = { class: classes };
  47754. var scopedSlot =
  47755. !this.$scopedSlots.$hasNormal &&
  47756. this.$scopedSlots.default &&
  47757. this.$scopedSlots.default({
  47758. href: href,
  47759. route: route,
  47760. navigate: handler,
  47761. isActive: classes[activeClass],
  47762. isExactActive: classes[exactActiveClass]
  47763. });
  47764. if (scopedSlot) {
  47765. if (scopedSlot.length === 1) {
  47766. return scopedSlot[0]
  47767. } else if (scopedSlot.length > 1 || !scopedSlot.length) {
  47768. if (true) {
  47769. warn(
  47770. false,
  47771. ("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.")
  47772. );
  47773. }
  47774. return scopedSlot.length === 0 ? h() : h('span', {}, scopedSlot)
  47775. }
  47776. }
  47777. if (this.tag === 'a') {
  47778. data.on = on;
  47779. data.attrs = { href: href };
  47780. } else {
  47781. // find the first <a> child and apply listener and href
  47782. var a = findAnchor(this.$slots.default);
  47783. if (a) {
  47784. // in case the <a> is a static node
  47785. a.isStatic = false;
  47786. var aData = (a.data = extend({}, a.data));
  47787. aData.on = aData.on || {};
  47788. // transform existing events in both objects into arrays so we can push later
  47789. for (var event in aData.on) {
  47790. var handler$1 = aData.on[event];
  47791. if (event in on) {
  47792. aData.on[event] = Array.isArray(handler$1) ? handler$1 : [handler$1];
  47793. }
  47794. }
  47795. // append new listeners for router-link
  47796. for (var event$1 in on) {
  47797. if (event$1 in aData.on) {
  47798. // on[event] is always a function
  47799. aData.on[event$1].push(on[event$1]);
  47800. } else {
  47801. aData.on[event$1] = handler;
  47802. }
  47803. }
  47804. var aAttrs = (a.data.attrs = extend({}, a.data.attrs));
  47805. aAttrs.href = href;
  47806. } else {
  47807. // doesn't have <a> child, apply listener to self
  47808. data.on = on;
  47809. }
  47810. }
  47811. return h(this.tag, data, this.$slots.default)
  47812. }
  47813. };
  47814. function guardEvent (e) {
  47815. // don't redirect with control keys
  47816. if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) { return }
  47817. // don't redirect when preventDefault called
  47818. if (e.defaultPrevented) { return }
  47819. // don't redirect on right click
  47820. if (e.button !== undefined && e.button !== 0) { return }
  47821. // don't redirect if `target="_blank"`
  47822. if (e.currentTarget && e.currentTarget.getAttribute) {
  47823. var target = e.currentTarget.getAttribute('target');
  47824. if (/\b_blank\b/i.test(target)) { return }
  47825. }
  47826. // this may be a Weex event which doesn't have this method
  47827. if (e.preventDefault) {
  47828. e.preventDefault();
  47829. }
  47830. return true
  47831. }
  47832. function findAnchor (children) {
  47833. if (children) {
  47834. var child;
  47835. for (var i = 0; i < children.length; i++) {
  47836. child = children[i];
  47837. if (child.tag === 'a') {
  47838. return child
  47839. }
  47840. if (child.children && (child = findAnchor(child.children))) {
  47841. return child
  47842. }
  47843. }
  47844. }
  47845. }
  47846. var _Vue;
  47847. function install (Vue) {
  47848. if (install.installed && _Vue === Vue) { return }
  47849. install.installed = true;
  47850. _Vue = Vue;
  47851. var isDef = function (v) { return v !== undefined; };
  47852. var registerInstance = function (vm, callVal) {
  47853. var i = vm.$options._parentVnode;
  47854. if (isDef(i) && isDef(i = i.data) && isDef(i = i.registerRouteInstance)) {
  47855. i(vm, callVal);
  47856. }
  47857. };
  47858. Vue.mixin({
  47859. beforeCreate: function beforeCreate () {
  47860. if (isDef(this.$options.router)) {
  47861. this._routerRoot = this;
  47862. this._router = this.$options.router;
  47863. this._router.init(this);
  47864. Vue.util.defineReactive(this, '_route', this._router.history.current);
  47865. } else {
  47866. this._routerRoot = (this.$parent && this.$parent._routerRoot) || this;
  47867. }
  47868. registerInstance(this, this);
  47869. },
  47870. destroyed: function destroyed () {
  47871. registerInstance(this);
  47872. }
  47873. });
  47874. Object.defineProperty(Vue.prototype, '$router', {
  47875. get: function get () { return this._routerRoot._router }
  47876. });
  47877. Object.defineProperty(Vue.prototype, '$route', {
  47878. get: function get () { return this._routerRoot._route }
  47879. });
  47880. Vue.component('RouterView', View);
  47881. Vue.component('RouterLink', Link);
  47882. var strats = Vue.config.optionMergeStrategies;
  47883. // use the same hook merging strategy for route hooks
  47884. strats.beforeRouteEnter = strats.beforeRouteLeave = strats.beforeRouteUpdate = strats.created;
  47885. }
  47886. /* */
  47887. var inBrowser = typeof window !== 'undefined';
  47888. /* */
  47889. function createRouteMap (
  47890. routes,
  47891. oldPathList,
  47892. oldPathMap,
  47893. oldNameMap
  47894. ) {
  47895. // the path list is used to control path matching priority
  47896. var pathList = oldPathList || [];
  47897. // $flow-disable-line
  47898. var pathMap = oldPathMap || Object.create(null);
  47899. // $flow-disable-line
  47900. var nameMap = oldNameMap || Object.create(null);
  47901. routes.forEach(function (route) {
  47902. addRouteRecord(pathList, pathMap, nameMap, route);
  47903. });
  47904. // ensure wildcard routes are always at the end
  47905. for (var i = 0, l = pathList.length; i < l; i++) {
  47906. if (pathList[i] === '*') {
  47907. pathList.push(pathList.splice(i, 1)[0]);
  47908. l--;
  47909. i--;
  47910. }
  47911. }
  47912. if (true) {
  47913. // warn if routes do not include leading slashes
  47914. var found = pathList
  47915. // check for missing leading slash
  47916. .filter(function (path) { return path && path.charAt(0) !== '*' && path.charAt(0) !== '/'; });
  47917. if (found.length > 0) {
  47918. var pathNames = found.map(function (path) { return ("- " + path); }).join('\n');
  47919. warn(false, ("Non-nested routes must include a leading slash character. Fix the following routes: \n" + pathNames));
  47920. }
  47921. }
  47922. return {
  47923. pathList: pathList,
  47924. pathMap: pathMap,
  47925. nameMap: nameMap
  47926. }
  47927. }
  47928. function addRouteRecord (
  47929. pathList,
  47930. pathMap,
  47931. nameMap,
  47932. route,
  47933. parent,
  47934. matchAs
  47935. ) {
  47936. var path = route.path;
  47937. var name = route.name;
  47938. if (true) {
  47939. assert(path != null, "\"path\" is required in a route configuration.");
  47940. assert(
  47941. typeof route.component !== 'string',
  47942. "route config \"component\" for path: " + (String(
  47943. path || name
  47944. )) + " cannot be a " + "string id. Use an actual component instead."
  47945. );
  47946. }
  47947. var pathToRegexpOptions =
  47948. route.pathToRegexpOptions || {};
  47949. var normalizedPath = normalizePath(path, parent, pathToRegexpOptions.strict);
  47950. if (typeof route.caseSensitive === 'boolean') {
  47951. pathToRegexpOptions.sensitive = route.caseSensitive;
  47952. }
  47953. var record = {
  47954. path: normalizedPath,
  47955. regex: compileRouteRegex(normalizedPath, pathToRegexpOptions),
  47956. components: route.components || { default: route.component },
  47957. instances: {},
  47958. name: name,
  47959. parent: parent,
  47960. matchAs: matchAs,
  47961. redirect: route.redirect,
  47962. beforeEnter: route.beforeEnter,
  47963. meta: route.meta || {},
  47964. props:
  47965. route.props == null
  47966. ? {}
  47967. : route.components
  47968. ? route.props
  47969. : { default: route.props }
  47970. };
  47971. if (route.children) {
  47972. // Warn if route is named, does not redirect and has a default child route.
  47973. // If users navigate to this route by name, the default child will
  47974. // not be rendered (GH Issue #629)
  47975. if (true) {
  47976. if (
  47977. route.name &&
  47978. !route.redirect &&
  47979. route.children.some(function (child) { return /^\/?$/.test(child.path); })
  47980. ) {
  47981. warn(
  47982. false,
  47983. "Named Route '" + (route.name) + "' has a default child route. " +
  47984. "When navigating to this named route (:to=\"{name: '" + (route.name) + "'\"), " +
  47985. "the default child route will not be rendered. Remove the name from " +
  47986. "this route and use the name of the default child route for named " +
  47987. "links instead."
  47988. );
  47989. }
  47990. }
  47991. route.children.forEach(function (child) {
  47992. var childMatchAs = matchAs
  47993. ? cleanPath((matchAs + "/" + (child.path)))
  47994. : undefined;
  47995. addRouteRecord(pathList, pathMap, nameMap, child, record, childMatchAs);
  47996. });
  47997. }
  47998. if (!pathMap[record.path]) {
  47999. pathList.push(record.path);
  48000. pathMap[record.path] = record;
  48001. }
  48002. if (route.alias !== undefined) {
  48003. var aliases = Array.isArray(route.alias) ? route.alias : [route.alias];
  48004. for (var i = 0; i < aliases.length; ++i) {
  48005. var alias = aliases[i];
  48006. if ( true && alias === path) {
  48007. warn(
  48008. false,
  48009. ("Found an alias with the same value as the path: \"" + path + "\". You have to remove that alias. It will be ignored in development.")
  48010. );
  48011. // skip in dev to make it work
  48012. continue
  48013. }
  48014. var aliasRoute = {
  48015. path: alias,
  48016. children: route.children
  48017. };
  48018. addRouteRecord(
  48019. pathList,
  48020. pathMap,
  48021. nameMap,
  48022. aliasRoute,
  48023. parent,
  48024. record.path || '/' // matchAs
  48025. );
  48026. }
  48027. }
  48028. if (name) {
  48029. if (!nameMap[name]) {
  48030. nameMap[name] = record;
  48031. } else if ( true && !matchAs) {
  48032. warn(
  48033. false,
  48034. "Duplicate named routes definition: " +
  48035. "{ name: \"" + name + "\", path: \"" + (record.path) + "\" }"
  48036. );
  48037. }
  48038. }
  48039. }
  48040. function compileRouteRegex (
  48041. path,
  48042. pathToRegexpOptions
  48043. ) {
  48044. var regex = pathToRegexp_1(path, [], pathToRegexpOptions);
  48045. if (true) {
  48046. var keys = Object.create(null);
  48047. regex.keys.forEach(function (key) {
  48048. warn(
  48049. !keys[key.name],
  48050. ("Duplicate param keys in route with path: \"" + path + "\"")
  48051. );
  48052. keys[key.name] = true;
  48053. });
  48054. }
  48055. return regex
  48056. }
  48057. function normalizePath (
  48058. path,
  48059. parent,
  48060. strict
  48061. ) {
  48062. if (!strict) { path = path.replace(/\/$/, ''); }
  48063. if (path[0] === '/') { return path }
  48064. if (parent == null) { return path }
  48065. return cleanPath(((parent.path) + "/" + path))
  48066. }
  48067. /* */
  48068. function createMatcher (
  48069. routes,
  48070. router
  48071. ) {
  48072. var ref = createRouteMap(routes);
  48073. var pathList = ref.pathList;
  48074. var pathMap = ref.pathMap;
  48075. var nameMap = ref.nameMap;
  48076. function addRoutes (routes) {
  48077. createRouteMap(routes, pathList, pathMap, nameMap);
  48078. }
  48079. function match (
  48080. raw,
  48081. currentRoute,
  48082. redirectedFrom
  48083. ) {
  48084. var location = normalizeLocation(raw, currentRoute, false, router);
  48085. var name = location.name;
  48086. if (name) {
  48087. var record = nameMap[name];
  48088. if (true) {
  48089. warn(record, ("Route with name '" + name + "' does not exist"));
  48090. }
  48091. if (!record) { return _createRoute(null, location) }
  48092. var paramNames = record.regex.keys
  48093. .filter(function (key) { return !key.optional; })
  48094. .map(function (key) { return key.name; });
  48095. if (typeof location.params !== 'object') {
  48096. location.params = {};
  48097. }
  48098. if (currentRoute && typeof currentRoute.params === 'object') {
  48099. for (var key in currentRoute.params) {
  48100. if (!(key in location.params) && paramNames.indexOf(key) > -1) {
  48101. location.params[key] = currentRoute.params[key];
  48102. }
  48103. }
  48104. }
  48105. location.path = fillParams(record.path, location.params, ("named route \"" + name + "\""));
  48106. return _createRoute(record, location, redirectedFrom)
  48107. } else if (location.path) {
  48108. location.params = {};
  48109. for (var i = 0; i < pathList.length; i++) {
  48110. var path = pathList[i];
  48111. var record$1 = pathMap[path];
  48112. if (matchRoute(record$1.regex, location.path, location.params)) {
  48113. return _createRoute(record$1, location, redirectedFrom)
  48114. }
  48115. }
  48116. }
  48117. // no match
  48118. return _createRoute(null, location)
  48119. }
  48120. function redirect (
  48121. record,
  48122. location
  48123. ) {
  48124. var originalRedirect = record.redirect;
  48125. var redirect = typeof originalRedirect === 'function'
  48126. ? originalRedirect(createRoute(record, location, null, router))
  48127. : originalRedirect;
  48128. if (typeof redirect === 'string') {
  48129. redirect = { path: redirect };
  48130. }
  48131. if (!redirect || typeof redirect !== 'object') {
  48132. if (true) {
  48133. warn(
  48134. false, ("invalid redirect option: " + (JSON.stringify(redirect)))
  48135. );
  48136. }
  48137. return _createRoute(null, location)
  48138. }
  48139. var re = redirect;
  48140. var name = re.name;
  48141. var path = re.path;
  48142. var query = location.query;
  48143. var hash = location.hash;
  48144. var params = location.params;
  48145. query = re.hasOwnProperty('query') ? re.query : query;
  48146. hash = re.hasOwnProperty('hash') ? re.hash : hash;
  48147. params = re.hasOwnProperty('params') ? re.params : params;
  48148. if (name) {
  48149. // resolved named direct
  48150. var targetRecord = nameMap[name];
  48151. if (true) {
  48152. assert(targetRecord, ("redirect failed: named route \"" + name + "\" not found."));
  48153. }
  48154. return match({
  48155. _normalized: true,
  48156. name: name,
  48157. query: query,
  48158. hash: hash,
  48159. params: params
  48160. }, undefined, location)
  48161. } else if (path) {
  48162. // 1. resolve relative redirect
  48163. var rawPath = resolveRecordPath(path, record);
  48164. // 2. resolve params
  48165. var resolvedPath = fillParams(rawPath, params, ("redirect route with path \"" + rawPath + "\""));
  48166. // 3. rematch with existing query and hash
  48167. return match({
  48168. _normalized: true,
  48169. path: resolvedPath,
  48170. query: query,
  48171. hash: hash
  48172. }, undefined, location)
  48173. } else {
  48174. if (true) {
  48175. warn(false, ("invalid redirect option: " + (JSON.stringify(redirect))));
  48176. }
  48177. return _createRoute(null, location)
  48178. }
  48179. }
  48180. function alias (
  48181. record,
  48182. location,
  48183. matchAs
  48184. ) {
  48185. var aliasedPath = fillParams(matchAs, location.params, ("aliased route with path \"" + matchAs + "\""));
  48186. var aliasedMatch = match({
  48187. _normalized: true,
  48188. path: aliasedPath
  48189. });
  48190. if (aliasedMatch) {
  48191. var matched = aliasedMatch.matched;
  48192. var aliasedRecord = matched[matched.length - 1];
  48193. location.params = aliasedMatch.params;
  48194. return _createRoute(aliasedRecord, location)
  48195. }
  48196. return _createRoute(null, location)
  48197. }
  48198. function _createRoute (
  48199. record,
  48200. location,
  48201. redirectedFrom
  48202. ) {
  48203. if (record && record.redirect) {
  48204. return redirect(record, redirectedFrom || location)
  48205. }
  48206. if (record && record.matchAs) {
  48207. return alias(record, location, record.matchAs)
  48208. }
  48209. return createRoute(record, location, redirectedFrom, router)
  48210. }
  48211. return {
  48212. match: match,
  48213. addRoutes: addRoutes
  48214. }
  48215. }
  48216. function matchRoute (
  48217. regex,
  48218. path,
  48219. params
  48220. ) {
  48221. var m = path.match(regex);
  48222. if (!m) {
  48223. return false
  48224. } else if (!params) {
  48225. return true
  48226. }
  48227. for (var i = 1, len = m.length; i < len; ++i) {
  48228. var key = regex.keys[i - 1];
  48229. var val = typeof m[i] === 'string' ? decodeURIComponent(m[i]) : m[i];
  48230. if (key) {
  48231. // Fix #1994: using * with props: true generates a param named 0
  48232. params[key.name || 'pathMatch'] = val;
  48233. }
  48234. }
  48235. return true
  48236. }
  48237. function resolveRecordPath (path, record) {
  48238. return resolvePath(path, record.parent ? record.parent.path : '/', true)
  48239. }
  48240. /* */
  48241. // use User Timing api (if present) for more accurate key precision
  48242. var Time =
  48243. inBrowser && window.performance && window.performance.now
  48244. ? window.performance
  48245. : Date;
  48246. function genStateKey () {
  48247. return Time.now().toFixed(3)
  48248. }
  48249. var _key = genStateKey();
  48250. function getStateKey () {
  48251. return _key
  48252. }
  48253. function setStateKey (key) {
  48254. return (_key = key)
  48255. }
  48256. /* */
  48257. var positionStore = Object.create(null);
  48258. function setupScroll () {
  48259. // Fix for #1585 for Firefox
  48260. // Fix for #2195 Add optional third attribute to workaround a bug in safari https://bugs.webkit.org/show_bug.cgi?id=182678
  48261. // Fix for #2774 Support for apps loaded from Windows file shares not mapped to network drives: replaced location.origin with
  48262. // window.location.protocol + '//' + window.location.host
  48263. // location.host contains the port and location.hostname doesn't
  48264. var protocolAndPath = window.location.protocol + '//' + window.location.host;
  48265. var absolutePath = window.location.href.replace(protocolAndPath, '');
  48266. // preserve existing history state as it could be overriden by the user
  48267. var stateCopy = extend({}, window.history.state);
  48268. stateCopy.key = getStateKey();
  48269. window.history.replaceState(stateCopy, '', absolutePath);
  48270. window.addEventListener('popstate', function (e) {
  48271. saveScrollPosition();
  48272. if (e.state && e.state.key) {
  48273. setStateKey(e.state.key);
  48274. }
  48275. });
  48276. }
  48277. function handleScroll (
  48278. router,
  48279. to,
  48280. from,
  48281. isPop
  48282. ) {
  48283. if (!router.app) {
  48284. return
  48285. }
  48286. var behavior = router.options.scrollBehavior;
  48287. if (!behavior) {
  48288. return
  48289. }
  48290. if (true) {
  48291. assert(typeof behavior === 'function', "scrollBehavior must be a function");
  48292. }
  48293. // wait until re-render finishes before scrolling
  48294. router.app.$nextTick(function () {
  48295. var position = getScrollPosition();
  48296. var shouldScroll = behavior.call(
  48297. router,
  48298. to,
  48299. from,
  48300. isPop ? position : null
  48301. );
  48302. if (!shouldScroll) {
  48303. return
  48304. }
  48305. if (typeof shouldScroll.then === 'function') {
  48306. shouldScroll
  48307. .then(function (shouldScroll) {
  48308. scrollToPosition((shouldScroll), position);
  48309. })
  48310. .catch(function (err) {
  48311. if (true) {
  48312. assert(false, err.toString());
  48313. }
  48314. });
  48315. } else {
  48316. scrollToPosition(shouldScroll, position);
  48317. }
  48318. });
  48319. }
  48320. function saveScrollPosition () {
  48321. var key = getStateKey();
  48322. if (key) {
  48323. positionStore[key] = {
  48324. x: window.pageXOffset,
  48325. y: window.pageYOffset
  48326. };
  48327. }
  48328. }
  48329. function getScrollPosition () {
  48330. var key = getStateKey();
  48331. if (key) {
  48332. return positionStore[key]
  48333. }
  48334. }
  48335. function getElementPosition (el, offset) {
  48336. var docEl = document.documentElement;
  48337. var docRect = docEl.getBoundingClientRect();
  48338. var elRect = el.getBoundingClientRect();
  48339. return {
  48340. x: elRect.left - docRect.left - offset.x,
  48341. y: elRect.top - docRect.top - offset.y
  48342. }
  48343. }
  48344. function isValidPosition (obj) {
  48345. return isNumber(obj.x) || isNumber(obj.y)
  48346. }
  48347. function normalizePosition (obj) {
  48348. return {
  48349. x: isNumber(obj.x) ? obj.x : window.pageXOffset,
  48350. y: isNumber(obj.y) ? obj.y : window.pageYOffset
  48351. }
  48352. }
  48353. function normalizeOffset (obj) {
  48354. return {
  48355. x: isNumber(obj.x) ? obj.x : 0,
  48356. y: isNumber(obj.y) ? obj.y : 0
  48357. }
  48358. }
  48359. function isNumber (v) {
  48360. return typeof v === 'number'
  48361. }
  48362. var hashStartsWithNumberRE = /^#\d/;
  48363. function scrollToPosition (shouldScroll, position) {
  48364. var isObject = typeof shouldScroll === 'object';
  48365. if (isObject && typeof shouldScroll.selector === 'string') {
  48366. // getElementById would still fail if the selector contains a more complicated query like #main[data-attr]
  48367. // but at the same time, it doesn't make much sense to select an element with an id and an extra selector
  48368. var el = hashStartsWithNumberRE.test(shouldScroll.selector) // $flow-disable-line
  48369. ? document.getElementById(shouldScroll.selector.slice(1)) // $flow-disable-line
  48370. : document.querySelector(shouldScroll.selector);
  48371. if (el) {
  48372. var offset =
  48373. shouldScroll.offset && typeof shouldScroll.offset === 'object'
  48374. ? shouldScroll.offset
  48375. : {};
  48376. offset = normalizeOffset(offset);
  48377. position = getElementPosition(el, offset);
  48378. } else if (isValidPosition(shouldScroll)) {
  48379. position = normalizePosition(shouldScroll);
  48380. }
  48381. } else if (isObject && isValidPosition(shouldScroll)) {
  48382. position = normalizePosition(shouldScroll);
  48383. }
  48384. if (position) {
  48385. window.scrollTo(position.x, position.y);
  48386. }
  48387. }
  48388. /* */
  48389. var supportsPushState =
  48390. inBrowser &&
  48391. (function () {
  48392. var ua = window.navigator.userAgent;
  48393. if (
  48394. (ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) &&
  48395. ua.indexOf('Mobile Safari') !== -1 &&
  48396. ua.indexOf('Chrome') === -1 &&
  48397. ua.indexOf('Windows Phone') === -1
  48398. ) {
  48399. return false
  48400. }
  48401. return window.history && 'pushState' in window.history
  48402. })();
  48403. function pushState (url, replace) {
  48404. saveScrollPosition();
  48405. // try...catch the pushState call to get around Safari
  48406. // DOM Exception 18 where it limits to 100 pushState calls
  48407. var history = window.history;
  48408. try {
  48409. if (replace) {
  48410. // preserve existing history state as it could be overriden by the user
  48411. var stateCopy = extend({}, history.state);
  48412. stateCopy.key = getStateKey();
  48413. history.replaceState(stateCopy, '', url);
  48414. } else {
  48415. history.pushState({ key: setStateKey(genStateKey()) }, '', url);
  48416. }
  48417. } catch (e) {
  48418. window.location[replace ? 'replace' : 'assign'](url);
  48419. }
  48420. }
  48421. function replaceState (url) {
  48422. pushState(url, true);
  48423. }
  48424. /* */
  48425. function runQueue (queue, fn, cb) {
  48426. var step = function (index) {
  48427. if (index >= queue.length) {
  48428. cb();
  48429. } else {
  48430. if (queue[index]) {
  48431. fn(queue[index], function () {
  48432. step(index + 1);
  48433. });
  48434. } else {
  48435. step(index + 1);
  48436. }
  48437. }
  48438. };
  48439. step(0);
  48440. }
  48441. /* */
  48442. function resolveAsyncComponents (matched) {
  48443. return function (to, from, next) {
  48444. var hasAsync = false;
  48445. var pending = 0;
  48446. var error = null;
  48447. flatMapComponents(matched, function (def, _, match, key) {
  48448. // if it's a function and doesn't have cid attached,
  48449. // assume it's an async component resolve function.
  48450. // we are not using Vue's default async resolving mechanism because
  48451. // we want to halt the navigation until the incoming component has been
  48452. // resolved.
  48453. if (typeof def === 'function' && def.cid === undefined) {
  48454. hasAsync = true;
  48455. pending++;
  48456. var resolve = once(function (resolvedDef) {
  48457. if (isESModule(resolvedDef)) {
  48458. resolvedDef = resolvedDef.default;
  48459. }
  48460. // save resolved on async factory in case it's used elsewhere
  48461. def.resolved = typeof resolvedDef === 'function'
  48462. ? resolvedDef
  48463. : _Vue.extend(resolvedDef);
  48464. match.components[key] = resolvedDef;
  48465. pending--;
  48466. if (pending <= 0) {
  48467. next();
  48468. }
  48469. });
  48470. var reject = once(function (reason) {
  48471. var msg = "Failed to resolve async component " + key + ": " + reason;
  48472. true && warn(false, msg);
  48473. if (!error) {
  48474. error = isError(reason)
  48475. ? reason
  48476. : new Error(msg);
  48477. next(error);
  48478. }
  48479. });
  48480. var res;
  48481. try {
  48482. res = def(resolve, reject);
  48483. } catch (e) {
  48484. reject(e);
  48485. }
  48486. if (res) {
  48487. if (typeof res.then === 'function') {
  48488. res.then(resolve, reject);
  48489. } else {
  48490. // new syntax in Vue 2.3
  48491. var comp = res.component;
  48492. if (comp && typeof comp.then === 'function') {
  48493. comp.then(resolve, reject);
  48494. }
  48495. }
  48496. }
  48497. }
  48498. });
  48499. if (!hasAsync) { next(); }
  48500. }
  48501. }
  48502. function flatMapComponents (
  48503. matched,
  48504. fn
  48505. ) {
  48506. return flatten(matched.map(function (m) {
  48507. return Object.keys(m.components).map(function (key) { return fn(
  48508. m.components[key],
  48509. m.instances[key],
  48510. m, key
  48511. ); })
  48512. }))
  48513. }
  48514. function flatten (arr) {
  48515. return Array.prototype.concat.apply([], arr)
  48516. }
  48517. var hasSymbol =
  48518. typeof Symbol === 'function' &&
  48519. typeof Symbol.toStringTag === 'symbol';
  48520. function isESModule (obj) {
  48521. return obj.__esModule || (hasSymbol && obj[Symbol.toStringTag] === 'Module')
  48522. }
  48523. // in Webpack 2, require.ensure now also returns a Promise
  48524. // so the resolve/reject functions may get called an extra time
  48525. // if the user uses an arrow function shorthand that happens to
  48526. // return that Promise.
  48527. function once (fn) {
  48528. var called = false;
  48529. return function () {
  48530. var args = [], len = arguments.length;
  48531. while ( len-- ) args[ len ] = arguments[ len ];
  48532. if (called) { return }
  48533. called = true;
  48534. return fn.apply(this, args)
  48535. }
  48536. }
  48537. var NavigationDuplicated = /*@__PURE__*/(function (Error) {
  48538. function NavigationDuplicated (normalizedLocation) {
  48539. Error.call(this);
  48540. this.name = this._name = 'NavigationDuplicated';
  48541. // passing the message to super() doesn't seem to work in the transpiled version
  48542. this.message = "Navigating to current location (\"" + (normalizedLocation.fullPath) + "\") is not allowed";
  48543. // add a stack property so services like Sentry can correctly display it
  48544. Object.defineProperty(this, 'stack', {
  48545. value: new Error().stack,
  48546. writable: true,
  48547. configurable: true
  48548. });
  48549. // we could also have used
  48550. // Error.captureStackTrace(this, this.constructor)
  48551. // but it only exists on node and chrome
  48552. }
  48553. if ( Error ) NavigationDuplicated.__proto__ = Error;
  48554. NavigationDuplicated.prototype = Object.create( Error && Error.prototype );
  48555. NavigationDuplicated.prototype.constructor = NavigationDuplicated;
  48556. return NavigationDuplicated;
  48557. }(Error));
  48558. // support IE9
  48559. NavigationDuplicated._name = 'NavigationDuplicated';
  48560. /* */
  48561. var History = function History (router, base) {
  48562. this.router = router;
  48563. this.base = normalizeBase(base);
  48564. // start with a route object that stands for "nowhere"
  48565. this.current = START;
  48566. this.pending = null;
  48567. this.ready = false;
  48568. this.readyCbs = [];
  48569. this.readyErrorCbs = [];
  48570. this.errorCbs = [];
  48571. };
  48572. History.prototype.listen = function listen (cb) {
  48573. this.cb = cb;
  48574. };
  48575. History.prototype.onReady = function onReady (cb, errorCb) {
  48576. if (this.ready) {
  48577. cb();
  48578. } else {
  48579. this.readyCbs.push(cb);
  48580. if (errorCb) {
  48581. this.readyErrorCbs.push(errorCb);
  48582. }
  48583. }
  48584. };
  48585. History.prototype.onError = function onError (errorCb) {
  48586. this.errorCbs.push(errorCb);
  48587. };
  48588. History.prototype.transitionTo = function transitionTo (
  48589. location,
  48590. onComplete,
  48591. onAbort
  48592. ) {
  48593. var this$1 = this;
  48594. var route = this.router.match(location, this.current);
  48595. this.confirmTransition(
  48596. route,
  48597. function () {
  48598. this$1.updateRoute(route);
  48599. onComplete && onComplete(route);
  48600. this$1.ensureURL();
  48601. // fire ready cbs once
  48602. if (!this$1.ready) {
  48603. this$1.ready = true;
  48604. this$1.readyCbs.forEach(function (cb) {
  48605. cb(route);
  48606. });
  48607. }
  48608. },
  48609. function (err) {
  48610. if (onAbort) {
  48611. onAbort(err);
  48612. }
  48613. if (err && !this$1.ready) {
  48614. this$1.ready = true;
  48615. this$1.readyErrorCbs.forEach(function (cb) {
  48616. cb(err);
  48617. });
  48618. }
  48619. }
  48620. );
  48621. };
  48622. History.prototype.confirmTransition = function confirmTransition (route, onComplete, onAbort) {
  48623. var this$1 = this;
  48624. var current = this.current;
  48625. var abort = function (err) {
  48626. // after merging https://github.com/vuejs/vue-router/pull/2771 we
  48627. // When the user navigates through history through back/forward buttons
  48628. // we do not want to throw the error. We only throw it if directly calling
  48629. // push/replace. That's why it's not included in isError
  48630. if (!isExtendedError(NavigationDuplicated, err) && isError(err)) {
  48631. if (this$1.errorCbs.length) {
  48632. this$1.errorCbs.forEach(function (cb) {
  48633. cb(err);
  48634. });
  48635. } else {
  48636. warn(false, 'uncaught error during route navigation:');
  48637. console.error(err);
  48638. }
  48639. }
  48640. onAbort && onAbort(err);
  48641. };
  48642. if (
  48643. isSameRoute(route, current) &&
  48644. // in the case the route map has been dynamically appended to
  48645. route.matched.length === current.matched.length
  48646. ) {
  48647. this.ensureURL();
  48648. return abort(new NavigationDuplicated(route))
  48649. }
  48650. var ref = resolveQueue(
  48651. this.current.matched,
  48652. route.matched
  48653. );
  48654. var updated = ref.updated;
  48655. var deactivated = ref.deactivated;
  48656. var activated = ref.activated;
  48657. var queue = [].concat(
  48658. // in-component leave guards
  48659. extractLeaveGuards(deactivated),
  48660. // global before hooks
  48661. this.router.beforeHooks,
  48662. // in-component update hooks
  48663. extractUpdateHooks(updated),
  48664. // in-config enter guards
  48665. activated.map(function (m) { return m.beforeEnter; }),
  48666. // async components
  48667. resolveAsyncComponents(activated)
  48668. );
  48669. this.pending = route;
  48670. var iterator = function (hook, next) {
  48671. if (this$1.pending !== route) {
  48672. return abort()
  48673. }
  48674. try {
  48675. hook(route, current, function (to) {
  48676. if (to === false || isError(to)) {
  48677. // next(false) -> abort navigation, ensure current URL
  48678. this$1.ensureURL(true);
  48679. abort(to);
  48680. } else if (
  48681. typeof to === 'string' ||
  48682. (typeof to === 'object' &&
  48683. (typeof to.path === 'string' || typeof to.name === 'string'))
  48684. ) {
  48685. // next('/') or next({ path: '/' }) -> redirect
  48686. abort();
  48687. if (typeof to === 'object' && to.replace) {
  48688. this$1.replace(to);
  48689. } else {
  48690. this$1.push(to);
  48691. }
  48692. } else {
  48693. // confirm transition and pass on the value
  48694. next(to);
  48695. }
  48696. });
  48697. } catch (e) {
  48698. abort(e);
  48699. }
  48700. };
  48701. runQueue(queue, iterator, function () {
  48702. var postEnterCbs = [];
  48703. var isValid = function () { return this$1.current === route; };
  48704. // wait until async components are resolved before
  48705. // extracting in-component enter guards
  48706. var enterGuards = extractEnterGuards(activated, postEnterCbs, isValid);
  48707. var queue = enterGuards.concat(this$1.router.resolveHooks);
  48708. runQueue(queue, iterator, function () {
  48709. if (this$1.pending !== route) {
  48710. return abort()
  48711. }
  48712. this$1.pending = null;
  48713. onComplete(route);
  48714. if (this$1.router.app) {
  48715. this$1.router.app.$nextTick(function () {
  48716. postEnterCbs.forEach(function (cb) {
  48717. cb();
  48718. });
  48719. });
  48720. }
  48721. });
  48722. });
  48723. };
  48724. History.prototype.updateRoute = function updateRoute (route) {
  48725. var prev = this.current;
  48726. this.current = route;
  48727. this.cb && this.cb(route);
  48728. this.router.afterHooks.forEach(function (hook) {
  48729. hook && hook(route, prev);
  48730. });
  48731. };
  48732. function normalizeBase (base) {
  48733. if (!base) {
  48734. if (inBrowser) {
  48735. // respect <base> tag
  48736. var baseEl = document.querySelector('base');
  48737. base = (baseEl && baseEl.getAttribute('href')) || '/';
  48738. // strip full URL origin
  48739. base = base.replace(/^https?:\/\/[^\/]+/, '');
  48740. } else {
  48741. base = '/';
  48742. }
  48743. }
  48744. // make sure there's the starting slash
  48745. if (base.charAt(0) !== '/') {
  48746. base = '/' + base;
  48747. }
  48748. // remove trailing slash
  48749. return base.replace(/\/$/, '')
  48750. }
  48751. function resolveQueue (
  48752. current,
  48753. next
  48754. ) {
  48755. var i;
  48756. var max = Math.max(current.length, next.length);
  48757. for (i = 0; i < max; i++) {
  48758. if (current[i] !== next[i]) {
  48759. break
  48760. }
  48761. }
  48762. return {
  48763. updated: next.slice(0, i),
  48764. activated: next.slice(i),
  48765. deactivated: current.slice(i)
  48766. }
  48767. }
  48768. function extractGuards (
  48769. records,
  48770. name,
  48771. bind,
  48772. reverse
  48773. ) {
  48774. var guards = flatMapComponents(records, function (def, instance, match, key) {
  48775. var guard = extractGuard(def, name);
  48776. if (guard) {
  48777. return Array.isArray(guard)
  48778. ? guard.map(function (guard) { return bind(guard, instance, match, key); })
  48779. : bind(guard, instance, match, key)
  48780. }
  48781. });
  48782. return flatten(reverse ? guards.reverse() : guards)
  48783. }
  48784. function extractGuard (
  48785. def,
  48786. key
  48787. ) {
  48788. if (typeof def !== 'function') {
  48789. // extend now so that global mixins are applied.
  48790. def = _Vue.extend(def);
  48791. }
  48792. return def.options[key]
  48793. }
  48794. function extractLeaveGuards (deactivated) {
  48795. return extractGuards(deactivated, 'beforeRouteLeave', bindGuard, true)
  48796. }
  48797. function extractUpdateHooks (updated) {
  48798. return extractGuards(updated, 'beforeRouteUpdate', bindGuard)
  48799. }
  48800. function bindGuard (guard, instance) {
  48801. if (instance) {
  48802. return function boundRouteGuard () {
  48803. return guard.apply(instance, arguments)
  48804. }
  48805. }
  48806. }
  48807. function extractEnterGuards (
  48808. activated,
  48809. cbs,
  48810. isValid
  48811. ) {
  48812. return extractGuards(
  48813. activated,
  48814. 'beforeRouteEnter',
  48815. function (guard, _, match, key) {
  48816. return bindEnterGuard(guard, match, key, cbs, isValid)
  48817. }
  48818. )
  48819. }
  48820. function bindEnterGuard (
  48821. guard,
  48822. match,
  48823. key,
  48824. cbs,
  48825. isValid
  48826. ) {
  48827. return function routeEnterGuard (to, from, next) {
  48828. return guard(to, from, function (cb) {
  48829. if (typeof cb === 'function') {
  48830. cbs.push(function () {
  48831. // #750
  48832. // if a router-view is wrapped with an out-in transition,
  48833. // the instance may not have been registered at this time.
  48834. // we will need to poll for registration until current route
  48835. // is no longer valid.
  48836. poll(cb, match.instances, key, isValid);
  48837. });
  48838. }
  48839. next(cb);
  48840. })
  48841. }
  48842. }
  48843. function poll (
  48844. cb, // somehow flow cannot infer this is a function
  48845. instances,
  48846. key,
  48847. isValid
  48848. ) {
  48849. if (
  48850. instances[key] &&
  48851. !instances[key]._isBeingDestroyed // do not reuse being destroyed instance
  48852. ) {
  48853. cb(instances[key]);
  48854. } else if (isValid()) {
  48855. setTimeout(function () {
  48856. poll(cb, instances, key, isValid);
  48857. }, 16);
  48858. }
  48859. }
  48860. /* */
  48861. var HTML5History = /*@__PURE__*/(function (History) {
  48862. function HTML5History (router, base) {
  48863. var this$1 = this;
  48864. History.call(this, router, base);
  48865. var expectScroll = router.options.scrollBehavior;
  48866. var supportsScroll = supportsPushState && expectScroll;
  48867. if (supportsScroll) {
  48868. setupScroll();
  48869. }
  48870. var initLocation = getLocation(this.base);
  48871. window.addEventListener('popstate', function (e) {
  48872. var current = this$1.current;
  48873. // Avoiding first `popstate` event dispatched in some browsers but first
  48874. // history route not updated since async guard at the same time.
  48875. var location = getLocation(this$1.base);
  48876. if (this$1.current === START && location === initLocation) {
  48877. return
  48878. }
  48879. this$1.transitionTo(location, function (route) {
  48880. if (supportsScroll) {
  48881. handleScroll(router, route, current, true);
  48882. }
  48883. });
  48884. });
  48885. }
  48886. if ( History ) HTML5History.__proto__ = History;
  48887. HTML5History.prototype = Object.create( History && History.prototype );
  48888. HTML5History.prototype.constructor = HTML5History;
  48889. HTML5History.prototype.go = function go (n) {
  48890. window.history.go(n);
  48891. };
  48892. HTML5History.prototype.push = function push (location, onComplete, onAbort) {
  48893. var this$1 = this;
  48894. var ref = this;
  48895. var fromRoute = ref.current;
  48896. this.transitionTo(location, function (route) {
  48897. pushState(cleanPath(this$1.base + route.fullPath));
  48898. handleScroll(this$1.router, route, fromRoute, false);
  48899. onComplete && onComplete(route);
  48900. }, onAbort);
  48901. };
  48902. HTML5History.prototype.replace = function replace (location, onComplete, onAbort) {
  48903. var this$1 = this;
  48904. var ref = this;
  48905. var fromRoute = ref.current;
  48906. this.transitionTo(location, function (route) {
  48907. replaceState(cleanPath(this$1.base + route.fullPath));
  48908. handleScroll(this$1.router, route, fromRoute, false);
  48909. onComplete && onComplete(route);
  48910. }, onAbort);
  48911. };
  48912. HTML5History.prototype.ensureURL = function ensureURL (push) {
  48913. if (getLocation(this.base) !== this.current.fullPath) {
  48914. var current = cleanPath(this.base + this.current.fullPath);
  48915. push ? pushState(current) : replaceState(current);
  48916. }
  48917. };
  48918. HTML5History.prototype.getCurrentLocation = function getCurrentLocation () {
  48919. return getLocation(this.base)
  48920. };
  48921. return HTML5History;
  48922. }(History));
  48923. function getLocation (base) {
  48924. var path = decodeURI(window.location.pathname);
  48925. if (base && path.indexOf(base) === 0) {
  48926. path = path.slice(base.length);
  48927. }
  48928. return (path || '/') + window.location.search + window.location.hash
  48929. }
  48930. /* */
  48931. var HashHistory = /*@__PURE__*/(function (History) {
  48932. function HashHistory (router, base, fallback) {
  48933. History.call(this, router, base);
  48934. // check history fallback deeplinking
  48935. if (fallback && checkFallback(this.base)) {
  48936. return
  48937. }
  48938. ensureSlash();
  48939. }
  48940. if ( History ) HashHistory.__proto__ = History;
  48941. HashHistory.prototype = Object.create( History && History.prototype );
  48942. HashHistory.prototype.constructor = HashHistory;
  48943. // this is delayed until the app mounts
  48944. // to avoid the hashchange listener being fired too early
  48945. HashHistory.prototype.setupListeners = function setupListeners () {
  48946. var this$1 = this;
  48947. var router = this.router;
  48948. var expectScroll = router.options.scrollBehavior;
  48949. var supportsScroll = supportsPushState && expectScroll;
  48950. if (supportsScroll) {
  48951. setupScroll();
  48952. }
  48953. window.addEventListener(
  48954. supportsPushState ? 'popstate' : 'hashchange',
  48955. function () {
  48956. var current = this$1.current;
  48957. if (!ensureSlash()) {
  48958. return
  48959. }
  48960. this$1.transitionTo(getHash(), function (route) {
  48961. if (supportsScroll) {
  48962. handleScroll(this$1.router, route, current, true);
  48963. }
  48964. if (!supportsPushState) {
  48965. replaceHash(route.fullPath);
  48966. }
  48967. });
  48968. }
  48969. );
  48970. };
  48971. HashHistory.prototype.push = function push (location, onComplete, onAbort) {
  48972. var this$1 = this;
  48973. var ref = this;
  48974. var fromRoute = ref.current;
  48975. this.transitionTo(
  48976. location,
  48977. function (route) {
  48978. pushHash(route.fullPath);
  48979. handleScroll(this$1.router, route, fromRoute, false);
  48980. onComplete && onComplete(route);
  48981. },
  48982. onAbort
  48983. );
  48984. };
  48985. HashHistory.prototype.replace = function replace (location, onComplete, onAbort) {
  48986. var this$1 = this;
  48987. var ref = this;
  48988. var fromRoute = ref.current;
  48989. this.transitionTo(
  48990. location,
  48991. function (route) {
  48992. replaceHash(route.fullPath);
  48993. handleScroll(this$1.router, route, fromRoute, false);
  48994. onComplete && onComplete(route);
  48995. },
  48996. onAbort
  48997. );
  48998. };
  48999. HashHistory.prototype.go = function go (n) {
  49000. window.history.go(n);
  49001. };
  49002. HashHistory.prototype.ensureURL = function ensureURL (push) {
  49003. var current = this.current.fullPath;
  49004. if (getHash() !== current) {
  49005. push ? pushHash(current) : replaceHash(current);
  49006. }
  49007. };
  49008. HashHistory.prototype.getCurrentLocation = function getCurrentLocation () {
  49009. return getHash()
  49010. };
  49011. return HashHistory;
  49012. }(History));
  49013. function checkFallback (base) {
  49014. var location = getLocation(base);
  49015. if (!/^\/#/.test(location)) {
  49016. window.location.replace(cleanPath(base + '/#' + location));
  49017. return true
  49018. }
  49019. }
  49020. function ensureSlash () {
  49021. var path = getHash();
  49022. if (path.charAt(0) === '/') {
  49023. return true
  49024. }
  49025. replaceHash('/' + path);
  49026. return false
  49027. }
  49028. function getHash () {
  49029. // We can't use window.location.hash here because it's not
  49030. // consistent across browsers - Firefox will pre-decode it!
  49031. var href = window.location.href;
  49032. var index = href.indexOf('#');
  49033. // empty path
  49034. if (index < 0) { return '' }
  49035. href = href.slice(index + 1);
  49036. // decode the hash but not the search or hash
  49037. // as search(query) is already decoded
  49038. // https://github.com/vuejs/vue-router/issues/2708
  49039. var searchIndex = href.indexOf('?');
  49040. if (searchIndex < 0) {
  49041. var hashIndex = href.indexOf('#');
  49042. if (hashIndex > -1) {
  49043. href = decodeURI(href.slice(0, hashIndex)) + href.slice(hashIndex);
  49044. } else { href = decodeURI(href); }
  49045. } else {
  49046. href = decodeURI(href.slice(0, searchIndex)) + href.slice(searchIndex);
  49047. }
  49048. return href
  49049. }
  49050. function getUrl (path) {
  49051. var href = window.location.href;
  49052. var i = href.indexOf('#');
  49053. var base = i >= 0 ? href.slice(0, i) : href;
  49054. return (base + "#" + path)
  49055. }
  49056. function pushHash (path) {
  49057. if (supportsPushState) {
  49058. pushState(getUrl(path));
  49059. } else {
  49060. window.location.hash = path;
  49061. }
  49062. }
  49063. function replaceHash (path) {
  49064. if (supportsPushState) {
  49065. replaceState(getUrl(path));
  49066. } else {
  49067. window.location.replace(getUrl(path));
  49068. }
  49069. }
  49070. /* */
  49071. var AbstractHistory = /*@__PURE__*/(function (History) {
  49072. function AbstractHistory (router, base) {
  49073. History.call(this, router, base);
  49074. this.stack = [];
  49075. this.index = -1;
  49076. }
  49077. if ( History ) AbstractHistory.__proto__ = History;
  49078. AbstractHistory.prototype = Object.create( History && History.prototype );
  49079. AbstractHistory.prototype.constructor = AbstractHistory;
  49080. AbstractHistory.prototype.push = function push (location, onComplete, onAbort) {
  49081. var this$1 = this;
  49082. this.transitionTo(
  49083. location,
  49084. function (route) {
  49085. this$1.stack = this$1.stack.slice(0, this$1.index + 1).concat(route);
  49086. this$1.index++;
  49087. onComplete && onComplete(route);
  49088. },
  49089. onAbort
  49090. );
  49091. };
  49092. AbstractHistory.prototype.replace = function replace (location, onComplete, onAbort) {
  49093. var this$1 = this;
  49094. this.transitionTo(
  49095. location,
  49096. function (route) {
  49097. this$1.stack = this$1.stack.slice(0, this$1.index).concat(route);
  49098. onComplete && onComplete(route);
  49099. },
  49100. onAbort
  49101. );
  49102. };
  49103. AbstractHistory.prototype.go = function go (n) {
  49104. var this$1 = this;
  49105. var targetIndex = this.index + n;
  49106. if (targetIndex < 0 || targetIndex >= this.stack.length) {
  49107. return
  49108. }
  49109. var route = this.stack[targetIndex];
  49110. this.confirmTransition(
  49111. route,
  49112. function () {
  49113. this$1.index = targetIndex;
  49114. this$1.updateRoute(route);
  49115. },
  49116. function (err) {
  49117. if (isExtendedError(NavigationDuplicated, err)) {
  49118. this$1.index = targetIndex;
  49119. }
  49120. }
  49121. );
  49122. };
  49123. AbstractHistory.prototype.getCurrentLocation = function getCurrentLocation () {
  49124. var current = this.stack[this.stack.length - 1];
  49125. return current ? current.fullPath : '/'
  49126. };
  49127. AbstractHistory.prototype.ensureURL = function ensureURL () {
  49128. // noop
  49129. };
  49130. return AbstractHistory;
  49131. }(History));
  49132. /* */
  49133. var VueRouter = function VueRouter (options) {
  49134. if ( options === void 0 ) options = {};
  49135. this.app = null;
  49136. this.apps = [];
  49137. this.options = options;
  49138. this.beforeHooks = [];
  49139. this.resolveHooks = [];
  49140. this.afterHooks = [];
  49141. this.matcher = createMatcher(options.routes || [], this);
  49142. var mode = options.mode || 'hash';
  49143. this.fallback = mode === 'history' && !supportsPushState && options.fallback !== false;
  49144. if (this.fallback) {
  49145. mode = 'hash';
  49146. }
  49147. if (!inBrowser) {
  49148. mode = 'abstract';
  49149. }
  49150. this.mode = mode;
  49151. switch (mode) {
  49152. case 'history':
  49153. this.history = new HTML5History(this, options.base);
  49154. break
  49155. case 'hash':
  49156. this.history = new HashHistory(this, options.base, this.fallback);
  49157. break
  49158. case 'abstract':
  49159. this.history = new AbstractHistory(this, options.base);
  49160. break
  49161. default:
  49162. if (true) {
  49163. assert(false, ("invalid mode: " + mode));
  49164. }
  49165. }
  49166. };
  49167. var prototypeAccessors = { currentRoute: { configurable: true } };
  49168. VueRouter.prototype.match = function match (
  49169. raw,
  49170. current,
  49171. redirectedFrom
  49172. ) {
  49173. return this.matcher.match(raw, current, redirectedFrom)
  49174. };
  49175. prototypeAccessors.currentRoute.get = function () {
  49176. return this.history && this.history.current
  49177. };
  49178. VueRouter.prototype.init = function init (app /* Vue component instance */) {
  49179. var this$1 = this;
  49180. true && assert(
  49181. install.installed,
  49182. "not installed. Make sure to call `Vue.use(VueRouter)` " +
  49183. "before creating root instance."
  49184. );
  49185. this.apps.push(app);
  49186. // set up app destroyed handler
  49187. // https://github.com/vuejs/vue-router/issues/2639
  49188. app.$once('hook:destroyed', function () {
  49189. // clean out app from this.apps array once destroyed
  49190. var index = this$1.apps.indexOf(app);
  49191. if (index > -1) { this$1.apps.splice(index, 1); }
  49192. // ensure we still have a main app or null if no apps
  49193. // we do not release the router so it can be reused
  49194. if (this$1.app === app) { this$1.app = this$1.apps[0] || null; }
  49195. });
  49196. // main app previously initialized
  49197. // return as we don't need to set up new history listener
  49198. if (this.app) {
  49199. return
  49200. }
  49201. this.app = app;
  49202. var history = this.history;
  49203. if (history instanceof HTML5History) {
  49204. history.transitionTo(history.getCurrentLocation());
  49205. } else if (history instanceof HashHistory) {
  49206. var setupHashListener = function () {
  49207. history.setupListeners();
  49208. };
  49209. history.transitionTo(
  49210. history.getCurrentLocation(),
  49211. setupHashListener,
  49212. setupHashListener
  49213. );
  49214. }
  49215. history.listen(function (route) {
  49216. this$1.apps.forEach(function (app) {
  49217. app._route = route;
  49218. });
  49219. });
  49220. };
  49221. VueRouter.prototype.beforeEach = function beforeEach (fn) {
  49222. return registerHook(this.beforeHooks, fn)
  49223. };
  49224. VueRouter.prototype.beforeResolve = function beforeResolve (fn) {
  49225. return registerHook(this.resolveHooks, fn)
  49226. };
  49227. VueRouter.prototype.afterEach = function afterEach (fn) {
  49228. return registerHook(this.afterHooks, fn)
  49229. };
  49230. VueRouter.prototype.onReady = function onReady (cb, errorCb) {
  49231. this.history.onReady(cb, errorCb);
  49232. };
  49233. VueRouter.prototype.onError = function onError (errorCb) {
  49234. this.history.onError(errorCb);
  49235. };
  49236. VueRouter.prototype.push = function push (location, onComplete, onAbort) {
  49237. var this$1 = this;
  49238. // $flow-disable-line
  49239. if (!onComplete && !onAbort && typeof Promise !== 'undefined') {
  49240. return new Promise(function (resolve, reject) {
  49241. this$1.history.push(location, resolve, reject);
  49242. })
  49243. } else {
  49244. this.history.push(location, onComplete, onAbort);
  49245. }
  49246. };
  49247. VueRouter.prototype.replace = function replace (location, onComplete, onAbort) {
  49248. var this$1 = this;
  49249. // $flow-disable-line
  49250. if (!onComplete && !onAbort && typeof Promise !== 'undefined') {
  49251. return new Promise(function (resolve, reject) {
  49252. this$1.history.replace(location, resolve, reject);
  49253. })
  49254. } else {
  49255. this.history.replace(location, onComplete, onAbort);
  49256. }
  49257. };
  49258. VueRouter.prototype.go = function go (n) {
  49259. this.history.go(n);
  49260. };
  49261. VueRouter.prototype.back = function back () {
  49262. this.go(-1);
  49263. };
  49264. VueRouter.prototype.forward = function forward () {
  49265. this.go(1);
  49266. };
  49267. VueRouter.prototype.getMatchedComponents = function getMatchedComponents (to) {
  49268. var route = to
  49269. ? to.matched
  49270. ? to
  49271. : this.resolve(to).route
  49272. : this.currentRoute;
  49273. if (!route) {
  49274. return []
  49275. }
  49276. return [].concat.apply([], route.matched.map(function (m) {
  49277. return Object.keys(m.components).map(function (key) {
  49278. return m.components[key]
  49279. })
  49280. }))
  49281. };
  49282. VueRouter.prototype.resolve = function resolve (
  49283. to,
  49284. current,
  49285. append
  49286. ) {
  49287. current = current || this.history.current;
  49288. var location = normalizeLocation(
  49289. to,
  49290. current,
  49291. append,
  49292. this
  49293. );
  49294. var route = this.match(location, current);
  49295. var fullPath = route.redirectedFrom || route.fullPath;
  49296. var base = this.history.base;
  49297. var href = createHref(base, fullPath, this.mode);
  49298. return {
  49299. location: location,
  49300. route: route,
  49301. href: href,
  49302. // for backwards compat
  49303. normalizedTo: location,
  49304. resolved: route
  49305. }
  49306. };
  49307. VueRouter.prototype.addRoutes = function addRoutes (routes) {
  49308. this.matcher.addRoutes(routes);
  49309. if (this.history.current !== START) {
  49310. this.history.transitionTo(this.history.getCurrentLocation());
  49311. }
  49312. };
  49313. Object.defineProperties( VueRouter.prototype, prototypeAccessors );
  49314. function registerHook (list, fn) {
  49315. list.push(fn);
  49316. return function () {
  49317. var i = list.indexOf(fn);
  49318. if (i > -1) { list.splice(i, 1); }
  49319. }
  49320. }
  49321. function createHref (base, fullPath, mode) {
  49322. var path = mode === 'hash' ? '#' + fullPath : fullPath;
  49323. return base ? cleanPath(base + '/' + path) : path
  49324. }
  49325. VueRouter.install = install;
  49326. VueRouter.version = '3.1.6';
  49327. if (inBrowser && window.Vue) {
  49328. window.Vue.use(VueRouter);
  49329. }
  49330. /* harmony default export */ __webpack_exports__["default"] = (VueRouter);
  49331. /***/ }),
  49332. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  49333. /*!*************************************************!*\
  49334. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  49335. \*************************************************/
  49336. /*! no static exports found */
  49337. /***/ (function(module, exports, __webpack_require__) {
  49338. "use strict";
  49339. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  49340. * Vue.js v2.6.11
  49341. * (c) 2014-2019 Evan You
  49342. * Released under the MIT License.
  49343. */
  49344. /* */
  49345. var emptyObject = Object.freeze({});
  49346. // These helpers produce better VM code in JS engines due to their
  49347. // explicitness and function inlining.
  49348. function isUndef (v) {
  49349. return v === undefined || v === null
  49350. }
  49351. function isDef (v) {
  49352. return v !== undefined && v !== null
  49353. }
  49354. function isTrue (v) {
  49355. return v === true
  49356. }
  49357. function isFalse (v) {
  49358. return v === false
  49359. }
  49360. /**
  49361. * Check if value is primitive.
  49362. */
  49363. function isPrimitive (value) {
  49364. return (
  49365. typeof value === 'string' ||
  49366. typeof value === 'number' ||
  49367. // $flow-disable-line
  49368. typeof value === 'symbol' ||
  49369. typeof value === 'boolean'
  49370. )
  49371. }
  49372. /**
  49373. * Quick object check - this is primarily used to tell
  49374. * Objects from primitive values when we know the value
  49375. * is a JSON-compliant type.
  49376. */
  49377. function isObject (obj) {
  49378. return obj !== null && typeof obj === 'object'
  49379. }
  49380. /**
  49381. * Get the raw type string of a value, e.g., [object Object].
  49382. */
  49383. var _toString = Object.prototype.toString;
  49384. function toRawType (value) {
  49385. return _toString.call(value).slice(8, -1)
  49386. }
  49387. /**
  49388. * Strict object type check. Only returns true
  49389. * for plain JavaScript objects.
  49390. */
  49391. function isPlainObject (obj) {
  49392. return _toString.call(obj) === '[object Object]'
  49393. }
  49394. function isRegExp (v) {
  49395. return _toString.call(v) === '[object RegExp]'
  49396. }
  49397. /**
  49398. * Check if val is a valid array index.
  49399. */
  49400. function isValidArrayIndex (val) {
  49401. var n = parseFloat(String(val));
  49402. return n >= 0 && Math.floor(n) === n && isFinite(val)
  49403. }
  49404. function isPromise (val) {
  49405. return (
  49406. isDef(val) &&
  49407. typeof val.then === 'function' &&
  49408. typeof val.catch === 'function'
  49409. )
  49410. }
  49411. /**
  49412. * Convert a value to a string that is actually rendered.
  49413. */
  49414. function toString (val) {
  49415. return val == null
  49416. ? ''
  49417. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  49418. ? JSON.stringify(val, null, 2)
  49419. : String(val)
  49420. }
  49421. /**
  49422. * Convert an input value to a number for persistence.
  49423. * If the conversion fails, return original string.
  49424. */
  49425. function toNumber (val) {
  49426. var n = parseFloat(val);
  49427. return isNaN(n) ? val : n
  49428. }
  49429. /**
  49430. * Make a map and return a function for checking if a key
  49431. * is in that map.
  49432. */
  49433. function makeMap (
  49434. str,
  49435. expectsLowerCase
  49436. ) {
  49437. var map = Object.create(null);
  49438. var list = str.split(',');
  49439. for (var i = 0; i < list.length; i++) {
  49440. map[list[i]] = true;
  49441. }
  49442. return expectsLowerCase
  49443. ? function (val) { return map[val.toLowerCase()]; }
  49444. : function (val) { return map[val]; }
  49445. }
  49446. /**
  49447. * Check if a tag is a built-in tag.
  49448. */
  49449. var isBuiltInTag = makeMap('slot,component', true);
  49450. /**
  49451. * Check if an attribute is a reserved attribute.
  49452. */
  49453. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  49454. /**
  49455. * Remove an item from an array.
  49456. */
  49457. function remove (arr, item) {
  49458. if (arr.length) {
  49459. var index = arr.indexOf(item);
  49460. if (index > -1) {
  49461. return arr.splice(index, 1)
  49462. }
  49463. }
  49464. }
  49465. /**
  49466. * Check whether an object has the property.
  49467. */
  49468. var hasOwnProperty = Object.prototype.hasOwnProperty;
  49469. function hasOwn (obj, key) {
  49470. return hasOwnProperty.call(obj, key)
  49471. }
  49472. /**
  49473. * Create a cached version of a pure function.
  49474. */
  49475. function cached (fn) {
  49476. var cache = Object.create(null);
  49477. return (function cachedFn (str) {
  49478. var hit = cache[str];
  49479. return hit || (cache[str] = fn(str))
  49480. })
  49481. }
  49482. /**
  49483. * Camelize a hyphen-delimited string.
  49484. */
  49485. var camelizeRE = /-(\w)/g;
  49486. var camelize = cached(function (str) {
  49487. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  49488. });
  49489. /**
  49490. * Capitalize a string.
  49491. */
  49492. var capitalize = cached(function (str) {
  49493. return str.charAt(0).toUpperCase() + str.slice(1)
  49494. });
  49495. /**
  49496. * Hyphenate a camelCase string.
  49497. */
  49498. var hyphenateRE = /\B([A-Z])/g;
  49499. var hyphenate = cached(function (str) {
  49500. return str.replace(hyphenateRE, '-$1').toLowerCase()
  49501. });
  49502. /**
  49503. * Simple bind polyfill for environments that do not support it,
  49504. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  49505. * since native bind is now performant enough in most browsers.
  49506. * But removing it would mean breaking code that was able to run in
  49507. * PhantomJS 1.x, so this must be kept for backward compatibility.
  49508. */
  49509. /* istanbul ignore next */
  49510. function polyfillBind (fn, ctx) {
  49511. function boundFn (a) {
  49512. var l = arguments.length;
  49513. return l
  49514. ? l > 1
  49515. ? fn.apply(ctx, arguments)
  49516. : fn.call(ctx, a)
  49517. : fn.call(ctx)
  49518. }
  49519. boundFn._length = fn.length;
  49520. return boundFn
  49521. }
  49522. function nativeBind (fn, ctx) {
  49523. return fn.bind(ctx)
  49524. }
  49525. var bind = Function.prototype.bind
  49526. ? nativeBind
  49527. : polyfillBind;
  49528. /**
  49529. * Convert an Array-like object to a real Array.
  49530. */
  49531. function toArray (list, start) {
  49532. start = start || 0;
  49533. var i = list.length - start;
  49534. var ret = new Array(i);
  49535. while (i--) {
  49536. ret[i] = list[i + start];
  49537. }
  49538. return ret
  49539. }
  49540. /**
  49541. * Mix properties into target object.
  49542. */
  49543. function extend (to, _from) {
  49544. for (var key in _from) {
  49545. to[key] = _from[key];
  49546. }
  49547. return to
  49548. }
  49549. /**
  49550. * Merge an Array of Objects into a single Object.
  49551. */
  49552. function toObject (arr) {
  49553. var res = {};
  49554. for (var i = 0; i < arr.length; i++) {
  49555. if (arr[i]) {
  49556. extend(res, arr[i]);
  49557. }
  49558. }
  49559. return res
  49560. }
  49561. /* eslint-disable no-unused-vars */
  49562. /**
  49563. * Perform no operation.
  49564. * Stubbing args to make Flow happy without leaving useless transpiled code
  49565. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  49566. */
  49567. function noop (a, b, c) {}
  49568. /**
  49569. * Always return false.
  49570. */
  49571. var no = function (a, b, c) { return false; };
  49572. /* eslint-enable no-unused-vars */
  49573. /**
  49574. * Return the same value.
  49575. */
  49576. var identity = function (_) { return _; };
  49577. /**
  49578. * Generate a string containing static keys from compiler modules.
  49579. */
  49580. function genStaticKeys (modules) {
  49581. return modules.reduce(function (keys, m) {
  49582. return keys.concat(m.staticKeys || [])
  49583. }, []).join(',')
  49584. }
  49585. /**
  49586. * Check if two values are loosely equal - that is,
  49587. * if they are plain objects, do they have the same shape?
  49588. */
  49589. function looseEqual (a, b) {
  49590. if (a === b) { return true }
  49591. var isObjectA = isObject(a);
  49592. var isObjectB = isObject(b);
  49593. if (isObjectA && isObjectB) {
  49594. try {
  49595. var isArrayA = Array.isArray(a);
  49596. var isArrayB = Array.isArray(b);
  49597. if (isArrayA && isArrayB) {
  49598. return a.length === b.length && a.every(function (e, i) {
  49599. return looseEqual(e, b[i])
  49600. })
  49601. } else if (a instanceof Date && b instanceof Date) {
  49602. return a.getTime() === b.getTime()
  49603. } else if (!isArrayA && !isArrayB) {
  49604. var keysA = Object.keys(a);
  49605. var keysB = Object.keys(b);
  49606. return keysA.length === keysB.length && keysA.every(function (key) {
  49607. return looseEqual(a[key], b[key])
  49608. })
  49609. } else {
  49610. /* istanbul ignore next */
  49611. return false
  49612. }
  49613. } catch (e) {
  49614. /* istanbul ignore next */
  49615. return false
  49616. }
  49617. } else if (!isObjectA && !isObjectB) {
  49618. return String(a) === String(b)
  49619. } else {
  49620. return false
  49621. }
  49622. }
  49623. /**
  49624. * Return the first index at which a loosely equal value can be
  49625. * found in the array (if value is a plain object, the array must
  49626. * contain an object of the same shape), or -1 if it is not present.
  49627. */
  49628. function looseIndexOf (arr, val) {
  49629. for (var i = 0; i < arr.length; i++) {
  49630. if (looseEqual(arr[i], val)) { return i }
  49631. }
  49632. return -1
  49633. }
  49634. /**
  49635. * Ensure a function is called only once.
  49636. */
  49637. function once (fn) {
  49638. var called = false;
  49639. return function () {
  49640. if (!called) {
  49641. called = true;
  49642. fn.apply(this, arguments);
  49643. }
  49644. }
  49645. }
  49646. var SSR_ATTR = 'data-server-rendered';
  49647. var ASSET_TYPES = [
  49648. 'component',
  49649. 'directive',
  49650. 'filter'
  49651. ];
  49652. var LIFECYCLE_HOOKS = [
  49653. 'beforeCreate',
  49654. 'created',
  49655. 'beforeMount',
  49656. 'mounted',
  49657. 'beforeUpdate',
  49658. 'updated',
  49659. 'beforeDestroy',
  49660. 'destroyed',
  49661. 'activated',
  49662. 'deactivated',
  49663. 'errorCaptured',
  49664. 'serverPrefetch'
  49665. ];
  49666. /* */
  49667. var config = ({
  49668. /**
  49669. * Option merge strategies (used in core/util/options)
  49670. */
  49671. // $flow-disable-line
  49672. optionMergeStrategies: Object.create(null),
  49673. /**
  49674. * Whether to suppress warnings.
  49675. */
  49676. silent: false,
  49677. /**
  49678. * Show production mode tip message on boot?
  49679. */
  49680. productionTip: "development" !== 'production',
  49681. /**
  49682. * Whether to enable devtools
  49683. */
  49684. devtools: "development" !== 'production',
  49685. /**
  49686. * Whether to record perf
  49687. */
  49688. performance: false,
  49689. /**
  49690. * Error handler for watcher errors
  49691. */
  49692. errorHandler: null,
  49693. /**
  49694. * Warn handler for watcher warns
  49695. */
  49696. warnHandler: null,
  49697. /**
  49698. * Ignore certain custom elements
  49699. */
  49700. ignoredElements: [],
  49701. /**
  49702. * Custom user key aliases for v-on
  49703. */
  49704. // $flow-disable-line
  49705. keyCodes: Object.create(null),
  49706. /**
  49707. * Check if a tag is reserved so that it cannot be registered as a
  49708. * component. This is platform-dependent and may be overwritten.
  49709. */
  49710. isReservedTag: no,
  49711. /**
  49712. * Check if an attribute is reserved so that it cannot be used as a component
  49713. * prop. This is platform-dependent and may be overwritten.
  49714. */
  49715. isReservedAttr: no,
  49716. /**
  49717. * Check if a tag is an unknown element.
  49718. * Platform-dependent.
  49719. */
  49720. isUnknownElement: no,
  49721. /**
  49722. * Get the namespace of an element
  49723. */
  49724. getTagNamespace: noop,
  49725. /**
  49726. * Parse the real tag name for the specific platform.
  49727. */
  49728. parsePlatformTagName: identity,
  49729. /**
  49730. * Check if an attribute must be bound using property, e.g. value
  49731. * Platform-dependent.
  49732. */
  49733. mustUseProp: no,
  49734. /**
  49735. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  49736. * This will significantly reduce performance if set to false.
  49737. */
  49738. async: true,
  49739. /**
  49740. * Exposed for legacy reasons
  49741. */
  49742. _lifecycleHooks: LIFECYCLE_HOOKS
  49743. });
  49744. /* */
  49745. /**
  49746. * unicode letters used for parsing html tags, component names and property paths.
  49747. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  49748. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  49749. */
  49750. 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/;
  49751. /**
  49752. * Check if a string starts with $ or _
  49753. */
  49754. function isReserved (str) {
  49755. var c = (str + '').charCodeAt(0);
  49756. return c === 0x24 || c === 0x5F
  49757. }
  49758. /**
  49759. * Define a property.
  49760. */
  49761. function def (obj, key, val, enumerable) {
  49762. Object.defineProperty(obj, key, {
  49763. value: val,
  49764. enumerable: !!enumerable,
  49765. writable: true,
  49766. configurable: true
  49767. });
  49768. }
  49769. /**
  49770. * Parse simple path.
  49771. */
  49772. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  49773. function parsePath (path) {
  49774. if (bailRE.test(path)) {
  49775. return
  49776. }
  49777. var segments = path.split('.');
  49778. return function (obj) {
  49779. for (var i = 0; i < segments.length; i++) {
  49780. if (!obj) { return }
  49781. obj = obj[segments[i]];
  49782. }
  49783. return obj
  49784. }
  49785. }
  49786. /* */
  49787. // can we use __proto__?
  49788. var hasProto = '__proto__' in {};
  49789. // Browser environment sniffing
  49790. var inBrowser = typeof window !== 'undefined';
  49791. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  49792. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  49793. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  49794. var isIE = UA && /msie|trident/.test(UA);
  49795. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  49796. var isEdge = UA && UA.indexOf('edge/') > 0;
  49797. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  49798. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  49799. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  49800. var isPhantomJS = UA && /phantomjs/.test(UA);
  49801. var isFF = UA && UA.match(/firefox\/(\d+)/);
  49802. // Firefox has a "watch" function on Object.prototype...
  49803. var nativeWatch = ({}).watch;
  49804. var supportsPassive = false;
  49805. if (inBrowser) {
  49806. try {
  49807. var opts = {};
  49808. Object.defineProperty(opts, 'passive', ({
  49809. get: function get () {
  49810. /* istanbul ignore next */
  49811. supportsPassive = true;
  49812. }
  49813. })); // https://github.com/facebook/flow/issues/285
  49814. window.addEventListener('test-passive', null, opts);
  49815. } catch (e) {}
  49816. }
  49817. // this needs to be lazy-evaled because vue may be required before
  49818. // vue-server-renderer can set VUE_ENV
  49819. var _isServer;
  49820. var isServerRendering = function () {
  49821. if (_isServer === undefined) {
  49822. /* istanbul ignore if */
  49823. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  49824. // detect presence of vue-server-renderer and avoid
  49825. // Webpack shimming the process
  49826. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  49827. } else {
  49828. _isServer = false;
  49829. }
  49830. }
  49831. return _isServer
  49832. };
  49833. // detect devtools
  49834. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  49835. /* istanbul ignore next */
  49836. function isNative (Ctor) {
  49837. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  49838. }
  49839. var hasSymbol =
  49840. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  49841. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  49842. var _Set;
  49843. /* istanbul ignore if */ // $flow-disable-line
  49844. if (typeof Set !== 'undefined' && isNative(Set)) {
  49845. // use native Set when available.
  49846. _Set = Set;
  49847. } else {
  49848. // a non-standard Set polyfill that only works with primitive keys.
  49849. _Set = /*@__PURE__*/(function () {
  49850. function Set () {
  49851. this.set = Object.create(null);
  49852. }
  49853. Set.prototype.has = function has (key) {
  49854. return this.set[key] === true
  49855. };
  49856. Set.prototype.add = function add (key) {
  49857. this.set[key] = true;
  49858. };
  49859. Set.prototype.clear = function clear () {
  49860. this.set = Object.create(null);
  49861. };
  49862. return Set;
  49863. }());
  49864. }
  49865. /* */
  49866. var warn = noop;
  49867. var tip = noop;
  49868. var generateComponentTrace = (noop); // work around flow check
  49869. var formatComponentName = (noop);
  49870. {
  49871. var hasConsole = typeof console !== 'undefined';
  49872. var classifyRE = /(?:^|[-_])(\w)/g;
  49873. var classify = function (str) { return str
  49874. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  49875. .replace(/[-_]/g, ''); };
  49876. warn = function (msg, vm) {
  49877. var trace = vm ? generateComponentTrace(vm) : '';
  49878. if (config.warnHandler) {
  49879. config.warnHandler.call(null, msg, vm, trace);
  49880. } else if (hasConsole && (!config.silent)) {
  49881. console.error(("[Vue warn]: " + msg + trace));
  49882. }
  49883. };
  49884. tip = function (msg, vm) {
  49885. if (hasConsole && (!config.silent)) {
  49886. console.warn("[Vue tip]: " + msg + (
  49887. vm ? generateComponentTrace(vm) : ''
  49888. ));
  49889. }
  49890. };
  49891. formatComponentName = function (vm, includeFile) {
  49892. if (vm.$root === vm) {
  49893. return '<Root>'
  49894. }
  49895. var options = typeof vm === 'function' && vm.cid != null
  49896. ? vm.options
  49897. : vm._isVue
  49898. ? vm.$options || vm.constructor.options
  49899. : vm;
  49900. var name = options.name || options._componentTag;
  49901. var file = options.__file;
  49902. if (!name && file) {
  49903. var match = file.match(/([^/\\]+)\.vue$/);
  49904. name = match && match[1];
  49905. }
  49906. return (
  49907. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  49908. (file && includeFile !== false ? (" at " + file) : '')
  49909. )
  49910. };
  49911. var repeat = function (str, n) {
  49912. var res = '';
  49913. while (n) {
  49914. if (n % 2 === 1) { res += str; }
  49915. if (n > 1) { str += str; }
  49916. n >>= 1;
  49917. }
  49918. return res
  49919. };
  49920. generateComponentTrace = function (vm) {
  49921. if (vm._isVue && vm.$parent) {
  49922. var tree = [];
  49923. var currentRecursiveSequence = 0;
  49924. while (vm) {
  49925. if (tree.length > 0) {
  49926. var last = tree[tree.length - 1];
  49927. if (last.constructor === vm.constructor) {
  49928. currentRecursiveSequence++;
  49929. vm = vm.$parent;
  49930. continue
  49931. } else if (currentRecursiveSequence > 0) {
  49932. tree[tree.length - 1] = [last, currentRecursiveSequence];
  49933. currentRecursiveSequence = 0;
  49934. }
  49935. }
  49936. tree.push(vm);
  49937. vm = vm.$parent;
  49938. }
  49939. return '\n\nfound in\n\n' + tree
  49940. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  49941. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  49942. : formatComponentName(vm))); })
  49943. .join('\n')
  49944. } else {
  49945. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  49946. }
  49947. };
  49948. }
  49949. /* */
  49950. var uid = 0;
  49951. /**
  49952. * A dep is an observable that can have multiple
  49953. * directives subscribing to it.
  49954. */
  49955. var Dep = function Dep () {
  49956. this.id = uid++;
  49957. this.subs = [];
  49958. };
  49959. Dep.prototype.addSub = function addSub (sub) {
  49960. this.subs.push(sub);
  49961. };
  49962. Dep.prototype.removeSub = function removeSub (sub) {
  49963. remove(this.subs, sub);
  49964. };
  49965. Dep.prototype.depend = function depend () {
  49966. if (Dep.target) {
  49967. Dep.target.addDep(this);
  49968. }
  49969. };
  49970. Dep.prototype.notify = function notify () {
  49971. // stabilize the subscriber list first
  49972. var subs = this.subs.slice();
  49973. if (!config.async) {
  49974. // subs aren't sorted in scheduler if not running async
  49975. // we need to sort them now to make sure they fire in correct
  49976. // order
  49977. subs.sort(function (a, b) { return a.id - b.id; });
  49978. }
  49979. for (var i = 0, l = subs.length; i < l; i++) {
  49980. subs[i].update();
  49981. }
  49982. };
  49983. // The current target watcher being evaluated.
  49984. // This is globally unique because only one watcher
  49985. // can be evaluated at a time.
  49986. Dep.target = null;
  49987. var targetStack = [];
  49988. function pushTarget (target) {
  49989. targetStack.push(target);
  49990. Dep.target = target;
  49991. }
  49992. function popTarget () {
  49993. targetStack.pop();
  49994. Dep.target = targetStack[targetStack.length - 1];
  49995. }
  49996. /* */
  49997. var VNode = function VNode (
  49998. tag,
  49999. data,
  50000. children,
  50001. text,
  50002. elm,
  50003. context,
  50004. componentOptions,
  50005. asyncFactory
  50006. ) {
  50007. this.tag = tag;
  50008. this.data = data;
  50009. this.children = children;
  50010. this.text = text;
  50011. this.elm = elm;
  50012. this.ns = undefined;
  50013. this.context = context;
  50014. this.fnContext = undefined;
  50015. this.fnOptions = undefined;
  50016. this.fnScopeId = undefined;
  50017. this.key = data && data.key;
  50018. this.componentOptions = componentOptions;
  50019. this.componentInstance = undefined;
  50020. this.parent = undefined;
  50021. this.raw = false;
  50022. this.isStatic = false;
  50023. this.isRootInsert = true;
  50024. this.isComment = false;
  50025. this.isCloned = false;
  50026. this.isOnce = false;
  50027. this.asyncFactory = asyncFactory;
  50028. this.asyncMeta = undefined;
  50029. this.isAsyncPlaceholder = false;
  50030. };
  50031. var prototypeAccessors = { child: { configurable: true } };
  50032. // DEPRECATED: alias for componentInstance for backwards compat.
  50033. /* istanbul ignore next */
  50034. prototypeAccessors.child.get = function () {
  50035. return this.componentInstance
  50036. };
  50037. Object.defineProperties( VNode.prototype, prototypeAccessors );
  50038. var createEmptyVNode = function (text) {
  50039. if ( text === void 0 ) text = '';
  50040. var node = new VNode();
  50041. node.text = text;
  50042. node.isComment = true;
  50043. return node
  50044. };
  50045. function createTextVNode (val) {
  50046. return new VNode(undefined, undefined, undefined, String(val))
  50047. }
  50048. // optimized shallow clone
  50049. // used for static nodes and slot nodes because they may be reused across
  50050. // multiple renders, cloning them avoids errors when DOM manipulations rely
  50051. // on their elm reference.
  50052. function cloneVNode (vnode) {
  50053. var cloned = new VNode(
  50054. vnode.tag,
  50055. vnode.data,
  50056. // #7975
  50057. // clone children array to avoid mutating original in case of cloning
  50058. // a child.
  50059. vnode.children && vnode.children.slice(),
  50060. vnode.text,
  50061. vnode.elm,
  50062. vnode.context,
  50063. vnode.componentOptions,
  50064. vnode.asyncFactory
  50065. );
  50066. cloned.ns = vnode.ns;
  50067. cloned.isStatic = vnode.isStatic;
  50068. cloned.key = vnode.key;
  50069. cloned.isComment = vnode.isComment;
  50070. cloned.fnContext = vnode.fnContext;
  50071. cloned.fnOptions = vnode.fnOptions;
  50072. cloned.fnScopeId = vnode.fnScopeId;
  50073. cloned.asyncMeta = vnode.asyncMeta;
  50074. cloned.isCloned = true;
  50075. return cloned
  50076. }
  50077. /*
  50078. * not type checking this file because flow doesn't play well with
  50079. * dynamically accessing methods on Array prototype
  50080. */
  50081. var arrayProto = Array.prototype;
  50082. var arrayMethods = Object.create(arrayProto);
  50083. var methodsToPatch = [
  50084. 'push',
  50085. 'pop',
  50086. 'shift',
  50087. 'unshift',
  50088. 'splice',
  50089. 'sort',
  50090. 'reverse'
  50091. ];
  50092. /**
  50093. * Intercept mutating methods and emit events
  50094. */
  50095. methodsToPatch.forEach(function (method) {
  50096. // cache original method
  50097. var original = arrayProto[method];
  50098. def(arrayMethods, method, function mutator () {
  50099. var args = [], len = arguments.length;
  50100. while ( len-- ) args[ len ] = arguments[ len ];
  50101. var result = original.apply(this, args);
  50102. var ob = this.__ob__;
  50103. var inserted;
  50104. switch (method) {
  50105. case 'push':
  50106. case 'unshift':
  50107. inserted = args;
  50108. break
  50109. case 'splice':
  50110. inserted = args.slice(2);
  50111. break
  50112. }
  50113. if (inserted) { ob.observeArray(inserted); }
  50114. // notify change
  50115. ob.dep.notify();
  50116. return result
  50117. });
  50118. });
  50119. /* */
  50120. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  50121. /**
  50122. * In some cases we may want to disable observation inside a component's
  50123. * update computation.
  50124. */
  50125. var shouldObserve = true;
  50126. function toggleObserving (value) {
  50127. shouldObserve = value;
  50128. }
  50129. /**
  50130. * Observer class that is attached to each observed
  50131. * object. Once attached, the observer converts the target
  50132. * object's property keys into getter/setters that
  50133. * collect dependencies and dispatch updates.
  50134. */
  50135. var Observer = function Observer (value) {
  50136. this.value = value;
  50137. this.dep = new Dep();
  50138. this.vmCount = 0;
  50139. def(value, '__ob__', this);
  50140. if (Array.isArray(value)) {
  50141. if (hasProto) {
  50142. protoAugment(value, arrayMethods);
  50143. } else {
  50144. copyAugment(value, arrayMethods, arrayKeys);
  50145. }
  50146. this.observeArray(value);
  50147. } else {
  50148. this.walk(value);
  50149. }
  50150. };
  50151. /**
  50152. * Walk through all properties and convert them into
  50153. * getter/setters. This method should only be called when
  50154. * value type is Object.
  50155. */
  50156. Observer.prototype.walk = function walk (obj) {
  50157. var keys = Object.keys(obj);
  50158. for (var i = 0; i < keys.length; i++) {
  50159. defineReactive$$1(obj, keys[i]);
  50160. }
  50161. };
  50162. /**
  50163. * Observe a list of Array items.
  50164. */
  50165. Observer.prototype.observeArray = function observeArray (items) {
  50166. for (var i = 0, l = items.length; i < l; i++) {
  50167. observe(items[i]);
  50168. }
  50169. };
  50170. // helpers
  50171. /**
  50172. * Augment a target Object or Array by intercepting
  50173. * the prototype chain using __proto__
  50174. */
  50175. function protoAugment (target, src) {
  50176. /* eslint-disable no-proto */
  50177. target.__proto__ = src;
  50178. /* eslint-enable no-proto */
  50179. }
  50180. /**
  50181. * Augment a target Object or Array by defining
  50182. * hidden properties.
  50183. */
  50184. /* istanbul ignore next */
  50185. function copyAugment (target, src, keys) {
  50186. for (var i = 0, l = keys.length; i < l; i++) {
  50187. var key = keys[i];
  50188. def(target, key, src[key]);
  50189. }
  50190. }
  50191. /**
  50192. * Attempt to create an observer instance for a value,
  50193. * returns the new observer if successfully observed,
  50194. * or the existing observer if the value already has one.
  50195. */
  50196. function observe (value, asRootData) {
  50197. if (!isObject(value) || value instanceof VNode) {
  50198. return
  50199. }
  50200. var ob;
  50201. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  50202. ob = value.__ob__;
  50203. } else if (
  50204. shouldObserve &&
  50205. !isServerRendering() &&
  50206. (Array.isArray(value) || isPlainObject(value)) &&
  50207. Object.isExtensible(value) &&
  50208. !value._isVue
  50209. ) {
  50210. ob = new Observer(value);
  50211. }
  50212. if (asRootData && ob) {
  50213. ob.vmCount++;
  50214. }
  50215. return ob
  50216. }
  50217. /**
  50218. * Define a reactive property on an Object.
  50219. */
  50220. function defineReactive$$1 (
  50221. obj,
  50222. key,
  50223. val,
  50224. customSetter,
  50225. shallow
  50226. ) {
  50227. var dep = new Dep();
  50228. var property = Object.getOwnPropertyDescriptor(obj, key);
  50229. if (property && property.configurable === false) {
  50230. return
  50231. }
  50232. // cater for pre-defined getter/setters
  50233. var getter = property && property.get;
  50234. var setter = property && property.set;
  50235. if ((!getter || setter) && arguments.length === 2) {
  50236. val = obj[key];
  50237. }
  50238. var childOb = !shallow && observe(val);
  50239. Object.defineProperty(obj, key, {
  50240. enumerable: true,
  50241. configurable: true,
  50242. get: function reactiveGetter () {
  50243. var value = getter ? getter.call(obj) : val;
  50244. if (Dep.target) {
  50245. dep.depend();
  50246. if (childOb) {
  50247. childOb.dep.depend();
  50248. if (Array.isArray(value)) {
  50249. dependArray(value);
  50250. }
  50251. }
  50252. }
  50253. return value
  50254. },
  50255. set: function reactiveSetter (newVal) {
  50256. var value = getter ? getter.call(obj) : val;
  50257. /* eslint-disable no-self-compare */
  50258. if (newVal === value || (newVal !== newVal && value !== value)) {
  50259. return
  50260. }
  50261. /* eslint-enable no-self-compare */
  50262. if (customSetter) {
  50263. customSetter();
  50264. }
  50265. // #7981: for accessor properties without setter
  50266. if (getter && !setter) { return }
  50267. if (setter) {
  50268. setter.call(obj, newVal);
  50269. } else {
  50270. val = newVal;
  50271. }
  50272. childOb = !shallow && observe(newVal);
  50273. dep.notify();
  50274. }
  50275. });
  50276. }
  50277. /**
  50278. * Set a property on an object. Adds the new property and
  50279. * triggers change notification if the property doesn't
  50280. * already exist.
  50281. */
  50282. function set (target, key, val) {
  50283. if (isUndef(target) || isPrimitive(target)
  50284. ) {
  50285. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  50286. }
  50287. if (Array.isArray(target) && isValidArrayIndex(key)) {
  50288. target.length = Math.max(target.length, key);
  50289. target.splice(key, 1, val);
  50290. return val
  50291. }
  50292. if (key in target && !(key in Object.prototype)) {
  50293. target[key] = val;
  50294. return val
  50295. }
  50296. var ob = (target).__ob__;
  50297. if (target._isVue || (ob && ob.vmCount)) {
  50298. warn(
  50299. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  50300. 'at runtime - declare it upfront in the data option.'
  50301. );
  50302. return val
  50303. }
  50304. if (!ob) {
  50305. target[key] = val;
  50306. return val
  50307. }
  50308. defineReactive$$1(ob.value, key, val);
  50309. ob.dep.notify();
  50310. return val
  50311. }
  50312. /**
  50313. * Delete a property and trigger change if necessary.
  50314. */
  50315. function del (target, key) {
  50316. if (isUndef(target) || isPrimitive(target)
  50317. ) {
  50318. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  50319. }
  50320. if (Array.isArray(target) && isValidArrayIndex(key)) {
  50321. target.splice(key, 1);
  50322. return
  50323. }
  50324. var ob = (target).__ob__;
  50325. if (target._isVue || (ob && ob.vmCount)) {
  50326. warn(
  50327. 'Avoid deleting properties on a Vue instance or its root $data ' +
  50328. '- just set it to null.'
  50329. );
  50330. return
  50331. }
  50332. if (!hasOwn(target, key)) {
  50333. return
  50334. }
  50335. delete target[key];
  50336. if (!ob) {
  50337. return
  50338. }
  50339. ob.dep.notify();
  50340. }
  50341. /**
  50342. * Collect dependencies on array elements when the array is touched, since
  50343. * we cannot intercept array element access like property getters.
  50344. */
  50345. function dependArray (value) {
  50346. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  50347. e = value[i];
  50348. e && e.__ob__ && e.__ob__.dep.depend();
  50349. if (Array.isArray(e)) {
  50350. dependArray(e);
  50351. }
  50352. }
  50353. }
  50354. /* */
  50355. /**
  50356. * Option overwriting strategies are functions that handle
  50357. * how to merge a parent option value and a child option
  50358. * value into the final value.
  50359. */
  50360. var strats = config.optionMergeStrategies;
  50361. /**
  50362. * Options with restrictions
  50363. */
  50364. {
  50365. strats.el = strats.propsData = function (parent, child, vm, key) {
  50366. if (!vm) {
  50367. warn(
  50368. "option \"" + key + "\" can only be used during instance " +
  50369. 'creation with the `new` keyword.'
  50370. );
  50371. }
  50372. return defaultStrat(parent, child)
  50373. };
  50374. }
  50375. /**
  50376. * Helper that recursively merges two data objects together.
  50377. */
  50378. function mergeData (to, from) {
  50379. if (!from) { return to }
  50380. var key, toVal, fromVal;
  50381. var keys = hasSymbol
  50382. ? Reflect.ownKeys(from)
  50383. : Object.keys(from);
  50384. for (var i = 0; i < keys.length; i++) {
  50385. key = keys[i];
  50386. // in case the object is already observed...
  50387. if (key === '__ob__') { continue }
  50388. toVal = to[key];
  50389. fromVal = from[key];
  50390. if (!hasOwn(to, key)) {
  50391. set(to, key, fromVal);
  50392. } else if (
  50393. toVal !== fromVal &&
  50394. isPlainObject(toVal) &&
  50395. isPlainObject(fromVal)
  50396. ) {
  50397. mergeData(toVal, fromVal);
  50398. }
  50399. }
  50400. return to
  50401. }
  50402. /**
  50403. * Data
  50404. */
  50405. function mergeDataOrFn (
  50406. parentVal,
  50407. childVal,
  50408. vm
  50409. ) {
  50410. if (!vm) {
  50411. // in a Vue.extend merge, both should be functions
  50412. if (!childVal) {
  50413. return parentVal
  50414. }
  50415. if (!parentVal) {
  50416. return childVal
  50417. }
  50418. // when parentVal & childVal are both present,
  50419. // we need to return a function that returns the
  50420. // merged result of both functions... no need to
  50421. // check if parentVal is a function here because
  50422. // it has to be a function to pass previous merges.
  50423. return function mergedDataFn () {
  50424. return mergeData(
  50425. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  50426. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  50427. )
  50428. }
  50429. } else {
  50430. return function mergedInstanceDataFn () {
  50431. // instance merge
  50432. var instanceData = typeof childVal === 'function'
  50433. ? childVal.call(vm, vm)
  50434. : childVal;
  50435. var defaultData = typeof parentVal === 'function'
  50436. ? parentVal.call(vm, vm)
  50437. : parentVal;
  50438. if (instanceData) {
  50439. return mergeData(instanceData, defaultData)
  50440. } else {
  50441. return defaultData
  50442. }
  50443. }
  50444. }
  50445. }
  50446. strats.data = function (
  50447. parentVal,
  50448. childVal,
  50449. vm
  50450. ) {
  50451. if (!vm) {
  50452. if (childVal && typeof childVal !== 'function') {
  50453. warn(
  50454. 'The "data" option should be a function ' +
  50455. 'that returns a per-instance value in component ' +
  50456. 'definitions.',
  50457. vm
  50458. );
  50459. return parentVal
  50460. }
  50461. return mergeDataOrFn(parentVal, childVal)
  50462. }
  50463. return mergeDataOrFn(parentVal, childVal, vm)
  50464. };
  50465. /**
  50466. * Hooks and props are merged as arrays.
  50467. */
  50468. function mergeHook (
  50469. parentVal,
  50470. childVal
  50471. ) {
  50472. var res = childVal
  50473. ? parentVal
  50474. ? parentVal.concat(childVal)
  50475. : Array.isArray(childVal)
  50476. ? childVal
  50477. : [childVal]
  50478. : parentVal;
  50479. return res
  50480. ? dedupeHooks(res)
  50481. : res
  50482. }
  50483. function dedupeHooks (hooks) {
  50484. var res = [];
  50485. for (var i = 0; i < hooks.length; i++) {
  50486. if (res.indexOf(hooks[i]) === -1) {
  50487. res.push(hooks[i]);
  50488. }
  50489. }
  50490. return res
  50491. }
  50492. LIFECYCLE_HOOKS.forEach(function (hook) {
  50493. strats[hook] = mergeHook;
  50494. });
  50495. /**
  50496. * Assets
  50497. *
  50498. * When a vm is present (instance creation), we need to do
  50499. * a three-way merge between constructor options, instance
  50500. * options and parent options.
  50501. */
  50502. function mergeAssets (
  50503. parentVal,
  50504. childVal,
  50505. vm,
  50506. key
  50507. ) {
  50508. var res = Object.create(parentVal || null);
  50509. if (childVal) {
  50510. assertObjectType(key, childVal, vm);
  50511. return extend(res, childVal)
  50512. } else {
  50513. return res
  50514. }
  50515. }
  50516. ASSET_TYPES.forEach(function (type) {
  50517. strats[type + 's'] = mergeAssets;
  50518. });
  50519. /**
  50520. * Watchers.
  50521. *
  50522. * Watchers hashes should not overwrite one
  50523. * another, so we merge them as arrays.
  50524. */
  50525. strats.watch = function (
  50526. parentVal,
  50527. childVal,
  50528. vm,
  50529. key
  50530. ) {
  50531. // work around Firefox's Object.prototype.watch...
  50532. if (parentVal === nativeWatch) { parentVal = undefined; }
  50533. if (childVal === nativeWatch) { childVal = undefined; }
  50534. /* istanbul ignore if */
  50535. if (!childVal) { return Object.create(parentVal || null) }
  50536. {
  50537. assertObjectType(key, childVal, vm);
  50538. }
  50539. if (!parentVal) { return childVal }
  50540. var ret = {};
  50541. extend(ret, parentVal);
  50542. for (var key$1 in childVal) {
  50543. var parent = ret[key$1];
  50544. var child = childVal[key$1];
  50545. if (parent && !Array.isArray(parent)) {
  50546. parent = [parent];
  50547. }
  50548. ret[key$1] = parent
  50549. ? parent.concat(child)
  50550. : Array.isArray(child) ? child : [child];
  50551. }
  50552. return ret
  50553. };
  50554. /**
  50555. * Other object hashes.
  50556. */
  50557. strats.props =
  50558. strats.methods =
  50559. strats.inject =
  50560. strats.computed = function (
  50561. parentVal,
  50562. childVal,
  50563. vm,
  50564. key
  50565. ) {
  50566. if (childVal && "development" !== 'production') {
  50567. assertObjectType(key, childVal, vm);
  50568. }
  50569. if (!parentVal) { return childVal }
  50570. var ret = Object.create(null);
  50571. extend(ret, parentVal);
  50572. if (childVal) { extend(ret, childVal); }
  50573. return ret
  50574. };
  50575. strats.provide = mergeDataOrFn;
  50576. /**
  50577. * Default strategy.
  50578. */
  50579. var defaultStrat = function (parentVal, childVal) {
  50580. return childVal === undefined
  50581. ? parentVal
  50582. : childVal
  50583. };
  50584. /**
  50585. * Validate component names
  50586. */
  50587. function checkComponents (options) {
  50588. for (var key in options.components) {
  50589. validateComponentName(key);
  50590. }
  50591. }
  50592. function validateComponentName (name) {
  50593. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  50594. warn(
  50595. 'Invalid component name: "' + name + '". Component names ' +
  50596. 'should conform to valid custom element name in html5 specification.'
  50597. );
  50598. }
  50599. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  50600. warn(
  50601. 'Do not use built-in or reserved HTML elements as component ' +
  50602. 'id: ' + name
  50603. );
  50604. }
  50605. }
  50606. /**
  50607. * Ensure all props option syntax are normalized into the
  50608. * Object-based format.
  50609. */
  50610. function normalizeProps (options, vm) {
  50611. var props = options.props;
  50612. if (!props) { return }
  50613. var res = {};
  50614. var i, val, name;
  50615. if (Array.isArray(props)) {
  50616. i = props.length;
  50617. while (i--) {
  50618. val = props[i];
  50619. if (typeof val === 'string') {
  50620. name = camelize(val);
  50621. res[name] = { type: null };
  50622. } else {
  50623. warn('props must be strings when using array syntax.');
  50624. }
  50625. }
  50626. } else if (isPlainObject(props)) {
  50627. for (var key in props) {
  50628. val = props[key];
  50629. name = camelize(key);
  50630. res[name] = isPlainObject(val)
  50631. ? val
  50632. : { type: val };
  50633. }
  50634. } else {
  50635. warn(
  50636. "Invalid value for option \"props\": expected an Array or an Object, " +
  50637. "but got " + (toRawType(props)) + ".",
  50638. vm
  50639. );
  50640. }
  50641. options.props = res;
  50642. }
  50643. /**
  50644. * Normalize all injections into Object-based format
  50645. */
  50646. function normalizeInject (options, vm) {
  50647. var inject = options.inject;
  50648. if (!inject) { return }
  50649. var normalized = options.inject = {};
  50650. if (Array.isArray(inject)) {
  50651. for (var i = 0; i < inject.length; i++) {
  50652. normalized[inject[i]] = { from: inject[i] };
  50653. }
  50654. } else if (isPlainObject(inject)) {
  50655. for (var key in inject) {
  50656. var val = inject[key];
  50657. normalized[key] = isPlainObject(val)
  50658. ? extend({ from: key }, val)
  50659. : { from: val };
  50660. }
  50661. } else {
  50662. warn(
  50663. "Invalid value for option \"inject\": expected an Array or an Object, " +
  50664. "but got " + (toRawType(inject)) + ".",
  50665. vm
  50666. );
  50667. }
  50668. }
  50669. /**
  50670. * Normalize raw function directives into object format.
  50671. */
  50672. function normalizeDirectives (options) {
  50673. var dirs = options.directives;
  50674. if (dirs) {
  50675. for (var key in dirs) {
  50676. var def$$1 = dirs[key];
  50677. if (typeof def$$1 === 'function') {
  50678. dirs[key] = { bind: def$$1, update: def$$1 };
  50679. }
  50680. }
  50681. }
  50682. }
  50683. function assertObjectType (name, value, vm) {
  50684. if (!isPlainObject(value)) {
  50685. warn(
  50686. "Invalid value for option \"" + name + "\": expected an Object, " +
  50687. "but got " + (toRawType(value)) + ".",
  50688. vm
  50689. );
  50690. }
  50691. }
  50692. /**
  50693. * Merge two option objects into a new one.
  50694. * Core utility used in both instantiation and inheritance.
  50695. */
  50696. function mergeOptions (
  50697. parent,
  50698. child,
  50699. vm
  50700. ) {
  50701. {
  50702. checkComponents(child);
  50703. }
  50704. if (typeof child === 'function') {
  50705. child = child.options;
  50706. }
  50707. normalizeProps(child, vm);
  50708. normalizeInject(child, vm);
  50709. normalizeDirectives(child);
  50710. // Apply extends and mixins on the child options,
  50711. // but only if it is a raw options object that isn't
  50712. // the result of another mergeOptions call.
  50713. // Only merged options has the _base property.
  50714. if (!child._base) {
  50715. if (child.extends) {
  50716. parent = mergeOptions(parent, child.extends, vm);
  50717. }
  50718. if (child.mixins) {
  50719. for (var i = 0, l = child.mixins.length; i < l; i++) {
  50720. parent = mergeOptions(parent, child.mixins[i], vm);
  50721. }
  50722. }
  50723. }
  50724. var options = {};
  50725. var key;
  50726. for (key in parent) {
  50727. mergeField(key);
  50728. }
  50729. for (key in child) {
  50730. if (!hasOwn(parent, key)) {
  50731. mergeField(key);
  50732. }
  50733. }
  50734. function mergeField (key) {
  50735. var strat = strats[key] || defaultStrat;
  50736. options[key] = strat(parent[key], child[key], vm, key);
  50737. }
  50738. return options
  50739. }
  50740. /**
  50741. * Resolve an asset.
  50742. * This function is used because child instances need access
  50743. * to assets defined in its ancestor chain.
  50744. */
  50745. function resolveAsset (
  50746. options,
  50747. type,
  50748. id,
  50749. warnMissing
  50750. ) {
  50751. /* istanbul ignore if */
  50752. if (typeof id !== 'string') {
  50753. return
  50754. }
  50755. var assets = options[type];
  50756. // check local registration variations first
  50757. if (hasOwn(assets, id)) { return assets[id] }
  50758. var camelizedId = camelize(id);
  50759. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  50760. var PascalCaseId = capitalize(camelizedId);
  50761. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  50762. // fallback to prototype chain
  50763. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  50764. if (warnMissing && !res) {
  50765. warn(
  50766. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  50767. options
  50768. );
  50769. }
  50770. return res
  50771. }
  50772. /* */
  50773. function validateProp (
  50774. key,
  50775. propOptions,
  50776. propsData,
  50777. vm
  50778. ) {
  50779. var prop = propOptions[key];
  50780. var absent = !hasOwn(propsData, key);
  50781. var value = propsData[key];
  50782. // boolean casting
  50783. var booleanIndex = getTypeIndex(Boolean, prop.type);
  50784. if (booleanIndex > -1) {
  50785. if (absent && !hasOwn(prop, 'default')) {
  50786. value = false;
  50787. } else if (value === '' || value === hyphenate(key)) {
  50788. // only cast empty string / same name to boolean if
  50789. // boolean has higher priority
  50790. var stringIndex = getTypeIndex(String, prop.type);
  50791. if (stringIndex < 0 || booleanIndex < stringIndex) {
  50792. value = true;
  50793. }
  50794. }
  50795. }
  50796. // check default value
  50797. if (value === undefined) {
  50798. value = getPropDefaultValue(vm, prop, key);
  50799. // since the default value is a fresh copy,
  50800. // make sure to observe it.
  50801. var prevShouldObserve = shouldObserve;
  50802. toggleObserving(true);
  50803. observe(value);
  50804. toggleObserving(prevShouldObserve);
  50805. }
  50806. {
  50807. assertProp(prop, key, value, vm, absent);
  50808. }
  50809. return value
  50810. }
  50811. /**
  50812. * Get the default value of a prop.
  50813. */
  50814. function getPropDefaultValue (vm, prop, key) {
  50815. // no default, return undefined
  50816. if (!hasOwn(prop, 'default')) {
  50817. return undefined
  50818. }
  50819. var def = prop.default;
  50820. // warn against non-factory defaults for Object & Array
  50821. if (isObject(def)) {
  50822. warn(
  50823. 'Invalid default value for prop "' + key + '": ' +
  50824. 'Props with type Object/Array must use a factory function ' +
  50825. 'to return the default value.',
  50826. vm
  50827. );
  50828. }
  50829. // the raw prop value was also undefined from previous render,
  50830. // return previous default value to avoid unnecessary watcher trigger
  50831. if (vm && vm.$options.propsData &&
  50832. vm.$options.propsData[key] === undefined &&
  50833. vm._props[key] !== undefined
  50834. ) {
  50835. return vm._props[key]
  50836. }
  50837. // call factory function for non-Function types
  50838. // a value is Function if its prototype is function even across different execution context
  50839. return typeof def === 'function' && getType(prop.type) !== 'Function'
  50840. ? def.call(vm)
  50841. : def
  50842. }
  50843. /**
  50844. * Assert whether a prop is valid.
  50845. */
  50846. function assertProp (
  50847. prop,
  50848. name,
  50849. value,
  50850. vm,
  50851. absent
  50852. ) {
  50853. if (prop.required && absent) {
  50854. warn(
  50855. 'Missing required prop: "' + name + '"',
  50856. vm
  50857. );
  50858. return
  50859. }
  50860. if (value == null && !prop.required) {
  50861. return
  50862. }
  50863. var type = prop.type;
  50864. var valid = !type || type === true;
  50865. var expectedTypes = [];
  50866. if (type) {
  50867. if (!Array.isArray(type)) {
  50868. type = [type];
  50869. }
  50870. for (var i = 0; i < type.length && !valid; i++) {
  50871. var assertedType = assertType(value, type[i]);
  50872. expectedTypes.push(assertedType.expectedType || '');
  50873. valid = assertedType.valid;
  50874. }
  50875. }
  50876. if (!valid) {
  50877. warn(
  50878. getInvalidTypeMessage(name, value, expectedTypes),
  50879. vm
  50880. );
  50881. return
  50882. }
  50883. var validator = prop.validator;
  50884. if (validator) {
  50885. if (!validator(value)) {
  50886. warn(
  50887. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  50888. vm
  50889. );
  50890. }
  50891. }
  50892. }
  50893. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  50894. function assertType (value, type) {
  50895. var valid;
  50896. var expectedType = getType(type);
  50897. if (simpleCheckRE.test(expectedType)) {
  50898. var t = typeof value;
  50899. valid = t === expectedType.toLowerCase();
  50900. // for primitive wrapper objects
  50901. if (!valid && t === 'object') {
  50902. valid = value instanceof type;
  50903. }
  50904. } else if (expectedType === 'Object') {
  50905. valid = isPlainObject(value);
  50906. } else if (expectedType === 'Array') {
  50907. valid = Array.isArray(value);
  50908. } else {
  50909. valid = value instanceof type;
  50910. }
  50911. return {
  50912. valid: valid,
  50913. expectedType: expectedType
  50914. }
  50915. }
  50916. /**
  50917. * Use function string name to check built-in types,
  50918. * because a simple equality check will fail when running
  50919. * across different vms / iframes.
  50920. */
  50921. function getType (fn) {
  50922. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  50923. return match ? match[1] : ''
  50924. }
  50925. function isSameType (a, b) {
  50926. return getType(a) === getType(b)
  50927. }
  50928. function getTypeIndex (type, expectedTypes) {
  50929. if (!Array.isArray(expectedTypes)) {
  50930. return isSameType(expectedTypes, type) ? 0 : -1
  50931. }
  50932. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  50933. if (isSameType(expectedTypes[i], type)) {
  50934. return i
  50935. }
  50936. }
  50937. return -1
  50938. }
  50939. function getInvalidTypeMessage (name, value, expectedTypes) {
  50940. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  50941. " Expected " + (expectedTypes.map(capitalize).join(', '));
  50942. var expectedType = expectedTypes[0];
  50943. var receivedType = toRawType(value);
  50944. var expectedValue = styleValue(value, expectedType);
  50945. var receivedValue = styleValue(value, receivedType);
  50946. // check if we need to specify expected value
  50947. if (expectedTypes.length === 1 &&
  50948. isExplicable(expectedType) &&
  50949. !isBoolean(expectedType, receivedType)) {
  50950. message += " with value " + expectedValue;
  50951. }
  50952. message += ", got " + receivedType + " ";
  50953. // check if we need to specify received value
  50954. if (isExplicable(receivedType)) {
  50955. message += "with value " + receivedValue + ".";
  50956. }
  50957. return message
  50958. }
  50959. function styleValue (value, type) {
  50960. if (type === 'String') {
  50961. return ("\"" + value + "\"")
  50962. } else if (type === 'Number') {
  50963. return ("" + (Number(value)))
  50964. } else {
  50965. return ("" + value)
  50966. }
  50967. }
  50968. function isExplicable (value) {
  50969. var explicitTypes = ['string', 'number', 'boolean'];
  50970. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  50971. }
  50972. function isBoolean () {
  50973. var args = [], len = arguments.length;
  50974. while ( len-- ) args[ len ] = arguments[ len ];
  50975. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  50976. }
  50977. /* */
  50978. function handleError (err, vm, info) {
  50979. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  50980. // See: https://github.com/vuejs/vuex/issues/1505
  50981. pushTarget();
  50982. try {
  50983. if (vm) {
  50984. var cur = vm;
  50985. while ((cur = cur.$parent)) {
  50986. var hooks = cur.$options.errorCaptured;
  50987. if (hooks) {
  50988. for (var i = 0; i < hooks.length; i++) {
  50989. try {
  50990. var capture = hooks[i].call(cur, err, vm, info) === false;
  50991. if (capture) { return }
  50992. } catch (e) {
  50993. globalHandleError(e, cur, 'errorCaptured hook');
  50994. }
  50995. }
  50996. }
  50997. }
  50998. }
  50999. globalHandleError(err, vm, info);
  51000. } finally {
  51001. popTarget();
  51002. }
  51003. }
  51004. function invokeWithErrorHandling (
  51005. handler,
  51006. context,
  51007. args,
  51008. vm,
  51009. info
  51010. ) {
  51011. var res;
  51012. try {
  51013. res = args ? handler.apply(context, args) : handler.call(context);
  51014. if (res && !res._isVue && isPromise(res) && !res._handled) {
  51015. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  51016. // issue #9511
  51017. // avoid catch triggering multiple times when nested calls
  51018. res._handled = true;
  51019. }
  51020. } catch (e) {
  51021. handleError(e, vm, info);
  51022. }
  51023. return res
  51024. }
  51025. function globalHandleError (err, vm, info) {
  51026. if (config.errorHandler) {
  51027. try {
  51028. return config.errorHandler.call(null, err, vm, info)
  51029. } catch (e) {
  51030. // if the user intentionally throws the original error in the handler,
  51031. // do not log it twice
  51032. if (e !== err) {
  51033. logError(e, null, 'config.errorHandler');
  51034. }
  51035. }
  51036. }
  51037. logError(err, vm, info);
  51038. }
  51039. function logError (err, vm, info) {
  51040. {
  51041. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  51042. }
  51043. /* istanbul ignore else */
  51044. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  51045. console.error(err);
  51046. } else {
  51047. throw err
  51048. }
  51049. }
  51050. /* */
  51051. var isUsingMicroTask = false;
  51052. var callbacks = [];
  51053. var pending = false;
  51054. function flushCallbacks () {
  51055. pending = false;
  51056. var copies = callbacks.slice(0);
  51057. callbacks.length = 0;
  51058. for (var i = 0; i < copies.length; i++) {
  51059. copies[i]();
  51060. }
  51061. }
  51062. // Here we have async deferring wrappers using microtasks.
  51063. // In 2.5 we used (macro) tasks (in combination with microtasks).
  51064. // However, it has subtle problems when state is changed right before repaint
  51065. // (e.g. #6813, out-in transitions).
  51066. // Also, using (macro) tasks in event handler would cause some weird behaviors
  51067. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  51068. // So we now use microtasks everywhere, again.
  51069. // A major drawback of this tradeoff is that there are some scenarios
  51070. // where microtasks have too high a priority and fire in between supposedly
  51071. // sequential events (e.g. #4521, #6690, which have workarounds)
  51072. // or even between bubbling of the same event (#6566).
  51073. var timerFunc;
  51074. // The nextTick behavior leverages the microtask queue, which can be accessed
  51075. // via either native Promise.then or MutationObserver.
  51076. // MutationObserver has wider support, however it is seriously bugged in
  51077. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  51078. // completely stops working after triggering a few times... so, if native
  51079. // Promise is available, we will use it:
  51080. /* istanbul ignore next, $flow-disable-line */
  51081. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  51082. var p = Promise.resolve();
  51083. timerFunc = function () {
  51084. p.then(flushCallbacks);
  51085. // In problematic UIWebViews, Promise.then doesn't completely break, but
  51086. // it can get stuck in a weird state where callbacks are pushed into the
  51087. // microtask queue but the queue isn't being flushed, until the browser
  51088. // needs to do some other work, e.g. handle a timer. Therefore we can
  51089. // "force" the microtask queue to be flushed by adding an empty timer.
  51090. if (isIOS) { setTimeout(noop); }
  51091. };
  51092. isUsingMicroTask = true;
  51093. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  51094. isNative(MutationObserver) ||
  51095. // PhantomJS and iOS 7.x
  51096. MutationObserver.toString() === '[object MutationObserverConstructor]'
  51097. )) {
  51098. // Use MutationObserver where native Promise is not available,
  51099. // e.g. PhantomJS, iOS7, Android 4.4
  51100. // (#6466 MutationObserver is unreliable in IE11)
  51101. var counter = 1;
  51102. var observer = new MutationObserver(flushCallbacks);
  51103. var textNode = document.createTextNode(String(counter));
  51104. observer.observe(textNode, {
  51105. characterData: true
  51106. });
  51107. timerFunc = function () {
  51108. counter = (counter + 1) % 2;
  51109. textNode.data = String(counter);
  51110. };
  51111. isUsingMicroTask = true;
  51112. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  51113. // Fallback to setImmediate.
  51114. // Technically it leverages the (macro) task queue,
  51115. // but it is still a better choice than setTimeout.
  51116. timerFunc = function () {
  51117. setImmediate(flushCallbacks);
  51118. };
  51119. } else {
  51120. // Fallback to setTimeout.
  51121. timerFunc = function () {
  51122. setTimeout(flushCallbacks, 0);
  51123. };
  51124. }
  51125. function nextTick (cb, ctx) {
  51126. var _resolve;
  51127. callbacks.push(function () {
  51128. if (cb) {
  51129. try {
  51130. cb.call(ctx);
  51131. } catch (e) {
  51132. handleError(e, ctx, 'nextTick');
  51133. }
  51134. } else if (_resolve) {
  51135. _resolve(ctx);
  51136. }
  51137. });
  51138. if (!pending) {
  51139. pending = true;
  51140. timerFunc();
  51141. }
  51142. // $flow-disable-line
  51143. if (!cb && typeof Promise !== 'undefined') {
  51144. return new Promise(function (resolve) {
  51145. _resolve = resolve;
  51146. })
  51147. }
  51148. }
  51149. /* */
  51150. var mark;
  51151. var measure;
  51152. {
  51153. var perf = inBrowser && window.performance;
  51154. /* istanbul ignore if */
  51155. if (
  51156. perf &&
  51157. perf.mark &&
  51158. perf.measure &&
  51159. perf.clearMarks &&
  51160. perf.clearMeasures
  51161. ) {
  51162. mark = function (tag) { return perf.mark(tag); };
  51163. measure = function (name, startTag, endTag) {
  51164. perf.measure(name, startTag, endTag);
  51165. perf.clearMarks(startTag);
  51166. perf.clearMarks(endTag);
  51167. // perf.clearMeasures(name)
  51168. };
  51169. }
  51170. }
  51171. /* not type checking this file because flow doesn't play well with Proxy */
  51172. var initProxy;
  51173. {
  51174. var allowedGlobals = makeMap(
  51175. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  51176. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  51177. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  51178. 'require' // for Webpack/Browserify
  51179. );
  51180. var warnNonPresent = function (target, key) {
  51181. warn(
  51182. "Property or method \"" + key + "\" is not defined on the instance but " +
  51183. 'referenced during render. Make sure that this property is reactive, ' +
  51184. 'either in the data option, or for class-based components, by ' +
  51185. 'initializing the property. ' +
  51186. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  51187. target
  51188. );
  51189. };
  51190. var warnReservedPrefix = function (target, key) {
  51191. warn(
  51192. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  51193. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  51194. 'prevent conflicts with Vue internals. ' +
  51195. 'See: https://vuejs.org/v2/api/#data',
  51196. target
  51197. );
  51198. };
  51199. var hasProxy =
  51200. typeof Proxy !== 'undefined' && isNative(Proxy);
  51201. if (hasProxy) {
  51202. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  51203. config.keyCodes = new Proxy(config.keyCodes, {
  51204. set: function set (target, key, value) {
  51205. if (isBuiltInModifier(key)) {
  51206. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  51207. return false
  51208. } else {
  51209. target[key] = value;
  51210. return true
  51211. }
  51212. }
  51213. });
  51214. }
  51215. var hasHandler = {
  51216. has: function has (target, key) {
  51217. var has = key in target;
  51218. var isAllowed = allowedGlobals(key) ||
  51219. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  51220. if (!has && !isAllowed) {
  51221. if (key in target.$data) { warnReservedPrefix(target, key); }
  51222. else { warnNonPresent(target, key); }
  51223. }
  51224. return has || !isAllowed
  51225. }
  51226. };
  51227. var getHandler = {
  51228. get: function get (target, key) {
  51229. if (typeof key === 'string' && !(key in target)) {
  51230. if (key in target.$data) { warnReservedPrefix(target, key); }
  51231. else { warnNonPresent(target, key); }
  51232. }
  51233. return target[key]
  51234. }
  51235. };
  51236. initProxy = function initProxy (vm) {
  51237. if (hasProxy) {
  51238. // determine which proxy handler to use
  51239. var options = vm.$options;
  51240. var handlers = options.render && options.render._withStripped
  51241. ? getHandler
  51242. : hasHandler;
  51243. vm._renderProxy = new Proxy(vm, handlers);
  51244. } else {
  51245. vm._renderProxy = vm;
  51246. }
  51247. };
  51248. }
  51249. /* */
  51250. var seenObjects = new _Set();
  51251. /**
  51252. * Recursively traverse an object to evoke all converted
  51253. * getters, so that every nested property inside the object
  51254. * is collected as a "deep" dependency.
  51255. */
  51256. function traverse (val) {
  51257. _traverse(val, seenObjects);
  51258. seenObjects.clear();
  51259. }
  51260. function _traverse (val, seen) {
  51261. var i, keys;
  51262. var isA = Array.isArray(val);
  51263. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  51264. return
  51265. }
  51266. if (val.__ob__) {
  51267. var depId = val.__ob__.dep.id;
  51268. if (seen.has(depId)) {
  51269. return
  51270. }
  51271. seen.add(depId);
  51272. }
  51273. if (isA) {
  51274. i = val.length;
  51275. while (i--) { _traverse(val[i], seen); }
  51276. } else {
  51277. keys = Object.keys(val);
  51278. i = keys.length;
  51279. while (i--) { _traverse(val[keys[i]], seen); }
  51280. }
  51281. }
  51282. /* */
  51283. var normalizeEvent = cached(function (name) {
  51284. var passive = name.charAt(0) === '&';
  51285. name = passive ? name.slice(1) : name;
  51286. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  51287. name = once$$1 ? name.slice(1) : name;
  51288. var capture = name.charAt(0) === '!';
  51289. name = capture ? name.slice(1) : name;
  51290. return {
  51291. name: name,
  51292. once: once$$1,
  51293. capture: capture,
  51294. passive: passive
  51295. }
  51296. });
  51297. function createFnInvoker (fns, vm) {
  51298. function invoker () {
  51299. var arguments$1 = arguments;
  51300. var fns = invoker.fns;
  51301. if (Array.isArray(fns)) {
  51302. var cloned = fns.slice();
  51303. for (var i = 0; i < cloned.length; i++) {
  51304. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  51305. }
  51306. } else {
  51307. // return handler return value for single handlers
  51308. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  51309. }
  51310. }
  51311. invoker.fns = fns;
  51312. return invoker
  51313. }
  51314. function updateListeners (
  51315. on,
  51316. oldOn,
  51317. add,
  51318. remove$$1,
  51319. createOnceHandler,
  51320. vm
  51321. ) {
  51322. var name, def$$1, cur, old, event;
  51323. for (name in on) {
  51324. def$$1 = cur = on[name];
  51325. old = oldOn[name];
  51326. event = normalizeEvent(name);
  51327. if (isUndef(cur)) {
  51328. warn(
  51329. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  51330. vm
  51331. );
  51332. } else if (isUndef(old)) {
  51333. if (isUndef(cur.fns)) {
  51334. cur = on[name] = createFnInvoker(cur, vm);
  51335. }
  51336. if (isTrue(event.once)) {
  51337. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  51338. }
  51339. add(event.name, cur, event.capture, event.passive, event.params);
  51340. } else if (cur !== old) {
  51341. old.fns = cur;
  51342. on[name] = old;
  51343. }
  51344. }
  51345. for (name in oldOn) {
  51346. if (isUndef(on[name])) {
  51347. event = normalizeEvent(name);
  51348. remove$$1(event.name, oldOn[name], event.capture);
  51349. }
  51350. }
  51351. }
  51352. /* */
  51353. function mergeVNodeHook (def, hookKey, hook) {
  51354. if (def instanceof VNode) {
  51355. def = def.data.hook || (def.data.hook = {});
  51356. }
  51357. var invoker;
  51358. var oldHook = def[hookKey];
  51359. function wrappedHook () {
  51360. hook.apply(this, arguments);
  51361. // important: remove merged hook to ensure it's called only once
  51362. // and prevent memory leak
  51363. remove(invoker.fns, wrappedHook);
  51364. }
  51365. if (isUndef(oldHook)) {
  51366. // no existing hook
  51367. invoker = createFnInvoker([wrappedHook]);
  51368. } else {
  51369. /* istanbul ignore if */
  51370. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  51371. // already a merged invoker
  51372. invoker = oldHook;
  51373. invoker.fns.push(wrappedHook);
  51374. } else {
  51375. // existing plain hook
  51376. invoker = createFnInvoker([oldHook, wrappedHook]);
  51377. }
  51378. }
  51379. invoker.merged = true;
  51380. def[hookKey] = invoker;
  51381. }
  51382. /* */
  51383. function extractPropsFromVNodeData (
  51384. data,
  51385. Ctor,
  51386. tag
  51387. ) {
  51388. // we are only extracting raw values here.
  51389. // validation and default values are handled in the child
  51390. // component itself.
  51391. var propOptions = Ctor.options.props;
  51392. if (isUndef(propOptions)) {
  51393. return
  51394. }
  51395. var res = {};
  51396. var attrs = data.attrs;
  51397. var props = data.props;
  51398. if (isDef(attrs) || isDef(props)) {
  51399. for (var key in propOptions) {
  51400. var altKey = hyphenate(key);
  51401. {
  51402. var keyInLowerCase = key.toLowerCase();
  51403. if (
  51404. key !== keyInLowerCase &&
  51405. attrs && hasOwn(attrs, keyInLowerCase)
  51406. ) {
  51407. tip(
  51408. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  51409. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  51410. " \"" + key + "\". " +
  51411. "Note that HTML attributes are case-insensitive and camelCased " +
  51412. "props need to use their kebab-case equivalents when using in-DOM " +
  51413. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  51414. );
  51415. }
  51416. }
  51417. checkProp(res, props, key, altKey, true) ||
  51418. checkProp(res, attrs, key, altKey, false);
  51419. }
  51420. }
  51421. return res
  51422. }
  51423. function checkProp (
  51424. res,
  51425. hash,
  51426. key,
  51427. altKey,
  51428. preserve
  51429. ) {
  51430. if (isDef(hash)) {
  51431. if (hasOwn(hash, key)) {
  51432. res[key] = hash[key];
  51433. if (!preserve) {
  51434. delete hash[key];
  51435. }
  51436. return true
  51437. } else if (hasOwn(hash, altKey)) {
  51438. res[key] = hash[altKey];
  51439. if (!preserve) {
  51440. delete hash[altKey];
  51441. }
  51442. return true
  51443. }
  51444. }
  51445. return false
  51446. }
  51447. /* */
  51448. // The template compiler attempts to minimize the need for normalization by
  51449. // statically analyzing the template at compile time.
  51450. //
  51451. // For plain HTML markup, normalization can be completely skipped because the
  51452. // generated render function is guaranteed to return Array<VNode>. There are
  51453. // two cases where extra normalization is needed:
  51454. // 1. When the children contains components - because a functional component
  51455. // may return an Array instead of a single root. In this case, just a simple
  51456. // normalization is needed - if any child is an Array, we flatten the whole
  51457. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  51458. // because functional components already normalize their own children.
  51459. function simpleNormalizeChildren (children) {
  51460. for (var i = 0; i < children.length; i++) {
  51461. if (Array.isArray(children[i])) {
  51462. return Array.prototype.concat.apply([], children)
  51463. }
  51464. }
  51465. return children
  51466. }
  51467. // 2. When the children contains constructs that always generated nested Arrays,
  51468. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  51469. // with hand-written render functions / JSX. In such cases a full normalization
  51470. // is needed to cater to all possible types of children values.
  51471. function normalizeChildren (children) {
  51472. return isPrimitive(children)
  51473. ? [createTextVNode(children)]
  51474. : Array.isArray(children)
  51475. ? normalizeArrayChildren(children)
  51476. : undefined
  51477. }
  51478. function isTextNode (node) {
  51479. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  51480. }
  51481. function normalizeArrayChildren (children, nestedIndex) {
  51482. var res = [];
  51483. var i, c, lastIndex, last;
  51484. for (i = 0; i < children.length; i++) {
  51485. c = children[i];
  51486. if (isUndef(c) || typeof c === 'boolean') { continue }
  51487. lastIndex = res.length - 1;
  51488. last = res[lastIndex];
  51489. // nested
  51490. if (Array.isArray(c)) {
  51491. if (c.length > 0) {
  51492. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  51493. // merge adjacent text nodes
  51494. if (isTextNode(c[0]) && isTextNode(last)) {
  51495. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  51496. c.shift();
  51497. }
  51498. res.push.apply(res, c);
  51499. }
  51500. } else if (isPrimitive(c)) {
  51501. if (isTextNode(last)) {
  51502. // merge adjacent text nodes
  51503. // this is necessary for SSR hydration because text nodes are
  51504. // essentially merged when rendered to HTML strings
  51505. res[lastIndex] = createTextVNode(last.text + c);
  51506. } else if (c !== '') {
  51507. // convert primitive to vnode
  51508. res.push(createTextVNode(c));
  51509. }
  51510. } else {
  51511. if (isTextNode(c) && isTextNode(last)) {
  51512. // merge adjacent text nodes
  51513. res[lastIndex] = createTextVNode(last.text + c.text);
  51514. } else {
  51515. // default key for nested array children (likely generated by v-for)
  51516. if (isTrue(children._isVList) &&
  51517. isDef(c.tag) &&
  51518. isUndef(c.key) &&
  51519. isDef(nestedIndex)) {
  51520. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  51521. }
  51522. res.push(c);
  51523. }
  51524. }
  51525. }
  51526. return res
  51527. }
  51528. /* */
  51529. function initProvide (vm) {
  51530. var provide = vm.$options.provide;
  51531. if (provide) {
  51532. vm._provided = typeof provide === 'function'
  51533. ? provide.call(vm)
  51534. : provide;
  51535. }
  51536. }
  51537. function initInjections (vm) {
  51538. var result = resolveInject(vm.$options.inject, vm);
  51539. if (result) {
  51540. toggleObserving(false);
  51541. Object.keys(result).forEach(function (key) {
  51542. /* istanbul ignore else */
  51543. {
  51544. defineReactive$$1(vm, key, result[key], function () {
  51545. warn(
  51546. "Avoid mutating an injected value directly since the changes will be " +
  51547. "overwritten whenever the provided component re-renders. " +
  51548. "injection being mutated: \"" + key + "\"",
  51549. vm
  51550. );
  51551. });
  51552. }
  51553. });
  51554. toggleObserving(true);
  51555. }
  51556. }
  51557. function resolveInject (inject, vm) {
  51558. if (inject) {
  51559. // inject is :any because flow is not smart enough to figure out cached
  51560. var result = Object.create(null);
  51561. var keys = hasSymbol
  51562. ? Reflect.ownKeys(inject)
  51563. : Object.keys(inject);
  51564. for (var i = 0; i < keys.length; i++) {
  51565. var key = keys[i];
  51566. // #6574 in case the inject object is observed...
  51567. if (key === '__ob__') { continue }
  51568. var provideKey = inject[key].from;
  51569. var source = vm;
  51570. while (source) {
  51571. if (source._provided && hasOwn(source._provided, provideKey)) {
  51572. result[key] = source._provided[provideKey];
  51573. break
  51574. }
  51575. source = source.$parent;
  51576. }
  51577. if (!source) {
  51578. if ('default' in inject[key]) {
  51579. var provideDefault = inject[key].default;
  51580. result[key] = typeof provideDefault === 'function'
  51581. ? provideDefault.call(vm)
  51582. : provideDefault;
  51583. } else {
  51584. warn(("Injection \"" + key + "\" not found"), vm);
  51585. }
  51586. }
  51587. }
  51588. return result
  51589. }
  51590. }
  51591. /* */
  51592. /**
  51593. * Runtime helper for resolving raw children VNodes into a slot object.
  51594. */
  51595. function resolveSlots (
  51596. children,
  51597. context
  51598. ) {
  51599. if (!children || !children.length) {
  51600. return {}
  51601. }
  51602. var slots = {};
  51603. for (var i = 0, l = children.length; i < l; i++) {
  51604. var child = children[i];
  51605. var data = child.data;
  51606. // remove slot attribute if the node is resolved as a Vue slot node
  51607. if (data && data.attrs && data.attrs.slot) {
  51608. delete data.attrs.slot;
  51609. }
  51610. // named slots should only be respected if the vnode was rendered in the
  51611. // same context.
  51612. if ((child.context === context || child.fnContext === context) &&
  51613. data && data.slot != null
  51614. ) {
  51615. var name = data.slot;
  51616. var slot = (slots[name] || (slots[name] = []));
  51617. if (child.tag === 'template') {
  51618. slot.push.apply(slot, child.children || []);
  51619. } else {
  51620. slot.push(child);
  51621. }
  51622. } else {
  51623. (slots.default || (slots.default = [])).push(child);
  51624. }
  51625. }
  51626. // ignore slots that contains only whitespace
  51627. for (var name$1 in slots) {
  51628. if (slots[name$1].every(isWhitespace)) {
  51629. delete slots[name$1];
  51630. }
  51631. }
  51632. return slots
  51633. }
  51634. function isWhitespace (node) {
  51635. return (node.isComment && !node.asyncFactory) || node.text === ' '
  51636. }
  51637. /* */
  51638. function normalizeScopedSlots (
  51639. slots,
  51640. normalSlots,
  51641. prevSlots
  51642. ) {
  51643. var res;
  51644. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  51645. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  51646. var key = slots && slots.$key;
  51647. if (!slots) {
  51648. res = {};
  51649. } else if (slots._normalized) {
  51650. // fast path 1: child component re-render only, parent did not change
  51651. return slots._normalized
  51652. } else if (
  51653. isStable &&
  51654. prevSlots &&
  51655. prevSlots !== emptyObject &&
  51656. key === prevSlots.$key &&
  51657. !hasNormalSlots &&
  51658. !prevSlots.$hasNormal
  51659. ) {
  51660. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  51661. // only need to normalize once
  51662. return prevSlots
  51663. } else {
  51664. res = {};
  51665. for (var key$1 in slots) {
  51666. if (slots[key$1] && key$1[0] !== '$') {
  51667. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  51668. }
  51669. }
  51670. }
  51671. // expose normal slots on scopedSlots
  51672. for (var key$2 in normalSlots) {
  51673. if (!(key$2 in res)) {
  51674. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  51675. }
  51676. }
  51677. // avoriaz seems to mock a non-extensible $scopedSlots object
  51678. // and when that is passed down this would cause an error
  51679. if (slots && Object.isExtensible(slots)) {
  51680. (slots)._normalized = res;
  51681. }
  51682. def(res, '$stable', isStable);
  51683. def(res, '$key', key);
  51684. def(res, '$hasNormal', hasNormalSlots);
  51685. return res
  51686. }
  51687. function normalizeScopedSlot(normalSlots, key, fn) {
  51688. var normalized = function () {
  51689. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  51690. res = res && typeof res === 'object' && !Array.isArray(res)
  51691. ? [res] // single vnode
  51692. : normalizeChildren(res);
  51693. return res && (
  51694. res.length === 0 ||
  51695. (res.length === 1 && res[0].isComment) // #9658
  51696. ) ? undefined
  51697. : res
  51698. };
  51699. // this is a slot using the new v-slot syntax without scope. although it is
  51700. // compiled as a scoped slot, render fn users would expect it to be present
  51701. // on this.$slots because the usage is semantically a normal slot.
  51702. if (fn.proxy) {
  51703. Object.defineProperty(normalSlots, key, {
  51704. get: normalized,
  51705. enumerable: true,
  51706. configurable: true
  51707. });
  51708. }
  51709. return normalized
  51710. }
  51711. function proxyNormalSlot(slots, key) {
  51712. return function () { return slots[key]; }
  51713. }
  51714. /* */
  51715. /**
  51716. * Runtime helper for rendering v-for lists.
  51717. */
  51718. function renderList (
  51719. val,
  51720. render
  51721. ) {
  51722. var ret, i, l, keys, key;
  51723. if (Array.isArray(val) || typeof val === 'string') {
  51724. ret = new Array(val.length);
  51725. for (i = 0, l = val.length; i < l; i++) {
  51726. ret[i] = render(val[i], i);
  51727. }
  51728. } else if (typeof val === 'number') {
  51729. ret = new Array(val);
  51730. for (i = 0; i < val; i++) {
  51731. ret[i] = render(i + 1, i);
  51732. }
  51733. } else if (isObject(val)) {
  51734. if (hasSymbol && val[Symbol.iterator]) {
  51735. ret = [];
  51736. var iterator = val[Symbol.iterator]();
  51737. var result = iterator.next();
  51738. while (!result.done) {
  51739. ret.push(render(result.value, ret.length));
  51740. result = iterator.next();
  51741. }
  51742. } else {
  51743. keys = Object.keys(val);
  51744. ret = new Array(keys.length);
  51745. for (i = 0, l = keys.length; i < l; i++) {
  51746. key = keys[i];
  51747. ret[i] = render(val[key], key, i);
  51748. }
  51749. }
  51750. }
  51751. if (!isDef(ret)) {
  51752. ret = [];
  51753. }
  51754. (ret)._isVList = true;
  51755. return ret
  51756. }
  51757. /* */
  51758. /**
  51759. * Runtime helper for rendering <slot>
  51760. */
  51761. function renderSlot (
  51762. name,
  51763. fallback,
  51764. props,
  51765. bindObject
  51766. ) {
  51767. var scopedSlotFn = this.$scopedSlots[name];
  51768. var nodes;
  51769. if (scopedSlotFn) { // scoped slot
  51770. props = props || {};
  51771. if (bindObject) {
  51772. if (!isObject(bindObject)) {
  51773. warn(
  51774. 'slot v-bind without argument expects an Object',
  51775. this
  51776. );
  51777. }
  51778. props = extend(extend({}, bindObject), props);
  51779. }
  51780. nodes = scopedSlotFn(props) || fallback;
  51781. } else {
  51782. nodes = this.$slots[name] || fallback;
  51783. }
  51784. var target = props && props.slot;
  51785. if (target) {
  51786. return this.$createElement('template', { slot: target }, nodes)
  51787. } else {
  51788. return nodes
  51789. }
  51790. }
  51791. /* */
  51792. /**
  51793. * Runtime helper for resolving filters
  51794. */
  51795. function resolveFilter (id) {
  51796. return resolveAsset(this.$options, 'filters', id, true) || identity
  51797. }
  51798. /* */
  51799. function isKeyNotMatch (expect, actual) {
  51800. if (Array.isArray(expect)) {
  51801. return expect.indexOf(actual) === -1
  51802. } else {
  51803. return expect !== actual
  51804. }
  51805. }
  51806. /**
  51807. * Runtime helper for checking keyCodes from config.
  51808. * exposed as Vue.prototype._k
  51809. * passing in eventKeyName as last argument separately for backwards compat
  51810. */
  51811. function checkKeyCodes (
  51812. eventKeyCode,
  51813. key,
  51814. builtInKeyCode,
  51815. eventKeyName,
  51816. builtInKeyName
  51817. ) {
  51818. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  51819. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  51820. return isKeyNotMatch(builtInKeyName, eventKeyName)
  51821. } else if (mappedKeyCode) {
  51822. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  51823. } else if (eventKeyName) {
  51824. return hyphenate(eventKeyName) !== key
  51825. }
  51826. }
  51827. /* */
  51828. /**
  51829. * Runtime helper for merging v-bind="object" into a VNode's data.
  51830. */
  51831. function bindObjectProps (
  51832. data,
  51833. tag,
  51834. value,
  51835. asProp,
  51836. isSync
  51837. ) {
  51838. if (value) {
  51839. if (!isObject(value)) {
  51840. warn(
  51841. 'v-bind without argument expects an Object or Array value',
  51842. this
  51843. );
  51844. } else {
  51845. if (Array.isArray(value)) {
  51846. value = toObject(value);
  51847. }
  51848. var hash;
  51849. var loop = function ( key ) {
  51850. if (
  51851. key === 'class' ||
  51852. key === 'style' ||
  51853. isReservedAttribute(key)
  51854. ) {
  51855. hash = data;
  51856. } else {
  51857. var type = data.attrs && data.attrs.type;
  51858. hash = asProp || config.mustUseProp(tag, type, key)
  51859. ? data.domProps || (data.domProps = {})
  51860. : data.attrs || (data.attrs = {});
  51861. }
  51862. var camelizedKey = camelize(key);
  51863. var hyphenatedKey = hyphenate(key);
  51864. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  51865. hash[key] = value[key];
  51866. if (isSync) {
  51867. var on = data.on || (data.on = {});
  51868. on[("update:" + key)] = function ($event) {
  51869. value[key] = $event;
  51870. };
  51871. }
  51872. }
  51873. };
  51874. for (var key in value) loop( key );
  51875. }
  51876. }
  51877. return data
  51878. }
  51879. /* */
  51880. /**
  51881. * Runtime helper for rendering static trees.
  51882. */
  51883. function renderStatic (
  51884. index,
  51885. isInFor
  51886. ) {
  51887. var cached = this._staticTrees || (this._staticTrees = []);
  51888. var tree = cached[index];
  51889. // if has already-rendered static tree and not inside v-for,
  51890. // we can reuse the same tree.
  51891. if (tree && !isInFor) {
  51892. return tree
  51893. }
  51894. // otherwise, render a fresh tree.
  51895. tree = cached[index] = this.$options.staticRenderFns[index].call(
  51896. this._renderProxy,
  51897. null,
  51898. this // for render fns generated for functional component templates
  51899. );
  51900. markStatic(tree, ("__static__" + index), false);
  51901. return tree
  51902. }
  51903. /**
  51904. * Runtime helper for v-once.
  51905. * Effectively it means marking the node as static with a unique key.
  51906. */
  51907. function markOnce (
  51908. tree,
  51909. index,
  51910. key
  51911. ) {
  51912. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  51913. return tree
  51914. }
  51915. function markStatic (
  51916. tree,
  51917. key,
  51918. isOnce
  51919. ) {
  51920. if (Array.isArray(tree)) {
  51921. for (var i = 0; i < tree.length; i++) {
  51922. if (tree[i] && typeof tree[i] !== 'string') {
  51923. markStaticNode(tree[i], (key + "_" + i), isOnce);
  51924. }
  51925. }
  51926. } else {
  51927. markStaticNode(tree, key, isOnce);
  51928. }
  51929. }
  51930. function markStaticNode (node, key, isOnce) {
  51931. node.isStatic = true;
  51932. node.key = key;
  51933. node.isOnce = isOnce;
  51934. }
  51935. /* */
  51936. function bindObjectListeners (data, value) {
  51937. if (value) {
  51938. if (!isPlainObject(value)) {
  51939. warn(
  51940. 'v-on without argument expects an Object value',
  51941. this
  51942. );
  51943. } else {
  51944. var on = data.on = data.on ? extend({}, data.on) : {};
  51945. for (var key in value) {
  51946. var existing = on[key];
  51947. var ours = value[key];
  51948. on[key] = existing ? [].concat(existing, ours) : ours;
  51949. }
  51950. }
  51951. }
  51952. return data
  51953. }
  51954. /* */
  51955. function resolveScopedSlots (
  51956. fns, // see flow/vnode
  51957. res,
  51958. // the following are added in 2.6
  51959. hasDynamicKeys,
  51960. contentHashKey
  51961. ) {
  51962. res = res || { $stable: !hasDynamicKeys };
  51963. for (var i = 0; i < fns.length; i++) {
  51964. var slot = fns[i];
  51965. if (Array.isArray(slot)) {
  51966. resolveScopedSlots(slot, res, hasDynamicKeys);
  51967. } else if (slot) {
  51968. // marker for reverse proxying v-slot without scope on this.$slots
  51969. if (slot.proxy) {
  51970. slot.fn.proxy = true;
  51971. }
  51972. res[slot.key] = slot.fn;
  51973. }
  51974. }
  51975. if (contentHashKey) {
  51976. (res).$key = contentHashKey;
  51977. }
  51978. return res
  51979. }
  51980. /* */
  51981. function bindDynamicKeys (baseObj, values) {
  51982. for (var i = 0; i < values.length; i += 2) {
  51983. var key = values[i];
  51984. if (typeof key === 'string' && key) {
  51985. baseObj[values[i]] = values[i + 1];
  51986. } else if (key !== '' && key !== null) {
  51987. // null is a special value for explicitly removing a binding
  51988. warn(
  51989. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  51990. this
  51991. );
  51992. }
  51993. }
  51994. return baseObj
  51995. }
  51996. // helper to dynamically append modifier runtime markers to event names.
  51997. // ensure only append when value is already string, otherwise it will be cast
  51998. // to string and cause the type check to miss.
  51999. function prependModifier (value, symbol) {
  52000. return typeof value === 'string' ? symbol + value : value
  52001. }
  52002. /* */
  52003. function installRenderHelpers (target) {
  52004. target._o = markOnce;
  52005. target._n = toNumber;
  52006. target._s = toString;
  52007. target._l = renderList;
  52008. target._t = renderSlot;
  52009. target._q = looseEqual;
  52010. target._i = looseIndexOf;
  52011. target._m = renderStatic;
  52012. target._f = resolveFilter;
  52013. target._k = checkKeyCodes;
  52014. target._b = bindObjectProps;
  52015. target._v = createTextVNode;
  52016. target._e = createEmptyVNode;
  52017. target._u = resolveScopedSlots;
  52018. target._g = bindObjectListeners;
  52019. target._d = bindDynamicKeys;
  52020. target._p = prependModifier;
  52021. }
  52022. /* */
  52023. function FunctionalRenderContext (
  52024. data,
  52025. props,
  52026. children,
  52027. parent,
  52028. Ctor
  52029. ) {
  52030. var this$1 = this;
  52031. var options = Ctor.options;
  52032. // ensure the createElement function in functional components
  52033. // gets a unique context - this is necessary for correct named slot check
  52034. var contextVm;
  52035. if (hasOwn(parent, '_uid')) {
  52036. contextVm = Object.create(parent);
  52037. // $flow-disable-line
  52038. contextVm._original = parent;
  52039. } else {
  52040. // the context vm passed in is a functional context as well.
  52041. // in this case we want to make sure we are able to get a hold to the
  52042. // real context instance.
  52043. contextVm = parent;
  52044. // $flow-disable-line
  52045. parent = parent._original;
  52046. }
  52047. var isCompiled = isTrue(options._compiled);
  52048. var needNormalization = !isCompiled;
  52049. this.data = data;
  52050. this.props = props;
  52051. this.children = children;
  52052. this.parent = parent;
  52053. this.listeners = data.on || emptyObject;
  52054. this.injections = resolveInject(options.inject, parent);
  52055. this.slots = function () {
  52056. if (!this$1.$slots) {
  52057. normalizeScopedSlots(
  52058. data.scopedSlots,
  52059. this$1.$slots = resolveSlots(children, parent)
  52060. );
  52061. }
  52062. return this$1.$slots
  52063. };
  52064. Object.defineProperty(this, 'scopedSlots', ({
  52065. enumerable: true,
  52066. get: function get () {
  52067. return normalizeScopedSlots(data.scopedSlots, this.slots())
  52068. }
  52069. }));
  52070. // support for compiled functional template
  52071. if (isCompiled) {
  52072. // exposing $options for renderStatic()
  52073. this.$options = options;
  52074. // pre-resolve slots for renderSlot()
  52075. this.$slots = this.slots();
  52076. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  52077. }
  52078. if (options._scopeId) {
  52079. this._c = function (a, b, c, d) {
  52080. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  52081. if (vnode && !Array.isArray(vnode)) {
  52082. vnode.fnScopeId = options._scopeId;
  52083. vnode.fnContext = parent;
  52084. }
  52085. return vnode
  52086. };
  52087. } else {
  52088. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  52089. }
  52090. }
  52091. installRenderHelpers(FunctionalRenderContext.prototype);
  52092. function createFunctionalComponent (
  52093. Ctor,
  52094. propsData,
  52095. data,
  52096. contextVm,
  52097. children
  52098. ) {
  52099. var options = Ctor.options;
  52100. var props = {};
  52101. var propOptions = options.props;
  52102. if (isDef(propOptions)) {
  52103. for (var key in propOptions) {
  52104. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  52105. }
  52106. } else {
  52107. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  52108. if (isDef(data.props)) { mergeProps(props, data.props); }
  52109. }
  52110. var renderContext = new FunctionalRenderContext(
  52111. data,
  52112. props,
  52113. children,
  52114. contextVm,
  52115. Ctor
  52116. );
  52117. var vnode = options.render.call(null, renderContext._c, renderContext);
  52118. if (vnode instanceof VNode) {
  52119. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  52120. } else if (Array.isArray(vnode)) {
  52121. var vnodes = normalizeChildren(vnode) || [];
  52122. var res = new Array(vnodes.length);
  52123. for (var i = 0; i < vnodes.length; i++) {
  52124. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  52125. }
  52126. return res
  52127. }
  52128. }
  52129. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  52130. // #7817 clone node before setting fnContext, otherwise if the node is reused
  52131. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  52132. // that should not be matched to match.
  52133. var clone = cloneVNode(vnode);
  52134. clone.fnContext = contextVm;
  52135. clone.fnOptions = options;
  52136. {
  52137. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  52138. }
  52139. if (data.slot) {
  52140. (clone.data || (clone.data = {})).slot = data.slot;
  52141. }
  52142. return clone
  52143. }
  52144. function mergeProps (to, from) {
  52145. for (var key in from) {
  52146. to[camelize(key)] = from[key];
  52147. }
  52148. }
  52149. /* */
  52150. /* */
  52151. /* */
  52152. /* */
  52153. // inline hooks to be invoked on component VNodes during patch
  52154. var componentVNodeHooks = {
  52155. init: function init (vnode, hydrating) {
  52156. if (
  52157. vnode.componentInstance &&
  52158. !vnode.componentInstance._isDestroyed &&
  52159. vnode.data.keepAlive
  52160. ) {
  52161. // kept-alive components, treat as a patch
  52162. var mountedNode = vnode; // work around flow
  52163. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  52164. } else {
  52165. var child = vnode.componentInstance = createComponentInstanceForVnode(
  52166. vnode,
  52167. activeInstance
  52168. );
  52169. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  52170. }
  52171. },
  52172. prepatch: function prepatch (oldVnode, vnode) {
  52173. var options = vnode.componentOptions;
  52174. var child = vnode.componentInstance = oldVnode.componentInstance;
  52175. updateChildComponent(
  52176. child,
  52177. options.propsData, // updated props
  52178. options.listeners, // updated listeners
  52179. vnode, // new parent vnode
  52180. options.children // new children
  52181. );
  52182. },
  52183. insert: function insert (vnode) {
  52184. var context = vnode.context;
  52185. var componentInstance = vnode.componentInstance;
  52186. if (!componentInstance._isMounted) {
  52187. componentInstance._isMounted = true;
  52188. callHook(componentInstance, 'mounted');
  52189. }
  52190. if (vnode.data.keepAlive) {
  52191. if (context._isMounted) {
  52192. // vue-router#1212
  52193. // During updates, a kept-alive component's child components may
  52194. // change, so directly walking the tree here may call activated hooks
  52195. // on incorrect children. Instead we push them into a queue which will
  52196. // be processed after the whole patch process ended.
  52197. queueActivatedComponent(componentInstance);
  52198. } else {
  52199. activateChildComponent(componentInstance, true /* direct */);
  52200. }
  52201. }
  52202. },
  52203. destroy: function destroy (vnode) {
  52204. var componentInstance = vnode.componentInstance;
  52205. if (!componentInstance._isDestroyed) {
  52206. if (!vnode.data.keepAlive) {
  52207. componentInstance.$destroy();
  52208. } else {
  52209. deactivateChildComponent(componentInstance, true /* direct */);
  52210. }
  52211. }
  52212. }
  52213. };
  52214. var hooksToMerge = Object.keys(componentVNodeHooks);
  52215. function createComponent (
  52216. Ctor,
  52217. data,
  52218. context,
  52219. children,
  52220. tag
  52221. ) {
  52222. if (isUndef(Ctor)) {
  52223. return
  52224. }
  52225. var baseCtor = context.$options._base;
  52226. // plain options object: turn it into a constructor
  52227. if (isObject(Ctor)) {
  52228. Ctor = baseCtor.extend(Ctor);
  52229. }
  52230. // if at this stage it's not a constructor or an async component factory,
  52231. // reject.
  52232. if (typeof Ctor !== 'function') {
  52233. {
  52234. warn(("Invalid Component definition: " + (String(Ctor))), context);
  52235. }
  52236. return
  52237. }
  52238. // async component
  52239. var asyncFactory;
  52240. if (isUndef(Ctor.cid)) {
  52241. asyncFactory = Ctor;
  52242. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  52243. if (Ctor === undefined) {
  52244. // return a placeholder node for async component, which is rendered
  52245. // as a comment node but preserves all the raw information for the node.
  52246. // the information will be used for async server-rendering and hydration.
  52247. return createAsyncPlaceholder(
  52248. asyncFactory,
  52249. data,
  52250. context,
  52251. children,
  52252. tag
  52253. )
  52254. }
  52255. }
  52256. data = data || {};
  52257. // resolve constructor options in case global mixins are applied after
  52258. // component constructor creation
  52259. resolveConstructorOptions(Ctor);
  52260. // transform component v-model data into props & events
  52261. if (isDef(data.model)) {
  52262. transformModel(Ctor.options, data);
  52263. }
  52264. // extract props
  52265. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  52266. // functional component
  52267. if (isTrue(Ctor.options.functional)) {
  52268. return createFunctionalComponent(Ctor, propsData, data, context, children)
  52269. }
  52270. // extract listeners, since these needs to be treated as
  52271. // child component listeners instead of DOM listeners
  52272. var listeners = data.on;
  52273. // replace with listeners with .native modifier
  52274. // so it gets processed during parent component patch.
  52275. data.on = data.nativeOn;
  52276. if (isTrue(Ctor.options.abstract)) {
  52277. // abstract components do not keep anything
  52278. // other than props & listeners & slot
  52279. // work around flow
  52280. var slot = data.slot;
  52281. data = {};
  52282. if (slot) {
  52283. data.slot = slot;
  52284. }
  52285. }
  52286. // install component management hooks onto the placeholder node
  52287. installComponentHooks(data);
  52288. // return a placeholder vnode
  52289. var name = Ctor.options.name || tag;
  52290. var vnode = new VNode(
  52291. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  52292. data, undefined, undefined, undefined, context,
  52293. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  52294. asyncFactory
  52295. );
  52296. return vnode
  52297. }
  52298. function createComponentInstanceForVnode (
  52299. vnode, // we know it's MountedComponentVNode but flow doesn't
  52300. parent // activeInstance in lifecycle state
  52301. ) {
  52302. var options = {
  52303. _isComponent: true,
  52304. _parentVnode: vnode,
  52305. parent: parent
  52306. };
  52307. // check inline-template render functions
  52308. var inlineTemplate = vnode.data.inlineTemplate;
  52309. if (isDef(inlineTemplate)) {
  52310. options.render = inlineTemplate.render;
  52311. options.staticRenderFns = inlineTemplate.staticRenderFns;
  52312. }
  52313. return new vnode.componentOptions.Ctor(options)
  52314. }
  52315. function installComponentHooks (data) {
  52316. var hooks = data.hook || (data.hook = {});
  52317. for (var i = 0; i < hooksToMerge.length; i++) {
  52318. var key = hooksToMerge[i];
  52319. var existing = hooks[key];
  52320. var toMerge = componentVNodeHooks[key];
  52321. if (existing !== toMerge && !(existing && existing._merged)) {
  52322. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  52323. }
  52324. }
  52325. }
  52326. function mergeHook$1 (f1, f2) {
  52327. var merged = function (a, b) {
  52328. // flow complains about extra args which is why we use any
  52329. f1(a, b);
  52330. f2(a, b);
  52331. };
  52332. merged._merged = true;
  52333. return merged
  52334. }
  52335. // transform component v-model info (value and callback) into
  52336. // prop and event handler respectively.
  52337. function transformModel (options, data) {
  52338. var prop = (options.model && options.model.prop) || 'value';
  52339. var event = (options.model && options.model.event) || 'input'
  52340. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  52341. var on = data.on || (data.on = {});
  52342. var existing = on[event];
  52343. var callback = data.model.callback;
  52344. if (isDef(existing)) {
  52345. if (
  52346. Array.isArray(existing)
  52347. ? existing.indexOf(callback) === -1
  52348. : existing !== callback
  52349. ) {
  52350. on[event] = [callback].concat(existing);
  52351. }
  52352. } else {
  52353. on[event] = callback;
  52354. }
  52355. }
  52356. /* */
  52357. var SIMPLE_NORMALIZE = 1;
  52358. var ALWAYS_NORMALIZE = 2;
  52359. // wrapper function for providing a more flexible interface
  52360. // without getting yelled at by flow
  52361. function createElement (
  52362. context,
  52363. tag,
  52364. data,
  52365. children,
  52366. normalizationType,
  52367. alwaysNormalize
  52368. ) {
  52369. if (Array.isArray(data) || isPrimitive(data)) {
  52370. normalizationType = children;
  52371. children = data;
  52372. data = undefined;
  52373. }
  52374. if (isTrue(alwaysNormalize)) {
  52375. normalizationType = ALWAYS_NORMALIZE;
  52376. }
  52377. return _createElement(context, tag, data, children, normalizationType)
  52378. }
  52379. function _createElement (
  52380. context,
  52381. tag,
  52382. data,
  52383. children,
  52384. normalizationType
  52385. ) {
  52386. if (isDef(data) && isDef((data).__ob__)) {
  52387. warn(
  52388. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  52389. 'Always create fresh vnode data objects in each render!',
  52390. context
  52391. );
  52392. return createEmptyVNode()
  52393. }
  52394. // object syntax in v-bind
  52395. if (isDef(data) && isDef(data.is)) {
  52396. tag = data.is;
  52397. }
  52398. if (!tag) {
  52399. // in case of component :is set to falsy value
  52400. return createEmptyVNode()
  52401. }
  52402. // warn against non-primitive key
  52403. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  52404. ) {
  52405. {
  52406. warn(
  52407. 'Avoid using non-primitive value as key, ' +
  52408. 'use string/number value instead.',
  52409. context
  52410. );
  52411. }
  52412. }
  52413. // support single function children as default scoped slot
  52414. if (Array.isArray(children) &&
  52415. typeof children[0] === 'function'
  52416. ) {
  52417. data = data || {};
  52418. data.scopedSlots = { default: children[0] };
  52419. children.length = 0;
  52420. }
  52421. if (normalizationType === ALWAYS_NORMALIZE) {
  52422. children = normalizeChildren(children);
  52423. } else if (normalizationType === SIMPLE_NORMALIZE) {
  52424. children = simpleNormalizeChildren(children);
  52425. }
  52426. var vnode, ns;
  52427. if (typeof tag === 'string') {
  52428. var Ctor;
  52429. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  52430. if (config.isReservedTag(tag)) {
  52431. // platform built-in elements
  52432. if (isDef(data) && isDef(data.nativeOn)) {
  52433. warn(
  52434. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  52435. context
  52436. );
  52437. }
  52438. vnode = new VNode(
  52439. config.parsePlatformTagName(tag), data, children,
  52440. undefined, undefined, context
  52441. );
  52442. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  52443. // component
  52444. vnode = createComponent(Ctor, data, context, children, tag);
  52445. } else {
  52446. // unknown or unlisted namespaced elements
  52447. // check at runtime because it may get assigned a namespace when its
  52448. // parent normalizes children
  52449. vnode = new VNode(
  52450. tag, data, children,
  52451. undefined, undefined, context
  52452. );
  52453. }
  52454. } else {
  52455. // direct component options / constructor
  52456. vnode = createComponent(tag, data, context, children);
  52457. }
  52458. if (Array.isArray(vnode)) {
  52459. return vnode
  52460. } else if (isDef(vnode)) {
  52461. if (isDef(ns)) { applyNS(vnode, ns); }
  52462. if (isDef(data)) { registerDeepBindings(data); }
  52463. return vnode
  52464. } else {
  52465. return createEmptyVNode()
  52466. }
  52467. }
  52468. function applyNS (vnode, ns, force) {
  52469. vnode.ns = ns;
  52470. if (vnode.tag === 'foreignObject') {
  52471. // use default namespace inside foreignObject
  52472. ns = undefined;
  52473. force = true;
  52474. }
  52475. if (isDef(vnode.children)) {
  52476. for (var i = 0, l = vnode.children.length; i < l; i++) {
  52477. var child = vnode.children[i];
  52478. if (isDef(child.tag) && (
  52479. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  52480. applyNS(child, ns, force);
  52481. }
  52482. }
  52483. }
  52484. }
  52485. // ref #5318
  52486. // necessary to ensure parent re-render when deep bindings like :style and
  52487. // :class are used on slot nodes
  52488. function registerDeepBindings (data) {
  52489. if (isObject(data.style)) {
  52490. traverse(data.style);
  52491. }
  52492. if (isObject(data.class)) {
  52493. traverse(data.class);
  52494. }
  52495. }
  52496. /* */
  52497. function initRender (vm) {
  52498. vm._vnode = null; // the root of the child tree
  52499. vm._staticTrees = null; // v-once cached trees
  52500. var options = vm.$options;
  52501. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  52502. var renderContext = parentVnode && parentVnode.context;
  52503. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  52504. vm.$scopedSlots = emptyObject;
  52505. // bind the createElement fn to this instance
  52506. // so that we get proper render context inside it.
  52507. // args order: tag, data, children, normalizationType, alwaysNormalize
  52508. // internal version is used by render functions compiled from templates
  52509. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  52510. // normalization is always applied for the public version, used in
  52511. // user-written render functions.
  52512. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  52513. // $attrs & $listeners are exposed for easier HOC creation.
  52514. // they need to be reactive so that HOCs using them are always updated
  52515. var parentData = parentVnode && parentVnode.data;
  52516. /* istanbul ignore else */
  52517. {
  52518. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  52519. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  52520. }, true);
  52521. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  52522. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  52523. }, true);
  52524. }
  52525. }
  52526. var currentRenderingInstance = null;
  52527. function renderMixin (Vue) {
  52528. // install runtime convenience helpers
  52529. installRenderHelpers(Vue.prototype);
  52530. Vue.prototype.$nextTick = function (fn) {
  52531. return nextTick(fn, this)
  52532. };
  52533. Vue.prototype._render = function () {
  52534. var vm = this;
  52535. var ref = vm.$options;
  52536. var render = ref.render;
  52537. var _parentVnode = ref._parentVnode;
  52538. if (_parentVnode) {
  52539. vm.$scopedSlots = normalizeScopedSlots(
  52540. _parentVnode.data.scopedSlots,
  52541. vm.$slots,
  52542. vm.$scopedSlots
  52543. );
  52544. }
  52545. // set parent vnode. this allows render functions to have access
  52546. // to the data on the placeholder node.
  52547. vm.$vnode = _parentVnode;
  52548. // render self
  52549. var vnode;
  52550. try {
  52551. // There's no need to maintain a stack because all render fns are called
  52552. // separately from one another. Nested component's render fns are called
  52553. // when parent component is patched.
  52554. currentRenderingInstance = vm;
  52555. vnode = render.call(vm._renderProxy, vm.$createElement);
  52556. } catch (e) {
  52557. handleError(e, vm, "render");
  52558. // return error render result,
  52559. // or previous vnode to prevent render error causing blank component
  52560. /* istanbul ignore else */
  52561. if (vm.$options.renderError) {
  52562. try {
  52563. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  52564. } catch (e) {
  52565. handleError(e, vm, "renderError");
  52566. vnode = vm._vnode;
  52567. }
  52568. } else {
  52569. vnode = vm._vnode;
  52570. }
  52571. } finally {
  52572. currentRenderingInstance = null;
  52573. }
  52574. // if the returned array contains only a single node, allow it
  52575. if (Array.isArray(vnode) && vnode.length === 1) {
  52576. vnode = vnode[0];
  52577. }
  52578. // return empty vnode in case the render function errored out
  52579. if (!(vnode instanceof VNode)) {
  52580. if (Array.isArray(vnode)) {
  52581. warn(
  52582. 'Multiple root nodes returned from render function. Render function ' +
  52583. 'should return a single root node.',
  52584. vm
  52585. );
  52586. }
  52587. vnode = createEmptyVNode();
  52588. }
  52589. // set parent
  52590. vnode.parent = _parentVnode;
  52591. return vnode
  52592. };
  52593. }
  52594. /* */
  52595. function ensureCtor (comp, base) {
  52596. if (
  52597. comp.__esModule ||
  52598. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  52599. ) {
  52600. comp = comp.default;
  52601. }
  52602. return isObject(comp)
  52603. ? base.extend(comp)
  52604. : comp
  52605. }
  52606. function createAsyncPlaceholder (
  52607. factory,
  52608. data,
  52609. context,
  52610. children,
  52611. tag
  52612. ) {
  52613. var node = createEmptyVNode();
  52614. node.asyncFactory = factory;
  52615. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  52616. return node
  52617. }
  52618. function resolveAsyncComponent (
  52619. factory,
  52620. baseCtor
  52621. ) {
  52622. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  52623. return factory.errorComp
  52624. }
  52625. if (isDef(factory.resolved)) {
  52626. return factory.resolved
  52627. }
  52628. var owner = currentRenderingInstance;
  52629. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  52630. // already pending
  52631. factory.owners.push(owner);
  52632. }
  52633. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  52634. return factory.loadingComp
  52635. }
  52636. if (owner && !isDef(factory.owners)) {
  52637. var owners = factory.owners = [owner];
  52638. var sync = true;
  52639. var timerLoading = null;
  52640. var timerTimeout = null
  52641. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  52642. var forceRender = function (renderCompleted) {
  52643. for (var i = 0, l = owners.length; i < l; i++) {
  52644. (owners[i]).$forceUpdate();
  52645. }
  52646. if (renderCompleted) {
  52647. owners.length = 0;
  52648. if (timerLoading !== null) {
  52649. clearTimeout(timerLoading);
  52650. timerLoading = null;
  52651. }
  52652. if (timerTimeout !== null) {
  52653. clearTimeout(timerTimeout);
  52654. timerTimeout = null;
  52655. }
  52656. }
  52657. };
  52658. var resolve = once(function (res) {
  52659. // cache resolved
  52660. factory.resolved = ensureCtor(res, baseCtor);
  52661. // invoke callbacks only if this is not a synchronous resolve
  52662. // (async resolves are shimmed as synchronous during SSR)
  52663. if (!sync) {
  52664. forceRender(true);
  52665. } else {
  52666. owners.length = 0;
  52667. }
  52668. });
  52669. var reject = once(function (reason) {
  52670. warn(
  52671. "Failed to resolve async component: " + (String(factory)) +
  52672. (reason ? ("\nReason: " + reason) : '')
  52673. );
  52674. if (isDef(factory.errorComp)) {
  52675. factory.error = true;
  52676. forceRender(true);
  52677. }
  52678. });
  52679. var res = factory(resolve, reject);
  52680. if (isObject(res)) {
  52681. if (isPromise(res)) {
  52682. // () => Promise
  52683. if (isUndef(factory.resolved)) {
  52684. res.then(resolve, reject);
  52685. }
  52686. } else if (isPromise(res.component)) {
  52687. res.component.then(resolve, reject);
  52688. if (isDef(res.error)) {
  52689. factory.errorComp = ensureCtor(res.error, baseCtor);
  52690. }
  52691. if (isDef(res.loading)) {
  52692. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  52693. if (res.delay === 0) {
  52694. factory.loading = true;
  52695. } else {
  52696. timerLoading = setTimeout(function () {
  52697. timerLoading = null;
  52698. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  52699. factory.loading = true;
  52700. forceRender(false);
  52701. }
  52702. }, res.delay || 200);
  52703. }
  52704. }
  52705. if (isDef(res.timeout)) {
  52706. timerTimeout = setTimeout(function () {
  52707. timerTimeout = null;
  52708. if (isUndef(factory.resolved)) {
  52709. reject(
  52710. "timeout (" + (res.timeout) + "ms)"
  52711. );
  52712. }
  52713. }, res.timeout);
  52714. }
  52715. }
  52716. }
  52717. sync = false;
  52718. // return in case resolved synchronously
  52719. return factory.loading
  52720. ? factory.loadingComp
  52721. : factory.resolved
  52722. }
  52723. }
  52724. /* */
  52725. function isAsyncPlaceholder (node) {
  52726. return node.isComment && node.asyncFactory
  52727. }
  52728. /* */
  52729. function getFirstComponentChild (children) {
  52730. if (Array.isArray(children)) {
  52731. for (var i = 0; i < children.length; i++) {
  52732. var c = children[i];
  52733. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  52734. return c
  52735. }
  52736. }
  52737. }
  52738. }
  52739. /* */
  52740. /* */
  52741. function initEvents (vm) {
  52742. vm._events = Object.create(null);
  52743. vm._hasHookEvent = false;
  52744. // init parent attached events
  52745. var listeners = vm.$options._parentListeners;
  52746. if (listeners) {
  52747. updateComponentListeners(vm, listeners);
  52748. }
  52749. }
  52750. var target;
  52751. function add (event, fn) {
  52752. target.$on(event, fn);
  52753. }
  52754. function remove$1 (event, fn) {
  52755. target.$off(event, fn);
  52756. }
  52757. function createOnceHandler (event, fn) {
  52758. var _target = target;
  52759. return function onceHandler () {
  52760. var res = fn.apply(null, arguments);
  52761. if (res !== null) {
  52762. _target.$off(event, onceHandler);
  52763. }
  52764. }
  52765. }
  52766. function updateComponentListeners (
  52767. vm,
  52768. listeners,
  52769. oldListeners
  52770. ) {
  52771. target = vm;
  52772. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  52773. target = undefined;
  52774. }
  52775. function eventsMixin (Vue) {
  52776. var hookRE = /^hook:/;
  52777. Vue.prototype.$on = function (event, fn) {
  52778. var vm = this;
  52779. if (Array.isArray(event)) {
  52780. for (var i = 0, l = event.length; i < l; i++) {
  52781. vm.$on(event[i], fn);
  52782. }
  52783. } else {
  52784. (vm._events[event] || (vm._events[event] = [])).push(fn);
  52785. // optimize hook:event cost by using a boolean flag marked at registration
  52786. // instead of a hash lookup
  52787. if (hookRE.test(event)) {
  52788. vm._hasHookEvent = true;
  52789. }
  52790. }
  52791. return vm
  52792. };
  52793. Vue.prototype.$once = function (event, fn) {
  52794. var vm = this;
  52795. function on () {
  52796. vm.$off(event, on);
  52797. fn.apply(vm, arguments);
  52798. }
  52799. on.fn = fn;
  52800. vm.$on(event, on);
  52801. return vm
  52802. };
  52803. Vue.prototype.$off = function (event, fn) {
  52804. var vm = this;
  52805. // all
  52806. if (!arguments.length) {
  52807. vm._events = Object.create(null);
  52808. return vm
  52809. }
  52810. // array of events
  52811. if (Array.isArray(event)) {
  52812. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  52813. vm.$off(event[i$1], fn);
  52814. }
  52815. return vm
  52816. }
  52817. // specific event
  52818. var cbs = vm._events[event];
  52819. if (!cbs) {
  52820. return vm
  52821. }
  52822. if (!fn) {
  52823. vm._events[event] = null;
  52824. return vm
  52825. }
  52826. // specific handler
  52827. var cb;
  52828. var i = cbs.length;
  52829. while (i--) {
  52830. cb = cbs[i];
  52831. if (cb === fn || cb.fn === fn) {
  52832. cbs.splice(i, 1);
  52833. break
  52834. }
  52835. }
  52836. return vm
  52837. };
  52838. Vue.prototype.$emit = function (event) {
  52839. var vm = this;
  52840. {
  52841. var lowerCaseEvent = event.toLowerCase();
  52842. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  52843. tip(
  52844. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  52845. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  52846. "Note that HTML attributes are case-insensitive and you cannot use " +
  52847. "v-on to listen to camelCase events when using in-DOM templates. " +
  52848. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  52849. );
  52850. }
  52851. }
  52852. var cbs = vm._events[event];
  52853. if (cbs) {
  52854. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  52855. var args = toArray(arguments, 1);
  52856. var info = "event handler for \"" + event + "\"";
  52857. for (var i = 0, l = cbs.length; i < l; i++) {
  52858. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  52859. }
  52860. }
  52861. return vm
  52862. };
  52863. }
  52864. /* */
  52865. var activeInstance = null;
  52866. var isUpdatingChildComponent = false;
  52867. function setActiveInstance(vm) {
  52868. var prevActiveInstance = activeInstance;
  52869. activeInstance = vm;
  52870. return function () {
  52871. activeInstance = prevActiveInstance;
  52872. }
  52873. }
  52874. function initLifecycle (vm) {
  52875. var options = vm.$options;
  52876. // locate first non-abstract parent
  52877. var parent = options.parent;
  52878. if (parent && !options.abstract) {
  52879. while (parent.$options.abstract && parent.$parent) {
  52880. parent = parent.$parent;
  52881. }
  52882. parent.$children.push(vm);
  52883. }
  52884. vm.$parent = parent;
  52885. vm.$root = parent ? parent.$root : vm;
  52886. vm.$children = [];
  52887. vm.$refs = {};
  52888. vm._watcher = null;
  52889. vm._inactive = null;
  52890. vm._directInactive = false;
  52891. vm._isMounted = false;
  52892. vm._isDestroyed = false;
  52893. vm._isBeingDestroyed = false;
  52894. }
  52895. function lifecycleMixin (Vue) {
  52896. Vue.prototype._update = function (vnode, hydrating) {
  52897. var vm = this;
  52898. var prevEl = vm.$el;
  52899. var prevVnode = vm._vnode;
  52900. var restoreActiveInstance = setActiveInstance(vm);
  52901. vm._vnode = vnode;
  52902. // Vue.prototype.__patch__ is injected in entry points
  52903. // based on the rendering backend used.
  52904. if (!prevVnode) {
  52905. // initial render
  52906. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  52907. } else {
  52908. // updates
  52909. vm.$el = vm.__patch__(prevVnode, vnode);
  52910. }
  52911. restoreActiveInstance();
  52912. // update __vue__ reference
  52913. if (prevEl) {
  52914. prevEl.__vue__ = null;
  52915. }
  52916. if (vm.$el) {
  52917. vm.$el.__vue__ = vm;
  52918. }
  52919. // if parent is an HOC, update its $el as well
  52920. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  52921. vm.$parent.$el = vm.$el;
  52922. }
  52923. // updated hook is called by the scheduler to ensure that children are
  52924. // updated in a parent's updated hook.
  52925. };
  52926. Vue.prototype.$forceUpdate = function () {
  52927. var vm = this;
  52928. if (vm._watcher) {
  52929. vm._watcher.update();
  52930. }
  52931. };
  52932. Vue.prototype.$destroy = function () {
  52933. var vm = this;
  52934. if (vm._isBeingDestroyed) {
  52935. return
  52936. }
  52937. callHook(vm, 'beforeDestroy');
  52938. vm._isBeingDestroyed = true;
  52939. // remove self from parent
  52940. var parent = vm.$parent;
  52941. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  52942. remove(parent.$children, vm);
  52943. }
  52944. // teardown watchers
  52945. if (vm._watcher) {
  52946. vm._watcher.teardown();
  52947. }
  52948. var i = vm._watchers.length;
  52949. while (i--) {
  52950. vm._watchers[i].teardown();
  52951. }
  52952. // remove reference from data ob
  52953. // frozen object may not have observer.
  52954. if (vm._data.__ob__) {
  52955. vm._data.__ob__.vmCount--;
  52956. }
  52957. // call the last hook...
  52958. vm._isDestroyed = true;
  52959. // invoke destroy hooks on current rendered tree
  52960. vm.__patch__(vm._vnode, null);
  52961. // fire destroyed hook
  52962. callHook(vm, 'destroyed');
  52963. // turn off all instance listeners.
  52964. vm.$off();
  52965. // remove __vue__ reference
  52966. if (vm.$el) {
  52967. vm.$el.__vue__ = null;
  52968. }
  52969. // release circular reference (#6759)
  52970. if (vm.$vnode) {
  52971. vm.$vnode.parent = null;
  52972. }
  52973. };
  52974. }
  52975. function mountComponent (
  52976. vm,
  52977. el,
  52978. hydrating
  52979. ) {
  52980. vm.$el = el;
  52981. if (!vm.$options.render) {
  52982. vm.$options.render = createEmptyVNode;
  52983. {
  52984. /* istanbul ignore if */
  52985. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  52986. vm.$options.el || el) {
  52987. warn(
  52988. 'You are using the runtime-only build of Vue where the template ' +
  52989. 'compiler is not available. Either pre-compile the templates into ' +
  52990. 'render functions, or use the compiler-included build.',
  52991. vm
  52992. );
  52993. } else {
  52994. warn(
  52995. 'Failed to mount component: template or render function not defined.',
  52996. vm
  52997. );
  52998. }
  52999. }
  53000. }
  53001. callHook(vm, 'beforeMount');
  53002. var updateComponent;
  53003. /* istanbul ignore if */
  53004. if (config.performance && mark) {
  53005. updateComponent = function () {
  53006. var name = vm._name;
  53007. var id = vm._uid;
  53008. var startTag = "vue-perf-start:" + id;
  53009. var endTag = "vue-perf-end:" + id;
  53010. mark(startTag);
  53011. var vnode = vm._render();
  53012. mark(endTag);
  53013. measure(("vue " + name + " render"), startTag, endTag);
  53014. mark(startTag);
  53015. vm._update(vnode, hydrating);
  53016. mark(endTag);
  53017. measure(("vue " + name + " patch"), startTag, endTag);
  53018. };
  53019. } else {
  53020. updateComponent = function () {
  53021. vm._update(vm._render(), hydrating);
  53022. };
  53023. }
  53024. // we set this to vm._watcher inside the watcher's constructor
  53025. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  53026. // component's mounted hook), which relies on vm._watcher being already defined
  53027. new Watcher(vm, updateComponent, noop, {
  53028. before: function before () {
  53029. if (vm._isMounted && !vm._isDestroyed) {
  53030. callHook(vm, 'beforeUpdate');
  53031. }
  53032. }
  53033. }, true /* isRenderWatcher */);
  53034. hydrating = false;
  53035. // manually mounted instance, call mounted on self
  53036. // mounted is called for render-created child components in its inserted hook
  53037. if (vm.$vnode == null) {
  53038. vm._isMounted = true;
  53039. callHook(vm, 'mounted');
  53040. }
  53041. return vm
  53042. }
  53043. function updateChildComponent (
  53044. vm,
  53045. propsData,
  53046. listeners,
  53047. parentVnode,
  53048. renderChildren
  53049. ) {
  53050. {
  53051. isUpdatingChildComponent = true;
  53052. }
  53053. // determine whether component has slot children
  53054. // we need to do this before overwriting $options._renderChildren.
  53055. // check if there are dynamic scopedSlots (hand-written or compiled but with
  53056. // dynamic slot names). Static scoped slots compiled from template has the
  53057. // "$stable" marker.
  53058. var newScopedSlots = parentVnode.data.scopedSlots;
  53059. var oldScopedSlots = vm.$scopedSlots;
  53060. var hasDynamicScopedSlot = !!(
  53061. (newScopedSlots && !newScopedSlots.$stable) ||
  53062. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  53063. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  53064. );
  53065. // Any static slot children from the parent may have changed during parent's
  53066. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  53067. // update is necessary to ensure correctness.
  53068. var needsForceUpdate = !!(
  53069. renderChildren || // has new static slots
  53070. vm.$options._renderChildren || // has old static slots
  53071. hasDynamicScopedSlot
  53072. );
  53073. vm.$options._parentVnode = parentVnode;
  53074. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  53075. if (vm._vnode) { // update child tree's parent
  53076. vm._vnode.parent = parentVnode;
  53077. }
  53078. vm.$options._renderChildren = renderChildren;
  53079. // update $attrs and $listeners hash
  53080. // these are also reactive so they may trigger child update if the child
  53081. // used them during render
  53082. vm.$attrs = parentVnode.data.attrs || emptyObject;
  53083. vm.$listeners = listeners || emptyObject;
  53084. // update props
  53085. if (propsData && vm.$options.props) {
  53086. toggleObserving(false);
  53087. var props = vm._props;
  53088. var propKeys = vm.$options._propKeys || [];
  53089. for (var i = 0; i < propKeys.length; i++) {
  53090. var key = propKeys[i];
  53091. var propOptions = vm.$options.props; // wtf flow?
  53092. props[key] = validateProp(key, propOptions, propsData, vm);
  53093. }
  53094. toggleObserving(true);
  53095. // keep a copy of raw propsData
  53096. vm.$options.propsData = propsData;
  53097. }
  53098. // update listeners
  53099. listeners = listeners || emptyObject;
  53100. var oldListeners = vm.$options._parentListeners;
  53101. vm.$options._parentListeners = listeners;
  53102. updateComponentListeners(vm, listeners, oldListeners);
  53103. // resolve slots + force update if has children
  53104. if (needsForceUpdate) {
  53105. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  53106. vm.$forceUpdate();
  53107. }
  53108. {
  53109. isUpdatingChildComponent = false;
  53110. }
  53111. }
  53112. function isInInactiveTree (vm) {
  53113. while (vm && (vm = vm.$parent)) {
  53114. if (vm._inactive) { return true }
  53115. }
  53116. return false
  53117. }
  53118. function activateChildComponent (vm, direct) {
  53119. if (direct) {
  53120. vm._directInactive = false;
  53121. if (isInInactiveTree(vm)) {
  53122. return
  53123. }
  53124. } else if (vm._directInactive) {
  53125. return
  53126. }
  53127. if (vm._inactive || vm._inactive === null) {
  53128. vm._inactive = false;
  53129. for (var i = 0; i < vm.$children.length; i++) {
  53130. activateChildComponent(vm.$children[i]);
  53131. }
  53132. callHook(vm, 'activated');
  53133. }
  53134. }
  53135. function deactivateChildComponent (vm, direct) {
  53136. if (direct) {
  53137. vm._directInactive = true;
  53138. if (isInInactiveTree(vm)) {
  53139. return
  53140. }
  53141. }
  53142. if (!vm._inactive) {
  53143. vm._inactive = true;
  53144. for (var i = 0; i < vm.$children.length; i++) {
  53145. deactivateChildComponent(vm.$children[i]);
  53146. }
  53147. callHook(vm, 'deactivated');
  53148. }
  53149. }
  53150. function callHook (vm, hook) {
  53151. // #7573 disable dep collection when invoking lifecycle hooks
  53152. pushTarget();
  53153. var handlers = vm.$options[hook];
  53154. var info = hook + " hook";
  53155. if (handlers) {
  53156. for (var i = 0, j = handlers.length; i < j; i++) {
  53157. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  53158. }
  53159. }
  53160. if (vm._hasHookEvent) {
  53161. vm.$emit('hook:' + hook);
  53162. }
  53163. popTarget();
  53164. }
  53165. /* */
  53166. var MAX_UPDATE_COUNT = 100;
  53167. var queue = [];
  53168. var activatedChildren = [];
  53169. var has = {};
  53170. var circular = {};
  53171. var waiting = false;
  53172. var flushing = false;
  53173. var index = 0;
  53174. /**
  53175. * Reset the scheduler's state.
  53176. */
  53177. function resetSchedulerState () {
  53178. index = queue.length = activatedChildren.length = 0;
  53179. has = {};
  53180. {
  53181. circular = {};
  53182. }
  53183. waiting = flushing = false;
  53184. }
  53185. // Async edge case #6566 requires saving the timestamp when event listeners are
  53186. // attached. However, calling performance.now() has a perf overhead especially
  53187. // if the page has thousands of event listeners. Instead, we take a timestamp
  53188. // every time the scheduler flushes and use that for all event listeners
  53189. // attached during that flush.
  53190. var currentFlushTimestamp = 0;
  53191. // Async edge case fix requires storing an event listener's attach timestamp.
  53192. var getNow = Date.now;
  53193. // Determine what event timestamp the browser is using. Annoyingly, the
  53194. // timestamp can either be hi-res (relative to page load) or low-res
  53195. // (relative to UNIX epoch), so in order to compare time we have to use the
  53196. // same timestamp type when saving the flush timestamp.
  53197. // All IE versions use low-res event timestamps, and have problematic clock
  53198. // implementations (#9632)
  53199. if (inBrowser && !isIE) {
  53200. var performance = window.performance;
  53201. if (
  53202. performance &&
  53203. typeof performance.now === 'function' &&
  53204. getNow() > document.createEvent('Event').timeStamp
  53205. ) {
  53206. // if the event timestamp, although evaluated AFTER the Date.now(), is
  53207. // smaller than it, it means the event is using a hi-res timestamp,
  53208. // and we need to use the hi-res version for event listener timestamps as
  53209. // well.
  53210. getNow = function () { return performance.now(); };
  53211. }
  53212. }
  53213. /**
  53214. * Flush both queues and run the watchers.
  53215. */
  53216. function flushSchedulerQueue () {
  53217. currentFlushTimestamp = getNow();
  53218. flushing = true;
  53219. var watcher, id;
  53220. // Sort queue before flush.
  53221. // This ensures that:
  53222. // 1. Components are updated from parent to child. (because parent is always
  53223. // created before the child)
  53224. // 2. A component's user watchers are run before its render watcher (because
  53225. // user watchers are created before the render watcher)
  53226. // 3. If a component is destroyed during a parent component's watcher run,
  53227. // its watchers can be skipped.
  53228. queue.sort(function (a, b) { return a.id - b.id; });
  53229. // do not cache length because more watchers might be pushed
  53230. // as we run existing watchers
  53231. for (index = 0; index < queue.length; index++) {
  53232. watcher = queue[index];
  53233. if (watcher.before) {
  53234. watcher.before();
  53235. }
  53236. id = watcher.id;
  53237. has[id] = null;
  53238. watcher.run();
  53239. // in dev build, check and stop circular updates.
  53240. if (has[id] != null) {
  53241. circular[id] = (circular[id] || 0) + 1;
  53242. if (circular[id] > MAX_UPDATE_COUNT) {
  53243. warn(
  53244. 'You may have an infinite update loop ' + (
  53245. watcher.user
  53246. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  53247. : "in a component render function."
  53248. ),
  53249. watcher.vm
  53250. );
  53251. break
  53252. }
  53253. }
  53254. }
  53255. // keep copies of post queues before resetting state
  53256. var activatedQueue = activatedChildren.slice();
  53257. var updatedQueue = queue.slice();
  53258. resetSchedulerState();
  53259. // call component updated and activated hooks
  53260. callActivatedHooks(activatedQueue);
  53261. callUpdatedHooks(updatedQueue);
  53262. // devtool hook
  53263. /* istanbul ignore if */
  53264. if (devtools && config.devtools) {
  53265. devtools.emit('flush');
  53266. }
  53267. }
  53268. function callUpdatedHooks (queue) {
  53269. var i = queue.length;
  53270. while (i--) {
  53271. var watcher = queue[i];
  53272. var vm = watcher.vm;
  53273. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  53274. callHook(vm, 'updated');
  53275. }
  53276. }
  53277. }
  53278. /**
  53279. * Queue a kept-alive component that was activated during patch.
  53280. * The queue will be processed after the entire tree has been patched.
  53281. */
  53282. function queueActivatedComponent (vm) {
  53283. // setting _inactive to false here so that a render function can
  53284. // rely on checking whether it's in an inactive tree (e.g. router-view)
  53285. vm._inactive = false;
  53286. activatedChildren.push(vm);
  53287. }
  53288. function callActivatedHooks (queue) {
  53289. for (var i = 0; i < queue.length; i++) {
  53290. queue[i]._inactive = true;
  53291. activateChildComponent(queue[i], true /* true */);
  53292. }
  53293. }
  53294. /**
  53295. * Push a watcher into the watcher queue.
  53296. * Jobs with duplicate IDs will be skipped unless it's
  53297. * pushed when the queue is being flushed.
  53298. */
  53299. function queueWatcher (watcher) {
  53300. var id = watcher.id;
  53301. if (has[id] == null) {
  53302. has[id] = true;
  53303. if (!flushing) {
  53304. queue.push(watcher);
  53305. } else {
  53306. // if already flushing, splice the watcher based on its id
  53307. // if already past its id, it will be run next immediately.
  53308. var i = queue.length - 1;
  53309. while (i > index && queue[i].id > watcher.id) {
  53310. i--;
  53311. }
  53312. queue.splice(i + 1, 0, watcher);
  53313. }
  53314. // queue the flush
  53315. if (!waiting) {
  53316. waiting = true;
  53317. if (!config.async) {
  53318. flushSchedulerQueue();
  53319. return
  53320. }
  53321. nextTick(flushSchedulerQueue);
  53322. }
  53323. }
  53324. }
  53325. /* */
  53326. var uid$2 = 0;
  53327. /**
  53328. * A watcher parses an expression, collects dependencies,
  53329. * and fires callback when the expression value changes.
  53330. * This is used for both the $watch() api and directives.
  53331. */
  53332. var Watcher = function Watcher (
  53333. vm,
  53334. expOrFn,
  53335. cb,
  53336. options,
  53337. isRenderWatcher
  53338. ) {
  53339. this.vm = vm;
  53340. if (isRenderWatcher) {
  53341. vm._watcher = this;
  53342. }
  53343. vm._watchers.push(this);
  53344. // options
  53345. if (options) {
  53346. this.deep = !!options.deep;
  53347. this.user = !!options.user;
  53348. this.lazy = !!options.lazy;
  53349. this.sync = !!options.sync;
  53350. this.before = options.before;
  53351. } else {
  53352. this.deep = this.user = this.lazy = this.sync = false;
  53353. }
  53354. this.cb = cb;
  53355. this.id = ++uid$2; // uid for batching
  53356. this.active = true;
  53357. this.dirty = this.lazy; // for lazy watchers
  53358. this.deps = [];
  53359. this.newDeps = [];
  53360. this.depIds = new _Set();
  53361. this.newDepIds = new _Set();
  53362. this.expression = expOrFn.toString();
  53363. // parse expression for getter
  53364. if (typeof expOrFn === 'function') {
  53365. this.getter = expOrFn;
  53366. } else {
  53367. this.getter = parsePath(expOrFn);
  53368. if (!this.getter) {
  53369. this.getter = noop;
  53370. warn(
  53371. "Failed watching path: \"" + expOrFn + "\" " +
  53372. 'Watcher only accepts simple dot-delimited paths. ' +
  53373. 'For full control, use a function instead.',
  53374. vm
  53375. );
  53376. }
  53377. }
  53378. this.value = this.lazy
  53379. ? undefined
  53380. : this.get();
  53381. };
  53382. /**
  53383. * Evaluate the getter, and re-collect dependencies.
  53384. */
  53385. Watcher.prototype.get = function get () {
  53386. pushTarget(this);
  53387. var value;
  53388. var vm = this.vm;
  53389. try {
  53390. value = this.getter.call(vm, vm);
  53391. } catch (e) {
  53392. if (this.user) {
  53393. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  53394. } else {
  53395. throw e
  53396. }
  53397. } finally {
  53398. // "touch" every property so they are all tracked as
  53399. // dependencies for deep watching
  53400. if (this.deep) {
  53401. traverse(value);
  53402. }
  53403. popTarget();
  53404. this.cleanupDeps();
  53405. }
  53406. return value
  53407. };
  53408. /**
  53409. * Add a dependency to this directive.
  53410. */
  53411. Watcher.prototype.addDep = function addDep (dep) {
  53412. var id = dep.id;
  53413. if (!this.newDepIds.has(id)) {
  53414. this.newDepIds.add(id);
  53415. this.newDeps.push(dep);
  53416. if (!this.depIds.has(id)) {
  53417. dep.addSub(this);
  53418. }
  53419. }
  53420. };
  53421. /**
  53422. * Clean up for dependency collection.
  53423. */
  53424. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  53425. var i = this.deps.length;
  53426. while (i--) {
  53427. var dep = this.deps[i];
  53428. if (!this.newDepIds.has(dep.id)) {
  53429. dep.removeSub(this);
  53430. }
  53431. }
  53432. var tmp = this.depIds;
  53433. this.depIds = this.newDepIds;
  53434. this.newDepIds = tmp;
  53435. this.newDepIds.clear();
  53436. tmp = this.deps;
  53437. this.deps = this.newDeps;
  53438. this.newDeps = tmp;
  53439. this.newDeps.length = 0;
  53440. };
  53441. /**
  53442. * Subscriber interface.
  53443. * Will be called when a dependency changes.
  53444. */
  53445. Watcher.prototype.update = function update () {
  53446. /* istanbul ignore else */
  53447. if (this.lazy) {
  53448. this.dirty = true;
  53449. } else if (this.sync) {
  53450. this.run();
  53451. } else {
  53452. queueWatcher(this);
  53453. }
  53454. };
  53455. /**
  53456. * Scheduler job interface.
  53457. * Will be called by the scheduler.
  53458. */
  53459. Watcher.prototype.run = function run () {
  53460. if (this.active) {
  53461. var value = this.get();
  53462. if (
  53463. value !== this.value ||
  53464. // Deep watchers and watchers on Object/Arrays should fire even
  53465. // when the value is the same, because the value may
  53466. // have mutated.
  53467. isObject(value) ||
  53468. this.deep
  53469. ) {
  53470. // set new value
  53471. var oldValue = this.value;
  53472. this.value = value;
  53473. if (this.user) {
  53474. try {
  53475. this.cb.call(this.vm, value, oldValue);
  53476. } catch (e) {
  53477. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  53478. }
  53479. } else {
  53480. this.cb.call(this.vm, value, oldValue);
  53481. }
  53482. }
  53483. }
  53484. };
  53485. /**
  53486. * Evaluate the value of the watcher.
  53487. * This only gets called for lazy watchers.
  53488. */
  53489. Watcher.prototype.evaluate = function evaluate () {
  53490. this.value = this.get();
  53491. this.dirty = false;
  53492. };
  53493. /**
  53494. * Depend on all deps collected by this watcher.
  53495. */
  53496. Watcher.prototype.depend = function depend () {
  53497. var i = this.deps.length;
  53498. while (i--) {
  53499. this.deps[i].depend();
  53500. }
  53501. };
  53502. /**
  53503. * Remove self from all dependencies' subscriber list.
  53504. */
  53505. Watcher.prototype.teardown = function teardown () {
  53506. if (this.active) {
  53507. // remove self from vm's watcher list
  53508. // this is a somewhat expensive operation so we skip it
  53509. // if the vm is being destroyed.
  53510. if (!this.vm._isBeingDestroyed) {
  53511. remove(this.vm._watchers, this);
  53512. }
  53513. var i = this.deps.length;
  53514. while (i--) {
  53515. this.deps[i].removeSub(this);
  53516. }
  53517. this.active = false;
  53518. }
  53519. };
  53520. /* */
  53521. var sharedPropertyDefinition = {
  53522. enumerable: true,
  53523. configurable: true,
  53524. get: noop,
  53525. set: noop
  53526. };
  53527. function proxy (target, sourceKey, key) {
  53528. sharedPropertyDefinition.get = function proxyGetter () {
  53529. return this[sourceKey][key]
  53530. };
  53531. sharedPropertyDefinition.set = function proxySetter (val) {
  53532. this[sourceKey][key] = val;
  53533. };
  53534. Object.defineProperty(target, key, sharedPropertyDefinition);
  53535. }
  53536. function initState (vm) {
  53537. vm._watchers = [];
  53538. var opts = vm.$options;
  53539. if (opts.props) { initProps(vm, opts.props); }
  53540. if (opts.methods) { initMethods(vm, opts.methods); }
  53541. if (opts.data) {
  53542. initData(vm);
  53543. } else {
  53544. observe(vm._data = {}, true /* asRootData */);
  53545. }
  53546. if (opts.computed) { initComputed(vm, opts.computed); }
  53547. if (opts.watch && opts.watch !== nativeWatch) {
  53548. initWatch(vm, opts.watch);
  53549. }
  53550. }
  53551. function initProps (vm, propsOptions) {
  53552. var propsData = vm.$options.propsData || {};
  53553. var props = vm._props = {};
  53554. // cache prop keys so that future props updates can iterate using Array
  53555. // instead of dynamic object key enumeration.
  53556. var keys = vm.$options._propKeys = [];
  53557. var isRoot = !vm.$parent;
  53558. // root instance props should be converted
  53559. if (!isRoot) {
  53560. toggleObserving(false);
  53561. }
  53562. var loop = function ( key ) {
  53563. keys.push(key);
  53564. var value = validateProp(key, propsOptions, propsData, vm);
  53565. /* istanbul ignore else */
  53566. {
  53567. var hyphenatedKey = hyphenate(key);
  53568. if (isReservedAttribute(hyphenatedKey) ||
  53569. config.isReservedAttr(hyphenatedKey)) {
  53570. warn(
  53571. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  53572. vm
  53573. );
  53574. }
  53575. defineReactive$$1(props, key, value, function () {
  53576. if (!isRoot && !isUpdatingChildComponent) {
  53577. warn(
  53578. "Avoid mutating a prop directly since the value will be " +
  53579. "overwritten whenever the parent component re-renders. " +
  53580. "Instead, use a data or computed property based on the prop's " +
  53581. "value. Prop being mutated: \"" + key + "\"",
  53582. vm
  53583. );
  53584. }
  53585. });
  53586. }
  53587. // static props are already proxied on the component's prototype
  53588. // during Vue.extend(). We only need to proxy props defined at
  53589. // instantiation here.
  53590. if (!(key in vm)) {
  53591. proxy(vm, "_props", key);
  53592. }
  53593. };
  53594. for (var key in propsOptions) loop( key );
  53595. toggleObserving(true);
  53596. }
  53597. function initData (vm) {
  53598. var data = vm.$options.data;
  53599. data = vm._data = typeof data === 'function'
  53600. ? getData(data, vm)
  53601. : data || {};
  53602. if (!isPlainObject(data)) {
  53603. data = {};
  53604. warn(
  53605. 'data functions should return an object:\n' +
  53606. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  53607. vm
  53608. );
  53609. }
  53610. // proxy data on instance
  53611. var keys = Object.keys(data);
  53612. var props = vm.$options.props;
  53613. var methods = vm.$options.methods;
  53614. var i = keys.length;
  53615. while (i--) {
  53616. var key = keys[i];
  53617. {
  53618. if (methods && hasOwn(methods, key)) {
  53619. warn(
  53620. ("Method \"" + key + "\" has already been defined as a data property."),
  53621. vm
  53622. );
  53623. }
  53624. }
  53625. if (props && hasOwn(props, key)) {
  53626. warn(
  53627. "The data property \"" + key + "\" is already declared as a prop. " +
  53628. "Use prop default value instead.",
  53629. vm
  53630. );
  53631. } else if (!isReserved(key)) {
  53632. proxy(vm, "_data", key);
  53633. }
  53634. }
  53635. // observe data
  53636. observe(data, true /* asRootData */);
  53637. }
  53638. function getData (data, vm) {
  53639. // #7573 disable dep collection when invoking data getters
  53640. pushTarget();
  53641. try {
  53642. return data.call(vm, vm)
  53643. } catch (e) {
  53644. handleError(e, vm, "data()");
  53645. return {}
  53646. } finally {
  53647. popTarget();
  53648. }
  53649. }
  53650. var computedWatcherOptions = { lazy: true };
  53651. function initComputed (vm, computed) {
  53652. // $flow-disable-line
  53653. var watchers = vm._computedWatchers = Object.create(null);
  53654. // computed properties are just getters during SSR
  53655. var isSSR = isServerRendering();
  53656. for (var key in computed) {
  53657. var userDef = computed[key];
  53658. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  53659. if (getter == null) {
  53660. warn(
  53661. ("Getter is missing for computed property \"" + key + "\"."),
  53662. vm
  53663. );
  53664. }
  53665. if (!isSSR) {
  53666. // create internal watcher for the computed property.
  53667. watchers[key] = new Watcher(
  53668. vm,
  53669. getter || noop,
  53670. noop,
  53671. computedWatcherOptions
  53672. );
  53673. }
  53674. // component-defined computed properties are already defined on the
  53675. // component prototype. We only need to define computed properties defined
  53676. // at instantiation here.
  53677. if (!(key in vm)) {
  53678. defineComputed(vm, key, userDef);
  53679. } else {
  53680. if (key in vm.$data) {
  53681. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  53682. } else if (vm.$options.props && key in vm.$options.props) {
  53683. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  53684. }
  53685. }
  53686. }
  53687. }
  53688. function defineComputed (
  53689. target,
  53690. key,
  53691. userDef
  53692. ) {
  53693. var shouldCache = !isServerRendering();
  53694. if (typeof userDef === 'function') {
  53695. sharedPropertyDefinition.get = shouldCache
  53696. ? createComputedGetter(key)
  53697. : createGetterInvoker(userDef);
  53698. sharedPropertyDefinition.set = noop;
  53699. } else {
  53700. sharedPropertyDefinition.get = userDef.get
  53701. ? shouldCache && userDef.cache !== false
  53702. ? createComputedGetter(key)
  53703. : createGetterInvoker(userDef.get)
  53704. : noop;
  53705. sharedPropertyDefinition.set = userDef.set || noop;
  53706. }
  53707. if (sharedPropertyDefinition.set === noop) {
  53708. sharedPropertyDefinition.set = function () {
  53709. warn(
  53710. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  53711. this
  53712. );
  53713. };
  53714. }
  53715. Object.defineProperty(target, key, sharedPropertyDefinition);
  53716. }
  53717. function createComputedGetter (key) {
  53718. return function computedGetter () {
  53719. var watcher = this._computedWatchers && this._computedWatchers[key];
  53720. if (watcher) {
  53721. if (watcher.dirty) {
  53722. watcher.evaluate();
  53723. }
  53724. if (Dep.target) {
  53725. watcher.depend();
  53726. }
  53727. return watcher.value
  53728. }
  53729. }
  53730. }
  53731. function createGetterInvoker(fn) {
  53732. return function computedGetter () {
  53733. return fn.call(this, this)
  53734. }
  53735. }
  53736. function initMethods (vm, methods) {
  53737. var props = vm.$options.props;
  53738. for (var key in methods) {
  53739. {
  53740. if (typeof methods[key] !== 'function') {
  53741. warn(
  53742. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  53743. "Did you reference the function correctly?",
  53744. vm
  53745. );
  53746. }
  53747. if (props && hasOwn(props, key)) {
  53748. warn(
  53749. ("Method \"" + key + "\" has already been defined as a prop."),
  53750. vm
  53751. );
  53752. }
  53753. if ((key in vm) && isReserved(key)) {
  53754. warn(
  53755. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  53756. "Avoid defining component methods that start with _ or $."
  53757. );
  53758. }
  53759. }
  53760. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  53761. }
  53762. }
  53763. function initWatch (vm, watch) {
  53764. for (var key in watch) {
  53765. var handler = watch[key];
  53766. if (Array.isArray(handler)) {
  53767. for (var i = 0; i < handler.length; i++) {
  53768. createWatcher(vm, key, handler[i]);
  53769. }
  53770. } else {
  53771. createWatcher(vm, key, handler);
  53772. }
  53773. }
  53774. }
  53775. function createWatcher (
  53776. vm,
  53777. expOrFn,
  53778. handler,
  53779. options
  53780. ) {
  53781. if (isPlainObject(handler)) {
  53782. options = handler;
  53783. handler = handler.handler;
  53784. }
  53785. if (typeof handler === 'string') {
  53786. handler = vm[handler];
  53787. }
  53788. return vm.$watch(expOrFn, handler, options)
  53789. }
  53790. function stateMixin (Vue) {
  53791. // flow somehow has problems with directly declared definition object
  53792. // when using Object.defineProperty, so we have to procedurally build up
  53793. // the object here.
  53794. var dataDef = {};
  53795. dataDef.get = function () { return this._data };
  53796. var propsDef = {};
  53797. propsDef.get = function () { return this._props };
  53798. {
  53799. dataDef.set = function () {
  53800. warn(
  53801. 'Avoid replacing instance root $data. ' +
  53802. 'Use nested data properties instead.',
  53803. this
  53804. );
  53805. };
  53806. propsDef.set = function () {
  53807. warn("$props is readonly.", this);
  53808. };
  53809. }
  53810. Object.defineProperty(Vue.prototype, '$data', dataDef);
  53811. Object.defineProperty(Vue.prototype, '$props', propsDef);
  53812. Vue.prototype.$set = set;
  53813. Vue.prototype.$delete = del;
  53814. Vue.prototype.$watch = function (
  53815. expOrFn,
  53816. cb,
  53817. options
  53818. ) {
  53819. var vm = this;
  53820. if (isPlainObject(cb)) {
  53821. return createWatcher(vm, expOrFn, cb, options)
  53822. }
  53823. options = options || {};
  53824. options.user = true;
  53825. var watcher = new Watcher(vm, expOrFn, cb, options);
  53826. if (options.immediate) {
  53827. try {
  53828. cb.call(vm, watcher.value);
  53829. } catch (error) {
  53830. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  53831. }
  53832. }
  53833. return function unwatchFn () {
  53834. watcher.teardown();
  53835. }
  53836. };
  53837. }
  53838. /* */
  53839. var uid$3 = 0;
  53840. function initMixin (Vue) {
  53841. Vue.prototype._init = function (options) {
  53842. var vm = this;
  53843. // a uid
  53844. vm._uid = uid$3++;
  53845. var startTag, endTag;
  53846. /* istanbul ignore if */
  53847. if (config.performance && mark) {
  53848. startTag = "vue-perf-start:" + (vm._uid);
  53849. endTag = "vue-perf-end:" + (vm._uid);
  53850. mark(startTag);
  53851. }
  53852. // a flag to avoid this being observed
  53853. vm._isVue = true;
  53854. // merge options
  53855. if (options && options._isComponent) {
  53856. // optimize internal component instantiation
  53857. // since dynamic options merging is pretty slow, and none of the
  53858. // internal component options needs special treatment.
  53859. initInternalComponent(vm, options);
  53860. } else {
  53861. vm.$options = mergeOptions(
  53862. resolveConstructorOptions(vm.constructor),
  53863. options || {},
  53864. vm
  53865. );
  53866. }
  53867. /* istanbul ignore else */
  53868. {
  53869. initProxy(vm);
  53870. }
  53871. // expose real self
  53872. vm._self = vm;
  53873. initLifecycle(vm);
  53874. initEvents(vm);
  53875. initRender(vm);
  53876. callHook(vm, 'beforeCreate');
  53877. initInjections(vm); // resolve injections before data/props
  53878. initState(vm);
  53879. initProvide(vm); // resolve provide after data/props
  53880. callHook(vm, 'created');
  53881. /* istanbul ignore if */
  53882. if (config.performance && mark) {
  53883. vm._name = formatComponentName(vm, false);
  53884. mark(endTag);
  53885. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  53886. }
  53887. if (vm.$options.el) {
  53888. vm.$mount(vm.$options.el);
  53889. }
  53890. };
  53891. }
  53892. function initInternalComponent (vm, options) {
  53893. var opts = vm.$options = Object.create(vm.constructor.options);
  53894. // doing this because it's faster than dynamic enumeration.
  53895. var parentVnode = options._parentVnode;
  53896. opts.parent = options.parent;
  53897. opts._parentVnode = parentVnode;
  53898. var vnodeComponentOptions = parentVnode.componentOptions;
  53899. opts.propsData = vnodeComponentOptions.propsData;
  53900. opts._parentListeners = vnodeComponentOptions.listeners;
  53901. opts._renderChildren = vnodeComponentOptions.children;
  53902. opts._componentTag = vnodeComponentOptions.tag;
  53903. if (options.render) {
  53904. opts.render = options.render;
  53905. opts.staticRenderFns = options.staticRenderFns;
  53906. }
  53907. }
  53908. function resolveConstructorOptions (Ctor) {
  53909. var options = Ctor.options;
  53910. if (Ctor.super) {
  53911. var superOptions = resolveConstructorOptions(Ctor.super);
  53912. var cachedSuperOptions = Ctor.superOptions;
  53913. if (superOptions !== cachedSuperOptions) {
  53914. // super option changed,
  53915. // need to resolve new options.
  53916. Ctor.superOptions = superOptions;
  53917. // check if there are any late-modified/attached options (#4976)
  53918. var modifiedOptions = resolveModifiedOptions(Ctor);
  53919. // update base extend options
  53920. if (modifiedOptions) {
  53921. extend(Ctor.extendOptions, modifiedOptions);
  53922. }
  53923. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  53924. if (options.name) {
  53925. options.components[options.name] = Ctor;
  53926. }
  53927. }
  53928. }
  53929. return options
  53930. }
  53931. function resolveModifiedOptions (Ctor) {
  53932. var modified;
  53933. var latest = Ctor.options;
  53934. var sealed = Ctor.sealedOptions;
  53935. for (var key in latest) {
  53936. if (latest[key] !== sealed[key]) {
  53937. if (!modified) { modified = {}; }
  53938. modified[key] = latest[key];
  53939. }
  53940. }
  53941. return modified
  53942. }
  53943. function Vue (options) {
  53944. if (!(this instanceof Vue)
  53945. ) {
  53946. warn('Vue is a constructor and should be called with the `new` keyword');
  53947. }
  53948. this._init(options);
  53949. }
  53950. initMixin(Vue);
  53951. stateMixin(Vue);
  53952. eventsMixin(Vue);
  53953. lifecycleMixin(Vue);
  53954. renderMixin(Vue);
  53955. /* */
  53956. function initUse (Vue) {
  53957. Vue.use = function (plugin) {
  53958. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  53959. if (installedPlugins.indexOf(plugin) > -1) {
  53960. return this
  53961. }
  53962. // additional parameters
  53963. var args = toArray(arguments, 1);
  53964. args.unshift(this);
  53965. if (typeof plugin.install === 'function') {
  53966. plugin.install.apply(plugin, args);
  53967. } else if (typeof plugin === 'function') {
  53968. plugin.apply(null, args);
  53969. }
  53970. installedPlugins.push(plugin);
  53971. return this
  53972. };
  53973. }
  53974. /* */
  53975. function initMixin$1 (Vue) {
  53976. Vue.mixin = function (mixin) {
  53977. this.options = mergeOptions(this.options, mixin);
  53978. return this
  53979. };
  53980. }
  53981. /* */
  53982. function initExtend (Vue) {
  53983. /**
  53984. * Each instance constructor, including Vue, has a unique
  53985. * cid. This enables us to create wrapped "child
  53986. * constructors" for prototypal inheritance and cache them.
  53987. */
  53988. Vue.cid = 0;
  53989. var cid = 1;
  53990. /**
  53991. * Class inheritance
  53992. */
  53993. Vue.extend = function (extendOptions) {
  53994. extendOptions = extendOptions || {};
  53995. var Super = this;
  53996. var SuperId = Super.cid;
  53997. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  53998. if (cachedCtors[SuperId]) {
  53999. return cachedCtors[SuperId]
  54000. }
  54001. var name = extendOptions.name || Super.options.name;
  54002. if (name) {
  54003. validateComponentName(name);
  54004. }
  54005. var Sub = function VueComponent (options) {
  54006. this._init(options);
  54007. };
  54008. Sub.prototype = Object.create(Super.prototype);
  54009. Sub.prototype.constructor = Sub;
  54010. Sub.cid = cid++;
  54011. Sub.options = mergeOptions(
  54012. Super.options,
  54013. extendOptions
  54014. );
  54015. Sub['super'] = Super;
  54016. // For props and computed properties, we define the proxy getters on
  54017. // the Vue instances at extension time, on the extended prototype. This
  54018. // avoids Object.defineProperty calls for each instance created.
  54019. if (Sub.options.props) {
  54020. initProps$1(Sub);
  54021. }
  54022. if (Sub.options.computed) {
  54023. initComputed$1(Sub);
  54024. }
  54025. // allow further extension/mixin/plugin usage
  54026. Sub.extend = Super.extend;
  54027. Sub.mixin = Super.mixin;
  54028. Sub.use = Super.use;
  54029. // create asset registers, so extended classes
  54030. // can have their private assets too.
  54031. ASSET_TYPES.forEach(function (type) {
  54032. Sub[type] = Super[type];
  54033. });
  54034. // enable recursive self-lookup
  54035. if (name) {
  54036. Sub.options.components[name] = Sub;
  54037. }
  54038. // keep a reference to the super options at extension time.
  54039. // later at instantiation we can check if Super's options have
  54040. // been updated.
  54041. Sub.superOptions = Super.options;
  54042. Sub.extendOptions = extendOptions;
  54043. Sub.sealedOptions = extend({}, Sub.options);
  54044. // cache constructor
  54045. cachedCtors[SuperId] = Sub;
  54046. return Sub
  54047. };
  54048. }
  54049. function initProps$1 (Comp) {
  54050. var props = Comp.options.props;
  54051. for (var key in props) {
  54052. proxy(Comp.prototype, "_props", key);
  54053. }
  54054. }
  54055. function initComputed$1 (Comp) {
  54056. var computed = Comp.options.computed;
  54057. for (var key in computed) {
  54058. defineComputed(Comp.prototype, key, computed[key]);
  54059. }
  54060. }
  54061. /* */
  54062. function initAssetRegisters (Vue) {
  54063. /**
  54064. * Create asset registration methods.
  54065. */
  54066. ASSET_TYPES.forEach(function (type) {
  54067. Vue[type] = function (
  54068. id,
  54069. definition
  54070. ) {
  54071. if (!definition) {
  54072. return this.options[type + 's'][id]
  54073. } else {
  54074. /* istanbul ignore if */
  54075. if (type === 'component') {
  54076. validateComponentName(id);
  54077. }
  54078. if (type === 'component' && isPlainObject(definition)) {
  54079. definition.name = definition.name || id;
  54080. definition = this.options._base.extend(definition);
  54081. }
  54082. if (type === 'directive' && typeof definition === 'function') {
  54083. definition = { bind: definition, update: definition };
  54084. }
  54085. this.options[type + 's'][id] = definition;
  54086. return definition
  54087. }
  54088. };
  54089. });
  54090. }
  54091. /* */
  54092. function getComponentName (opts) {
  54093. return opts && (opts.Ctor.options.name || opts.tag)
  54094. }
  54095. function matches (pattern, name) {
  54096. if (Array.isArray(pattern)) {
  54097. return pattern.indexOf(name) > -1
  54098. } else if (typeof pattern === 'string') {
  54099. return pattern.split(',').indexOf(name) > -1
  54100. } else if (isRegExp(pattern)) {
  54101. return pattern.test(name)
  54102. }
  54103. /* istanbul ignore next */
  54104. return false
  54105. }
  54106. function pruneCache (keepAliveInstance, filter) {
  54107. var cache = keepAliveInstance.cache;
  54108. var keys = keepAliveInstance.keys;
  54109. var _vnode = keepAliveInstance._vnode;
  54110. for (var key in cache) {
  54111. var cachedNode = cache[key];
  54112. if (cachedNode) {
  54113. var name = getComponentName(cachedNode.componentOptions);
  54114. if (name && !filter(name)) {
  54115. pruneCacheEntry(cache, key, keys, _vnode);
  54116. }
  54117. }
  54118. }
  54119. }
  54120. function pruneCacheEntry (
  54121. cache,
  54122. key,
  54123. keys,
  54124. current
  54125. ) {
  54126. var cached$$1 = cache[key];
  54127. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  54128. cached$$1.componentInstance.$destroy();
  54129. }
  54130. cache[key] = null;
  54131. remove(keys, key);
  54132. }
  54133. var patternTypes = [String, RegExp, Array];
  54134. var KeepAlive = {
  54135. name: 'keep-alive',
  54136. abstract: true,
  54137. props: {
  54138. include: patternTypes,
  54139. exclude: patternTypes,
  54140. max: [String, Number]
  54141. },
  54142. created: function created () {
  54143. this.cache = Object.create(null);
  54144. this.keys = [];
  54145. },
  54146. destroyed: function destroyed () {
  54147. for (var key in this.cache) {
  54148. pruneCacheEntry(this.cache, key, this.keys);
  54149. }
  54150. },
  54151. mounted: function mounted () {
  54152. var this$1 = this;
  54153. this.$watch('include', function (val) {
  54154. pruneCache(this$1, function (name) { return matches(val, name); });
  54155. });
  54156. this.$watch('exclude', function (val) {
  54157. pruneCache(this$1, function (name) { return !matches(val, name); });
  54158. });
  54159. },
  54160. render: function render () {
  54161. var slot = this.$slots.default;
  54162. var vnode = getFirstComponentChild(slot);
  54163. var componentOptions = vnode && vnode.componentOptions;
  54164. if (componentOptions) {
  54165. // check pattern
  54166. var name = getComponentName(componentOptions);
  54167. var ref = this;
  54168. var include = ref.include;
  54169. var exclude = ref.exclude;
  54170. if (
  54171. // not included
  54172. (include && (!name || !matches(include, name))) ||
  54173. // excluded
  54174. (exclude && name && matches(exclude, name))
  54175. ) {
  54176. return vnode
  54177. }
  54178. var ref$1 = this;
  54179. var cache = ref$1.cache;
  54180. var keys = ref$1.keys;
  54181. var key = vnode.key == null
  54182. // same constructor may get registered as different local components
  54183. // so cid alone is not enough (#3269)
  54184. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  54185. : vnode.key;
  54186. if (cache[key]) {
  54187. vnode.componentInstance = cache[key].componentInstance;
  54188. // make current key freshest
  54189. remove(keys, key);
  54190. keys.push(key);
  54191. } else {
  54192. cache[key] = vnode;
  54193. keys.push(key);
  54194. // prune oldest entry
  54195. if (this.max && keys.length > parseInt(this.max)) {
  54196. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  54197. }
  54198. }
  54199. vnode.data.keepAlive = true;
  54200. }
  54201. return vnode || (slot && slot[0])
  54202. }
  54203. };
  54204. var builtInComponents = {
  54205. KeepAlive: KeepAlive
  54206. };
  54207. /* */
  54208. function initGlobalAPI (Vue) {
  54209. // config
  54210. var configDef = {};
  54211. configDef.get = function () { return config; };
  54212. {
  54213. configDef.set = function () {
  54214. warn(
  54215. 'Do not replace the Vue.config object, set individual fields instead.'
  54216. );
  54217. };
  54218. }
  54219. Object.defineProperty(Vue, 'config', configDef);
  54220. // exposed util methods.
  54221. // NOTE: these are not considered part of the public API - avoid relying on
  54222. // them unless you are aware of the risk.
  54223. Vue.util = {
  54224. warn: warn,
  54225. extend: extend,
  54226. mergeOptions: mergeOptions,
  54227. defineReactive: defineReactive$$1
  54228. };
  54229. Vue.set = set;
  54230. Vue.delete = del;
  54231. Vue.nextTick = nextTick;
  54232. // 2.6 explicit observable API
  54233. Vue.observable = function (obj) {
  54234. observe(obj);
  54235. return obj
  54236. };
  54237. Vue.options = Object.create(null);
  54238. ASSET_TYPES.forEach(function (type) {
  54239. Vue.options[type + 's'] = Object.create(null);
  54240. });
  54241. // this is used to identify the "base" constructor to extend all plain-object
  54242. // components with in Weex's multi-instance scenarios.
  54243. Vue.options._base = Vue;
  54244. extend(Vue.options.components, builtInComponents);
  54245. initUse(Vue);
  54246. initMixin$1(Vue);
  54247. initExtend(Vue);
  54248. initAssetRegisters(Vue);
  54249. }
  54250. initGlobalAPI(Vue);
  54251. Object.defineProperty(Vue.prototype, '$isServer', {
  54252. get: isServerRendering
  54253. });
  54254. Object.defineProperty(Vue.prototype, '$ssrContext', {
  54255. get: function get () {
  54256. /* istanbul ignore next */
  54257. return this.$vnode && this.$vnode.ssrContext
  54258. }
  54259. });
  54260. // expose FunctionalRenderContext for ssr runtime helper installation
  54261. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  54262. value: FunctionalRenderContext
  54263. });
  54264. Vue.version = '2.6.11';
  54265. /* */
  54266. // these are reserved for web because they are directly compiled away
  54267. // during template compilation
  54268. var isReservedAttr = makeMap('style,class');
  54269. // attributes that should be using props for binding
  54270. var acceptValue = makeMap('input,textarea,option,select,progress');
  54271. var mustUseProp = function (tag, type, attr) {
  54272. return (
  54273. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  54274. (attr === 'selected' && tag === 'option') ||
  54275. (attr === 'checked' && tag === 'input') ||
  54276. (attr === 'muted' && tag === 'video')
  54277. )
  54278. };
  54279. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  54280. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  54281. var convertEnumeratedValue = function (key, value) {
  54282. return isFalsyAttrValue(value) || value === 'false'
  54283. ? 'false'
  54284. // allow arbitrary string value for contenteditable
  54285. : key === 'contenteditable' && isValidContentEditableValue(value)
  54286. ? value
  54287. : 'true'
  54288. };
  54289. var isBooleanAttr = makeMap(
  54290. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  54291. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  54292. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  54293. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  54294. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  54295. 'truespeed,typemustmatch,visible'
  54296. );
  54297. var xlinkNS = 'http://www.w3.org/1999/xlink';
  54298. var isXlink = function (name) {
  54299. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  54300. };
  54301. var getXlinkProp = function (name) {
  54302. return isXlink(name) ? name.slice(6, name.length) : ''
  54303. };
  54304. var isFalsyAttrValue = function (val) {
  54305. return val == null || val === false
  54306. };
  54307. /* */
  54308. function genClassForVnode (vnode) {
  54309. var data = vnode.data;
  54310. var parentNode = vnode;
  54311. var childNode = vnode;
  54312. while (isDef(childNode.componentInstance)) {
  54313. childNode = childNode.componentInstance._vnode;
  54314. if (childNode && childNode.data) {
  54315. data = mergeClassData(childNode.data, data);
  54316. }
  54317. }
  54318. while (isDef(parentNode = parentNode.parent)) {
  54319. if (parentNode && parentNode.data) {
  54320. data = mergeClassData(data, parentNode.data);
  54321. }
  54322. }
  54323. return renderClass(data.staticClass, data.class)
  54324. }
  54325. function mergeClassData (child, parent) {
  54326. return {
  54327. staticClass: concat(child.staticClass, parent.staticClass),
  54328. class: isDef(child.class)
  54329. ? [child.class, parent.class]
  54330. : parent.class
  54331. }
  54332. }
  54333. function renderClass (
  54334. staticClass,
  54335. dynamicClass
  54336. ) {
  54337. if (isDef(staticClass) || isDef(dynamicClass)) {
  54338. return concat(staticClass, stringifyClass(dynamicClass))
  54339. }
  54340. /* istanbul ignore next */
  54341. return ''
  54342. }
  54343. function concat (a, b) {
  54344. return a ? b ? (a + ' ' + b) : a : (b || '')
  54345. }
  54346. function stringifyClass (value) {
  54347. if (Array.isArray(value)) {
  54348. return stringifyArray(value)
  54349. }
  54350. if (isObject(value)) {
  54351. return stringifyObject(value)
  54352. }
  54353. if (typeof value === 'string') {
  54354. return value
  54355. }
  54356. /* istanbul ignore next */
  54357. return ''
  54358. }
  54359. function stringifyArray (value) {
  54360. var res = '';
  54361. var stringified;
  54362. for (var i = 0, l = value.length; i < l; i++) {
  54363. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  54364. if (res) { res += ' '; }
  54365. res += stringified;
  54366. }
  54367. }
  54368. return res
  54369. }
  54370. function stringifyObject (value) {
  54371. var res = '';
  54372. for (var key in value) {
  54373. if (value[key]) {
  54374. if (res) { res += ' '; }
  54375. res += key;
  54376. }
  54377. }
  54378. return res
  54379. }
  54380. /* */
  54381. var namespaceMap = {
  54382. svg: 'http://www.w3.org/2000/svg',
  54383. math: 'http://www.w3.org/1998/Math/MathML'
  54384. };
  54385. var isHTMLTag = makeMap(
  54386. 'html,body,base,head,link,meta,style,title,' +
  54387. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  54388. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  54389. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  54390. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  54391. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  54392. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  54393. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  54394. 'output,progress,select,textarea,' +
  54395. 'details,dialog,menu,menuitem,summary,' +
  54396. 'content,element,shadow,template,blockquote,iframe,tfoot'
  54397. );
  54398. // this map is intentionally selective, only covering SVG elements that may
  54399. // contain child elements.
  54400. var isSVG = makeMap(
  54401. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  54402. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  54403. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  54404. true
  54405. );
  54406. var isPreTag = function (tag) { return tag === 'pre'; };
  54407. var isReservedTag = function (tag) {
  54408. return isHTMLTag(tag) || isSVG(tag)
  54409. };
  54410. function getTagNamespace (tag) {
  54411. if (isSVG(tag)) {
  54412. return 'svg'
  54413. }
  54414. // basic support for MathML
  54415. // note it doesn't support other MathML elements being component roots
  54416. if (tag === 'math') {
  54417. return 'math'
  54418. }
  54419. }
  54420. var unknownElementCache = Object.create(null);
  54421. function isUnknownElement (tag) {
  54422. /* istanbul ignore if */
  54423. if (!inBrowser) {
  54424. return true
  54425. }
  54426. if (isReservedTag(tag)) {
  54427. return false
  54428. }
  54429. tag = tag.toLowerCase();
  54430. /* istanbul ignore if */
  54431. if (unknownElementCache[tag] != null) {
  54432. return unknownElementCache[tag]
  54433. }
  54434. var el = document.createElement(tag);
  54435. if (tag.indexOf('-') > -1) {
  54436. // http://stackoverflow.com/a/28210364/1070244
  54437. return (unknownElementCache[tag] = (
  54438. el.constructor === window.HTMLUnknownElement ||
  54439. el.constructor === window.HTMLElement
  54440. ))
  54441. } else {
  54442. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  54443. }
  54444. }
  54445. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  54446. /* */
  54447. /**
  54448. * Query an element selector if it's not an element already.
  54449. */
  54450. function query (el) {
  54451. if (typeof el === 'string') {
  54452. var selected = document.querySelector(el);
  54453. if (!selected) {
  54454. warn(
  54455. 'Cannot find element: ' + el
  54456. );
  54457. return document.createElement('div')
  54458. }
  54459. return selected
  54460. } else {
  54461. return el
  54462. }
  54463. }
  54464. /* */
  54465. function createElement$1 (tagName, vnode) {
  54466. var elm = document.createElement(tagName);
  54467. if (tagName !== 'select') {
  54468. return elm
  54469. }
  54470. // false or null will remove the attribute but undefined will not
  54471. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  54472. elm.setAttribute('multiple', 'multiple');
  54473. }
  54474. return elm
  54475. }
  54476. function createElementNS (namespace, tagName) {
  54477. return document.createElementNS(namespaceMap[namespace], tagName)
  54478. }
  54479. function createTextNode (text) {
  54480. return document.createTextNode(text)
  54481. }
  54482. function createComment (text) {
  54483. return document.createComment(text)
  54484. }
  54485. function insertBefore (parentNode, newNode, referenceNode) {
  54486. parentNode.insertBefore(newNode, referenceNode);
  54487. }
  54488. function removeChild (node, child) {
  54489. node.removeChild(child);
  54490. }
  54491. function appendChild (node, child) {
  54492. node.appendChild(child);
  54493. }
  54494. function parentNode (node) {
  54495. return node.parentNode
  54496. }
  54497. function nextSibling (node) {
  54498. return node.nextSibling
  54499. }
  54500. function tagName (node) {
  54501. return node.tagName
  54502. }
  54503. function setTextContent (node, text) {
  54504. node.textContent = text;
  54505. }
  54506. function setStyleScope (node, scopeId) {
  54507. node.setAttribute(scopeId, '');
  54508. }
  54509. var nodeOps = /*#__PURE__*/Object.freeze({
  54510. createElement: createElement$1,
  54511. createElementNS: createElementNS,
  54512. createTextNode: createTextNode,
  54513. createComment: createComment,
  54514. insertBefore: insertBefore,
  54515. removeChild: removeChild,
  54516. appendChild: appendChild,
  54517. parentNode: parentNode,
  54518. nextSibling: nextSibling,
  54519. tagName: tagName,
  54520. setTextContent: setTextContent,
  54521. setStyleScope: setStyleScope
  54522. });
  54523. /* */
  54524. var ref = {
  54525. create: function create (_, vnode) {
  54526. registerRef(vnode);
  54527. },
  54528. update: function update (oldVnode, vnode) {
  54529. if (oldVnode.data.ref !== vnode.data.ref) {
  54530. registerRef(oldVnode, true);
  54531. registerRef(vnode);
  54532. }
  54533. },
  54534. destroy: function destroy (vnode) {
  54535. registerRef(vnode, true);
  54536. }
  54537. };
  54538. function registerRef (vnode, isRemoval) {
  54539. var key = vnode.data.ref;
  54540. if (!isDef(key)) { return }
  54541. var vm = vnode.context;
  54542. var ref = vnode.componentInstance || vnode.elm;
  54543. var refs = vm.$refs;
  54544. if (isRemoval) {
  54545. if (Array.isArray(refs[key])) {
  54546. remove(refs[key], ref);
  54547. } else if (refs[key] === ref) {
  54548. refs[key] = undefined;
  54549. }
  54550. } else {
  54551. if (vnode.data.refInFor) {
  54552. if (!Array.isArray(refs[key])) {
  54553. refs[key] = [ref];
  54554. } else if (refs[key].indexOf(ref) < 0) {
  54555. // $flow-disable-line
  54556. refs[key].push(ref);
  54557. }
  54558. } else {
  54559. refs[key] = ref;
  54560. }
  54561. }
  54562. }
  54563. /**
  54564. * Virtual DOM patching algorithm based on Snabbdom by
  54565. * Simon Friis Vindum (@paldepind)
  54566. * Licensed under the MIT License
  54567. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  54568. *
  54569. * modified by Evan You (@yyx990803)
  54570. *
  54571. * Not type-checking this because this file is perf-critical and the cost
  54572. * of making flow understand it is not worth it.
  54573. */
  54574. var emptyNode = new VNode('', {}, []);
  54575. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  54576. function sameVnode (a, b) {
  54577. return (
  54578. a.key === b.key && (
  54579. (
  54580. a.tag === b.tag &&
  54581. a.isComment === b.isComment &&
  54582. isDef(a.data) === isDef(b.data) &&
  54583. sameInputType(a, b)
  54584. ) || (
  54585. isTrue(a.isAsyncPlaceholder) &&
  54586. a.asyncFactory === b.asyncFactory &&
  54587. isUndef(b.asyncFactory.error)
  54588. )
  54589. )
  54590. )
  54591. }
  54592. function sameInputType (a, b) {
  54593. if (a.tag !== 'input') { return true }
  54594. var i;
  54595. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  54596. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  54597. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  54598. }
  54599. function createKeyToOldIdx (children, beginIdx, endIdx) {
  54600. var i, key;
  54601. var map = {};
  54602. for (i = beginIdx; i <= endIdx; ++i) {
  54603. key = children[i].key;
  54604. if (isDef(key)) { map[key] = i; }
  54605. }
  54606. return map
  54607. }
  54608. function createPatchFunction (backend) {
  54609. var i, j;
  54610. var cbs = {};
  54611. var modules = backend.modules;
  54612. var nodeOps = backend.nodeOps;
  54613. for (i = 0; i < hooks.length; ++i) {
  54614. cbs[hooks[i]] = [];
  54615. for (j = 0; j < modules.length; ++j) {
  54616. if (isDef(modules[j][hooks[i]])) {
  54617. cbs[hooks[i]].push(modules[j][hooks[i]]);
  54618. }
  54619. }
  54620. }
  54621. function emptyNodeAt (elm) {
  54622. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  54623. }
  54624. function createRmCb (childElm, listeners) {
  54625. function remove$$1 () {
  54626. if (--remove$$1.listeners === 0) {
  54627. removeNode(childElm);
  54628. }
  54629. }
  54630. remove$$1.listeners = listeners;
  54631. return remove$$1
  54632. }
  54633. function removeNode (el) {
  54634. var parent = nodeOps.parentNode(el);
  54635. // element may have already been removed due to v-html / v-text
  54636. if (isDef(parent)) {
  54637. nodeOps.removeChild(parent, el);
  54638. }
  54639. }
  54640. function isUnknownElement$$1 (vnode, inVPre) {
  54641. return (
  54642. !inVPre &&
  54643. !vnode.ns &&
  54644. !(
  54645. config.ignoredElements.length &&
  54646. config.ignoredElements.some(function (ignore) {
  54647. return isRegExp(ignore)
  54648. ? ignore.test(vnode.tag)
  54649. : ignore === vnode.tag
  54650. })
  54651. ) &&
  54652. config.isUnknownElement(vnode.tag)
  54653. )
  54654. }
  54655. var creatingElmInVPre = 0;
  54656. function createElm (
  54657. vnode,
  54658. insertedVnodeQueue,
  54659. parentElm,
  54660. refElm,
  54661. nested,
  54662. ownerArray,
  54663. index
  54664. ) {
  54665. if (isDef(vnode.elm) && isDef(ownerArray)) {
  54666. // This vnode was used in a previous render!
  54667. // now it's used as a new node, overwriting its elm would cause
  54668. // potential patch errors down the road when it's used as an insertion
  54669. // reference node. Instead, we clone the node on-demand before creating
  54670. // associated DOM element for it.
  54671. vnode = ownerArray[index] = cloneVNode(vnode);
  54672. }
  54673. vnode.isRootInsert = !nested; // for transition enter check
  54674. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  54675. return
  54676. }
  54677. var data = vnode.data;
  54678. var children = vnode.children;
  54679. var tag = vnode.tag;
  54680. if (isDef(tag)) {
  54681. {
  54682. if (data && data.pre) {
  54683. creatingElmInVPre++;
  54684. }
  54685. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  54686. warn(
  54687. 'Unknown custom element: <' + tag + '> - did you ' +
  54688. 'register the component correctly? For recursive components, ' +
  54689. 'make sure to provide the "name" option.',
  54690. vnode.context
  54691. );
  54692. }
  54693. }
  54694. vnode.elm = vnode.ns
  54695. ? nodeOps.createElementNS(vnode.ns, tag)
  54696. : nodeOps.createElement(tag, vnode);
  54697. setScope(vnode);
  54698. /* istanbul ignore if */
  54699. {
  54700. createChildren(vnode, children, insertedVnodeQueue);
  54701. if (isDef(data)) {
  54702. invokeCreateHooks(vnode, insertedVnodeQueue);
  54703. }
  54704. insert(parentElm, vnode.elm, refElm);
  54705. }
  54706. if (data && data.pre) {
  54707. creatingElmInVPre--;
  54708. }
  54709. } else if (isTrue(vnode.isComment)) {
  54710. vnode.elm = nodeOps.createComment(vnode.text);
  54711. insert(parentElm, vnode.elm, refElm);
  54712. } else {
  54713. vnode.elm = nodeOps.createTextNode(vnode.text);
  54714. insert(parentElm, vnode.elm, refElm);
  54715. }
  54716. }
  54717. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  54718. var i = vnode.data;
  54719. if (isDef(i)) {
  54720. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  54721. if (isDef(i = i.hook) && isDef(i = i.init)) {
  54722. i(vnode, false /* hydrating */);
  54723. }
  54724. // after calling the init hook, if the vnode is a child component
  54725. // it should've created a child instance and mounted it. the child
  54726. // component also has set the placeholder vnode's elm.
  54727. // in that case we can just return the element and be done.
  54728. if (isDef(vnode.componentInstance)) {
  54729. initComponent(vnode, insertedVnodeQueue);
  54730. insert(parentElm, vnode.elm, refElm);
  54731. if (isTrue(isReactivated)) {
  54732. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  54733. }
  54734. return true
  54735. }
  54736. }
  54737. }
  54738. function initComponent (vnode, insertedVnodeQueue) {
  54739. if (isDef(vnode.data.pendingInsert)) {
  54740. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  54741. vnode.data.pendingInsert = null;
  54742. }
  54743. vnode.elm = vnode.componentInstance.$el;
  54744. if (isPatchable(vnode)) {
  54745. invokeCreateHooks(vnode, insertedVnodeQueue);
  54746. setScope(vnode);
  54747. } else {
  54748. // empty component root.
  54749. // skip all element-related modules except for ref (#3455)
  54750. registerRef(vnode);
  54751. // make sure to invoke the insert hook
  54752. insertedVnodeQueue.push(vnode);
  54753. }
  54754. }
  54755. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  54756. var i;
  54757. // hack for #4339: a reactivated component with inner transition
  54758. // does not trigger because the inner node's created hooks are not called
  54759. // again. It's not ideal to involve module-specific logic in here but
  54760. // there doesn't seem to be a better way to do it.
  54761. var innerNode = vnode;
  54762. while (innerNode.componentInstance) {
  54763. innerNode = innerNode.componentInstance._vnode;
  54764. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  54765. for (i = 0; i < cbs.activate.length; ++i) {
  54766. cbs.activate[i](emptyNode, innerNode);
  54767. }
  54768. insertedVnodeQueue.push(innerNode);
  54769. break
  54770. }
  54771. }
  54772. // unlike a newly created component,
  54773. // a reactivated keep-alive component doesn't insert itself
  54774. insert(parentElm, vnode.elm, refElm);
  54775. }
  54776. function insert (parent, elm, ref$$1) {
  54777. if (isDef(parent)) {
  54778. if (isDef(ref$$1)) {
  54779. if (nodeOps.parentNode(ref$$1) === parent) {
  54780. nodeOps.insertBefore(parent, elm, ref$$1);
  54781. }
  54782. } else {
  54783. nodeOps.appendChild(parent, elm);
  54784. }
  54785. }
  54786. }
  54787. function createChildren (vnode, children, insertedVnodeQueue) {
  54788. if (Array.isArray(children)) {
  54789. {
  54790. checkDuplicateKeys(children);
  54791. }
  54792. for (var i = 0; i < children.length; ++i) {
  54793. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  54794. }
  54795. } else if (isPrimitive(vnode.text)) {
  54796. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  54797. }
  54798. }
  54799. function isPatchable (vnode) {
  54800. while (vnode.componentInstance) {
  54801. vnode = vnode.componentInstance._vnode;
  54802. }
  54803. return isDef(vnode.tag)
  54804. }
  54805. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  54806. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  54807. cbs.create[i$1](emptyNode, vnode);
  54808. }
  54809. i = vnode.data.hook; // Reuse variable
  54810. if (isDef(i)) {
  54811. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  54812. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  54813. }
  54814. }
  54815. // set scope id attribute for scoped CSS.
  54816. // this is implemented as a special case to avoid the overhead
  54817. // of going through the normal attribute patching process.
  54818. function setScope (vnode) {
  54819. var i;
  54820. if (isDef(i = vnode.fnScopeId)) {
  54821. nodeOps.setStyleScope(vnode.elm, i);
  54822. } else {
  54823. var ancestor = vnode;
  54824. while (ancestor) {
  54825. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  54826. nodeOps.setStyleScope(vnode.elm, i);
  54827. }
  54828. ancestor = ancestor.parent;
  54829. }
  54830. }
  54831. // for slot content they should also get the scopeId from the host instance.
  54832. if (isDef(i = activeInstance) &&
  54833. i !== vnode.context &&
  54834. i !== vnode.fnContext &&
  54835. isDef(i = i.$options._scopeId)
  54836. ) {
  54837. nodeOps.setStyleScope(vnode.elm, i);
  54838. }
  54839. }
  54840. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  54841. for (; startIdx <= endIdx; ++startIdx) {
  54842. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  54843. }
  54844. }
  54845. function invokeDestroyHook (vnode) {
  54846. var i, j;
  54847. var data = vnode.data;
  54848. if (isDef(data)) {
  54849. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  54850. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  54851. }
  54852. if (isDef(i = vnode.children)) {
  54853. for (j = 0; j < vnode.children.length; ++j) {
  54854. invokeDestroyHook(vnode.children[j]);
  54855. }
  54856. }
  54857. }
  54858. function removeVnodes (vnodes, startIdx, endIdx) {
  54859. for (; startIdx <= endIdx; ++startIdx) {
  54860. var ch = vnodes[startIdx];
  54861. if (isDef(ch)) {
  54862. if (isDef(ch.tag)) {
  54863. removeAndInvokeRemoveHook(ch);
  54864. invokeDestroyHook(ch);
  54865. } else { // Text node
  54866. removeNode(ch.elm);
  54867. }
  54868. }
  54869. }
  54870. }
  54871. function removeAndInvokeRemoveHook (vnode, rm) {
  54872. if (isDef(rm) || isDef(vnode.data)) {
  54873. var i;
  54874. var listeners = cbs.remove.length + 1;
  54875. if (isDef(rm)) {
  54876. // we have a recursively passed down rm callback
  54877. // increase the listeners count
  54878. rm.listeners += listeners;
  54879. } else {
  54880. // directly removing
  54881. rm = createRmCb(vnode.elm, listeners);
  54882. }
  54883. // recursively invoke hooks on child component root node
  54884. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  54885. removeAndInvokeRemoveHook(i, rm);
  54886. }
  54887. for (i = 0; i < cbs.remove.length; ++i) {
  54888. cbs.remove[i](vnode, rm);
  54889. }
  54890. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  54891. i(vnode, rm);
  54892. } else {
  54893. rm();
  54894. }
  54895. } else {
  54896. removeNode(vnode.elm);
  54897. }
  54898. }
  54899. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  54900. var oldStartIdx = 0;
  54901. var newStartIdx = 0;
  54902. var oldEndIdx = oldCh.length - 1;
  54903. var oldStartVnode = oldCh[0];
  54904. var oldEndVnode = oldCh[oldEndIdx];
  54905. var newEndIdx = newCh.length - 1;
  54906. var newStartVnode = newCh[0];
  54907. var newEndVnode = newCh[newEndIdx];
  54908. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  54909. // removeOnly is a special flag used only by <transition-group>
  54910. // to ensure removed elements stay in correct relative positions
  54911. // during leaving transitions
  54912. var canMove = !removeOnly;
  54913. {
  54914. checkDuplicateKeys(newCh);
  54915. }
  54916. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  54917. if (isUndef(oldStartVnode)) {
  54918. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  54919. } else if (isUndef(oldEndVnode)) {
  54920. oldEndVnode = oldCh[--oldEndIdx];
  54921. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  54922. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  54923. oldStartVnode = oldCh[++oldStartIdx];
  54924. newStartVnode = newCh[++newStartIdx];
  54925. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  54926. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  54927. oldEndVnode = oldCh[--oldEndIdx];
  54928. newEndVnode = newCh[--newEndIdx];
  54929. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  54930. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  54931. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  54932. oldStartVnode = oldCh[++oldStartIdx];
  54933. newEndVnode = newCh[--newEndIdx];
  54934. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  54935. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  54936. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  54937. oldEndVnode = oldCh[--oldEndIdx];
  54938. newStartVnode = newCh[++newStartIdx];
  54939. } else {
  54940. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  54941. idxInOld = isDef(newStartVnode.key)
  54942. ? oldKeyToIdx[newStartVnode.key]
  54943. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  54944. if (isUndef(idxInOld)) { // New element
  54945. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  54946. } else {
  54947. vnodeToMove = oldCh[idxInOld];
  54948. if (sameVnode(vnodeToMove, newStartVnode)) {
  54949. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  54950. oldCh[idxInOld] = undefined;
  54951. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  54952. } else {
  54953. // same key but different element. treat as new element
  54954. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  54955. }
  54956. }
  54957. newStartVnode = newCh[++newStartIdx];
  54958. }
  54959. }
  54960. if (oldStartIdx > oldEndIdx) {
  54961. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  54962. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  54963. } else if (newStartIdx > newEndIdx) {
  54964. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  54965. }
  54966. }
  54967. function checkDuplicateKeys (children) {
  54968. var seenKeys = {};
  54969. for (var i = 0; i < children.length; i++) {
  54970. var vnode = children[i];
  54971. var key = vnode.key;
  54972. if (isDef(key)) {
  54973. if (seenKeys[key]) {
  54974. warn(
  54975. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  54976. vnode.context
  54977. );
  54978. } else {
  54979. seenKeys[key] = true;
  54980. }
  54981. }
  54982. }
  54983. }
  54984. function findIdxInOld (node, oldCh, start, end) {
  54985. for (var i = start; i < end; i++) {
  54986. var c = oldCh[i];
  54987. if (isDef(c) && sameVnode(node, c)) { return i }
  54988. }
  54989. }
  54990. function patchVnode (
  54991. oldVnode,
  54992. vnode,
  54993. insertedVnodeQueue,
  54994. ownerArray,
  54995. index,
  54996. removeOnly
  54997. ) {
  54998. if (oldVnode === vnode) {
  54999. return
  55000. }
  55001. if (isDef(vnode.elm) && isDef(ownerArray)) {
  55002. // clone reused vnode
  55003. vnode = ownerArray[index] = cloneVNode(vnode);
  55004. }
  55005. var elm = vnode.elm = oldVnode.elm;
  55006. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  55007. if (isDef(vnode.asyncFactory.resolved)) {
  55008. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  55009. } else {
  55010. vnode.isAsyncPlaceholder = true;
  55011. }
  55012. return
  55013. }
  55014. // reuse element for static trees.
  55015. // note we only do this if the vnode is cloned -
  55016. // if the new node is not cloned it means the render functions have been
  55017. // reset by the hot-reload-api and we need to do a proper re-render.
  55018. if (isTrue(vnode.isStatic) &&
  55019. isTrue(oldVnode.isStatic) &&
  55020. vnode.key === oldVnode.key &&
  55021. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  55022. ) {
  55023. vnode.componentInstance = oldVnode.componentInstance;
  55024. return
  55025. }
  55026. var i;
  55027. var data = vnode.data;
  55028. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  55029. i(oldVnode, vnode);
  55030. }
  55031. var oldCh = oldVnode.children;
  55032. var ch = vnode.children;
  55033. if (isDef(data) && isPatchable(vnode)) {
  55034. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  55035. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  55036. }
  55037. if (isUndef(vnode.text)) {
  55038. if (isDef(oldCh) && isDef(ch)) {
  55039. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  55040. } else if (isDef(ch)) {
  55041. {
  55042. checkDuplicateKeys(ch);
  55043. }
  55044. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  55045. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  55046. } else if (isDef(oldCh)) {
  55047. removeVnodes(oldCh, 0, oldCh.length - 1);
  55048. } else if (isDef(oldVnode.text)) {
  55049. nodeOps.setTextContent(elm, '');
  55050. }
  55051. } else if (oldVnode.text !== vnode.text) {
  55052. nodeOps.setTextContent(elm, vnode.text);
  55053. }
  55054. if (isDef(data)) {
  55055. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  55056. }
  55057. }
  55058. function invokeInsertHook (vnode, queue, initial) {
  55059. // delay insert hooks for component root nodes, invoke them after the
  55060. // element is really inserted
  55061. if (isTrue(initial) && isDef(vnode.parent)) {
  55062. vnode.parent.data.pendingInsert = queue;
  55063. } else {
  55064. for (var i = 0; i < queue.length; ++i) {
  55065. queue[i].data.hook.insert(queue[i]);
  55066. }
  55067. }
  55068. }
  55069. var hydrationBailed = false;
  55070. // list of modules that can skip create hook during hydration because they
  55071. // are already rendered on the client or has no need for initialization
  55072. // Note: style is excluded because it relies on initial clone for future
  55073. // deep updates (#7063).
  55074. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  55075. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  55076. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  55077. var i;
  55078. var tag = vnode.tag;
  55079. var data = vnode.data;
  55080. var children = vnode.children;
  55081. inVPre = inVPre || (data && data.pre);
  55082. vnode.elm = elm;
  55083. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  55084. vnode.isAsyncPlaceholder = true;
  55085. return true
  55086. }
  55087. // assert node match
  55088. {
  55089. if (!assertNodeMatch(elm, vnode, inVPre)) {
  55090. return false
  55091. }
  55092. }
  55093. if (isDef(data)) {
  55094. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  55095. if (isDef(i = vnode.componentInstance)) {
  55096. // child component. it should have hydrated its own tree.
  55097. initComponent(vnode, insertedVnodeQueue);
  55098. return true
  55099. }
  55100. }
  55101. if (isDef(tag)) {
  55102. if (isDef(children)) {
  55103. // empty element, allow client to pick up and populate children
  55104. if (!elm.hasChildNodes()) {
  55105. createChildren(vnode, children, insertedVnodeQueue);
  55106. } else {
  55107. // v-html and domProps: innerHTML
  55108. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  55109. if (i !== elm.innerHTML) {
  55110. /* istanbul ignore if */
  55111. if (typeof console !== 'undefined' &&
  55112. !hydrationBailed
  55113. ) {
  55114. hydrationBailed = true;
  55115. console.warn('Parent: ', elm);
  55116. console.warn('server innerHTML: ', i);
  55117. console.warn('client innerHTML: ', elm.innerHTML);
  55118. }
  55119. return false
  55120. }
  55121. } else {
  55122. // iterate and compare children lists
  55123. var childrenMatch = true;
  55124. var childNode = elm.firstChild;
  55125. for (var i$1 = 0; i$1 < children.length; i$1++) {
  55126. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  55127. childrenMatch = false;
  55128. break
  55129. }
  55130. childNode = childNode.nextSibling;
  55131. }
  55132. // if childNode is not null, it means the actual childNodes list is
  55133. // longer than the virtual children list.
  55134. if (!childrenMatch || childNode) {
  55135. /* istanbul ignore if */
  55136. if (typeof console !== 'undefined' &&
  55137. !hydrationBailed
  55138. ) {
  55139. hydrationBailed = true;
  55140. console.warn('Parent: ', elm);
  55141. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  55142. }
  55143. return false
  55144. }
  55145. }
  55146. }
  55147. }
  55148. if (isDef(data)) {
  55149. var fullInvoke = false;
  55150. for (var key in data) {
  55151. if (!isRenderedModule(key)) {
  55152. fullInvoke = true;
  55153. invokeCreateHooks(vnode, insertedVnodeQueue);
  55154. break
  55155. }
  55156. }
  55157. if (!fullInvoke && data['class']) {
  55158. // ensure collecting deps for deep class bindings for future updates
  55159. traverse(data['class']);
  55160. }
  55161. }
  55162. } else if (elm.data !== vnode.text) {
  55163. elm.data = vnode.text;
  55164. }
  55165. return true
  55166. }
  55167. function assertNodeMatch (node, vnode, inVPre) {
  55168. if (isDef(vnode.tag)) {
  55169. return vnode.tag.indexOf('vue-component') === 0 || (
  55170. !isUnknownElement$$1(vnode, inVPre) &&
  55171. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  55172. )
  55173. } else {
  55174. return node.nodeType === (vnode.isComment ? 8 : 3)
  55175. }
  55176. }
  55177. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  55178. if (isUndef(vnode)) {
  55179. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  55180. return
  55181. }
  55182. var isInitialPatch = false;
  55183. var insertedVnodeQueue = [];
  55184. if (isUndef(oldVnode)) {
  55185. // empty mount (likely as component), create new root element
  55186. isInitialPatch = true;
  55187. createElm(vnode, insertedVnodeQueue);
  55188. } else {
  55189. var isRealElement = isDef(oldVnode.nodeType);
  55190. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  55191. // patch existing root node
  55192. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  55193. } else {
  55194. if (isRealElement) {
  55195. // mounting to a real element
  55196. // check if this is server-rendered content and if we can perform
  55197. // a successful hydration.
  55198. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  55199. oldVnode.removeAttribute(SSR_ATTR);
  55200. hydrating = true;
  55201. }
  55202. if (isTrue(hydrating)) {
  55203. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  55204. invokeInsertHook(vnode, insertedVnodeQueue, true);
  55205. return oldVnode
  55206. } else {
  55207. warn(
  55208. 'The client-side rendered virtual DOM tree is not matching ' +
  55209. 'server-rendered content. This is likely caused by incorrect ' +
  55210. 'HTML markup, for example nesting block-level elements inside ' +
  55211. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  55212. 'full client-side render.'
  55213. );
  55214. }
  55215. }
  55216. // either not server-rendered, or hydration failed.
  55217. // create an empty node and replace it
  55218. oldVnode = emptyNodeAt(oldVnode);
  55219. }
  55220. // replacing existing element
  55221. var oldElm = oldVnode.elm;
  55222. var parentElm = nodeOps.parentNode(oldElm);
  55223. // create new node
  55224. createElm(
  55225. vnode,
  55226. insertedVnodeQueue,
  55227. // extremely rare edge case: do not insert if old element is in a
  55228. // leaving transition. Only happens when combining transition +
  55229. // keep-alive + HOCs. (#4590)
  55230. oldElm._leaveCb ? null : parentElm,
  55231. nodeOps.nextSibling(oldElm)
  55232. );
  55233. // update parent placeholder node element, recursively
  55234. if (isDef(vnode.parent)) {
  55235. var ancestor = vnode.parent;
  55236. var patchable = isPatchable(vnode);
  55237. while (ancestor) {
  55238. for (var i = 0; i < cbs.destroy.length; ++i) {
  55239. cbs.destroy[i](ancestor);
  55240. }
  55241. ancestor.elm = vnode.elm;
  55242. if (patchable) {
  55243. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  55244. cbs.create[i$1](emptyNode, ancestor);
  55245. }
  55246. // #6513
  55247. // invoke insert hooks that may have been merged by create hooks.
  55248. // e.g. for directives that uses the "inserted" hook.
  55249. var insert = ancestor.data.hook.insert;
  55250. if (insert.merged) {
  55251. // start at index 1 to avoid re-invoking component mounted hook
  55252. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  55253. insert.fns[i$2]();
  55254. }
  55255. }
  55256. } else {
  55257. registerRef(ancestor);
  55258. }
  55259. ancestor = ancestor.parent;
  55260. }
  55261. }
  55262. // destroy old node
  55263. if (isDef(parentElm)) {
  55264. removeVnodes([oldVnode], 0, 0);
  55265. } else if (isDef(oldVnode.tag)) {
  55266. invokeDestroyHook(oldVnode);
  55267. }
  55268. }
  55269. }
  55270. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  55271. return vnode.elm
  55272. }
  55273. }
  55274. /* */
  55275. var directives = {
  55276. create: updateDirectives,
  55277. update: updateDirectives,
  55278. destroy: function unbindDirectives (vnode) {
  55279. updateDirectives(vnode, emptyNode);
  55280. }
  55281. };
  55282. function updateDirectives (oldVnode, vnode) {
  55283. if (oldVnode.data.directives || vnode.data.directives) {
  55284. _update(oldVnode, vnode);
  55285. }
  55286. }
  55287. function _update (oldVnode, vnode) {
  55288. var isCreate = oldVnode === emptyNode;
  55289. var isDestroy = vnode === emptyNode;
  55290. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  55291. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  55292. var dirsWithInsert = [];
  55293. var dirsWithPostpatch = [];
  55294. var key, oldDir, dir;
  55295. for (key in newDirs) {
  55296. oldDir = oldDirs[key];
  55297. dir = newDirs[key];
  55298. if (!oldDir) {
  55299. // new directive, bind
  55300. callHook$1(dir, 'bind', vnode, oldVnode);
  55301. if (dir.def && dir.def.inserted) {
  55302. dirsWithInsert.push(dir);
  55303. }
  55304. } else {
  55305. // existing directive, update
  55306. dir.oldValue = oldDir.value;
  55307. dir.oldArg = oldDir.arg;
  55308. callHook$1(dir, 'update', vnode, oldVnode);
  55309. if (dir.def && dir.def.componentUpdated) {
  55310. dirsWithPostpatch.push(dir);
  55311. }
  55312. }
  55313. }
  55314. if (dirsWithInsert.length) {
  55315. var callInsert = function () {
  55316. for (var i = 0; i < dirsWithInsert.length; i++) {
  55317. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  55318. }
  55319. };
  55320. if (isCreate) {
  55321. mergeVNodeHook(vnode, 'insert', callInsert);
  55322. } else {
  55323. callInsert();
  55324. }
  55325. }
  55326. if (dirsWithPostpatch.length) {
  55327. mergeVNodeHook(vnode, 'postpatch', function () {
  55328. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  55329. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  55330. }
  55331. });
  55332. }
  55333. if (!isCreate) {
  55334. for (key in oldDirs) {
  55335. if (!newDirs[key]) {
  55336. // no longer present, unbind
  55337. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  55338. }
  55339. }
  55340. }
  55341. }
  55342. var emptyModifiers = Object.create(null);
  55343. function normalizeDirectives$1 (
  55344. dirs,
  55345. vm
  55346. ) {
  55347. var res = Object.create(null);
  55348. if (!dirs) {
  55349. // $flow-disable-line
  55350. return res
  55351. }
  55352. var i, dir;
  55353. for (i = 0; i < dirs.length; i++) {
  55354. dir = dirs[i];
  55355. if (!dir.modifiers) {
  55356. // $flow-disable-line
  55357. dir.modifiers = emptyModifiers;
  55358. }
  55359. res[getRawDirName(dir)] = dir;
  55360. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  55361. }
  55362. // $flow-disable-line
  55363. return res
  55364. }
  55365. function getRawDirName (dir) {
  55366. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  55367. }
  55368. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  55369. var fn = dir.def && dir.def[hook];
  55370. if (fn) {
  55371. try {
  55372. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  55373. } catch (e) {
  55374. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  55375. }
  55376. }
  55377. }
  55378. var baseModules = [
  55379. ref,
  55380. directives
  55381. ];
  55382. /* */
  55383. function updateAttrs (oldVnode, vnode) {
  55384. var opts = vnode.componentOptions;
  55385. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  55386. return
  55387. }
  55388. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  55389. return
  55390. }
  55391. var key, cur, old;
  55392. var elm = vnode.elm;
  55393. var oldAttrs = oldVnode.data.attrs || {};
  55394. var attrs = vnode.data.attrs || {};
  55395. // clone observed objects, as the user probably wants to mutate it
  55396. if (isDef(attrs.__ob__)) {
  55397. attrs = vnode.data.attrs = extend({}, attrs);
  55398. }
  55399. for (key in attrs) {
  55400. cur = attrs[key];
  55401. old = oldAttrs[key];
  55402. if (old !== cur) {
  55403. setAttr(elm, key, cur);
  55404. }
  55405. }
  55406. // #4391: in IE9, setting type can reset value for input[type=radio]
  55407. // #6666: IE/Edge forces progress value down to 1 before setting a max
  55408. /* istanbul ignore if */
  55409. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  55410. setAttr(elm, 'value', attrs.value);
  55411. }
  55412. for (key in oldAttrs) {
  55413. if (isUndef(attrs[key])) {
  55414. if (isXlink(key)) {
  55415. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  55416. } else if (!isEnumeratedAttr(key)) {
  55417. elm.removeAttribute(key);
  55418. }
  55419. }
  55420. }
  55421. }
  55422. function setAttr (el, key, value) {
  55423. if (el.tagName.indexOf('-') > -1) {
  55424. baseSetAttr(el, key, value);
  55425. } else if (isBooleanAttr(key)) {
  55426. // set attribute for blank value
  55427. // e.g. <option disabled>Select one</option>
  55428. if (isFalsyAttrValue(value)) {
  55429. el.removeAttribute(key);
  55430. } else {
  55431. // technically allowfullscreen is a boolean attribute for <iframe>,
  55432. // but Flash expects a value of "true" when used on <embed> tag
  55433. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  55434. ? 'true'
  55435. : key;
  55436. el.setAttribute(key, value);
  55437. }
  55438. } else if (isEnumeratedAttr(key)) {
  55439. el.setAttribute(key, convertEnumeratedValue(key, value));
  55440. } else if (isXlink(key)) {
  55441. if (isFalsyAttrValue(value)) {
  55442. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  55443. } else {
  55444. el.setAttributeNS(xlinkNS, key, value);
  55445. }
  55446. } else {
  55447. baseSetAttr(el, key, value);
  55448. }
  55449. }
  55450. function baseSetAttr (el, key, value) {
  55451. if (isFalsyAttrValue(value)) {
  55452. el.removeAttribute(key);
  55453. } else {
  55454. // #7138: IE10 & 11 fires input event when setting placeholder on
  55455. // <textarea>... block the first input event and remove the blocker
  55456. // immediately.
  55457. /* istanbul ignore if */
  55458. if (
  55459. isIE && !isIE9 &&
  55460. el.tagName === 'TEXTAREA' &&
  55461. key === 'placeholder' && value !== '' && !el.__ieph
  55462. ) {
  55463. var blocker = function (e) {
  55464. e.stopImmediatePropagation();
  55465. el.removeEventListener('input', blocker);
  55466. };
  55467. el.addEventListener('input', blocker);
  55468. // $flow-disable-line
  55469. el.__ieph = true; /* IE placeholder patched */
  55470. }
  55471. el.setAttribute(key, value);
  55472. }
  55473. }
  55474. var attrs = {
  55475. create: updateAttrs,
  55476. update: updateAttrs
  55477. };
  55478. /* */
  55479. function updateClass (oldVnode, vnode) {
  55480. var el = vnode.elm;
  55481. var data = vnode.data;
  55482. var oldData = oldVnode.data;
  55483. if (
  55484. isUndef(data.staticClass) &&
  55485. isUndef(data.class) && (
  55486. isUndef(oldData) || (
  55487. isUndef(oldData.staticClass) &&
  55488. isUndef(oldData.class)
  55489. )
  55490. )
  55491. ) {
  55492. return
  55493. }
  55494. var cls = genClassForVnode(vnode);
  55495. // handle transition classes
  55496. var transitionClass = el._transitionClasses;
  55497. if (isDef(transitionClass)) {
  55498. cls = concat(cls, stringifyClass(transitionClass));
  55499. }
  55500. // set the class
  55501. if (cls !== el._prevClass) {
  55502. el.setAttribute('class', cls);
  55503. el._prevClass = cls;
  55504. }
  55505. }
  55506. var klass = {
  55507. create: updateClass,
  55508. update: updateClass
  55509. };
  55510. /* */
  55511. var validDivisionCharRE = /[\w).+\-_$\]]/;
  55512. function parseFilters (exp) {
  55513. var inSingle = false;
  55514. var inDouble = false;
  55515. var inTemplateString = false;
  55516. var inRegex = false;
  55517. var curly = 0;
  55518. var square = 0;
  55519. var paren = 0;
  55520. var lastFilterIndex = 0;
  55521. var c, prev, i, expression, filters;
  55522. for (i = 0; i < exp.length; i++) {
  55523. prev = c;
  55524. c = exp.charCodeAt(i);
  55525. if (inSingle) {
  55526. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  55527. } else if (inDouble) {
  55528. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  55529. } else if (inTemplateString) {
  55530. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  55531. } else if (inRegex) {
  55532. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  55533. } else if (
  55534. c === 0x7C && // pipe
  55535. exp.charCodeAt(i + 1) !== 0x7C &&
  55536. exp.charCodeAt(i - 1) !== 0x7C &&
  55537. !curly && !square && !paren
  55538. ) {
  55539. if (expression === undefined) {
  55540. // first filter, end of expression
  55541. lastFilterIndex = i + 1;
  55542. expression = exp.slice(0, i).trim();
  55543. } else {
  55544. pushFilter();
  55545. }
  55546. } else {
  55547. switch (c) {
  55548. case 0x22: inDouble = true; break // "
  55549. case 0x27: inSingle = true; break // '
  55550. case 0x60: inTemplateString = true; break // `
  55551. case 0x28: paren++; break // (
  55552. case 0x29: paren--; break // )
  55553. case 0x5B: square++; break // [
  55554. case 0x5D: square--; break // ]
  55555. case 0x7B: curly++; break // {
  55556. case 0x7D: curly--; break // }
  55557. }
  55558. if (c === 0x2f) { // /
  55559. var j = i - 1;
  55560. var p = (void 0);
  55561. // find first non-whitespace prev char
  55562. for (; j >= 0; j--) {
  55563. p = exp.charAt(j);
  55564. if (p !== ' ') { break }
  55565. }
  55566. if (!p || !validDivisionCharRE.test(p)) {
  55567. inRegex = true;
  55568. }
  55569. }
  55570. }
  55571. }
  55572. if (expression === undefined) {
  55573. expression = exp.slice(0, i).trim();
  55574. } else if (lastFilterIndex !== 0) {
  55575. pushFilter();
  55576. }
  55577. function pushFilter () {
  55578. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  55579. lastFilterIndex = i + 1;
  55580. }
  55581. if (filters) {
  55582. for (i = 0; i < filters.length; i++) {
  55583. expression = wrapFilter(expression, filters[i]);
  55584. }
  55585. }
  55586. return expression
  55587. }
  55588. function wrapFilter (exp, filter) {
  55589. var i = filter.indexOf('(');
  55590. if (i < 0) {
  55591. // _f: resolveFilter
  55592. return ("_f(\"" + filter + "\")(" + exp + ")")
  55593. } else {
  55594. var name = filter.slice(0, i);
  55595. var args = filter.slice(i + 1);
  55596. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  55597. }
  55598. }
  55599. /* */
  55600. /* eslint-disable no-unused-vars */
  55601. function baseWarn (msg, range) {
  55602. console.error(("[Vue compiler]: " + msg));
  55603. }
  55604. /* eslint-enable no-unused-vars */
  55605. function pluckModuleFunction (
  55606. modules,
  55607. key
  55608. ) {
  55609. return modules
  55610. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  55611. : []
  55612. }
  55613. function addProp (el, name, value, range, dynamic) {
  55614. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  55615. el.plain = false;
  55616. }
  55617. function addAttr (el, name, value, range, dynamic) {
  55618. var attrs = dynamic
  55619. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  55620. : (el.attrs || (el.attrs = []));
  55621. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  55622. el.plain = false;
  55623. }
  55624. // add a raw attr (use this in preTransforms)
  55625. function addRawAttr (el, name, value, range) {
  55626. el.attrsMap[name] = value;
  55627. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  55628. }
  55629. function addDirective (
  55630. el,
  55631. name,
  55632. rawName,
  55633. value,
  55634. arg,
  55635. isDynamicArg,
  55636. modifiers,
  55637. range
  55638. ) {
  55639. (el.directives || (el.directives = [])).push(rangeSetItem({
  55640. name: name,
  55641. rawName: rawName,
  55642. value: value,
  55643. arg: arg,
  55644. isDynamicArg: isDynamicArg,
  55645. modifiers: modifiers
  55646. }, range));
  55647. el.plain = false;
  55648. }
  55649. function prependModifierMarker (symbol, name, dynamic) {
  55650. return dynamic
  55651. ? ("_p(" + name + ",\"" + symbol + "\")")
  55652. : symbol + name // mark the event as captured
  55653. }
  55654. function addHandler (
  55655. el,
  55656. name,
  55657. value,
  55658. modifiers,
  55659. important,
  55660. warn,
  55661. range,
  55662. dynamic
  55663. ) {
  55664. modifiers = modifiers || emptyObject;
  55665. // warn prevent and passive modifier
  55666. /* istanbul ignore if */
  55667. if (
  55668. warn &&
  55669. modifiers.prevent && modifiers.passive
  55670. ) {
  55671. warn(
  55672. 'passive and prevent can\'t be used together. ' +
  55673. 'Passive handler can\'t prevent default event.',
  55674. range
  55675. );
  55676. }
  55677. // normalize click.right and click.middle since they don't actually fire
  55678. // this is technically browser-specific, but at least for now browsers are
  55679. // the only target envs that have right/middle clicks.
  55680. if (modifiers.right) {
  55681. if (dynamic) {
  55682. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  55683. } else if (name === 'click') {
  55684. name = 'contextmenu';
  55685. delete modifiers.right;
  55686. }
  55687. } else if (modifiers.middle) {
  55688. if (dynamic) {
  55689. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  55690. } else if (name === 'click') {
  55691. name = 'mouseup';
  55692. }
  55693. }
  55694. // check capture modifier
  55695. if (modifiers.capture) {
  55696. delete modifiers.capture;
  55697. name = prependModifierMarker('!', name, dynamic);
  55698. }
  55699. if (modifiers.once) {
  55700. delete modifiers.once;
  55701. name = prependModifierMarker('~', name, dynamic);
  55702. }
  55703. /* istanbul ignore if */
  55704. if (modifiers.passive) {
  55705. delete modifiers.passive;
  55706. name = prependModifierMarker('&', name, dynamic);
  55707. }
  55708. var events;
  55709. if (modifiers.native) {
  55710. delete modifiers.native;
  55711. events = el.nativeEvents || (el.nativeEvents = {});
  55712. } else {
  55713. events = el.events || (el.events = {});
  55714. }
  55715. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  55716. if (modifiers !== emptyObject) {
  55717. newHandler.modifiers = modifiers;
  55718. }
  55719. var handlers = events[name];
  55720. /* istanbul ignore if */
  55721. if (Array.isArray(handlers)) {
  55722. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  55723. } else if (handlers) {
  55724. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  55725. } else {
  55726. events[name] = newHandler;
  55727. }
  55728. el.plain = false;
  55729. }
  55730. function getRawBindingAttr (
  55731. el,
  55732. name
  55733. ) {
  55734. return el.rawAttrsMap[':' + name] ||
  55735. el.rawAttrsMap['v-bind:' + name] ||
  55736. el.rawAttrsMap[name]
  55737. }
  55738. function getBindingAttr (
  55739. el,
  55740. name,
  55741. getStatic
  55742. ) {
  55743. var dynamicValue =
  55744. getAndRemoveAttr(el, ':' + name) ||
  55745. getAndRemoveAttr(el, 'v-bind:' + name);
  55746. if (dynamicValue != null) {
  55747. return parseFilters(dynamicValue)
  55748. } else if (getStatic !== false) {
  55749. var staticValue = getAndRemoveAttr(el, name);
  55750. if (staticValue != null) {
  55751. return JSON.stringify(staticValue)
  55752. }
  55753. }
  55754. }
  55755. // note: this only removes the attr from the Array (attrsList) so that it
  55756. // doesn't get processed by processAttrs.
  55757. // By default it does NOT remove it from the map (attrsMap) because the map is
  55758. // needed during codegen.
  55759. function getAndRemoveAttr (
  55760. el,
  55761. name,
  55762. removeFromMap
  55763. ) {
  55764. var val;
  55765. if ((val = el.attrsMap[name]) != null) {
  55766. var list = el.attrsList;
  55767. for (var i = 0, l = list.length; i < l; i++) {
  55768. if (list[i].name === name) {
  55769. list.splice(i, 1);
  55770. break
  55771. }
  55772. }
  55773. }
  55774. if (removeFromMap) {
  55775. delete el.attrsMap[name];
  55776. }
  55777. return val
  55778. }
  55779. function getAndRemoveAttrByRegex (
  55780. el,
  55781. name
  55782. ) {
  55783. var list = el.attrsList;
  55784. for (var i = 0, l = list.length; i < l; i++) {
  55785. var attr = list[i];
  55786. if (name.test(attr.name)) {
  55787. list.splice(i, 1);
  55788. return attr
  55789. }
  55790. }
  55791. }
  55792. function rangeSetItem (
  55793. item,
  55794. range
  55795. ) {
  55796. if (range) {
  55797. if (range.start != null) {
  55798. item.start = range.start;
  55799. }
  55800. if (range.end != null) {
  55801. item.end = range.end;
  55802. }
  55803. }
  55804. return item
  55805. }
  55806. /* */
  55807. /**
  55808. * Cross-platform code generation for component v-model
  55809. */
  55810. function genComponentModel (
  55811. el,
  55812. value,
  55813. modifiers
  55814. ) {
  55815. var ref = modifiers || {};
  55816. var number = ref.number;
  55817. var trim = ref.trim;
  55818. var baseValueExpression = '$$v';
  55819. var valueExpression = baseValueExpression;
  55820. if (trim) {
  55821. valueExpression =
  55822. "(typeof " + baseValueExpression + " === 'string'" +
  55823. "? " + baseValueExpression + ".trim()" +
  55824. ": " + baseValueExpression + ")";
  55825. }
  55826. if (number) {
  55827. valueExpression = "_n(" + valueExpression + ")";
  55828. }
  55829. var assignment = genAssignmentCode(value, valueExpression);
  55830. el.model = {
  55831. value: ("(" + value + ")"),
  55832. expression: JSON.stringify(value),
  55833. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  55834. };
  55835. }
  55836. /**
  55837. * Cross-platform codegen helper for generating v-model value assignment code.
  55838. */
  55839. function genAssignmentCode (
  55840. value,
  55841. assignment
  55842. ) {
  55843. var res = parseModel(value);
  55844. if (res.key === null) {
  55845. return (value + "=" + assignment)
  55846. } else {
  55847. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  55848. }
  55849. }
  55850. /**
  55851. * Parse a v-model expression into a base path and a final key segment.
  55852. * Handles both dot-path and possible square brackets.
  55853. *
  55854. * Possible cases:
  55855. *
  55856. * - test
  55857. * - test[key]
  55858. * - test[test1[key]]
  55859. * - test["a"][key]
  55860. * - xxx.test[a[a].test1[key]]
  55861. * - test.xxx.a["asa"][test1[key]]
  55862. *
  55863. */
  55864. var len, str, chr, index$1, expressionPos, expressionEndPos;
  55865. function parseModel (val) {
  55866. // Fix https://github.com/vuejs/vue/pull/7730
  55867. // allow v-model="obj.val " (trailing whitespace)
  55868. val = val.trim();
  55869. len = val.length;
  55870. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  55871. index$1 = val.lastIndexOf('.');
  55872. if (index$1 > -1) {
  55873. return {
  55874. exp: val.slice(0, index$1),
  55875. key: '"' + val.slice(index$1 + 1) + '"'
  55876. }
  55877. } else {
  55878. return {
  55879. exp: val,
  55880. key: null
  55881. }
  55882. }
  55883. }
  55884. str = val;
  55885. index$1 = expressionPos = expressionEndPos = 0;
  55886. while (!eof()) {
  55887. chr = next();
  55888. /* istanbul ignore if */
  55889. if (isStringStart(chr)) {
  55890. parseString(chr);
  55891. } else if (chr === 0x5B) {
  55892. parseBracket(chr);
  55893. }
  55894. }
  55895. return {
  55896. exp: val.slice(0, expressionPos),
  55897. key: val.slice(expressionPos + 1, expressionEndPos)
  55898. }
  55899. }
  55900. function next () {
  55901. return str.charCodeAt(++index$1)
  55902. }
  55903. function eof () {
  55904. return index$1 >= len
  55905. }
  55906. function isStringStart (chr) {
  55907. return chr === 0x22 || chr === 0x27
  55908. }
  55909. function parseBracket (chr) {
  55910. var inBracket = 1;
  55911. expressionPos = index$1;
  55912. while (!eof()) {
  55913. chr = next();
  55914. if (isStringStart(chr)) {
  55915. parseString(chr);
  55916. continue
  55917. }
  55918. if (chr === 0x5B) { inBracket++; }
  55919. if (chr === 0x5D) { inBracket--; }
  55920. if (inBracket === 0) {
  55921. expressionEndPos = index$1;
  55922. break
  55923. }
  55924. }
  55925. }
  55926. function parseString (chr) {
  55927. var stringQuote = chr;
  55928. while (!eof()) {
  55929. chr = next();
  55930. if (chr === stringQuote) {
  55931. break
  55932. }
  55933. }
  55934. }
  55935. /* */
  55936. var warn$1;
  55937. // in some cases, the event used has to be determined at runtime
  55938. // so we used some reserved tokens during compile.
  55939. var RANGE_TOKEN = '__r';
  55940. var CHECKBOX_RADIO_TOKEN = '__c';
  55941. function model (
  55942. el,
  55943. dir,
  55944. _warn
  55945. ) {
  55946. warn$1 = _warn;
  55947. var value = dir.value;
  55948. var modifiers = dir.modifiers;
  55949. var tag = el.tag;
  55950. var type = el.attrsMap.type;
  55951. {
  55952. // inputs with type="file" are read only and setting the input's
  55953. // value will throw an error.
  55954. if (tag === 'input' && type === 'file') {
  55955. warn$1(
  55956. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  55957. "File inputs are read only. Use a v-on:change listener instead.",
  55958. el.rawAttrsMap['v-model']
  55959. );
  55960. }
  55961. }
  55962. if (el.component) {
  55963. genComponentModel(el, value, modifiers);
  55964. // component v-model doesn't need extra runtime
  55965. return false
  55966. } else if (tag === 'select') {
  55967. genSelect(el, value, modifiers);
  55968. } else if (tag === 'input' && type === 'checkbox') {
  55969. genCheckboxModel(el, value, modifiers);
  55970. } else if (tag === 'input' && type === 'radio') {
  55971. genRadioModel(el, value, modifiers);
  55972. } else if (tag === 'input' || tag === 'textarea') {
  55973. genDefaultModel(el, value, modifiers);
  55974. } else if (!config.isReservedTag(tag)) {
  55975. genComponentModel(el, value, modifiers);
  55976. // component v-model doesn't need extra runtime
  55977. return false
  55978. } else {
  55979. warn$1(
  55980. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  55981. "v-model is not supported on this element type. " +
  55982. 'If you are working with contenteditable, it\'s recommended to ' +
  55983. 'wrap a library dedicated for that purpose inside a custom component.',
  55984. el.rawAttrsMap['v-model']
  55985. );
  55986. }
  55987. // ensure runtime directive metadata
  55988. return true
  55989. }
  55990. function genCheckboxModel (
  55991. el,
  55992. value,
  55993. modifiers
  55994. ) {
  55995. var number = modifiers && modifiers.number;
  55996. var valueBinding = getBindingAttr(el, 'value') || 'null';
  55997. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  55998. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  55999. addProp(el, 'checked',
  56000. "Array.isArray(" + value + ")" +
  56001. "?_i(" + value + "," + valueBinding + ")>-1" + (
  56002. trueValueBinding === 'true'
  56003. ? (":(" + value + ")")
  56004. : (":_q(" + value + "," + trueValueBinding + ")")
  56005. )
  56006. );
  56007. addHandler(el, 'change',
  56008. "var $$a=" + value + "," +
  56009. '$$el=$event.target,' +
  56010. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  56011. 'if(Array.isArray($$a)){' +
  56012. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  56013. '$$i=_i($$a,$$v);' +
  56014. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  56015. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  56016. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  56017. null, true
  56018. );
  56019. }
  56020. function genRadioModel (
  56021. el,
  56022. value,
  56023. modifiers
  56024. ) {
  56025. var number = modifiers && modifiers.number;
  56026. var valueBinding = getBindingAttr(el, 'value') || 'null';
  56027. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  56028. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  56029. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  56030. }
  56031. function genSelect (
  56032. el,
  56033. value,
  56034. modifiers
  56035. ) {
  56036. var number = modifiers && modifiers.number;
  56037. var selectedVal = "Array.prototype.filter" +
  56038. ".call($event.target.options,function(o){return o.selected})" +
  56039. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  56040. "return " + (number ? '_n(val)' : 'val') + "})";
  56041. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  56042. var code = "var $$selectedVal = " + selectedVal + ";";
  56043. code = code + " " + (genAssignmentCode(value, assignment));
  56044. addHandler(el, 'change', code, null, true);
  56045. }
  56046. function genDefaultModel (
  56047. el,
  56048. value,
  56049. modifiers
  56050. ) {
  56051. var type = el.attrsMap.type;
  56052. // warn if v-bind:value conflicts with v-model
  56053. // except for inputs with v-bind:type
  56054. {
  56055. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  56056. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  56057. if (value$1 && !typeBinding) {
  56058. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  56059. warn$1(
  56060. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  56061. 'because the latter already expands to a value binding internally',
  56062. el.rawAttrsMap[binding]
  56063. );
  56064. }
  56065. }
  56066. var ref = modifiers || {};
  56067. var lazy = ref.lazy;
  56068. var number = ref.number;
  56069. var trim = ref.trim;
  56070. var needCompositionGuard = !lazy && type !== 'range';
  56071. var event = lazy
  56072. ? 'change'
  56073. : type === 'range'
  56074. ? RANGE_TOKEN
  56075. : 'input';
  56076. var valueExpression = '$event.target.value';
  56077. if (trim) {
  56078. valueExpression = "$event.target.value.trim()";
  56079. }
  56080. if (number) {
  56081. valueExpression = "_n(" + valueExpression + ")";
  56082. }
  56083. var code = genAssignmentCode(value, valueExpression);
  56084. if (needCompositionGuard) {
  56085. code = "if($event.target.composing)return;" + code;
  56086. }
  56087. addProp(el, 'value', ("(" + value + ")"));
  56088. addHandler(el, event, code, null, true);
  56089. if (trim || number) {
  56090. addHandler(el, 'blur', '$forceUpdate()');
  56091. }
  56092. }
  56093. /* */
  56094. // normalize v-model event tokens that can only be determined at runtime.
  56095. // it's important to place the event as the first in the array because
  56096. // the whole point is ensuring the v-model callback gets called before
  56097. // user-attached handlers.
  56098. function normalizeEvents (on) {
  56099. /* istanbul ignore if */
  56100. if (isDef(on[RANGE_TOKEN])) {
  56101. // IE input[type=range] only supports `change` event
  56102. var event = isIE ? 'change' : 'input';
  56103. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  56104. delete on[RANGE_TOKEN];
  56105. }
  56106. // This was originally intended to fix #4521 but no longer necessary
  56107. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  56108. /* istanbul ignore if */
  56109. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  56110. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  56111. delete on[CHECKBOX_RADIO_TOKEN];
  56112. }
  56113. }
  56114. var target$1;
  56115. function createOnceHandler$1 (event, handler, capture) {
  56116. var _target = target$1; // save current target element in closure
  56117. return function onceHandler () {
  56118. var res = handler.apply(null, arguments);
  56119. if (res !== null) {
  56120. remove$2(event, onceHandler, capture, _target);
  56121. }
  56122. }
  56123. }
  56124. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  56125. // implementation and does not fire microtasks in between event propagation, so
  56126. // safe to exclude.
  56127. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  56128. function add$1 (
  56129. name,
  56130. handler,
  56131. capture,
  56132. passive
  56133. ) {
  56134. // async edge case #6566: inner click event triggers patch, event handler
  56135. // attached to outer element during patch, and triggered again. This
  56136. // happens because browsers fire microtask ticks between event propagation.
  56137. // the solution is simple: we save the timestamp when a handler is attached,
  56138. // and the handler would only fire if the event passed to it was fired
  56139. // AFTER it was attached.
  56140. if (useMicrotaskFix) {
  56141. var attachedTimestamp = currentFlushTimestamp;
  56142. var original = handler;
  56143. handler = original._wrapper = function (e) {
  56144. if (
  56145. // no bubbling, should always fire.
  56146. // this is just a safety net in case event.timeStamp is unreliable in
  56147. // certain weird environments...
  56148. e.target === e.currentTarget ||
  56149. // event is fired after handler attachment
  56150. e.timeStamp >= attachedTimestamp ||
  56151. // bail for environments that have buggy event.timeStamp implementations
  56152. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  56153. // #9681 QtWebEngine event.timeStamp is negative value
  56154. e.timeStamp <= 0 ||
  56155. // #9448 bail if event is fired in another document in a multi-page
  56156. // electron/nw.js app, since event.timeStamp will be using a different
  56157. // starting reference
  56158. e.target.ownerDocument !== document
  56159. ) {
  56160. return original.apply(this, arguments)
  56161. }
  56162. };
  56163. }
  56164. target$1.addEventListener(
  56165. name,
  56166. handler,
  56167. supportsPassive
  56168. ? { capture: capture, passive: passive }
  56169. : capture
  56170. );
  56171. }
  56172. function remove$2 (
  56173. name,
  56174. handler,
  56175. capture,
  56176. _target
  56177. ) {
  56178. (_target || target$1).removeEventListener(
  56179. name,
  56180. handler._wrapper || handler,
  56181. capture
  56182. );
  56183. }
  56184. function updateDOMListeners (oldVnode, vnode) {
  56185. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  56186. return
  56187. }
  56188. var on = vnode.data.on || {};
  56189. var oldOn = oldVnode.data.on || {};
  56190. target$1 = vnode.elm;
  56191. normalizeEvents(on);
  56192. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  56193. target$1 = undefined;
  56194. }
  56195. var events = {
  56196. create: updateDOMListeners,
  56197. update: updateDOMListeners
  56198. };
  56199. /* */
  56200. var svgContainer;
  56201. function updateDOMProps (oldVnode, vnode) {
  56202. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  56203. return
  56204. }
  56205. var key, cur;
  56206. var elm = vnode.elm;
  56207. var oldProps = oldVnode.data.domProps || {};
  56208. var props = vnode.data.domProps || {};
  56209. // clone observed objects, as the user probably wants to mutate it
  56210. if (isDef(props.__ob__)) {
  56211. props = vnode.data.domProps = extend({}, props);
  56212. }
  56213. for (key in oldProps) {
  56214. if (!(key in props)) {
  56215. elm[key] = '';
  56216. }
  56217. }
  56218. for (key in props) {
  56219. cur = props[key];
  56220. // ignore children if the node has textContent or innerHTML,
  56221. // as these will throw away existing DOM nodes and cause removal errors
  56222. // on subsequent patches (#3360)
  56223. if (key === 'textContent' || key === 'innerHTML') {
  56224. if (vnode.children) { vnode.children.length = 0; }
  56225. if (cur === oldProps[key]) { continue }
  56226. // #6601 work around Chrome version <= 55 bug where single textNode
  56227. // replaced by innerHTML/textContent retains its parentNode property
  56228. if (elm.childNodes.length === 1) {
  56229. elm.removeChild(elm.childNodes[0]);
  56230. }
  56231. }
  56232. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  56233. // store value as _value as well since
  56234. // non-string values will be stringified
  56235. elm._value = cur;
  56236. // avoid resetting cursor position when value is the same
  56237. var strCur = isUndef(cur) ? '' : String(cur);
  56238. if (shouldUpdateValue(elm, strCur)) {
  56239. elm.value = strCur;
  56240. }
  56241. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  56242. // IE doesn't support innerHTML for SVG elements
  56243. svgContainer = svgContainer || document.createElement('div');
  56244. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  56245. var svg = svgContainer.firstChild;
  56246. while (elm.firstChild) {
  56247. elm.removeChild(elm.firstChild);
  56248. }
  56249. while (svg.firstChild) {
  56250. elm.appendChild(svg.firstChild);
  56251. }
  56252. } else if (
  56253. // skip the update if old and new VDOM state is the same.
  56254. // `value` is handled separately because the DOM value may be temporarily
  56255. // out of sync with VDOM state due to focus, composition and modifiers.
  56256. // This #4521 by skipping the unnecesarry `checked` update.
  56257. cur !== oldProps[key]
  56258. ) {
  56259. // some property updates can throw
  56260. // e.g. `value` on <progress> w/ non-finite value
  56261. try {
  56262. elm[key] = cur;
  56263. } catch (e) {}
  56264. }
  56265. }
  56266. }
  56267. // check platforms/web/util/attrs.js acceptValue
  56268. function shouldUpdateValue (elm, checkVal) {
  56269. return (!elm.composing && (
  56270. elm.tagName === 'OPTION' ||
  56271. isNotInFocusAndDirty(elm, checkVal) ||
  56272. isDirtyWithModifiers(elm, checkVal)
  56273. ))
  56274. }
  56275. function isNotInFocusAndDirty (elm, checkVal) {
  56276. // return true when textbox (.number and .trim) loses focus and its value is
  56277. // not equal to the updated value
  56278. var notInFocus = true;
  56279. // #6157
  56280. // work around IE bug when accessing document.activeElement in an iframe
  56281. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  56282. return notInFocus && elm.value !== checkVal
  56283. }
  56284. function isDirtyWithModifiers (elm, newVal) {
  56285. var value = elm.value;
  56286. var modifiers = elm._vModifiers; // injected by v-model runtime
  56287. if (isDef(modifiers)) {
  56288. if (modifiers.number) {
  56289. return toNumber(value) !== toNumber(newVal)
  56290. }
  56291. if (modifiers.trim) {
  56292. return value.trim() !== newVal.trim()
  56293. }
  56294. }
  56295. return value !== newVal
  56296. }
  56297. var domProps = {
  56298. create: updateDOMProps,
  56299. update: updateDOMProps
  56300. };
  56301. /* */
  56302. var parseStyleText = cached(function (cssText) {
  56303. var res = {};
  56304. var listDelimiter = /;(?![^(]*\))/g;
  56305. var propertyDelimiter = /:(.+)/;
  56306. cssText.split(listDelimiter).forEach(function (item) {
  56307. if (item) {
  56308. var tmp = item.split(propertyDelimiter);
  56309. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  56310. }
  56311. });
  56312. return res
  56313. });
  56314. // merge static and dynamic style data on the same vnode
  56315. function normalizeStyleData (data) {
  56316. var style = normalizeStyleBinding(data.style);
  56317. // static style is pre-processed into an object during compilation
  56318. // and is always a fresh object, so it's safe to merge into it
  56319. return data.staticStyle
  56320. ? extend(data.staticStyle, style)
  56321. : style
  56322. }
  56323. // normalize possible array / string values into Object
  56324. function normalizeStyleBinding (bindingStyle) {
  56325. if (Array.isArray(bindingStyle)) {
  56326. return toObject(bindingStyle)
  56327. }
  56328. if (typeof bindingStyle === 'string') {
  56329. return parseStyleText(bindingStyle)
  56330. }
  56331. return bindingStyle
  56332. }
  56333. /**
  56334. * parent component style should be after child's
  56335. * so that parent component's style could override it
  56336. */
  56337. function getStyle (vnode, checkChild) {
  56338. var res = {};
  56339. var styleData;
  56340. if (checkChild) {
  56341. var childNode = vnode;
  56342. while (childNode.componentInstance) {
  56343. childNode = childNode.componentInstance._vnode;
  56344. if (
  56345. childNode && childNode.data &&
  56346. (styleData = normalizeStyleData(childNode.data))
  56347. ) {
  56348. extend(res, styleData);
  56349. }
  56350. }
  56351. }
  56352. if ((styleData = normalizeStyleData(vnode.data))) {
  56353. extend(res, styleData);
  56354. }
  56355. var parentNode = vnode;
  56356. while ((parentNode = parentNode.parent)) {
  56357. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  56358. extend(res, styleData);
  56359. }
  56360. }
  56361. return res
  56362. }
  56363. /* */
  56364. var cssVarRE = /^--/;
  56365. var importantRE = /\s*!important$/;
  56366. var setProp = function (el, name, val) {
  56367. /* istanbul ignore if */
  56368. if (cssVarRE.test(name)) {
  56369. el.style.setProperty(name, val);
  56370. } else if (importantRE.test(val)) {
  56371. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  56372. } else {
  56373. var normalizedName = normalize(name);
  56374. if (Array.isArray(val)) {
  56375. // Support values array created by autoprefixer, e.g.
  56376. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  56377. // Set them one by one, and the browser will only set those it can recognize
  56378. for (var i = 0, len = val.length; i < len; i++) {
  56379. el.style[normalizedName] = val[i];
  56380. }
  56381. } else {
  56382. el.style[normalizedName] = val;
  56383. }
  56384. }
  56385. };
  56386. var vendorNames = ['Webkit', 'Moz', 'ms'];
  56387. var emptyStyle;
  56388. var normalize = cached(function (prop) {
  56389. emptyStyle = emptyStyle || document.createElement('div').style;
  56390. prop = camelize(prop);
  56391. if (prop !== 'filter' && (prop in emptyStyle)) {
  56392. return prop
  56393. }
  56394. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  56395. for (var i = 0; i < vendorNames.length; i++) {
  56396. var name = vendorNames[i] + capName;
  56397. if (name in emptyStyle) {
  56398. return name
  56399. }
  56400. }
  56401. });
  56402. function updateStyle (oldVnode, vnode) {
  56403. var data = vnode.data;
  56404. var oldData = oldVnode.data;
  56405. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  56406. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  56407. ) {
  56408. return
  56409. }
  56410. var cur, name;
  56411. var el = vnode.elm;
  56412. var oldStaticStyle = oldData.staticStyle;
  56413. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  56414. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  56415. var oldStyle = oldStaticStyle || oldStyleBinding;
  56416. var style = normalizeStyleBinding(vnode.data.style) || {};
  56417. // store normalized style under a different key for next diff
  56418. // make sure to clone it if it's reactive, since the user likely wants
  56419. // to mutate it.
  56420. vnode.data.normalizedStyle = isDef(style.__ob__)
  56421. ? extend({}, style)
  56422. : style;
  56423. var newStyle = getStyle(vnode, true);
  56424. for (name in oldStyle) {
  56425. if (isUndef(newStyle[name])) {
  56426. setProp(el, name, '');
  56427. }
  56428. }
  56429. for (name in newStyle) {
  56430. cur = newStyle[name];
  56431. if (cur !== oldStyle[name]) {
  56432. // ie9 setting to null has no effect, must use empty string
  56433. setProp(el, name, cur == null ? '' : cur);
  56434. }
  56435. }
  56436. }
  56437. var style = {
  56438. create: updateStyle,
  56439. update: updateStyle
  56440. };
  56441. /* */
  56442. var whitespaceRE = /\s+/;
  56443. /**
  56444. * Add class with compatibility for SVG since classList is not supported on
  56445. * SVG elements in IE
  56446. */
  56447. function addClass (el, cls) {
  56448. /* istanbul ignore if */
  56449. if (!cls || !(cls = cls.trim())) {
  56450. return
  56451. }
  56452. /* istanbul ignore else */
  56453. if (el.classList) {
  56454. if (cls.indexOf(' ') > -1) {
  56455. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  56456. } else {
  56457. el.classList.add(cls);
  56458. }
  56459. } else {
  56460. var cur = " " + (el.getAttribute('class') || '') + " ";
  56461. if (cur.indexOf(' ' + cls + ' ') < 0) {
  56462. el.setAttribute('class', (cur + cls).trim());
  56463. }
  56464. }
  56465. }
  56466. /**
  56467. * Remove class with compatibility for SVG since classList is not supported on
  56468. * SVG elements in IE
  56469. */
  56470. function removeClass (el, cls) {
  56471. /* istanbul ignore if */
  56472. if (!cls || !(cls = cls.trim())) {
  56473. return
  56474. }
  56475. /* istanbul ignore else */
  56476. if (el.classList) {
  56477. if (cls.indexOf(' ') > -1) {
  56478. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  56479. } else {
  56480. el.classList.remove(cls);
  56481. }
  56482. if (!el.classList.length) {
  56483. el.removeAttribute('class');
  56484. }
  56485. } else {
  56486. var cur = " " + (el.getAttribute('class') || '') + " ";
  56487. var tar = ' ' + cls + ' ';
  56488. while (cur.indexOf(tar) >= 0) {
  56489. cur = cur.replace(tar, ' ');
  56490. }
  56491. cur = cur.trim();
  56492. if (cur) {
  56493. el.setAttribute('class', cur);
  56494. } else {
  56495. el.removeAttribute('class');
  56496. }
  56497. }
  56498. }
  56499. /* */
  56500. function resolveTransition (def$$1) {
  56501. if (!def$$1) {
  56502. return
  56503. }
  56504. /* istanbul ignore else */
  56505. if (typeof def$$1 === 'object') {
  56506. var res = {};
  56507. if (def$$1.css !== false) {
  56508. extend(res, autoCssTransition(def$$1.name || 'v'));
  56509. }
  56510. extend(res, def$$1);
  56511. return res
  56512. } else if (typeof def$$1 === 'string') {
  56513. return autoCssTransition(def$$1)
  56514. }
  56515. }
  56516. var autoCssTransition = cached(function (name) {
  56517. return {
  56518. enterClass: (name + "-enter"),
  56519. enterToClass: (name + "-enter-to"),
  56520. enterActiveClass: (name + "-enter-active"),
  56521. leaveClass: (name + "-leave"),
  56522. leaveToClass: (name + "-leave-to"),
  56523. leaveActiveClass: (name + "-leave-active")
  56524. }
  56525. });
  56526. var hasTransition = inBrowser && !isIE9;
  56527. var TRANSITION = 'transition';
  56528. var ANIMATION = 'animation';
  56529. // Transition property/event sniffing
  56530. var transitionProp = 'transition';
  56531. var transitionEndEvent = 'transitionend';
  56532. var animationProp = 'animation';
  56533. var animationEndEvent = 'animationend';
  56534. if (hasTransition) {
  56535. /* istanbul ignore if */
  56536. if (window.ontransitionend === undefined &&
  56537. window.onwebkittransitionend !== undefined
  56538. ) {
  56539. transitionProp = 'WebkitTransition';
  56540. transitionEndEvent = 'webkitTransitionEnd';
  56541. }
  56542. if (window.onanimationend === undefined &&
  56543. window.onwebkitanimationend !== undefined
  56544. ) {
  56545. animationProp = 'WebkitAnimation';
  56546. animationEndEvent = 'webkitAnimationEnd';
  56547. }
  56548. }
  56549. // binding to window is necessary to make hot reload work in IE in strict mode
  56550. var raf = inBrowser
  56551. ? window.requestAnimationFrame
  56552. ? window.requestAnimationFrame.bind(window)
  56553. : setTimeout
  56554. : /* istanbul ignore next */ function (fn) { return fn(); };
  56555. function nextFrame (fn) {
  56556. raf(function () {
  56557. raf(fn);
  56558. });
  56559. }
  56560. function addTransitionClass (el, cls) {
  56561. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  56562. if (transitionClasses.indexOf(cls) < 0) {
  56563. transitionClasses.push(cls);
  56564. addClass(el, cls);
  56565. }
  56566. }
  56567. function removeTransitionClass (el, cls) {
  56568. if (el._transitionClasses) {
  56569. remove(el._transitionClasses, cls);
  56570. }
  56571. removeClass(el, cls);
  56572. }
  56573. function whenTransitionEnds (
  56574. el,
  56575. expectedType,
  56576. cb
  56577. ) {
  56578. var ref = getTransitionInfo(el, expectedType);
  56579. var type = ref.type;
  56580. var timeout = ref.timeout;
  56581. var propCount = ref.propCount;
  56582. if (!type) { return cb() }
  56583. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  56584. var ended = 0;
  56585. var end = function () {
  56586. el.removeEventListener(event, onEnd);
  56587. cb();
  56588. };
  56589. var onEnd = function (e) {
  56590. if (e.target === el) {
  56591. if (++ended >= propCount) {
  56592. end();
  56593. }
  56594. }
  56595. };
  56596. setTimeout(function () {
  56597. if (ended < propCount) {
  56598. end();
  56599. }
  56600. }, timeout + 1);
  56601. el.addEventListener(event, onEnd);
  56602. }
  56603. var transformRE = /\b(transform|all)(,|$)/;
  56604. function getTransitionInfo (el, expectedType) {
  56605. var styles = window.getComputedStyle(el);
  56606. // JSDOM may return undefined for transition properties
  56607. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  56608. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  56609. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  56610. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  56611. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  56612. var animationTimeout = getTimeout(animationDelays, animationDurations);
  56613. var type;
  56614. var timeout = 0;
  56615. var propCount = 0;
  56616. /* istanbul ignore if */
  56617. if (expectedType === TRANSITION) {
  56618. if (transitionTimeout > 0) {
  56619. type = TRANSITION;
  56620. timeout = transitionTimeout;
  56621. propCount = transitionDurations.length;
  56622. }
  56623. } else if (expectedType === ANIMATION) {
  56624. if (animationTimeout > 0) {
  56625. type = ANIMATION;
  56626. timeout = animationTimeout;
  56627. propCount = animationDurations.length;
  56628. }
  56629. } else {
  56630. timeout = Math.max(transitionTimeout, animationTimeout);
  56631. type = timeout > 0
  56632. ? transitionTimeout > animationTimeout
  56633. ? TRANSITION
  56634. : ANIMATION
  56635. : null;
  56636. propCount = type
  56637. ? type === TRANSITION
  56638. ? transitionDurations.length
  56639. : animationDurations.length
  56640. : 0;
  56641. }
  56642. var hasTransform =
  56643. type === TRANSITION &&
  56644. transformRE.test(styles[transitionProp + 'Property']);
  56645. return {
  56646. type: type,
  56647. timeout: timeout,
  56648. propCount: propCount,
  56649. hasTransform: hasTransform
  56650. }
  56651. }
  56652. function getTimeout (delays, durations) {
  56653. /* istanbul ignore next */
  56654. while (delays.length < durations.length) {
  56655. delays = delays.concat(delays);
  56656. }
  56657. return Math.max.apply(null, durations.map(function (d, i) {
  56658. return toMs(d) + toMs(delays[i])
  56659. }))
  56660. }
  56661. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  56662. // in a locale-dependent way, using a comma instead of a dot.
  56663. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  56664. // as a floor function) causing unexpected behaviors
  56665. function toMs (s) {
  56666. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  56667. }
  56668. /* */
  56669. function enter (vnode, toggleDisplay) {
  56670. var el = vnode.elm;
  56671. // call leave callback now
  56672. if (isDef(el._leaveCb)) {
  56673. el._leaveCb.cancelled = true;
  56674. el._leaveCb();
  56675. }
  56676. var data = resolveTransition(vnode.data.transition);
  56677. if (isUndef(data)) {
  56678. return
  56679. }
  56680. /* istanbul ignore if */
  56681. if (isDef(el._enterCb) || el.nodeType !== 1) {
  56682. return
  56683. }
  56684. var css = data.css;
  56685. var type = data.type;
  56686. var enterClass = data.enterClass;
  56687. var enterToClass = data.enterToClass;
  56688. var enterActiveClass = data.enterActiveClass;
  56689. var appearClass = data.appearClass;
  56690. var appearToClass = data.appearToClass;
  56691. var appearActiveClass = data.appearActiveClass;
  56692. var beforeEnter = data.beforeEnter;
  56693. var enter = data.enter;
  56694. var afterEnter = data.afterEnter;
  56695. var enterCancelled = data.enterCancelled;
  56696. var beforeAppear = data.beforeAppear;
  56697. var appear = data.appear;
  56698. var afterAppear = data.afterAppear;
  56699. var appearCancelled = data.appearCancelled;
  56700. var duration = data.duration;
  56701. // activeInstance will always be the <transition> component managing this
  56702. // transition. One edge case to check is when the <transition> is placed
  56703. // as the root node of a child component. In that case we need to check
  56704. // <transition>'s parent for appear check.
  56705. var context = activeInstance;
  56706. var transitionNode = activeInstance.$vnode;
  56707. while (transitionNode && transitionNode.parent) {
  56708. context = transitionNode.context;
  56709. transitionNode = transitionNode.parent;
  56710. }
  56711. var isAppear = !context._isMounted || !vnode.isRootInsert;
  56712. if (isAppear && !appear && appear !== '') {
  56713. return
  56714. }
  56715. var startClass = isAppear && appearClass
  56716. ? appearClass
  56717. : enterClass;
  56718. var activeClass = isAppear && appearActiveClass
  56719. ? appearActiveClass
  56720. : enterActiveClass;
  56721. var toClass = isAppear && appearToClass
  56722. ? appearToClass
  56723. : enterToClass;
  56724. var beforeEnterHook = isAppear
  56725. ? (beforeAppear || beforeEnter)
  56726. : beforeEnter;
  56727. var enterHook = isAppear
  56728. ? (typeof appear === 'function' ? appear : enter)
  56729. : enter;
  56730. var afterEnterHook = isAppear
  56731. ? (afterAppear || afterEnter)
  56732. : afterEnter;
  56733. var enterCancelledHook = isAppear
  56734. ? (appearCancelled || enterCancelled)
  56735. : enterCancelled;
  56736. var explicitEnterDuration = toNumber(
  56737. isObject(duration)
  56738. ? duration.enter
  56739. : duration
  56740. );
  56741. if (explicitEnterDuration != null) {
  56742. checkDuration(explicitEnterDuration, 'enter', vnode);
  56743. }
  56744. var expectsCSS = css !== false && !isIE9;
  56745. var userWantsControl = getHookArgumentsLength(enterHook);
  56746. var cb = el._enterCb = once(function () {
  56747. if (expectsCSS) {
  56748. removeTransitionClass(el, toClass);
  56749. removeTransitionClass(el, activeClass);
  56750. }
  56751. if (cb.cancelled) {
  56752. if (expectsCSS) {
  56753. removeTransitionClass(el, startClass);
  56754. }
  56755. enterCancelledHook && enterCancelledHook(el);
  56756. } else {
  56757. afterEnterHook && afterEnterHook(el);
  56758. }
  56759. el._enterCb = null;
  56760. });
  56761. if (!vnode.data.show) {
  56762. // remove pending leave element on enter by injecting an insert hook
  56763. mergeVNodeHook(vnode, 'insert', function () {
  56764. var parent = el.parentNode;
  56765. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  56766. if (pendingNode &&
  56767. pendingNode.tag === vnode.tag &&
  56768. pendingNode.elm._leaveCb
  56769. ) {
  56770. pendingNode.elm._leaveCb();
  56771. }
  56772. enterHook && enterHook(el, cb);
  56773. });
  56774. }
  56775. // start enter transition
  56776. beforeEnterHook && beforeEnterHook(el);
  56777. if (expectsCSS) {
  56778. addTransitionClass(el, startClass);
  56779. addTransitionClass(el, activeClass);
  56780. nextFrame(function () {
  56781. removeTransitionClass(el, startClass);
  56782. if (!cb.cancelled) {
  56783. addTransitionClass(el, toClass);
  56784. if (!userWantsControl) {
  56785. if (isValidDuration(explicitEnterDuration)) {
  56786. setTimeout(cb, explicitEnterDuration);
  56787. } else {
  56788. whenTransitionEnds(el, type, cb);
  56789. }
  56790. }
  56791. }
  56792. });
  56793. }
  56794. if (vnode.data.show) {
  56795. toggleDisplay && toggleDisplay();
  56796. enterHook && enterHook(el, cb);
  56797. }
  56798. if (!expectsCSS && !userWantsControl) {
  56799. cb();
  56800. }
  56801. }
  56802. function leave (vnode, rm) {
  56803. var el = vnode.elm;
  56804. // call enter callback now
  56805. if (isDef(el._enterCb)) {
  56806. el._enterCb.cancelled = true;
  56807. el._enterCb();
  56808. }
  56809. var data = resolveTransition(vnode.data.transition);
  56810. if (isUndef(data) || el.nodeType !== 1) {
  56811. return rm()
  56812. }
  56813. /* istanbul ignore if */
  56814. if (isDef(el._leaveCb)) {
  56815. return
  56816. }
  56817. var css = data.css;
  56818. var type = data.type;
  56819. var leaveClass = data.leaveClass;
  56820. var leaveToClass = data.leaveToClass;
  56821. var leaveActiveClass = data.leaveActiveClass;
  56822. var beforeLeave = data.beforeLeave;
  56823. var leave = data.leave;
  56824. var afterLeave = data.afterLeave;
  56825. var leaveCancelled = data.leaveCancelled;
  56826. var delayLeave = data.delayLeave;
  56827. var duration = data.duration;
  56828. var expectsCSS = css !== false && !isIE9;
  56829. var userWantsControl = getHookArgumentsLength(leave);
  56830. var explicitLeaveDuration = toNumber(
  56831. isObject(duration)
  56832. ? duration.leave
  56833. : duration
  56834. );
  56835. if (isDef(explicitLeaveDuration)) {
  56836. checkDuration(explicitLeaveDuration, 'leave', vnode);
  56837. }
  56838. var cb = el._leaveCb = once(function () {
  56839. if (el.parentNode && el.parentNode._pending) {
  56840. el.parentNode._pending[vnode.key] = null;
  56841. }
  56842. if (expectsCSS) {
  56843. removeTransitionClass(el, leaveToClass);
  56844. removeTransitionClass(el, leaveActiveClass);
  56845. }
  56846. if (cb.cancelled) {
  56847. if (expectsCSS) {
  56848. removeTransitionClass(el, leaveClass);
  56849. }
  56850. leaveCancelled && leaveCancelled(el);
  56851. } else {
  56852. rm();
  56853. afterLeave && afterLeave(el);
  56854. }
  56855. el._leaveCb = null;
  56856. });
  56857. if (delayLeave) {
  56858. delayLeave(performLeave);
  56859. } else {
  56860. performLeave();
  56861. }
  56862. function performLeave () {
  56863. // the delayed leave may have already been cancelled
  56864. if (cb.cancelled) {
  56865. return
  56866. }
  56867. // record leaving element
  56868. if (!vnode.data.show && el.parentNode) {
  56869. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  56870. }
  56871. beforeLeave && beforeLeave(el);
  56872. if (expectsCSS) {
  56873. addTransitionClass(el, leaveClass);
  56874. addTransitionClass(el, leaveActiveClass);
  56875. nextFrame(function () {
  56876. removeTransitionClass(el, leaveClass);
  56877. if (!cb.cancelled) {
  56878. addTransitionClass(el, leaveToClass);
  56879. if (!userWantsControl) {
  56880. if (isValidDuration(explicitLeaveDuration)) {
  56881. setTimeout(cb, explicitLeaveDuration);
  56882. } else {
  56883. whenTransitionEnds(el, type, cb);
  56884. }
  56885. }
  56886. }
  56887. });
  56888. }
  56889. leave && leave(el, cb);
  56890. if (!expectsCSS && !userWantsControl) {
  56891. cb();
  56892. }
  56893. }
  56894. }
  56895. // only used in dev mode
  56896. function checkDuration (val, name, vnode) {
  56897. if (typeof val !== 'number') {
  56898. warn(
  56899. "<transition> explicit " + name + " duration is not a valid number - " +
  56900. "got " + (JSON.stringify(val)) + ".",
  56901. vnode.context
  56902. );
  56903. } else if (isNaN(val)) {
  56904. warn(
  56905. "<transition> explicit " + name + " duration is NaN - " +
  56906. 'the duration expression might be incorrect.',
  56907. vnode.context
  56908. );
  56909. }
  56910. }
  56911. function isValidDuration (val) {
  56912. return typeof val === 'number' && !isNaN(val)
  56913. }
  56914. /**
  56915. * Normalize a transition hook's argument length. The hook may be:
  56916. * - a merged hook (invoker) with the original in .fns
  56917. * - a wrapped component method (check ._length)
  56918. * - a plain function (.length)
  56919. */
  56920. function getHookArgumentsLength (fn) {
  56921. if (isUndef(fn)) {
  56922. return false
  56923. }
  56924. var invokerFns = fn.fns;
  56925. if (isDef(invokerFns)) {
  56926. // invoker
  56927. return getHookArgumentsLength(
  56928. Array.isArray(invokerFns)
  56929. ? invokerFns[0]
  56930. : invokerFns
  56931. )
  56932. } else {
  56933. return (fn._length || fn.length) > 1
  56934. }
  56935. }
  56936. function _enter (_, vnode) {
  56937. if (vnode.data.show !== true) {
  56938. enter(vnode);
  56939. }
  56940. }
  56941. var transition = inBrowser ? {
  56942. create: _enter,
  56943. activate: _enter,
  56944. remove: function remove$$1 (vnode, rm) {
  56945. /* istanbul ignore else */
  56946. if (vnode.data.show !== true) {
  56947. leave(vnode, rm);
  56948. } else {
  56949. rm();
  56950. }
  56951. }
  56952. } : {};
  56953. var platformModules = [
  56954. attrs,
  56955. klass,
  56956. events,
  56957. domProps,
  56958. style,
  56959. transition
  56960. ];
  56961. /* */
  56962. // the directive module should be applied last, after all
  56963. // built-in modules have been applied.
  56964. var modules = platformModules.concat(baseModules);
  56965. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  56966. /**
  56967. * Not type checking this file because flow doesn't like attaching
  56968. * properties to Elements.
  56969. */
  56970. /* istanbul ignore if */
  56971. if (isIE9) {
  56972. // http://www.matts411.com/post/internet-explorer-9-oninput/
  56973. document.addEventListener('selectionchange', function () {
  56974. var el = document.activeElement;
  56975. if (el && el.vmodel) {
  56976. trigger(el, 'input');
  56977. }
  56978. });
  56979. }
  56980. var directive = {
  56981. inserted: function inserted (el, binding, vnode, oldVnode) {
  56982. if (vnode.tag === 'select') {
  56983. // #6903
  56984. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  56985. mergeVNodeHook(vnode, 'postpatch', function () {
  56986. directive.componentUpdated(el, binding, vnode);
  56987. });
  56988. } else {
  56989. setSelected(el, binding, vnode.context);
  56990. }
  56991. el._vOptions = [].map.call(el.options, getValue);
  56992. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  56993. el._vModifiers = binding.modifiers;
  56994. if (!binding.modifiers.lazy) {
  56995. el.addEventListener('compositionstart', onCompositionStart);
  56996. el.addEventListener('compositionend', onCompositionEnd);
  56997. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  56998. // switching focus before confirming composition choice
  56999. // this also fixes the issue where some browsers e.g. iOS Chrome
  57000. // fires "change" instead of "input" on autocomplete.
  57001. el.addEventListener('change', onCompositionEnd);
  57002. /* istanbul ignore if */
  57003. if (isIE9) {
  57004. el.vmodel = true;
  57005. }
  57006. }
  57007. }
  57008. },
  57009. componentUpdated: function componentUpdated (el, binding, vnode) {
  57010. if (vnode.tag === 'select') {
  57011. setSelected(el, binding, vnode.context);
  57012. // in case the options rendered by v-for have changed,
  57013. // it's possible that the value is out-of-sync with the rendered options.
  57014. // detect such cases and filter out values that no longer has a matching
  57015. // option in the DOM.
  57016. var prevOptions = el._vOptions;
  57017. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  57018. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  57019. // trigger change event if
  57020. // no matching option found for at least one value
  57021. var needReset = el.multiple
  57022. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  57023. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  57024. if (needReset) {
  57025. trigger(el, 'change');
  57026. }
  57027. }
  57028. }
  57029. }
  57030. };
  57031. function setSelected (el, binding, vm) {
  57032. actuallySetSelected(el, binding, vm);
  57033. /* istanbul ignore if */
  57034. if (isIE || isEdge) {
  57035. setTimeout(function () {
  57036. actuallySetSelected(el, binding, vm);
  57037. }, 0);
  57038. }
  57039. }
  57040. function actuallySetSelected (el, binding, vm) {
  57041. var value = binding.value;
  57042. var isMultiple = el.multiple;
  57043. if (isMultiple && !Array.isArray(value)) {
  57044. warn(
  57045. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  57046. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  57047. vm
  57048. );
  57049. return
  57050. }
  57051. var selected, option;
  57052. for (var i = 0, l = el.options.length; i < l; i++) {
  57053. option = el.options[i];
  57054. if (isMultiple) {
  57055. selected = looseIndexOf(value, getValue(option)) > -1;
  57056. if (option.selected !== selected) {
  57057. option.selected = selected;
  57058. }
  57059. } else {
  57060. if (looseEqual(getValue(option), value)) {
  57061. if (el.selectedIndex !== i) {
  57062. el.selectedIndex = i;
  57063. }
  57064. return
  57065. }
  57066. }
  57067. }
  57068. if (!isMultiple) {
  57069. el.selectedIndex = -1;
  57070. }
  57071. }
  57072. function hasNoMatchingOption (value, options) {
  57073. return options.every(function (o) { return !looseEqual(o, value); })
  57074. }
  57075. function getValue (option) {
  57076. return '_value' in option
  57077. ? option._value
  57078. : option.value
  57079. }
  57080. function onCompositionStart (e) {
  57081. e.target.composing = true;
  57082. }
  57083. function onCompositionEnd (e) {
  57084. // prevent triggering an input event for no reason
  57085. if (!e.target.composing) { return }
  57086. e.target.composing = false;
  57087. trigger(e.target, 'input');
  57088. }
  57089. function trigger (el, type) {
  57090. var e = document.createEvent('HTMLEvents');
  57091. e.initEvent(type, true, true);
  57092. el.dispatchEvent(e);
  57093. }
  57094. /* */
  57095. // recursively search for possible transition defined inside the component root
  57096. function locateNode (vnode) {
  57097. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  57098. ? locateNode(vnode.componentInstance._vnode)
  57099. : vnode
  57100. }
  57101. var show = {
  57102. bind: function bind (el, ref, vnode) {
  57103. var value = ref.value;
  57104. vnode = locateNode(vnode);
  57105. var transition$$1 = vnode.data && vnode.data.transition;
  57106. var originalDisplay = el.__vOriginalDisplay =
  57107. el.style.display === 'none' ? '' : el.style.display;
  57108. if (value && transition$$1) {
  57109. vnode.data.show = true;
  57110. enter(vnode, function () {
  57111. el.style.display = originalDisplay;
  57112. });
  57113. } else {
  57114. el.style.display = value ? originalDisplay : 'none';
  57115. }
  57116. },
  57117. update: function update (el, ref, vnode) {
  57118. var value = ref.value;
  57119. var oldValue = ref.oldValue;
  57120. /* istanbul ignore if */
  57121. if (!value === !oldValue) { return }
  57122. vnode = locateNode(vnode);
  57123. var transition$$1 = vnode.data && vnode.data.transition;
  57124. if (transition$$1) {
  57125. vnode.data.show = true;
  57126. if (value) {
  57127. enter(vnode, function () {
  57128. el.style.display = el.__vOriginalDisplay;
  57129. });
  57130. } else {
  57131. leave(vnode, function () {
  57132. el.style.display = 'none';
  57133. });
  57134. }
  57135. } else {
  57136. el.style.display = value ? el.__vOriginalDisplay : 'none';
  57137. }
  57138. },
  57139. unbind: function unbind (
  57140. el,
  57141. binding,
  57142. vnode,
  57143. oldVnode,
  57144. isDestroy
  57145. ) {
  57146. if (!isDestroy) {
  57147. el.style.display = el.__vOriginalDisplay;
  57148. }
  57149. }
  57150. };
  57151. var platformDirectives = {
  57152. model: directive,
  57153. show: show
  57154. };
  57155. /* */
  57156. var transitionProps = {
  57157. name: String,
  57158. appear: Boolean,
  57159. css: Boolean,
  57160. mode: String,
  57161. type: String,
  57162. enterClass: String,
  57163. leaveClass: String,
  57164. enterToClass: String,
  57165. leaveToClass: String,
  57166. enterActiveClass: String,
  57167. leaveActiveClass: String,
  57168. appearClass: String,
  57169. appearActiveClass: String,
  57170. appearToClass: String,
  57171. duration: [Number, String, Object]
  57172. };
  57173. // in case the child is also an abstract component, e.g. <keep-alive>
  57174. // we want to recursively retrieve the real component to be rendered
  57175. function getRealChild (vnode) {
  57176. var compOptions = vnode && vnode.componentOptions;
  57177. if (compOptions && compOptions.Ctor.options.abstract) {
  57178. return getRealChild(getFirstComponentChild(compOptions.children))
  57179. } else {
  57180. return vnode
  57181. }
  57182. }
  57183. function extractTransitionData (comp) {
  57184. var data = {};
  57185. var options = comp.$options;
  57186. // props
  57187. for (var key in options.propsData) {
  57188. data[key] = comp[key];
  57189. }
  57190. // events.
  57191. // extract listeners and pass them directly to the transition methods
  57192. var listeners = options._parentListeners;
  57193. for (var key$1 in listeners) {
  57194. data[camelize(key$1)] = listeners[key$1];
  57195. }
  57196. return data
  57197. }
  57198. function placeholder (h, rawChild) {
  57199. if (/\d-keep-alive$/.test(rawChild.tag)) {
  57200. return h('keep-alive', {
  57201. props: rawChild.componentOptions.propsData
  57202. })
  57203. }
  57204. }
  57205. function hasParentTransition (vnode) {
  57206. while ((vnode = vnode.parent)) {
  57207. if (vnode.data.transition) {
  57208. return true
  57209. }
  57210. }
  57211. }
  57212. function isSameChild (child, oldChild) {
  57213. return oldChild.key === child.key && oldChild.tag === child.tag
  57214. }
  57215. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  57216. var isVShowDirective = function (d) { return d.name === 'show'; };
  57217. var Transition = {
  57218. name: 'transition',
  57219. props: transitionProps,
  57220. abstract: true,
  57221. render: function render (h) {
  57222. var this$1 = this;
  57223. var children = this.$slots.default;
  57224. if (!children) {
  57225. return
  57226. }
  57227. // filter out text nodes (possible whitespaces)
  57228. children = children.filter(isNotTextNode);
  57229. /* istanbul ignore if */
  57230. if (!children.length) {
  57231. return
  57232. }
  57233. // warn multiple elements
  57234. if (children.length > 1) {
  57235. warn(
  57236. '<transition> can only be used on a single element. Use ' +
  57237. '<transition-group> for lists.',
  57238. this.$parent
  57239. );
  57240. }
  57241. var mode = this.mode;
  57242. // warn invalid mode
  57243. if (mode && mode !== 'in-out' && mode !== 'out-in'
  57244. ) {
  57245. warn(
  57246. 'invalid <transition> mode: ' + mode,
  57247. this.$parent
  57248. );
  57249. }
  57250. var rawChild = children[0];
  57251. // if this is a component root node and the component's
  57252. // parent container node also has transition, skip.
  57253. if (hasParentTransition(this.$vnode)) {
  57254. return rawChild
  57255. }
  57256. // apply transition data to child
  57257. // use getRealChild() to ignore abstract components e.g. keep-alive
  57258. var child = getRealChild(rawChild);
  57259. /* istanbul ignore if */
  57260. if (!child) {
  57261. return rawChild
  57262. }
  57263. if (this._leaving) {
  57264. return placeholder(h, rawChild)
  57265. }
  57266. // ensure a key that is unique to the vnode type and to this transition
  57267. // component instance. This key will be used to remove pending leaving nodes
  57268. // during entering.
  57269. var id = "__transition-" + (this._uid) + "-";
  57270. child.key = child.key == null
  57271. ? child.isComment
  57272. ? id + 'comment'
  57273. : id + child.tag
  57274. : isPrimitive(child.key)
  57275. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  57276. : child.key;
  57277. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  57278. var oldRawChild = this._vnode;
  57279. var oldChild = getRealChild(oldRawChild);
  57280. // mark v-show
  57281. // so that the transition module can hand over the control to the directive
  57282. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  57283. child.data.show = true;
  57284. }
  57285. if (
  57286. oldChild &&
  57287. oldChild.data &&
  57288. !isSameChild(child, oldChild) &&
  57289. !isAsyncPlaceholder(oldChild) &&
  57290. // #6687 component root is a comment node
  57291. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  57292. ) {
  57293. // replace old child transition data with fresh one
  57294. // important for dynamic transitions!
  57295. var oldData = oldChild.data.transition = extend({}, data);
  57296. // handle transition mode
  57297. if (mode === 'out-in') {
  57298. // return placeholder node and queue update when leave finishes
  57299. this._leaving = true;
  57300. mergeVNodeHook(oldData, 'afterLeave', function () {
  57301. this$1._leaving = false;
  57302. this$1.$forceUpdate();
  57303. });
  57304. return placeholder(h, rawChild)
  57305. } else if (mode === 'in-out') {
  57306. if (isAsyncPlaceholder(child)) {
  57307. return oldRawChild
  57308. }
  57309. var delayedLeave;
  57310. var performLeave = function () { delayedLeave(); };
  57311. mergeVNodeHook(data, 'afterEnter', performLeave);
  57312. mergeVNodeHook(data, 'enterCancelled', performLeave);
  57313. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  57314. }
  57315. }
  57316. return rawChild
  57317. }
  57318. };
  57319. /* */
  57320. var props = extend({
  57321. tag: String,
  57322. moveClass: String
  57323. }, transitionProps);
  57324. delete props.mode;
  57325. var TransitionGroup = {
  57326. props: props,
  57327. beforeMount: function beforeMount () {
  57328. var this$1 = this;
  57329. var update = this._update;
  57330. this._update = function (vnode, hydrating) {
  57331. var restoreActiveInstance = setActiveInstance(this$1);
  57332. // force removing pass
  57333. this$1.__patch__(
  57334. this$1._vnode,
  57335. this$1.kept,
  57336. false, // hydrating
  57337. true // removeOnly (!important, avoids unnecessary moves)
  57338. );
  57339. this$1._vnode = this$1.kept;
  57340. restoreActiveInstance();
  57341. update.call(this$1, vnode, hydrating);
  57342. };
  57343. },
  57344. render: function render (h) {
  57345. var tag = this.tag || this.$vnode.data.tag || 'span';
  57346. var map = Object.create(null);
  57347. var prevChildren = this.prevChildren = this.children;
  57348. var rawChildren = this.$slots.default || [];
  57349. var children = this.children = [];
  57350. var transitionData = extractTransitionData(this);
  57351. for (var i = 0; i < rawChildren.length; i++) {
  57352. var c = rawChildren[i];
  57353. if (c.tag) {
  57354. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  57355. children.push(c);
  57356. map[c.key] = c
  57357. ;(c.data || (c.data = {})).transition = transitionData;
  57358. } else {
  57359. var opts = c.componentOptions;
  57360. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  57361. warn(("<transition-group> children must be keyed: <" + name + ">"));
  57362. }
  57363. }
  57364. }
  57365. if (prevChildren) {
  57366. var kept = [];
  57367. var removed = [];
  57368. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  57369. var c$1 = prevChildren[i$1];
  57370. c$1.data.transition = transitionData;
  57371. c$1.data.pos = c$1.elm.getBoundingClientRect();
  57372. if (map[c$1.key]) {
  57373. kept.push(c$1);
  57374. } else {
  57375. removed.push(c$1);
  57376. }
  57377. }
  57378. this.kept = h(tag, null, kept);
  57379. this.removed = removed;
  57380. }
  57381. return h(tag, null, children)
  57382. },
  57383. updated: function updated () {
  57384. var children = this.prevChildren;
  57385. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  57386. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  57387. return
  57388. }
  57389. // we divide the work into three loops to avoid mixing DOM reads and writes
  57390. // in each iteration - which helps prevent layout thrashing.
  57391. children.forEach(callPendingCbs);
  57392. children.forEach(recordPosition);
  57393. children.forEach(applyTranslation);
  57394. // force reflow to put everything in position
  57395. // assign to this to avoid being removed in tree-shaking
  57396. // $flow-disable-line
  57397. this._reflow = document.body.offsetHeight;
  57398. children.forEach(function (c) {
  57399. if (c.data.moved) {
  57400. var el = c.elm;
  57401. var s = el.style;
  57402. addTransitionClass(el, moveClass);
  57403. s.transform = s.WebkitTransform = s.transitionDuration = '';
  57404. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  57405. if (e && e.target !== el) {
  57406. return
  57407. }
  57408. if (!e || /transform$/.test(e.propertyName)) {
  57409. el.removeEventListener(transitionEndEvent, cb);
  57410. el._moveCb = null;
  57411. removeTransitionClass(el, moveClass);
  57412. }
  57413. });
  57414. }
  57415. });
  57416. },
  57417. methods: {
  57418. hasMove: function hasMove (el, moveClass) {
  57419. /* istanbul ignore if */
  57420. if (!hasTransition) {
  57421. return false
  57422. }
  57423. /* istanbul ignore if */
  57424. if (this._hasMove) {
  57425. return this._hasMove
  57426. }
  57427. // Detect whether an element with the move class applied has
  57428. // CSS transitions. Since the element may be inside an entering
  57429. // transition at this very moment, we make a clone of it and remove
  57430. // all other transition classes applied to ensure only the move class
  57431. // is applied.
  57432. var clone = el.cloneNode();
  57433. if (el._transitionClasses) {
  57434. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  57435. }
  57436. addClass(clone, moveClass);
  57437. clone.style.display = 'none';
  57438. this.$el.appendChild(clone);
  57439. var info = getTransitionInfo(clone);
  57440. this.$el.removeChild(clone);
  57441. return (this._hasMove = info.hasTransform)
  57442. }
  57443. }
  57444. };
  57445. function callPendingCbs (c) {
  57446. /* istanbul ignore if */
  57447. if (c.elm._moveCb) {
  57448. c.elm._moveCb();
  57449. }
  57450. /* istanbul ignore if */
  57451. if (c.elm._enterCb) {
  57452. c.elm._enterCb();
  57453. }
  57454. }
  57455. function recordPosition (c) {
  57456. c.data.newPos = c.elm.getBoundingClientRect();
  57457. }
  57458. function applyTranslation (c) {
  57459. var oldPos = c.data.pos;
  57460. var newPos = c.data.newPos;
  57461. var dx = oldPos.left - newPos.left;
  57462. var dy = oldPos.top - newPos.top;
  57463. if (dx || dy) {
  57464. c.data.moved = true;
  57465. var s = c.elm.style;
  57466. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  57467. s.transitionDuration = '0s';
  57468. }
  57469. }
  57470. var platformComponents = {
  57471. Transition: Transition,
  57472. TransitionGroup: TransitionGroup
  57473. };
  57474. /* */
  57475. // install platform specific utils
  57476. Vue.config.mustUseProp = mustUseProp;
  57477. Vue.config.isReservedTag = isReservedTag;
  57478. Vue.config.isReservedAttr = isReservedAttr;
  57479. Vue.config.getTagNamespace = getTagNamespace;
  57480. Vue.config.isUnknownElement = isUnknownElement;
  57481. // install platform runtime directives & components
  57482. extend(Vue.options.directives, platformDirectives);
  57483. extend(Vue.options.components, platformComponents);
  57484. // install platform patch function
  57485. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  57486. // public mount method
  57487. Vue.prototype.$mount = function (
  57488. el,
  57489. hydrating
  57490. ) {
  57491. el = el && inBrowser ? query(el) : undefined;
  57492. return mountComponent(this, el, hydrating)
  57493. };
  57494. // devtools global hook
  57495. /* istanbul ignore next */
  57496. if (inBrowser) {
  57497. setTimeout(function () {
  57498. if (config.devtools) {
  57499. if (devtools) {
  57500. devtools.emit('init', Vue);
  57501. } else {
  57502. console[console.info ? 'info' : 'log'](
  57503. 'Download the Vue Devtools extension for a better development experience:\n' +
  57504. 'https://github.com/vuejs/vue-devtools'
  57505. );
  57506. }
  57507. }
  57508. if (config.productionTip !== false &&
  57509. typeof console !== 'undefined'
  57510. ) {
  57511. console[console.info ? 'info' : 'log'](
  57512. "You are running Vue in development mode.\n" +
  57513. "Make sure to turn on production mode when deploying for production.\n" +
  57514. "See more tips at https://vuejs.org/guide/deployment.html"
  57515. );
  57516. }
  57517. }, 0);
  57518. }
  57519. /* */
  57520. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  57521. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  57522. var buildRegex = cached(function (delimiters) {
  57523. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  57524. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  57525. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  57526. });
  57527. function parseText (
  57528. text,
  57529. delimiters
  57530. ) {
  57531. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  57532. if (!tagRE.test(text)) {
  57533. return
  57534. }
  57535. var tokens = [];
  57536. var rawTokens = [];
  57537. var lastIndex = tagRE.lastIndex = 0;
  57538. var match, index, tokenValue;
  57539. while ((match = tagRE.exec(text))) {
  57540. index = match.index;
  57541. // push text token
  57542. if (index > lastIndex) {
  57543. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  57544. tokens.push(JSON.stringify(tokenValue));
  57545. }
  57546. // tag token
  57547. var exp = parseFilters(match[1].trim());
  57548. tokens.push(("_s(" + exp + ")"));
  57549. rawTokens.push({ '@binding': exp });
  57550. lastIndex = index + match[0].length;
  57551. }
  57552. if (lastIndex < text.length) {
  57553. rawTokens.push(tokenValue = text.slice(lastIndex));
  57554. tokens.push(JSON.stringify(tokenValue));
  57555. }
  57556. return {
  57557. expression: tokens.join('+'),
  57558. tokens: rawTokens
  57559. }
  57560. }
  57561. /* */
  57562. function transformNode (el, options) {
  57563. var warn = options.warn || baseWarn;
  57564. var staticClass = getAndRemoveAttr(el, 'class');
  57565. if (staticClass) {
  57566. var res = parseText(staticClass, options.delimiters);
  57567. if (res) {
  57568. warn(
  57569. "class=\"" + staticClass + "\": " +
  57570. 'Interpolation inside attributes has been removed. ' +
  57571. 'Use v-bind or the colon shorthand instead. For example, ' +
  57572. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  57573. el.rawAttrsMap['class']
  57574. );
  57575. }
  57576. }
  57577. if (staticClass) {
  57578. el.staticClass = JSON.stringify(staticClass);
  57579. }
  57580. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  57581. if (classBinding) {
  57582. el.classBinding = classBinding;
  57583. }
  57584. }
  57585. function genData (el) {
  57586. var data = '';
  57587. if (el.staticClass) {
  57588. data += "staticClass:" + (el.staticClass) + ",";
  57589. }
  57590. if (el.classBinding) {
  57591. data += "class:" + (el.classBinding) + ",";
  57592. }
  57593. return data
  57594. }
  57595. var klass$1 = {
  57596. staticKeys: ['staticClass'],
  57597. transformNode: transformNode,
  57598. genData: genData
  57599. };
  57600. /* */
  57601. function transformNode$1 (el, options) {
  57602. var warn = options.warn || baseWarn;
  57603. var staticStyle = getAndRemoveAttr(el, 'style');
  57604. if (staticStyle) {
  57605. /* istanbul ignore if */
  57606. {
  57607. var res = parseText(staticStyle, options.delimiters);
  57608. if (res) {
  57609. warn(
  57610. "style=\"" + staticStyle + "\": " +
  57611. 'Interpolation inside attributes has been removed. ' +
  57612. 'Use v-bind or the colon shorthand instead. For example, ' +
  57613. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  57614. el.rawAttrsMap['style']
  57615. );
  57616. }
  57617. }
  57618. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  57619. }
  57620. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  57621. if (styleBinding) {
  57622. el.styleBinding = styleBinding;
  57623. }
  57624. }
  57625. function genData$1 (el) {
  57626. var data = '';
  57627. if (el.staticStyle) {
  57628. data += "staticStyle:" + (el.staticStyle) + ",";
  57629. }
  57630. if (el.styleBinding) {
  57631. data += "style:(" + (el.styleBinding) + "),";
  57632. }
  57633. return data
  57634. }
  57635. var style$1 = {
  57636. staticKeys: ['staticStyle'],
  57637. transformNode: transformNode$1,
  57638. genData: genData$1
  57639. };
  57640. /* */
  57641. var decoder;
  57642. var he = {
  57643. decode: function decode (html) {
  57644. decoder = decoder || document.createElement('div');
  57645. decoder.innerHTML = html;
  57646. return decoder.textContent
  57647. }
  57648. };
  57649. /* */
  57650. var isUnaryTag = makeMap(
  57651. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  57652. 'link,meta,param,source,track,wbr'
  57653. );
  57654. // Elements that you can, intentionally, leave open
  57655. // (and which close themselves)
  57656. var canBeLeftOpenTag = makeMap(
  57657. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  57658. );
  57659. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  57660. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  57661. var isNonPhrasingTag = makeMap(
  57662. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  57663. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  57664. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  57665. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  57666. 'title,tr,track'
  57667. );
  57668. /**
  57669. * Not type-checking this file because it's mostly vendor code.
  57670. */
  57671. // Regular Expressions for parsing tags and attributes
  57672. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  57673. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  57674. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  57675. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  57676. var startTagOpen = new RegExp(("^<" + qnameCapture));
  57677. var startTagClose = /^\s*(\/?)>/;
  57678. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  57679. var doctype = /^<!DOCTYPE [^>]+>/i;
  57680. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  57681. var comment = /^<!\--/;
  57682. var conditionalComment = /^<!\[/;
  57683. // Special Elements (can contain anything)
  57684. var isPlainTextElement = makeMap('script,style,textarea', true);
  57685. var reCache = {};
  57686. var decodingMap = {
  57687. '&lt;': '<',
  57688. '&gt;': '>',
  57689. '&quot;': '"',
  57690. '&amp;': '&',
  57691. '&#10;': '\n',
  57692. '&#9;': '\t',
  57693. '&#39;': "'"
  57694. };
  57695. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  57696. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  57697. // #5992
  57698. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  57699. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  57700. function decodeAttr (value, shouldDecodeNewlines) {
  57701. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  57702. return value.replace(re, function (match) { return decodingMap[match]; })
  57703. }
  57704. function parseHTML (html, options) {
  57705. var stack = [];
  57706. var expectHTML = options.expectHTML;
  57707. var isUnaryTag$$1 = options.isUnaryTag || no;
  57708. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  57709. var index = 0;
  57710. var last, lastTag;
  57711. while (html) {
  57712. last = html;
  57713. // Make sure we're not in a plaintext content element like script/style
  57714. if (!lastTag || !isPlainTextElement(lastTag)) {
  57715. var textEnd = html.indexOf('<');
  57716. if (textEnd === 0) {
  57717. // Comment:
  57718. if (comment.test(html)) {
  57719. var commentEnd = html.indexOf('-->');
  57720. if (commentEnd >= 0) {
  57721. if (options.shouldKeepComment) {
  57722. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  57723. }
  57724. advance(commentEnd + 3);
  57725. continue
  57726. }
  57727. }
  57728. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  57729. if (conditionalComment.test(html)) {
  57730. var conditionalEnd = html.indexOf(']>');
  57731. if (conditionalEnd >= 0) {
  57732. advance(conditionalEnd + 2);
  57733. continue
  57734. }
  57735. }
  57736. // Doctype:
  57737. var doctypeMatch = html.match(doctype);
  57738. if (doctypeMatch) {
  57739. advance(doctypeMatch[0].length);
  57740. continue
  57741. }
  57742. // End tag:
  57743. var endTagMatch = html.match(endTag);
  57744. if (endTagMatch) {
  57745. var curIndex = index;
  57746. advance(endTagMatch[0].length);
  57747. parseEndTag(endTagMatch[1], curIndex, index);
  57748. continue
  57749. }
  57750. // Start tag:
  57751. var startTagMatch = parseStartTag();
  57752. if (startTagMatch) {
  57753. handleStartTag(startTagMatch);
  57754. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  57755. advance(1);
  57756. }
  57757. continue
  57758. }
  57759. }
  57760. var text = (void 0), rest = (void 0), next = (void 0);
  57761. if (textEnd >= 0) {
  57762. rest = html.slice(textEnd);
  57763. while (
  57764. !endTag.test(rest) &&
  57765. !startTagOpen.test(rest) &&
  57766. !comment.test(rest) &&
  57767. !conditionalComment.test(rest)
  57768. ) {
  57769. // < in plain text, be forgiving and treat it as text
  57770. next = rest.indexOf('<', 1);
  57771. if (next < 0) { break }
  57772. textEnd += next;
  57773. rest = html.slice(textEnd);
  57774. }
  57775. text = html.substring(0, textEnd);
  57776. }
  57777. if (textEnd < 0) {
  57778. text = html;
  57779. }
  57780. if (text) {
  57781. advance(text.length);
  57782. }
  57783. if (options.chars && text) {
  57784. options.chars(text, index - text.length, index);
  57785. }
  57786. } else {
  57787. var endTagLength = 0;
  57788. var stackedTag = lastTag.toLowerCase();
  57789. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  57790. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  57791. endTagLength = endTag.length;
  57792. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  57793. text = text
  57794. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  57795. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  57796. }
  57797. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  57798. text = text.slice(1);
  57799. }
  57800. if (options.chars) {
  57801. options.chars(text);
  57802. }
  57803. return ''
  57804. });
  57805. index += html.length - rest$1.length;
  57806. html = rest$1;
  57807. parseEndTag(stackedTag, index - endTagLength, index);
  57808. }
  57809. if (html === last) {
  57810. options.chars && options.chars(html);
  57811. if (!stack.length && options.warn) {
  57812. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  57813. }
  57814. break
  57815. }
  57816. }
  57817. // Clean up any remaining tags
  57818. parseEndTag();
  57819. function advance (n) {
  57820. index += n;
  57821. html = html.substring(n);
  57822. }
  57823. function parseStartTag () {
  57824. var start = html.match(startTagOpen);
  57825. if (start) {
  57826. var match = {
  57827. tagName: start[1],
  57828. attrs: [],
  57829. start: index
  57830. };
  57831. advance(start[0].length);
  57832. var end, attr;
  57833. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  57834. attr.start = index;
  57835. advance(attr[0].length);
  57836. attr.end = index;
  57837. match.attrs.push(attr);
  57838. }
  57839. if (end) {
  57840. match.unarySlash = end[1];
  57841. advance(end[0].length);
  57842. match.end = index;
  57843. return match
  57844. }
  57845. }
  57846. }
  57847. function handleStartTag (match) {
  57848. var tagName = match.tagName;
  57849. var unarySlash = match.unarySlash;
  57850. if (expectHTML) {
  57851. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  57852. parseEndTag(lastTag);
  57853. }
  57854. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  57855. parseEndTag(tagName);
  57856. }
  57857. }
  57858. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  57859. var l = match.attrs.length;
  57860. var attrs = new Array(l);
  57861. for (var i = 0; i < l; i++) {
  57862. var args = match.attrs[i];
  57863. var value = args[3] || args[4] || args[5] || '';
  57864. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  57865. ? options.shouldDecodeNewlinesForHref
  57866. : options.shouldDecodeNewlines;
  57867. attrs[i] = {
  57868. name: args[1],
  57869. value: decodeAttr(value, shouldDecodeNewlines)
  57870. };
  57871. if (options.outputSourceRange) {
  57872. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  57873. attrs[i].end = args.end;
  57874. }
  57875. }
  57876. if (!unary) {
  57877. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  57878. lastTag = tagName;
  57879. }
  57880. if (options.start) {
  57881. options.start(tagName, attrs, unary, match.start, match.end);
  57882. }
  57883. }
  57884. function parseEndTag (tagName, start, end) {
  57885. var pos, lowerCasedTagName;
  57886. if (start == null) { start = index; }
  57887. if (end == null) { end = index; }
  57888. // Find the closest opened tag of the same type
  57889. if (tagName) {
  57890. lowerCasedTagName = tagName.toLowerCase();
  57891. for (pos = stack.length - 1; pos >= 0; pos--) {
  57892. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  57893. break
  57894. }
  57895. }
  57896. } else {
  57897. // If no tag name is provided, clean shop
  57898. pos = 0;
  57899. }
  57900. if (pos >= 0) {
  57901. // Close all the open elements, up the stack
  57902. for (var i = stack.length - 1; i >= pos; i--) {
  57903. if (i > pos || !tagName &&
  57904. options.warn
  57905. ) {
  57906. options.warn(
  57907. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  57908. { start: stack[i].start, end: stack[i].end }
  57909. );
  57910. }
  57911. if (options.end) {
  57912. options.end(stack[i].tag, start, end);
  57913. }
  57914. }
  57915. // Remove the open elements from the stack
  57916. stack.length = pos;
  57917. lastTag = pos && stack[pos - 1].tag;
  57918. } else if (lowerCasedTagName === 'br') {
  57919. if (options.start) {
  57920. options.start(tagName, [], true, start, end);
  57921. }
  57922. } else if (lowerCasedTagName === 'p') {
  57923. if (options.start) {
  57924. options.start(tagName, [], false, start, end);
  57925. }
  57926. if (options.end) {
  57927. options.end(tagName, start, end);
  57928. }
  57929. }
  57930. }
  57931. }
  57932. /* */
  57933. var onRE = /^@|^v-on:/;
  57934. var dirRE = /^v-|^@|^:|^#/;
  57935. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  57936. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  57937. var stripParensRE = /^\(|\)$/g;
  57938. var dynamicArgRE = /^\[.*\]$/;
  57939. var argRE = /:(.*)$/;
  57940. var bindRE = /^:|^\.|^v-bind:/;
  57941. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  57942. var slotRE = /^v-slot(:|$)|^#/;
  57943. var lineBreakRE = /[\r\n]/;
  57944. var whitespaceRE$1 = /\s+/g;
  57945. var invalidAttributeRE = /[\s"'<>\/=]/;
  57946. var decodeHTMLCached = cached(he.decode);
  57947. var emptySlotScopeToken = "_empty_";
  57948. // configurable state
  57949. var warn$2;
  57950. var delimiters;
  57951. var transforms;
  57952. var preTransforms;
  57953. var postTransforms;
  57954. var platformIsPreTag;
  57955. var platformMustUseProp;
  57956. var platformGetTagNamespace;
  57957. var maybeComponent;
  57958. function createASTElement (
  57959. tag,
  57960. attrs,
  57961. parent
  57962. ) {
  57963. return {
  57964. type: 1,
  57965. tag: tag,
  57966. attrsList: attrs,
  57967. attrsMap: makeAttrsMap(attrs),
  57968. rawAttrsMap: {},
  57969. parent: parent,
  57970. children: []
  57971. }
  57972. }
  57973. /**
  57974. * Convert HTML string to AST.
  57975. */
  57976. function parse (
  57977. template,
  57978. options
  57979. ) {
  57980. warn$2 = options.warn || baseWarn;
  57981. platformIsPreTag = options.isPreTag || no;
  57982. platformMustUseProp = options.mustUseProp || no;
  57983. platformGetTagNamespace = options.getTagNamespace || no;
  57984. var isReservedTag = options.isReservedTag || no;
  57985. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  57986. transforms = pluckModuleFunction(options.modules, 'transformNode');
  57987. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  57988. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  57989. delimiters = options.delimiters;
  57990. var stack = [];
  57991. var preserveWhitespace = options.preserveWhitespace !== false;
  57992. var whitespaceOption = options.whitespace;
  57993. var root;
  57994. var currentParent;
  57995. var inVPre = false;
  57996. var inPre = false;
  57997. var warned = false;
  57998. function warnOnce (msg, range) {
  57999. if (!warned) {
  58000. warned = true;
  58001. warn$2(msg, range);
  58002. }
  58003. }
  58004. function closeElement (element) {
  58005. trimEndingWhitespace(element);
  58006. if (!inVPre && !element.processed) {
  58007. element = processElement(element, options);
  58008. }
  58009. // tree management
  58010. if (!stack.length && element !== root) {
  58011. // allow root elements with v-if, v-else-if and v-else
  58012. if (root.if && (element.elseif || element.else)) {
  58013. {
  58014. checkRootConstraints(element);
  58015. }
  58016. addIfCondition(root, {
  58017. exp: element.elseif,
  58018. block: element
  58019. });
  58020. } else {
  58021. warnOnce(
  58022. "Component template should contain exactly one root element. " +
  58023. "If you are using v-if on multiple elements, " +
  58024. "use v-else-if to chain them instead.",
  58025. { start: element.start }
  58026. );
  58027. }
  58028. }
  58029. if (currentParent && !element.forbidden) {
  58030. if (element.elseif || element.else) {
  58031. processIfConditions(element, currentParent);
  58032. } else {
  58033. if (element.slotScope) {
  58034. // scoped slot
  58035. // keep it in the children list so that v-else(-if) conditions can
  58036. // find it as the prev node.
  58037. var name = element.slotTarget || '"default"'
  58038. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  58039. }
  58040. currentParent.children.push(element);
  58041. element.parent = currentParent;
  58042. }
  58043. }
  58044. // final children cleanup
  58045. // filter out scoped slots
  58046. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  58047. // remove trailing whitespace node again
  58048. trimEndingWhitespace(element);
  58049. // check pre state
  58050. if (element.pre) {
  58051. inVPre = false;
  58052. }
  58053. if (platformIsPreTag(element.tag)) {
  58054. inPre = false;
  58055. }
  58056. // apply post-transforms
  58057. for (var i = 0; i < postTransforms.length; i++) {
  58058. postTransforms[i](element, options);
  58059. }
  58060. }
  58061. function trimEndingWhitespace (el) {
  58062. // remove trailing whitespace node
  58063. if (!inPre) {
  58064. var lastNode;
  58065. while (
  58066. (lastNode = el.children[el.children.length - 1]) &&
  58067. lastNode.type === 3 &&
  58068. lastNode.text === ' '
  58069. ) {
  58070. el.children.pop();
  58071. }
  58072. }
  58073. }
  58074. function checkRootConstraints (el) {
  58075. if (el.tag === 'slot' || el.tag === 'template') {
  58076. warnOnce(
  58077. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  58078. 'contain multiple nodes.',
  58079. { start: el.start }
  58080. );
  58081. }
  58082. if (el.attrsMap.hasOwnProperty('v-for')) {
  58083. warnOnce(
  58084. 'Cannot use v-for on stateful component root element because ' +
  58085. 'it renders multiple elements.',
  58086. el.rawAttrsMap['v-for']
  58087. );
  58088. }
  58089. }
  58090. parseHTML(template, {
  58091. warn: warn$2,
  58092. expectHTML: options.expectHTML,
  58093. isUnaryTag: options.isUnaryTag,
  58094. canBeLeftOpenTag: options.canBeLeftOpenTag,
  58095. shouldDecodeNewlines: options.shouldDecodeNewlines,
  58096. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  58097. shouldKeepComment: options.comments,
  58098. outputSourceRange: options.outputSourceRange,
  58099. start: function start (tag, attrs, unary, start$1, end) {
  58100. // check namespace.
  58101. // inherit parent ns if there is one
  58102. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  58103. // handle IE svg bug
  58104. /* istanbul ignore if */
  58105. if (isIE && ns === 'svg') {
  58106. attrs = guardIESVGBug(attrs);
  58107. }
  58108. var element = createASTElement(tag, attrs, currentParent);
  58109. if (ns) {
  58110. element.ns = ns;
  58111. }
  58112. {
  58113. if (options.outputSourceRange) {
  58114. element.start = start$1;
  58115. element.end = end;
  58116. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  58117. cumulated[attr.name] = attr;
  58118. return cumulated
  58119. }, {});
  58120. }
  58121. attrs.forEach(function (attr) {
  58122. if (invalidAttributeRE.test(attr.name)) {
  58123. warn$2(
  58124. "Invalid dynamic argument expression: attribute names cannot contain " +
  58125. "spaces, quotes, <, >, / or =.",
  58126. {
  58127. start: attr.start + attr.name.indexOf("["),
  58128. end: attr.start + attr.name.length
  58129. }
  58130. );
  58131. }
  58132. });
  58133. }
  58134. if (isForbiddenTag(element) && !isServerRendering()) {
  58135. element.forbidden = true;
  58136. warn$2(
  58137. 'Templates should only be responsible for mapping the state to the ' +
  58138. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  58139. "<" + tag + ">" + ', as they will not be parsed.',
  58140. { start: element.start }
  58141. );
  58142. }
  58143. // apply pre-transforms
  58144. for (var i = 0; i < preTransforms.length; i++) {
  58145. element = preTransforms[i](element, options) || element;
  58146. }
  58147. if (!inVPre) {
  58148. processPre(element);
  58149. if (element.pre) {
  58150. inVPre = true;
  58151. }
  58152. }
  58153. if (platformIsPreTag(element.tag)) {
  58154. inPre = true;
  58155. }
  58156. if (inVPre) {
  58157. processRawAttrs(element);
  58158. } else if (!element.processed) {
  58159. // structural directives
  58160. processFor(element);
  58161. processIf(element);
  58162. processOnce(element);
  58163. }
  58164. if (!root) {
  58165. root = element;
  58166. {
  58167. checkRootConstraints(root);
  58168. }
  58169. }
  58170. if (!unary) {
  58171. currentParent = element;
  58172. stack.push(element);
  58173. } else {
  58174. closeElement(element);
  58175. }
  58176. },
  58177. end: function end (tag, start, end$1) {
  58178. var element = stack[stack.length - 1];
  58179. // pop stack
  58180. stack.length -= 1;
  58181. currentParent = stack[stack.length - 1];
  58182. if (options.outputSourceRange) {
  58183. element.end = end$1;
  58184. }
  58185. closeElement(element);
  58186. },
  58187. chars: function chars (text, start, end) {
  58188. if (!currentParent) {
  58189. {
  58190. if (text === template) {
  58191. warnOnce(
  58192. 'Component template requires a root element, rather than just text.',
  58193. { start: start }
  58194. );
  58195. } else if ((text = text.trim())) {
  58196. warnOnce(
  58197. ("text \"" + text + "\" outside root element will be ignored."),
  58198. { start: start }
  58199. );
  58200. }
  58201. }
  58202. return
  58203. }
  58204. // IE textarea placeholder bug
  58205. /* istanbul ignore if */
  58206. if (isIE &&
  58207. currentParent.tag === 'textarea' &&
  58208. currentParent.attrsMap.placeholder === text
  58209. ) {
  58210. return
  58211. }
  58212. var children = currentParent.children;
  58213. if (inPre || text.trim()) {
  58214. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  58215. } else if (!children.length) {
  58216. // remove the whitespace-only node right after an opening tag
  58217. text = '';
  58218. } else if (whitespaceOption) {
  58219. if (whitespaceOption === 'condense') {
  58220. // in condense mode, remove the whitespace node if it contains
  58221. // line break, otherwise condense to a single space
  58222. text = lineBreakRE.test(text) ? '' : ' ';
  58223. } else {
  58224. text = ' ';
  58225. }
  58226. } else {
  58227. text = preserveWhitespace ? ' ' : '';
  58228. }
  58229. if (text) {
  58230. if (!inPre && whitespaceOption === 'condense') {
  58231. // condense consecutive whitespaces into single space
  58232. text = text.replace(whitespaceRE$1, ' ');
  58233. }
  58234. var res;
  58235. var child;
  58236. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  58237. child = {
  58238. type: 2,
  58239. expression: res.expression,
  58240. tokens: res.tokens,
  58241. text: text
  58242. };
  58243. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  58244. child = {
  58245. type: 3,
  58246. text: text
  58247. };
  58248. }
  58249. if (child) {
  58250. if (options.outputSourceRange) {
  58251. child.start = start;
  58252. child.end = end;
  58253. }
  58254. children.push(child);
  58255. }
  58256. }
  58257. },
  58258. comment: function comment (text, start, end) {
  58259. // adding anyting as a sibling to the root node is forbidden
  58260. // comments should still be allowed, but ignored
  58261. if (currentParent) {
  58262. var child = {
  58263. type: 3,
  58264. text: text,
  58265. isComment: true
  58266. };
  58267. if (options.outputSourceRange) {
  58268. child.start = start;
  58269. child.end = end;
  58270. }
  58271. currentParent.children.push(child);
  58272. }
  58273. }
  58274. });
  58275. return root
  58276. }
  58277. function processPre (el) {
  58278. if (getAndRemoveAttr(el, 'v-pre') != null) {
  58279. el.pre = true;
  58280. }
  58281. }
  58282. function processRawAttrs (el) {
  58283. var list = el.attrsList;
  58284. var len = list.length;
  58285. if (len) {
  58286. var attrs = el.attrs = new Array(len);
  58287. for (var i = 0; i < len; i++) {
  58288. attrs[i] = {
  58289. name: list[i].name,
  58290. value: JSON.stringify(list[i].value)
  58291. };
  58292. if (list[i].start != null) {
  58293. attrs[i].start = list[i].start;
  58294. attrs[i].end = list[i].end;
  58295. }
  58296. }
  58297. } else if (!el.pre) {
  58298. // non root node in pre blocks with no attributes
  58299. el.plain = true;
  58300. }
  58301. }
  58302. function processElement (
  58303. element,
  58304. options
  58305. ) {
  58306. processKey(element);
  58307. // determine whether this is a plain element after
  58308. // removing structural attributes
  58309. element.plain = (
  58310. !element.key &&
  58311. !element.scopedSlots &&
  58312. !element.attrsList.length
  58313. );
  58314. processRef(element);
  58315. processSlotContent(element);
  58316. processSlotOutlet(element);
  58317. processComponent(element);
  58318. for (var i = 0; i < transforms.length; i++) {
  58319. element = transforms[i](element, options) || element;
  58320. }
  58321. processAttrs(element);
  58322. return element
  58323. }
  58324. function processKey (el) {
  58325. var exp = getBindingAttr(el, 'key');
  58326. if (exp) {
  58327. {
  58328. if (el.tag === 'template') {
  58329. warn$2(
  58330. "<template> cannot be keyed. Place the key on real elements instead.",
  58331. getRawBindingAttr(el, 'key')
  58332. );
  58333. }
  58334. if (el.for) {
  58335. var iterator = el.iterator2 || el.iterator1;
  58336. var parent = el.parent;
  58337. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  58338. warn$2(
  58339. "Do not use v-for index as key on <transition-group> children, " +
  58340. "this is the same as not using keys.",
  58341. getRawBindingAttr(el, 'key'),
  58342. true /* tip */
  58343. );
  58344. }
  58345. }
  58346. }
  58347. el.key = exp;
  58348. }
  58349. }
  58350. function processRef (el) {
  58351. var ref = getBindingAttr(el, 'ref');
  58352. if (ref) {
  58353. el.ref = ref;
  58354. el.refInFor = checkInFor(el);
  58355. }
  58356. }
  58357. function processFor (el) {
  58358. var exp;
  58359. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  58360. var res = parseFor(exp);
  58361. if (res) {
  58362. extend(el, res);
  58363. } else {
  58364. warn$2(
  58365. ("Invalid v-for expression: " + exp),
  58366. el.rawAttrsMap['v-for']
  58367. );
  58368. }
  58369. }
  58370. }
  58371. function parseFor (exp) {
  58372. var inMatch = exp.match(forAliasRE);
  58373. if (!inMatch) { return }
  58374. var res = {};
  58375. res.for = inMatch[2].trim();
  58376. var alias = inMatch[1].trim().replace(stripParensRE, '');
  58377. var iteratorMatch = alias.match(forIteratorRE);
  58378. if (iteratorMatch) {
  58379. res.alias = alias.replace(forIteratorRE, '').trim();
  58380. res.iterator1 = iteratorMatch[1].trim();
  58381. if (iteratorMatch[2]) {
  58382. res.iterator2 = iteratorMatch[2].trim();
  58383. }
  58384. } else {
  58385. res.alias = alias;
  58386. }
  58387. return res
  58388. }
  58389. function processIf (el) {
  58390. var exp = getAndRemoveAttr(el, 'v-if');
  58391. if (exp) {
  58392. el.if = exp;
  58393. addIfCondition(el, {
  58394. exp: exp,
  58395. block: el
  58396. });
  58397. } else {
  58398. if (getAndRemoveAttr(el, 'v-else') != null) {
  58399. el.else = true;
  58400. }
  58401. var elseif = getAndRemoveAttr(el, 'v-else-if');
  58402. if (elseif) {
  58403. el.elseif = elseif;
  58404. }
  58405. }
  58406. }
  58407. function processIfConditions (el, parent) {
  58408. var prev = findPrevElement(parent.children);
  58409. if (prev && prev.if) {
  58410. addIfCondition(prev, {
  58411. exp: el.elseif,
  58412. block: el
  58413. });
  58414. } else {
  58415. warn$2(
  58416. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  58417. "used on element <" + (el.tag) + "> without corresponding v-if.",
  58418. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  58419. );
  58420. }
  58421. }
  58422. function findPrevElement (children) {
  58423. var i = children.length;
  58424. while (i--) {
  58425. if (children[i].type === 1) {
  58426. return children[i]
  58427. } else {
  58428. if (children[i].text !== ' ') {
  58429. warn$2(
  58430. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  58431. "will be ignored.",
  58432. children[i]
  58433. );
  58434. }
  58435. children.pop();
  58436. }
  58437. }
  58438. }
  58439. function addIfCondition (el, condition) {
  58440. if (!el.ifConditions) {
  58441. el.ifConditions = [];
  58442. }
  58443. el.ifConditions.push(condition);
  58444. }
  58445. function processOnce (el) {
  58446. var once$$1 = getAndRemoveAttr(el, 'v-once');
  58447. if (once$$1 != null) {
  58448. el.once = true;
  58449. }
  58450. }
  58451. // handle content being passed to a component as slot,
  58452. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  58453. function processSlotContent (el) {
  58454. var slotScope;
  58455. if (el.tag === 'template') {
  58456. slotScope = getAndRemoveAttr(el, 'scope');
  58457. /* istanbul ignore if */
  58458. if (slotScope) {
  58459. warn$2(
  58460. "the \"scope\" attribute for scoped slots have been deprecated and " +
  58461. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  58462. "can also be used on plain elements in addition to <template> to " +
  58463. "denote scoped slots.",
  58464. el.rawAttrsMap['scope'],
  58465. true
  58466. );
  58467. }
  58468. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  58469. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  58470. /* istanbul ignore if */
  58471. if (el.attrsMap['v-for']) {
  58472. warn$2(
  58473. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  58474. "(v-for takes higher priority). Use a wrapper <template> for the " +
  58475. "scoped slot to make it clearer.",
  58476. el.rawAttrsMap['slot-scope'],
  58477. true
  58478. );
  58479. }
  58480. el.slotScope = slotScope;
  58481. }
  58482. // slot="xxx"
  58483. var slotTarget = getBindingAttr(el, 'slot');
  58484. if (slotTarget) {
  58485. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  58486. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  58487. // preserve slot as an attribute for native shadow DOM compat
  58488. // only for non-scoped slots.
  58489. if (el.tag !== 'template' && !el.slotScope) {
  58490. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  58491. }
  58492. }
  58493. // 2.6 v-slot syntax
  58494. {
  58495. if (el.tag === 'template') {
  58496. // v-slot on <template>
  58497. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  58498. if (slotBinding) {
  58499. {
  58500. if (el.slotTarget || el.slotScope) {
  58501. warn$2(
  58502. "Unexpected mixed usage of different slot syntaxes.",
  58503. el
  58504. );
  58505. }
  58506. if (el.parent && !maybeComponent(el.parent)) {
  58507. warn$2(
  58508. "<template v-slot> can only appear at the root level inside " +
  58509. "the receiving component",
  58510. el
  58511. );
  58512. }
  58513. }
  58514. var ref = getSlotName(slotBinding);
  58515. var name = ref.name;
  58516. var dynamic = ref.dynamic;
  58517. el.slotTarget = name;
  58518. el.slotTargetDynamic = dynamic;
  58519. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  58520. }
  58521. } else {
  58522. // v-slot on component, denotes default slot
  58523. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  58524. if (slotBinding$1) {
  58525. {
  58526. if (!maybeComponent(el)) {
  58527. warn$2(
  58528. "v-slot can only be used on components or <template>.",
  58529. slotBinding$1
  58530. );
  58531. }
  58532. if (el.slotScope || el.slotTarget) {
  58533. warn$2(
  58534. "Unexpected mixed usage of different slot syntaxes.",
  58535. el
  58536. );
  58537. }
  58538. if (el.scopedSlots) {
  58539. warn$2(
  58540. "To avoid scope ambiguity, the default slot should also use " +
  58541. "<template> syntax when there are other named slots.",
  58542. slotBinding$1
  58543. );
  58544. }
  58545. }
  58546. // add the component's children to its default slot
  58547. var slots = el.scopedSlots || (el.scopedSlots = {});
  58548. var ref$1 = getSlotName(slotBinding$1);
  58549. var name$1 = ref$1.name;
  58550. var dynamic$1 = ref$1.dynamic;
  58551. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  58552. slotContainer.slotTarget = name$1;
  58553. slotContainer.slotTargetDynamic = dynamic$1;
  58554. slotContainer.children = el.children.filter(function (c) {
  58555. if (!c.slotScope) {
  58556. c.parent = slotContainer;
  58557. return true
  58558. }
  58559. });
  58560. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  58561. // remove children as they are returned from scopedSlots now
  58562. el.children = [];
  58563. // mark el non-plain so data gets generated
  58564. el.plain = false;
  58565. }
  58566. }
  58567. }
  58568. }
  58569. function getSlotName (binding) {
  58570. var name = binding.name.replace(slotRE, '');
  58571. if (!name) {
  58572. if (binding.name[0] !== '#') {
  58573. name = 'default';
  58574. } else {
  58575. warn$2(
  58576. "v-slot shorthand syntax requires a slot name.",
  58577. binding
  58578. );
  58579. }
  58580. }
  58581. return dynamicArgRE.test(name)
  58582. // dynamic [name]
  58583. ? { name: name.slice(1, -1), dynamic: true }
  58584. // static name
  58585. : { name: ("\"" + name + "\""), dynamic: false }
  58586. }
  58587. // handle <slot/> outlets
  58588. function processSlotOutlet (el) {
  58589. if (el.tag === 'slot') {
  58590. el.slotName = getBindingAttr(el, 'name');
  58591. if (el.key) {
  58592. warn$2(
  58593. "`key` does not work on <slot> because slots are abstract outlets " +
  58594. "and can possibly expand into multiple elements. " +
  58595. "Use the key on a wrapping element instead.",
  58596. getRawBindingAttr(el, 'key')
  58597. );
  58598. }
  58599. }
  58600. }
  58601. function processComponent (el) {
  58602. var binding;
  58603. if ((binding = getBindingAttr(el, 'is'))) {
  58604. el.component = binding;
  58605. }
  58606. if (getAndRemoveAttr(el, 'inline-template') != null) {
  58607. el.inlineTemplate = true;
  58608. }
  58609. }
  58610. function processAttrs (el) {
  58611. var list = el.attrsList;
  58612. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  58613. for (i = 0, l = list.length; i < l; i++) {
  58614. name = rawName = list[i].name;
  58615. value = list[i].value;
  58616. if (dirRE.test(name)) {
  58617. // mark element as dynamic
  58618. el.hasBindings = true;
  58619. // modifiers
  58620. modifiers = parseModifiers(name.replace(dirRE, ''));
  58621. // support .foo shorthand syntax for the .prop modifier
  58622. if (modifiers) {
  58623. name = name.replace(modifierRE, '');
  58624. }
  58625. if (bindRE.test(name)) { // v-bind
  58626. name = name.replace(bindRE, '');
  58627. value = parseFilters(value);
  58628. isDynamic = dynamicArgRE.test(name);
  58629. if (isDynamic) {
  58630. name = name.slice(1, -1);
  58631. }
  58632. if (
  58633. value.trim().length === 0
  58634. ) {
  58635. warn$2(
  58636. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  58637. );
  58638. }
  58639. if (modifiers) {
  58640. if (modifiers.prop && !isDynamic) {
  58641. name = camelize(name);
  58642. if (name === 'innerHtml') { name = 'innerHTML'; }
  58643. }
  58644. if (modifiers.camel && !isDynamic) {
  58645. name = camelize(name);
  58646. }
  58647. if (modifiers.sync) {
  58648. syncGen = genAssignmentCode(value, "$event");
  58649. if (!isDynamic) {
  58650. addHandler(
  58651. el,
  58652. ("update:" + (camelize(name))),
  58653. syncGen,
  58654. null,
  58655. false,
  58656. warn$2,
  58657. list[i]
  58658. );
  58659. if (hyphenate(name) !== camelize(name)) {
  58660. addHandler(
  58661. el,
  58662. ("update:" + (hyphenate(name))),
  58663. syncGen,
  58664. null,
  58665. false,
  58666. warn$2,
  58667. list[i]
  58668. );
  58669. }
  58670. } else {
  58671. // handler w/ dynamic event name
  58672. addHandler(
  58673. el,
  58674. ("\"update:\"+(" + name + ")"),
  58675. syncGen,
  58676. null,
  58677. false,
  58678. warn$2,
  58679. list[i],
  58680. true // dynamic
  58681. );
  58682. }
  58683. }
  58684. }
  58685. if ((modifiers && modifiers.prop) || (
  58686. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  58687. )) {
  58688. addProp(el, name, value, list[i], isDynamic);
  58689. } else {
  58690. addAttr(el, name, value, list[i], isDynamic);
  58691. }
  58692. } else if (onRE.test(name)) { // v-on
  58693. name = name.replace(onRE, '');
  58694. isDynamic = dynamicArgRE.test(name);
  58695. if (isDynamic) {
  58696. name = name.slice(1, -1);
  58697. }
  58698. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  58699. } else { // normal directives
  58700. name = name.replace(dirRE, '');
  58701. // parse arg
  58702. var argMatch = name.match(argRE);
  58703. var arg = argMatch && argMatch[1];
  58704. isDynamic = false;
  58705. if (arg) {
  58706. name = name.slice(0, -(arg.length + 1));
  58707. if (dynamicArgRE.test(arg)) {
  58708. arg = arg.slice(1, -1);
  58709. isDynamic = true;
  58710. }
  58711. }
  58712. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  58713. if (name === 'model') {
  58714. checkForAliasModel(el, value);
  58715. }
  58716. }
  58717. } else {
  58718. // literal attribute
  58719. {
  58720. var res = parseText(value, delimiters);
  58721. if (res) {
  58722. warn$2(
  58723. name + "=\"" + value + "\": " +
  58724. 'Interpolation inside attributes has been removed. ' +
  58725. 'Use v-bind or the colon shorthand instead. For example, ' +
  58726. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  58727. list[i]
  58728. );
  58729. }
  58730. }
  58731. addAttr(el, name, JSON.stringify(value), list[i]);
  58732. // #6887 firefox doesn't update muted state if set via attribute
  58733. // even immediately after element creation
  58734. if (!el.component &&
  58735. name === 'muted' &&
  58736. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  58737. addProp(el, name, 'true', list[i]);
  58738. }
  58739. }
  58740. }
  58741. }
  58742. function checkInFor (el) {
  58743. var parent = el;
  58744. while (parent) {
  58745. if (parent.for !== undefined) {
  58746. return true
  58747. }
  58748. parent = parent.parent;
  58749. }
  58750. return false
  58751. }
  58752. function parseModifiers (name) {
  58753. var match = name.match(modifierRE);
  58754. if (match) {
  58755. var ret = {};
  58756. match.forEach(function (m) { ret[m.slice(1)] = true; });
  58757. return ret
  58758. }
  58759. }
  58760. function makeAttrsMap (attrs) {
  58761. var map = {};
  58762. for (var i = 0, l = attrs.length; i < l; i++) {
  58763. if (
  58764. map[attrs[i].name] && !isIE && !isEdge
  58765. ) {
  58766. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  58767. }
  58768. map[attrs[i].name] = attrs[i].value;
  58769. }
  58770. return map
  58771. }
  58772. // for script (e.g. type="x/template") or style, do not decode content
  58773. function isTextTag (el) {
  58774. return el.tag === 'script' || el.tag === 'style'
  58775. }
  58776. function isForbiddenTag (el) {
  58777. return (
  58778. el.tag === 'style' ||
  58779. (el.tag === 'script' && (
  58780. !el.attrsMap.type ||
  58781. el.attrsMap.type === 'text/javascript'
  58782. ))
  58783. )
  58784. }
  58785. var ieNSBug = /^xmlns:NS\d+/;
  58786. var ieNSPrefix = /^NS\d+:/;
  58787. /* istanbul ignore next */
  58788. function guardIESVGBug (attrs) {
  58789. var res = [];
  58790. for (var i = 0; i < attrs.length; i++) {
  58791. var attr = attrs[i];
  58792. if (!ieNSBug.test(attr.name)) {
  58793. attr.name = attr.name.replace(ieNSPrefix, '');
  58794. res.push(attr);
  58795. }
  58796. }
  58797. return res
  58798. }
  58799. function checkForAliasModel (el, value) {
  58800. var _el = el;
  58801. while (_el) {
  58802. if (_el.for && _el.alias === value) {
  58803. warn$2(
  58804. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  58805. "You are binding v-model directly to a v-for iteration alias. " +
  58806. "This will not be able to modify the v-for source array because " +
  58807. "writing to the alias is like modifying a function local variable. " +
  58808. "Consider using an array of objects and use v-model on an object property instead.",
  58809. el.rawAttrsMap['v-model']
  58810. );
  58811. }
  58812. _el = _el.parent;
  58813. }
  58814. }
  58815. /* */
  58816. function preTransformNode (el, options) {
  58817. if (el.tag === 'input') {
  58818. var map = el.attrsMap;
  58819. if (!map['v-model']) {
  58820. return
  58821. }
  58822. var typeBinding;
  58823. if (map[':type'] || map['v-bind:type']) {
  58824. typeBinding = getBindingAttr(el, 'type');
  58825. }
  58826. if (!map.type && !typeBinding && map['v-bind']) {
  58827. typeBinding = "(" + (map['v-bind']) + ").type";
  58828. }
  58829. if (typeBinding) {
  58830. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  58831. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  58832. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  58833. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  58834. // 1. checkbox
  58835. var branch0 = cloneASTElement(el);
  58836. // process for on the main node
  58837. processFor(branch0);
  58838. addRawAttr(branch0, 'type', 'checkbox');
  58839. processElement(branch0, options);
  58840. branch0.processed = true; // prevent it from double-processed
  58841. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  58842. addIfCondition(branch0, {
  58843. exp: branch0.if,
  58844. block: branch0
  58845. });
  58846. // 2. add radio else-if condition
  58847. var branch1 = cloneASTElement(el);
  58848. getAndRemoveAttr(branch1, 'v-for', true);
  58849. addRawAttr(branch1, 'type', 'radio');
  58850. processElement(branch1, options);
  58851. addIfCondition(branch0, {
  58852. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  58853. block: branch1
  58854. });
  58855. // 3. other
  58856. var branch2 = cloneASTElement(el);
  58857. getAndRemoveAttr(branch2, 'v-for', true);
  58858. addRawAttr(branch2, ':type', typeBinding);
  58859. processElement(branch2, options);
  58860. addIfCondition(branch0, {
  58861. exp: ifCondition,
  58862. block: branch2
  58863. });
  58864. if (hasElse) {
  58865. branch0.else = true;
  58866. } else if (elseIfCondition) {
  58867. branch0.elseif = elseIfCondition;
  58868. }
  58869. return branch0
  58870. }
  58871. }
  58872. }
  58873. function cloneASTElement (el) {
  58874. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  58875. }
  58876. var model$1 = {
  58877. preTransformNode: preTransformNode
  58878. };
  58879. var modules$1 = [
  58880. klass$1,
  58881. style$1,
  58882. model$1
  58883. ];
  58884. /* */
  58885. function text (el, dir) {
  58886. if (dir.value) {
  58887. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  58888. }
  58889. }
  58890. /* */
  58891. function html (el, dir) {
  58892. if (dir.value) {
  58893. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  58894. }
  58895. }
  58896. var directives$1 = {
  58897. model: model,
  58898. text: text,
  58899. html: html
  58900. };
  58901. /* */
  58902. var baseOptions = {
  58903. expectHTML: true,
  58904. modules: modules$1,
  58905. directives: directives$1,
  58906. isPreTag: isPreTag,
  58907. isUnaryTag: isUnaryTag,
  58908. mustUseProp: mustUseProp,
  58909. canBeLeftOpenTag: canBeLeftOpenTag,
  58910. isReservedTag: isReservedTag,
  58911. getTagNamespace: getTagNamespace,
  58912. staticKeys: genStaticKeys(modules$1)
  58913. };
  58914. /* */
  58915. var isStaticKey;
  58916. var isPlatformReservedTag;
  58917. var genStaticKeysCached = cached(genStaticKeys$1);
  58918. /**
  58919. * Goal of the optimizer: walk the generated template AST tree
  58920. * and detect sub-trees that are purely static, i.e. parts of
  58921. * the DOM that never needs to change.
  58922. *
  58923. * Once we detect these sub-trees, we can:
  58924. *
  58925. * 1. Hoist them into constants, so that we no longer need to
  58926. * create fresh nodes for them on each re-render;
  58927. * 2. Completely skip them in the patching process.
  58928. */
  58929. function optimize (root, options) {
  58930. if (!root) { return }
  58931. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  58932. isPlatformReservedTag = options.isReservedTag || no;
  58933. // first pass: mark all non-static nodes.
  58934. markStatic$1(root);
  58935. // second pass: mark static roots.
  58936. markStaticRoots(root, false);
  58937. }
  58938. function genStaticKeys$1 (keys) {
  58939. return makeMap(
  58940. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  58941. (keys ? ',' + keys : '')
  58942. )
  58943. }
  58944. function markStatic$1 (node) {
  58945. node.static = isStatic(node);
  58946. if (node.type === 1) {
  58947. // do not make component slot content static. this avoids
  58948. // 1. components not able to mutate slot nodes
  58949. // 2. static slot content fails for hot-reloading
  58950. if (
  58951. !isPlatformReservedTag(node.tag) &&
  58952. node.tag !== 'slot' &&
  58953. node.attrsMap['inline-template'] == null
  58954. ) {
  58955. return
  58956. }
  58957. for (var i = 0, l = node.children.length; i < l; i++) {
  58958. var child = node.children[i];
  58959. markStatic$1(child);
  58960. if (!child.static) {
  58961. node.static = false;
  58962. }
  58963. }
  58964. if (node.ifConditions) {
  58965. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  58966. var block = node.ifConditions[i$1].block;
  58967. markStatic$1(block);
  58968. if (!block.static) {
  58969. node.static = false;
  58970. }
  58971. }
  58972. }
  58973. }
  58974. }
  58975. function markStaticRoots (node, isInFor) {
  58976. if (node.type === 1) {
  58977. if (node.static || node.once) {
  58978. node.staticInFor = isInFor;
  58979. }
  58980. // For a node to qualify as a static root, it should have children that
  58981. // are not just static text. Otherwise the cost of hoisting out will
  58982. // outweigh the benefits and it's better off to just always render it fresh.
  58983. if (node.static && node.children.length && !(
  58984. node.children.length === 1 &&
  58985. node.children[0].type === 3
  58986. )) {
  58987. node.staticRoot = true;
  58988. return
  58989. } else {
  58990. node.staticRoot = false;
  58991. }
  58992. if (node.children) {
  58993. for (var i = 0, l = node.children.length; i < l; i++) {
  58994. markStaticRoots(node.children[i], isInFor || !!node.for);
  58995. }
  58996. }
  58997. if (node.ifConditions) {
  58998. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  58999. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  59000. }
  59001. }
  59002. }
  59003. }
  59004. function isStatic (node) {
  59005. if (node.type === 2) { // expression
  59006. return false
  59007. }
  59008. if (node.type === 3) { // text
  59009. return true
  59010. }
  59011. return !!(node.pre || (
  59012. !node.hasBindings && // no dynamic bindings
  59013. !node.if && !node.for && // not v-if or v-for or v-else
  59014. !isBuiltInTag(node.tag) && // not a built-in
  59015. isPlatformReservedTag(node.tag) && // not a component
  59016. !isDirectChildOfTemplateFor(node) &&
  59017. Object.keys(node).every(isStaticKey)
  59018. ))
  59019. }
  59020. function isDirectChildOfTemplateFor (node) {
  59021. while (node.parent) {
  59022. node = node.parent;
  59023. if (node.tag !== 'template') {
  59024. return false
  59025. }
  59026. if (node.for) {
  59027. return true
  59028. }
  59029. }
  59030. return false
  59031. }
  59032. /* */
  59033. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  59034. var fnInvokeRE = /\([^)]*?\);*$/;
  59035. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  59036. // KeyboardEvent.keyCode aliases
  59037. var keyCodes = {
  59038. esc: 27,
  59039. tab: 9,
  59040. enter: 13,
  59041. space: 32,
  59042. up: 38,
  59043. left: 37,
  59044. right: 39,
  59045. down: 40,
  59046. 'delete': [8, 46]
  59047. };
  59048. // KeyboardEvent.key aliases
  59049. var keyNames = {
  59050. // #7880: IE11 and Edge use `Esc` for Escape key name.
  59051. esc: ['Esc', 'Escape'],
  59052. tab: 'Tab',
  59053. enter: 'Enter',
  59054. // #9112: IE11 uses `Spacebar` for Space key name.
  59055. space: [' ', 'Spacebar'],
  59056. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  59057. up: ['Up', 'ArrowUp'],
  59058. left: ['Left', 'ArrowLeft'],
  59059. right: ['Right', 'ArrowRight'],
  59060. down: ['Down', 'ArrowDown'],
  59061. // #9112: IE11 uses `Del` for Delete key name.
  59062. 'delete': ['Backspace', 'Delete', 'Del']
  59063. };
  59064. // #4868: modifiers that prevent the execution of the listener
  59065. // need to explicitly return null so that we can determine whether to remove
  59066. // the listener for .once
  59067. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  59068. var modifierCode = {
  59069. stop: '$event.stopPropagation();',
  59070. prevent: '$event.preventDefault();',
  59071. self: genGuard("$event.target !== $event.currentTarget"),
  59072. ctrl: genGuard("!$event.ctrlKey"),
  59073. shift: genGuard("!$event.shiftKey"),
  59074. alt: genGuard("!$event.altKey"),
  59075. meta: genGuard("!$event.metaKey"),
  59076. left: genGuard("'button' in $event && $event.button !== 0"),
  59077. middle: genGuard("'button' in $event && $event.button !== 1"),
  59078. right: genGuard("'button' in $event && $event.button !== 2")
  59079. };
  59080. function genHandlers (
  59081. events,
  59082. isNative
  59083. ) {
  59084. var prefix = isNative ? 'nativeOn:' : 'on:';
  59085. var staticHandlers = "";
  59086. var dynamicHandlers = "";
  59087. for (var name in events) {
  59088. var handlerCode = genHandler(events[name]);
  59089. if (events[name] && events[name].dynamic) {
  59090. dynamicHandlers += name + "," + handlerCode + ",";
  59091. } else {
  59092. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  59093. }
  59094. }
  59095. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  59096. if (dynamicHandlers) {
  59097. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  59098. } else {
  59099. return prefix + staticHandlers
  59100. }
  59101. }
  59102. function genHandler (handler) {
  59103. if (!handler) {
  59104. return 'function(){}'
  59105. }
  59106. if (Array.isArray(handler)) {
  59107. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  59108. }
  59109. var isMethodPath = simplePathRE.test(handler.value);
  59110. var isFunctionExpression = fnExpRE.test(handler.value);
  59111. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  59112. if (!handler.modifiers) {
  59113. if (isMethodPath || isFunctionExpression) {
  59114. return handler.value
  59115. }
  59116. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  59117. } else {
  59118. var code = '';
  59119. var genModifierCode = '';
  59120. var keys = [];
  59121. for (var key in handler.modifiers) {
  59122. if (modifierCode[key]) {
  59123. genModifierCode += modifierCode[key];
  59124. // left/right
  59125. if (keyCodes[key]) {
  59126. keys.push(key);
  59127. }
  59128. } else if (key === 'exact') {
  59129. var modifiers = (handler.modifiers);
  59130. genModifierCode += genGuard(
  59131. ['ctrl', 'shift', 'alt', 'meta']
  59132. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  59133. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  59134. .join('||')
  59135. );
  59136. } else {
  59137. keys.push(key);
  59138. }
  59139. }
  59140. if (keys.length) {
  59141. code += genKeyFilter(keys);
  59142. }
  59143. // Make sure modifiers like prevent and stop get executed after key filtering
  59144. if (genModifierCode) {
  59145. code += genModifierCode;
  59146. }
  59147. var handlerCode = isMethodPath
  59148. ? ("return " + (handler.value) + "($event)")
  59149. : isFunctionExpression
  59150. ? ("return (" + (handler.value) + ")($event)")
  59151. : isFunctionInvocation
  59152. ? ("return " + (handler.value))
  59153. : handler.value;
  59154. return ("function($event){" + code + handlerCode + "}")
  59155. }
  59156. }
  59157. function genKeyFilter (keys) {
  59158. return (
  59159. // make sure the key filters only apply to KeyboardEvents
  59160. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  59161. // key events that do not have keyCode property...
  59162. "if(!$event.type.indexOf('key')&&" +
  59163. (keys.map(genFilterCode).join('&&')) + ")return null;"
  59164. )
  59165. }
  59166. function genFilterCode (key) {
  59167. var keyVal = parseInt(key, 10);
  59168. if (keyVal) {
  59169. return ("$event.keyCode!==" + keyVal)
  59170. }
  59171. var keyCode = keyCodes[key];
  59172. var keyName = keyNames[key];
  59173. return (
  59174. "_k($event.keyCode," +
  59175. (JSON.stringify(key)) + "," +
  59176. (JSON.stringify(keyCode)) + "," +
  59177. "$event.key," +
  59178. "" + (JSON.stringify(keyName)) +
  59179. ")"
  59180. )
  59181. }
  59182. /* */
  59183. function on (el, dir) {
  59184. if (dir.modifiers) {
  59185. warn("v-on without argument does not support modifiers.");
  59186. }
  59187. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  59188. }
  59189. /* */
  59190. function bind$1 (el, dir) {
  59191. el.wrapData = function (code) {
  59192. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  59193. };
  59194. }
  59195. /* */
  59196. var baseDirectives = {
  59197. on: on,
  59198. bind: bind$1,
  59199. cloak: noop
  59200. };
  59201. /* */
  59202. var CodegenState = function CodegenState (options) {
  59203. this.options = options;
  59204. this.warn = options.warn || baseWarn;
  59205. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  59206. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  59207. this.directives = extend(extend({}, baseDirectives), options.directives);
  59208. var isReservedTag = options.isReservedTag || no;
  59209. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  59210. this.onceId = 0;
  59211. this.staticRenderFns = [];
  59212. this.pre = false;
  59213. };
  59214. function generate (
  59215. ast,
  59216. options
  59217. ) {
  59218. var state = new CodegenState(options);
  59219. var code = ast ? genElement(ast, state) : '_c("div")';
  59220. return {
  59221. render: ("with(this){return " + code + "}"),
  59222. staticRenderFns: state.staticRenderFns
  59223. }
  59224. }
  59225. function genElement (el, state) {
  59226. if (el.parent) {
  59227. el.pre = el.pre || el.parent.pre;
  59228. }
  59229. if (el.staticRoot && !el.staticProcessed) {
  59230. return genStatic(el, state)
  59231. } else if (el.once && !el.onceProcessed) {
  59232. return genOnce(el, state)
  59233. } else if (el.for && !el.forProcessed) {
  59234. return genFor(el, state)
  59235. } else if (el.if && !el.ifProcessed) {
  59236. return genIf(el, state)
  59237. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  59238. return genChildren(el, state) || 'void 0'
  59239. } else if (el.tag === 'slot') {
  59240. return genSlot(el, state)
  59241. } else {
  59242. // component or element
  59243. var code;
  59244. if (el.component) {
  59245. code = genComponent(el.component, el, state);
  59246. } else {
  59247. var data;
  59248. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  59249. data = genData$2(el, state);
  59250. }
  59251. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  59252. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  59253. }
  59254. // module transforms
  59255. for (var i = 0; i < state.transforms.length; i++) {
  59256. code = state.transforms[i](el, code);
  59257. }
  59258. return code
  59259. }
  59260. }
  59261. // hoist static sub-trees out
  59262. function genStatic (el, state) {
  59263. el.staticProcessed = true;
  59264. // Some elements (templates) need to behave differently inside of a v-pre
  59265. // node. All pre nodes are static roots, so we can use this as a location to
  59266. // wrap a state change and reset it upon exiting the pre node.
  59267. var originalPreState = state.pre;
  59268. if (el.pre) {
  59269. state.pre = el.pre;
  59270. }
  59271. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  59272. state.pre = originalPreState;
  59273. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  59274. }
  59275. // v-once
  59276. function genOnce (el, state) {
  59277. el.onceProcessed = true;
  59278. if (el.if && !el.ifProcessed) {
  59279. return genIf(el, state)
  59280. } else if (el.staticInFor) {
  59281. var key = '';
  59282. var parent = el.parent;
  59283. while (parent) {
  59284. if (parent.for) {
  59285. key = parent.key;
  59286. break
  59287. }
  59288. parent = parent.parent;
  59289. }
  59290. if (!key) {
  59291. state.warn(
  59292. "v-once can only be used inside v-for that is keyed. ",
  59293. el.rawAttrsMap['v-once']
  59294. );
  59295. return genElement(el, state)
  59296. }
  59297. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  59298. } else {
  59299. return genStatic(el, state)
  59300. }
  59301. }
  59302. function genIf (
  59303. el,
  59304. state,
  59305. altGen,
  59306. altEmpty
  59307. ) {
  59308. el.ifProcessed = true; // avoid recursion
  59309. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  59310. }
  59311. function genIfConditions (
  59312. conditions,
  59313. state,
  59314. altGen,
  59315. altEmpty
  59316. ) {
  59317. if (!conditions.length) {
  59318. return altEmpty || '_e()'
  59319. }
  59320. var condition = conditions.shift();
  59321. if (condition.exp) {
  59322. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  59323. } else {
  59324. return ("" + (genTernaryExp(condition.block)))
  59325. }
  59326. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  59327. function genTernaryExp (el) {
  59328. return altGen
  59329. ? altGen(el, state)
  59330. : el.once
  59331. ? genOnce(el, state)
  59332. : genElement(el, state)
  59333. }
  59334. }
  59335. function genFor (
  59336. el,
  59337. state,
  59338. altGen,
  59339. altHelper
  59340. ) {
  59341. var exp = el.for;
  59342. var alias = el.alias;
  59343. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  59344. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  59345. if (state.maybeComponent(el) &&
  59346. el.tag !== 'slot' &&
  59347. el.tag !== 'template' &&
  59348. !el.key
  59349. ) {
  59350. state.warn(
  59351. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  59352. "v-for should have explicit keys. " +
  59353. "See https://vuejs.org/guide/list.html#key for more info.",
  59354. el.rawAttrsMap['v-for'],
  59355. true /* tip */
  59356. );
  59357. }
  59358. el.forProcessed = true; // avoid recursion
  59359. return (altHelper || '_l') + "((" + exp + ")," +
  59360. "function(" + alias + iterator1 + iterator2 + "){" +
  59361. "return " + ((altGen || genElement)(el, state)) +
  59362. '})'
  59363. }
  59364. function genData$2 (el, state) {
  59365. var data = '{';
  59366. // directives first.
  59367. // directives may mutate the el's other properties before they are generated.
  59368. var dirs = genDirectives(el, state);
  59369. if (dirs) { data += dirs + ','; }
  59370. // key
  59371. if (el.key) {
  59372. data += "key:" + (el.key) + ",";
  59373. }
  59374. // ref
  59375. if (el.ref) {
  59376. data += "ref:" + (el.ref) + ",";
  59377. }
  59378. if (el.refInFor) {
  59379. data += "refInFor:true,";
  59380. }
  59381. // pre
  59382. if (el.pre) {
  59383. data += "pre:true,";
  59384. }
  59385. // record original tag name for components using "is" attribute
  59386. if (el.component) {
  59387. data += "tag:\"" + (el.tag) + "\",";
  59388. }
  59389. // module data generation functions
  59390. for (var i = 0; i < state.dataGenFns.length; i++) {
  59391. data += state.dataGenFns[i](el);
  59392. }
  59393. // attributes
  59394. if (el.attrs) {
  59395. data += "attrs:" + (genProps(el.attrs)) + ",";
  59396. }
  59397. // DOM props
  59398. if (el.props) {
  59399. data += "domProps:" + (genProps(el.props)) + ",";
  59400. }
  59401. // event handlers
  59402. if (el.events) {
  59403. data += (genHandlers(el.events, false)) + ",";
  59404. }
  59405. if (el.nativeEvents) {
  59406. data += (genHandlers(el.nativeEvents, true)) + ",";
  59407. }
  59408. // slot target
  59409. // only for non-scoped slots
  59410. if (el.slotTarget && !el.slotScope) {
  59411. data += "slot:" + (el.slotTarget) + ",";
  59412. }
  59413. // scoped slots
  59414. if (el.scopedSlots) {
  59415. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  59416. }
  59417. // component v-model
  59418. if (el.model) {
  59419. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  59420. }
  59421. // inline-template
  59422. if (el.inlineTemplate) {
  59423. var inlineTemplate = genInlineTemplate(el, state);
  59424. if (inlineTemplate) {
  59425. data += inlineTemplate + ",";
  59426. }
  59427. }
  59428. data = data.replace(/,$/, '') + '}';
  59429. // v-bind dynamic argument wrap
  59430. // v-bind with dynamic arguments must be applied using the same v-bind object
  59431. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  59432. if (el.dynamicAttrs) {
  59433. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  59434. }
  59435. // v-bind data wrap
  59436. if (el.wrapData) {
  59437. data = el.wrapData(data);
  59438. }
  59439. // v-on data wrap
  59440. if (el.wrapListeners) {
  59441. data = el.wrapListeners(data);
  59442. }
  59443. return data
  59444. }
  59445. function genDirectives (el, state) {
  59446. var dirs = el.directives;
  59447. if (!dirs) { return }
  59448. var res = 'directives:[';
  59449. var hasRuntime = false;
  59450. var i, l, dir, needRuntime;
  59451. for (i = 0, l = dirs.length; i < l; i++) {
  59452. dir = dirs[i];
  59453. needRuntime = true;
  59454. var gen = state.directives[dir.name];
  59455. if (gen) {
  59456. // compile-time directive that manipulates AST.
  59457. // returns true if it also needs a runtime counterpart.
  59458. needRuntime = !!gen(el, dir, state.warn);
  59459. }
  59460. if (needRuntime) {
  59461. hasRuntime = true;
  59462. 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))) : '') + "},";
  59463. }
  59464. }
  59465. if (hasRuntime) {
  59466. return res.slice(0, -1) + ']'
  59467. }
  59468. }
  59469. function genInlineTemplate (el, state) {
  59470. var ast = el.children[0];
  59471. if (el.children.length !== 1 || ast.type !== 1) {
  59472. state.warn(
  59473. 'Inline-template components must have exactly one child element.',
  59474. { start: el.start }
  59475. );
  59476. }
  59477. if (ast && ast.type === 1) {
  59478. var inlineRenderFns = generate(ast, state.options);
  59479. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  59480. }
  59481. }
  59482. function genScopedSlots (
  59483. el,
  59484. slots,
  59485. state
  59486. ) {
  59487. // by default scoped slots are considered "stable", this allows child
  59488. // components with only scoped slots to skip forced updates from parent.
  59489. // but in some cases we have to bail-out of this optimization
  59490. // for example if the slot contains dynamic names, has v-if or v-for on them...
  59491. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  59492. var slot = slots[key];
  59493. return (
  59494. slot.slotTargetDynamic ||
  59495. slot.if ||
  59496. slot.for ||
  59497. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  59498. )
  59499. });
  59500. // #9534: if a component with scoped slots is inside a conditional branch,
  59501. // it's possible for the same component to be reused but with different
  59502. // compiled slot content. To avoid that, we generate a unique key based on
  59503. // the generated code of all the slot contents.
  59504. var needsKey = !!el.if;
  59505. // OR when it is inside another scoped slot or v-for (the reactivity may be
  59506. // disconnected due to the intermediate scope variable)
  59507. // #9438, #9506
  59508. // TODO: this can be further optimized by properly analyzing in-scope bindings
  59509. // and skip force updating ones that do not actually use scope variables.
  59510. if (!needsForceUpdate) {
  59511. var parent = el.parent;
  59512. while (parent) {
  59513. if (
  59514. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  59515. parent.for
  59516. ) {
  59517. needsForceUpdate = true;
  59518. break
  59519. }
  59520. if (parent.if) {
  59521. needsKey = true;
  59522. }
  59523. parent = parent.parent;
  59524. }
  59525. }
  59526. var generatedSlots = Object.keys(slots)
  59527. .map(function (key) { return genScopedSlot(slots[key], state); })
  59528. .join(',');
  59529. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  59530. }
  59531. function hash(str) {
  59532. var hash = 5381;
  59533. var i = str.length;
  59534. while(i) {
  59535. hash = (hash * 33) ^ str.charCodeAt(--i);
  59536. }
  59537. return hash >>> 0
  59538. }
  59539. function containsSlotChild (el) {
  59540. if (el.type === 1) {
  59541. if (el.tag === 'slot') {
  59542. return true
  59543. }
  59544. return el.children.some(containsSlotChild)
  59545. }
  59546. return false
  59547. }
  59548. function genScopedSlot (
  59549. el,
  59550. state
  59551. ) {
  59552. var isLegacySyntax = el.attrsMap['slot-scope'];
  59553. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  59554. return genIf(el, state, genScopedSlot, "null")
  59555. }
  59556. if (el.for && !el.forProcessed) {
  59557. return genFor(el, state, genScopedSlot)
  59558. }
  59559. var slotScope = el.slotScope === emptySlotScopeToken
  59560. ? ""
  59561. : String(el.slotScope);
  59562. var fn = "function(" + slotScope + "){" +
  59563. "return " + (el.tag === 'template'
  59564. ? el.if && isLegacySyntax
  59565. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  59566. : genChildren(el, state) || 'undefined'
  59567. : genElement(el, state)) + "}";
  59568. // reverse proxy v-slot without scope on this.$slots
  59569. var reverseProxy = slotScope ? "" : ",proxy:true";
  59570. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  59571. }
  59572. function genChildren (
  59573. el,
  59574. state,
  59575. checkSkip,
  59576. altGenElement,
  59577. altGenNode
  59578. ) {
  59579. var children = el.children;
  59580. if (children.length) {
  59581. var el$1 = children[0];
  59582. // optimize single v-for
  59583. if (children.length === 1 &&
  59584. el$1.for &&
  59585. el$1.tag !== 'template' &&
  59586. el$1.tag !== 'slot'
  59587. ) {
  59588. var normalizationType = checkSkip
  59589. ? state.maybeComponent(el$1) ? ",1" : ",0"
  59590. : "";
  59591. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  59592. }
  59593. var normalizationType$1 = checkSkip
  59594. ? getNormalizationType(children, state.maybeComponent)
  59595. : 0;
  59596. var gen = altGenNode || genNode;
  59597. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  59598. }
  59599. }
  59600. // determine the normalization needed for the children array.
  59601. // 0: no normalization needed
  59602. // 1: simple normalization needed (possible 1-level deep nested array)
  59603. // 2: full normalization needed
  59604. function getNormalizationType (
  59605. children,
  59606. maybeComponent
  59607. ) {
  59608. var res = 0;
  59609. for (var i = 0; i < children.length; i++) {
  59610. var el = children[i];
  59611. if (el.type !== 1) {
  59612. continue
  59613. }
  59614. if (needsNormalization(el) ||
  59615. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  59616. res = 2;
  59617. break
  59618. }
  59619. if (maybeComponent(el) ||
  59620. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  59621. res = 1;
  59622. }
  59623. }
  59624. return res
  59625. }
  59626. function needsNormalization (el) {
  59627. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  59628. }
  59629. function genNode (node, state) {
  59630. if (node.type === 1) {
  59631. return genElement(node, state)
  59632. } else if (node.type === 3 && node.isComment) {
  59633. return genComment(node)
  59634. } else {
  59635. return genText(node)
  59636. }
  59637. }
  59638. function genText (text) {
  59639. return ("_v(" + (text.type === 2
  59640. ? text.expression // no need for () because already wrapped in _s()
  59641. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  59642. }
  59643. function genComment (comment) {
  59644. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  59645. }
  59646. function genSlot (el, state) {
  59647. var slotName = el.slotName || '"default"';
  59648. var children = genChildren(el, state);
  59649. var res = "_t(" + slotName + (children ? ("," + children) : '');
  59650. var attrs = el.attrs || el.dynamicAttrs
  59651. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  59652. // slot props are camelized
  59653. name: camelize(attr.name),
  59654. value: attr.value,
  59655. dynamic: attr.dynamic
  59656. }); }))
  59657. : null;
  59658. var bind$$1 = el.attrsMap['v-bind'];
  59659. if ((attrs || bind$$1) && !children) {
  59660. res += ",null";
  59661. }
  59662. if (attrs) {
  59663. res += "," + attrs;
  59664. }
  59665. if (bind$$1) {
  59666. res += (attrs ? '' : ',null') + "," + bind$$1;
  59667. }
  59668. return res + ')'
  59669. }
  59670. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  59671. function genComponent (
  59672. componentName,
  59673. el,
  59674. state
  59675. ) {
  59676. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  59677. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  59678. }
  59679. function genProps (props) {
  59680. var staticProps = "";
  59681. var dynamicProps = "";
  59682. for (var i = 0; i < props.length; i++) {
  59683. var prop = props[i];
  59684. var value = transformSpecialNewlines(prop.value);
  59685. if (prop.dynamic) {
  59686. dynamicProps += (prop.name) + "," + value + ",";
  59687. } else {
  59688. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  59689. }
  59690. }
  59691. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  59692. if (dynamicProps) {
  59693. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  59694. } else {
  59695. return staticProps
  59696. }
  59697. }
  59698. // #3895, #4268
  59699. function transformSpecialNewlines (text) {
  59700. return text
  59701. .replace(/\u2028/g, '\\u2028')
  59702. .replace(/\u2029/g, '\\u2029')
  59703. }
  59704. /* */
  59705. // these keywords should not appear inside expressions, but operators like
  59706. // typeof, instanceof and in are allowed
  59707. var prohibitedKeywordRE = new RegExp('\\b' + (
  59708. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  59709. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  59710. 'extends,finally,continue,debugger,function,arguments'
  59711. ).split(',').join('\\b|\\b') + '\\b');
  59712. // these unary operators should not be used as property/method names
  59713. var unaryOperatorsRE = new RegExp('\\b' + (
  59714. 'delete,typeof,void'
  59715. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  59716. // strip strings in expressions
  59717. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  59718. // detect problematic expressions in a template
  59719. function detectErrors (ast, warn) {
  59720. if (ast) {
  59721. checkNode(ast, warn);
  59722. }
  59723. }
  59724. function checkNode (node, warn) {
  59725. if (node.type === 1) {
  59726. for (var name in node.attrsMap) {
  59727. if (dirRE.test(name)) {
  59728. var value = node.attrsMap[name];
  59729. if (value) {
  59730. var range = node.rawAttrsMap[name];
  59731. if (name === 'v-for') {
  59732. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  59733. } else if (name === 'v-slot' || name[0] === '#') {
  59734. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  59735. } else if (onRE.test(name)) {
  59736. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  59737. } else {
  59738. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  59739. }
  59740. }
  59741. }
  59742. }
  59743. if (node.children) {
  59744. for (var i = 0; i < node.children.length; i++) {
  59745. checkNode(node.children[i], warn);
  59746. }
  59747. }
  59748. } else if (node.type === 2) {
  59749. checkExpression(node.expression, node.text, warn, node);
  59750. }
  59751. }
  59752. function checkEvent (exp, text, warn, range) {
  59753. var stripped = exp.replace(stripStringRE, '');
  59754. var keywordMatch = stripped.match(unaryOperatorsRE);
  59755. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  59756. warn(
  59757. "avoid using JavaScript unary operator as property name: " +
  59758. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  59759. range
  59760. );
  59761. }
  59762. checkExpression(exp, text, warn, range);
  59763. }
  59764. function checkFor (node, text, warn, range) {
  59765. checkExpression(node.for || '', text, warn, range);
  59766. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  59767. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  59768. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  59769. }
  59770. function checkIdentifier (
  59771. ident,
  59772. type,
  59773. text,
  59774. warn,
  59775. range
  59776. ) {
  59777. if (typeof ident === 'string') {
  59778. try {
  59779. new Function(("var " + ident + "=_"));
  59780. } catch (e) {
  59781. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  59782. }
  59783. }
  59784. }
  59785. function checkExpression (exp, text, warn, range) {
  59786. try {
  59787. new Function(("return " + exp));
  59788. } catch (e) {
  59789. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  59790. if (keywordMatch) {
  59791. warn(
  59792. "avoid using JavaScript keyword as property name: " +
  59793. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  59794. range
  59795. );
  59796. } else {
  59797. warn(
  59798. "invalid expression: " + (e.message) + " in\n\n" +
  59799. " " + exp + "\n\n" +
  59800. " Raw expression: " + (text.trim()) + "\n",
  59801. range
  59802. );
  59803. }
  59804. }
  59805. }
  59806. function checkFunctionParameterExpression (exp, text, warn, range) {
  59807. try {
  59808. new Function(exp, '');
  59809. } catch (e) {
  59810. warn(
  59811. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  59812. " " + exp + "\n\n" +
  59813. " Raw expression: " + (text.trim()) + "\n",
  59814. range
  59815. );
  59816. }
  59817. }
  59818. /* */
  59819. var range = 2;
  59820. function generateCodeFrame (
  59821. source,
  59822. start,
  59823. end
  59824. ) {
  59825. if ( start === void 0 ) start = 0;
  59826. if ( end === void 0 ) end = source.length;
  59827. var lines = source.split(/\r?\n/);
  59828. var count = 0;
  59829. var res = [];
  59830. for (var i = 0; i < lines.length; i++) {
  59831. count += lines[i].length + 1;
  59832. if (count >= start) {
  59833. for (var j = i - range; j <= i + range || end > count; j++) {
  59834. if (j < 0 || j >= lines.length) { continue }
  59835. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  59836. var lineLength = lines[j].length;
  59837. if (j === i) {
  59838. // push underline
  59839. var pad = start - (count - lineLength) + 1;
  59840. var length = end > count ? lineLength - pad : end - start;
  59841. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  59842. } else if (j > i) {
  59843. if (end > count) {
  59844. var length$1 = Math.min(end - count, lineLength);
  59845. res.push(" | " + repeat$1("^", length$1));
  59846. }
  59847. count += lineLength + 1;
  59848. }
  59849. }
  59850. break
  59851. }
  59852. }
  59853. return res.join('\n')
  59854. }
  59855. function repeat$1 (str, n) {
  59856. var result = '';
  59857. if (n > 0) {
  59858. while (true) { // eslint-disable-line
  59859. if (n & 1) { result += str; }
  59860. n >>>= 1;
  59861. if (n <= 0) { break }
  59862. str += str;
  59863. }
  59864. }
  59865. return result
  59866. }
  59867. /* */
  59868. function createFunction (code, errors) {
  59869. try {
  59870. return new Function(code)
  59871. } catch (err) {
  59872. errors.push({ err: err, code: code });
  59873. return noop
  59874. }
  59875. }
  59876. function createCompileToFunctionFn (compile) {
  59877. var cache = Object.create(null);
  59878. return function compileToFunctions (
  59879. template,
  59880. options,
  59881. vm
  59882. ) {
  59883. options = extend({}, options);
  59884. var warn$$1 = options.warn || warn;
  59885. delete options.warn;
  59886. /* istanbul ignore if */
  59887. {
  59888. // detect possible CSP restriction
  59889. try {
  59890. new Function('return 1');
  59891. } catch (e) {
  59892. if (e.toString().match(/unsafe-eval|CSP/)) {
  59893. warn$$1(
  59894. 'It seems you are using the standalone build of Vue.js in an ' +
  59895. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  59896. 'The template compiler cannot work in this environment. Consider ' +
  59897. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  59898. 'templates into render functions.'
  59899. );
  59900. }
  59901. }
  59902. }
  59903. // check cache
  59904. var key = options.delimiters
  59905. ? String(options.delimiters) + template
  59906. : template;
  59907. if (cache[key]) {
  59908. return cache[key]
  59909. }
  59910. // compile
  59911. var compiled = compile(template, options);
  59912. // check compilation errors/tips
  59913. {
  59914. if (compiled.errors && compiled.errors.length) {
  59915. if (options.outputSourceRange) {
  59916. compiled.errors.forEach(function (e) {
  59917. warn$$1(
  59918. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  59919. generateCodeFrame(template, e.start, e.end),
  59920. vm
  59921. );
  59922. });
  59923. } else {
  59924. warn$$1(
  59925. "Error compiling template:\n\n" + template + "\n\n" +
  59926. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  59927. vm
  59928. );
  59929. }
  59930. }
  59931. if (compiled.tips && compiled.tips.length) {
  59932. if (options.outputSourceRange) {
  59933. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  59934. } else {
  59935. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  59936. }
  59937. }
  59938. }
  59939. // turn code into functions
  59940. var res = {};
  59941. var fnGenErrors = [];
  59942. res.render = createFunction(compiled.render, fnGenErrors);
  59943. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  59944. return createFunction(code, fnGenErrors)
  59945. });
  59946. // check function generation errors.
  59947. // this should only happen if there is a bug in the compiler itself.
  59948. // mostly for codegen development use
  59949. /* istanbul ignore if */
  59950. {
  59951. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  59952. warn$$1(
  59953. "Failed to generate render function:\n\n" +
  59954. fnGenErrors.map(function (ref) {
  59955. var err = ref.err;
  59956. var code = ref.code;
  59957. return ((err.toString()) + " in\n\n" + code + "\n");
  59958. }).join('\n'),
  59959. vm
  59960. );
  59961. }
  59962. }
  59963. return (cache[key] = res)
  59964. }
  59965. }
  59966. /* */
  59967. function createCompilerCreator (baseCompile) {
  59968. return function createCompiler (baseOptions) {
  59969. function compile (
  59970. template,
  59971. options
  59972. ) {
  59973. var finalOptions = Object.create(baseOptions);
  59974. var errors = [];
  59975. var tips = [];
  59976. var warn = function (msg, range, tip) {
  59977. (tip ? tips : errors).push(msg);
  59978. };
  59979. if (options) {
  59980. if (options.outputSourceRange) {
  59981. // $flow-disable-line
  59982. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  59983. warn = function (msg, range, tip) {
  59984. var data = { msg: msg };
  59985. if (range) {
  59986. if (range.start != null) {
  59987. data.start = range.start + leadingSpaceLength;
  59988. }
  59989. if (range.end != null) {
  59990. data.end = range.end + leadingSpaceLength;
  59991. }
  59992. }
  59993. (tip ? tips : errors).push(data);
  59994. };
  59995. }
  59996. // merge custom modules
  59997. if (options.modules) {
  59998. finalOptions.modules =
  59999. (baseOptions.modules || []).concat(options.modules);
  60000. }
  60001. // merge custom directives
  60002. if (options.directives) {
  60003. finalOptions.directives = extend(
  60004. Object.create(baseOptions.directives || null),
  60005. options.directives
  60006. );
  60007. }
  60008. // copy other options
  60009. for (var key in options) {
  60010. if (key !== 'modules' && key !== 'directives') {
  60011. finalOptions[key] = options[key];
  60012. }
  60013. }
  60014. }
  60015. finalOptions.warn = warn;
  60016. var compiled = baseCompile(template.trim(), finalOptions);
  60017. {
  60018. detectErrors(compiled.ast, warn);
  60019. }
  60020. compiled.errors = errors;
  60021. compiled.tips = tips;
  60022. return compiled
  60023. }
  60024. return {
  60025. compile: compile,
  60026. compileToFunctions: createCompileToFunctionFn(compile)
  60027. }
  60028. }
  60029. }
  60030. /* */
  60031. // `createCompilerCreator` allows creating compilers that use alternative
  60032. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  60033. // Here we just export a default compiler using the default parts.
  60034. var createCompiler = createCompilerCreator(function baseCompile (
  60035. template,
  60036. options
  60037. ) {
  60038. var ast = parse(template.trim(), options);
  60039. if (options.optimize !== false) {
  60040. optimize(ast, options);
  60041. }
  60042. var code = generate(ast, options);
  60043. return {
  60044. ast: ast,
  60045. render: code.render,
  60046. staticRenderFns: code.staticRenderFns
  60047. }
  60048. });
  60049. /* */
  60050. var ref$1 = createCompiler(baseOptions);
  60051. var compile = ref$1.compile;
  60052. var compileToFunctions = ref$1.compileToFunctions;
  60053. /* */
  60054. // check whether current browser encodes a char inside attribute values
  60055. var div;
  60056. function getShouldDecode (href) {
  60057. div = div || document.createElement('div');
  60058. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  60059. return div.innerHTML.indexOf('&#10;') > 0
  60060. }
  60061. // #3663: IE encodes newlines inside attribute values while other browsers don't
  60062. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  60063. // #6828: chrome encodes content in a[href]
  60064. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  60065. /* */
  60066. var idToTemplate = cached(function (id) {
  60067. var el = query(id);
  60068. return el && el.innerHTML
  60069. });
  60070. var mount = Vue.prototype.$mount;
  60071. Vue.prototype.$mount = function (
  60072. el,
  60073. hydrating
  60074. ) {
  60075. el = el && query(el);
  60076. /* istanbul ignore if */
  60077. if (el === document.body || el === document.documentElement) {
  60078. warn(
  60079. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  60080. );
  60081. return this
  60082. }
  60083. var options = this.$options;
  60084. // resolve template/el and convert to render function
  60085. if (!options.render) {
  60086. var template = options.template;
  60087. if (template) {
  60088. if (typeof template === 'string') {
  60089. if (template.charAt(0) === '#') {
  60090. template = idToTemplate(template);
  60091. /* istanbul ignore if */
  60092. if (!template) {
  60093. warn(
  60094. ("Template element not found or is empty: " + (options.template)),
  60095. this
  60096. );
  60097. }
  60098. }
  60099. } else if (template.nodeType) {
  60100. template = template.innerHTML;
  60101. } else {
  60102. {
  60103. warn('invalid template option:' + template, this);
  60104. }
  60105. return this
  60106. }
  60107. } else if (el) {
  60108. template = getOuterHTML(el);
  60109. }
  60110. if (template) {
  60111. /* istanbul ignore if */
  60112. if (config.performance && mark) {
  60113. mark('compile');
  60114. }
  60115. var ref = compileToFunctions(template, {
  60116. outputSourceRange: "development" !== 'production',
  60117. shouldDecodeNewlines: shouldDecodeNewlines,
  60118. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  60119. delimiters: options.delimiters,
  60120. comments: options.comments
  60121. }, this);
  60122. var render = ref.render;
  60123. var staticRenderFns = ref.staticRenderFns;
  60124. options.render = render;
  60125. options.staticRenderFns = staticRenderFns;
  60126. /* istanbul ignore if */
  60127. if (config.performance && mark) {
  60128. mark('compile end');
  60129. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  60130. }
  60131. }
  60132. }
  60133. return mount.call(this, el, hydrating)
  60134. };
  60135. /**
  60136. * Get outerHTML of elements, taking care
  60137. * of SVG elements in IE as well.
  60138. */
  60139. function getOuterHTML (el) {
  60140. if (el.outerHTML) {
  60141. return el.outerHTML
  60142. } else {
  60143. var container = document.createElement('div');
  60144. container.appendChild(el.cloneNode(true));
  60145. return container.innerHTML
  60146. }
  60147. }
  60148. Vue.compile = compileToFunctions;
  60149. module.exports = Vue;
  60150. /* 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))
  60151. /***/ }),
  60152. /***/ "./node_modules/vue/dist/vue.common.js":
  60153. /*!*********************************************!*\
  60154. !*** ./node_modules/vue/dist/vue.common.js ***!
  60155. \*********************************************/
  60156. /*! no static exports found */
  60157. /***/ (function(module, exports, __webpack_require__) {
  60158. if (false) {} else {
  60159. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  60160. }
  60161. /***/ }),
  60162. /***/ "./node_modules/webpack/buildin/global.js":
  60163. /*!***********************************!*\
  60164. !*** (webpack)/buildin/global.js ***!
  60165. \***********************************/
  60166. /*! no static exports found */
  60167. /***/ (function(module, exports) {
  60168. var g;
  60169. // This works in non-strict mode
  60170. g = (function() {
  60171. return this;
  60172. })();
  60173. try {
  60174. // This works if eval is allowed (see CSP)
  60175. g = g || new Function("return this")();
  60176. } catch (e) {
  60177. // This works if the window reference is available
  60178. if (typeof window === "object") g = window;
  60179. }
  60180. // g can still be undefined, but nothing to do about it...
  60181. // We return undefined, instead of nothing here, so it's
  60182. // easier to handle this case. if(!global) { ...}
  60183. module.exports = g;
  60184. /***/ }),
  60185. /***/ "./node_modules/webpack/buildin/module.js":
  60186. /*!***********************************!*\
  60187. !*** (webpack)/buildin/module.js ***!
  60188. \***********************************/
  60189. /*! no static exports found */
  60190. /***/ (function(module, exports) {
  60191. module.exports = function(module) {
  60192. if (!module.webpackPolyfill) {
  60193. module.deprecate = function() {};
  60194. module.paths = [];
  60195. // module.parent = undefined by default
  60196. if (!module.children) module.children = [];
  60197. Object.defineProperty(module, "loaded", {
  60198. enumerable: true,
  60199. get: function() {
  60200. return module.l;
  60201. }
  60202. });
  60203. Object.defineProperty(module, "id", {
  60204. enumerable: true,
  60205. get: function() {
  60206. return module.i;
  60207. }
  60208. });
  60209. module.webpackPolyfill = 1;
  60210. }
  60211. return module;
  60212. };
  60213. /***/ }),
  60214. /***/ "./resources/js/app.js":
  60215. /*!*****************************!*\
  60216. !*** ./resources/js/app.js ***!
  60217. \*****************************/
  60218. /*! no exports provided */
  60219. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60220. "use strict";
  60221. __webpack_require__.r(__webpack_exports__);
  60222. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  60223. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
  60224. /* harmony import */ var vue_router__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vue-router */ "./node_modules/vue-router/dist/vue-router.esm.js");
  60225. /* harmony import */ var _views_App__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./views/App */ "./resources/js/views/App.vue");
  60226. /* harmony import */ var _views_Dashboard__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./views/Dashboard */ "./resources/js/views/Dashboard.vue");
  60227. /* harmony import */ var _views_WorkOrder__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./views/WorkOrder */ "./resources/js/views/WorkOrder.vue");
  60228. /* harmony import */ var _views_Login__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./views/Login */ "./resources/js/views/Login.vue");
  60229. /* harmony import */ var _views_Welcome__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./views/Welcome */ "./resources/js/views/Welcome.vue");
  60230. /**
  60231. * First we will load all of this project's JavaScript dependencies which
  60232. * includes Vue and other libraries. It is a great starting point when
  60233. * building robust, powerful web applications using Vue and Laravel.
  60234. */
  60235. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  60236. window.Clipboard = __webpack_require__(/*! clipboard */ "./node_modules/clipboard/dist/clipboard.js");
  60237. __webpack_require__(/*! ./notify.min.js */ "./resources/js/notify.min.js");
  60238. vue__WEBPACK_IMPORTED_MODULE_0___default.a.use(vue_router__WEBPACK_IMPORTED_MODULE_1__["default"]);
  60239. var router = new vue_router__WEBPACK_IMPORTED_MODULE_1__["default"]({
  60240. mode: 'history',
  60241. routes: [{
  60242. path: '/',
  60243. name: 'home',
  60244. component: _views_Welcome__WEBPACK_IMPORTED_MODULE_6__["default"]
  60245. }, {
  60246. path: '/login',
  60247. name: 'login',
  60248. component: _views_Login__WEBPACK_IMPORTED_MODULE_5__["default"]
  60249. }, {
  60250. path: '/dashboard',
  60251. name: 'dashboard',
  60252. component: _views_Dashboard__WEBPACK_IMPORTED_MODULE_3__["default"]
  60253. }, {
  60254. path: '/workorders/:id',
  60255. name: 'workorders',
  60256. component: _views_WorkOrder__WEBPACK_IMPORTED_MODULE_4__["default"],
  60257. props: true
  60258. }]
  60259. });
  60260. var app = new vue__WEBPACK_IMPORTED_MODULE_0___default.a({
  60261. el: '#app',
  60262. components: {
  60263. App: _views_App__WEBPACK_IMPORTED_MODULE_2__["default"]
  60264. },
  60265. router: router
  60266. });
  60267. $(function () {
  60268. $('[data-toggle="tooltip"]').tooltip();
  60269. });
  60270. var clipboard = new Clipboard('.btn-clip');
  60271. clipboard.on('success', function (e) {
  60272. $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard', {
  60273. position: "right",
  60274. className: 'success'
  60275. });
  60276. e.clearSelection();
  60277. });
  60278. /***/ }),
  60279. /***/ "./resources/js/bootstrap.js":
  60280. /*!***********************************!*\
  60281. !*** ./resources/js/bootstrap.js ***!
  60282. \***********************************/
  60283. /*! no exports provided */
  60284. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60285. "use strict";
  60286. __webpack_require__.r(__webpack_exports__);
  60287. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  60288. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  60289. /**
  60290. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  60291. * for JavaScript based Bootstrap features such as modals and tabs. This
  60292. * code may be modified to fit the specific needs of your application.
  60293. */
  60294. try {
  60295. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  60296. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  60297. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  60298. } catch (e) {}
  60299. /**
  60300. * We'll load the axios HTTP library which allows us to easily issue requests
  60301. * to our Laravel back-end. This library automatically handles sending the
  60302. * CSRF token as a header based on the value of the "XSRF" token cookie.
  60303. */
  60304. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  60305. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  60306. /**
  60307. * Echo exposes an expressive API for subscribing to channels and listening
  60308. * for events that are broadcast by Laravel. Echo and event broadcasting
  60309. * allows your team to easily build robust real-time web applications.
  60310. */
  60311. window.Pusher = __webpack_require__(/*! pusher-js */ "./node_modules/pusher-js/dist/web/pusher.js");
  60312. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  60313. broadcaster: 'pusher',
  60314. key: "upccrt",
  60315. wsHost: window.location.hostname,
  60316. wsPort: 6001,
  60317. disableStats: true
  60318. });
  60319. /***/ }),
  60320. /***/ "./resources/js/components/AssetInfo.vue":
  60321. /*!***********************************************!*\
  60322. !*** ./resources/js/components/AssetInfo.vue ***!
  60323. \***********************************************/
  60324. /*! exports provided: default */
  60325. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60326. "use strict";
  60327. __webpack_require__.r(__webpack_exports__);
  60328. /* 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&");
  60329. /* 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&");
  60330. /* 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");
  60331. /* normalize component */
  60332. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60333. _AssetInfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60334. _AssetInfo_vue_vue_type_template_id_f949323a___WEBPACK_IMPORTED_MODULE_0__["render"],
  60335. _AssetInfo_vue_vue_type_template_id_f949323a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60336. false,
  60337. null,
  60338. null,
  60339. null
  60340. )
  60341. /* hot reload */
  60342. if (false) { var api; }
  60343. component.options.__file = "resources/js/components/AssetInfo.vue"
  60344. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60345. /***/ }),
  60346. /***/ "./resources/js/components/AssetInfo.vue?vue&type=script&lang=js&":
  60347. /*!************************************************************************!*\
  60348. !*** ./resources/js/components/AssetInfo.vue?vue&type=script&lang=js& ***!
  60349. \************************************************************************/
  60350. /*! exports provided: default */
  60351. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60352. "use strict";
  60353. __webpack_require__.r(__webpack_exports__);
  60354. /* 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&");
  60355. /* 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"]);
  60356. /***/ }),
  60357. /***/ "./resources/js/components/AssetInfo.vue?vue&type=template&id=f949323a&":
  60358. /*!******************************************************************************!*\
  60359. !*** ./resources/js/components/AssetInfo.vue?vue&type=template&id=f949323a& ***!
  60360. \******************************************************************************/
  60361. /*! exports provided: render, staticRenderFns */
  60362. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60363. "use strict";
  60364. __webpack_require__.r(__webpack_exports__);
  60365. /* 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&");
  60366. /* 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"]; });
  60367. /* 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"]; });
  60368. /***/ }),
  60369. /***/ "./resources/js/components/AssetInfoEditModal.vue":
  60370. /*!********************************************************!*\
  60371. !*** ./resources/js/components/AssetInfoEditModal.vue ***!
  60372. \********************************************************/
  60373. /*! exports provided: default */
  60374. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60375. "use strict";
  60376. __webpack_require__.r(__webpack_exports__);
  60377. /* 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&");
  60378. /* 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&");
  60379. /* 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");
  60380. /* normalize component */
  60381. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60382. _AssetInfoEditModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60383. _AssetInfoEditModal_vue_vue_type_template_id_24c98bd0___WEBPACK_IMPORTED_MODULE_0__["render"],
  60384. _AssetInfoEditModal_vue_vue_type_template_id_24c98bd0___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60385. false,
  60386. null,
  60387. null,
  60388. null
  60389. )
  60390. /* hot reload */
  60391. if (false) { var api; }
  60392. component.options.__file = "resources/js/components/AssetInfoEditModal.vue"
  60393. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60394. /***/ }),
  60395. /***/ "./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js&":
  60396. /*!*********************************************************************************!*\
  60397. !*** ./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js& ***!
  60398. \*********************************************************************************/
  60399. /*! exports provided: default */
  60400. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60401. "use strict";
  60402. __webpack_require__.r(__webpack_exports__);
  60403. /* 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&");
  60404. /* 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"]);
  60405. /***/ }),
  60406. /***/ "./resources/js/components/AssetInfoEditModal.vue?vue&type=template&id=24c98bd0&":
  60407. /*!***************************************************************************************!*\
  60408. !*** ./resources/js/components/AssetInfoEditModal.vue?vue&type=template&id=24c98bd0& ***!
  60409. \***************************************************************************************/
  60410. /*! exports provided: render, staticRenderFns */
  60411. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60412. "use strict";
  60413. __webpack_require__.r(__webpack_exports__);
  60414. /* 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&");
  60415. /* 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"]; });
  60416. /* 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"]; });
  60417. /***/ }),
  60418. /***/ "./resources/js/components/AutocompleteCustomDropdown.vue":
  60419. /*!****************************************************************!*\
  60420. !*** ./resources/js/components/AutocompleteCustomDropdown.vue ***!
  60421. \****************************************************************/
  60422. /*! exports provided: default */
  60423. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60424. "use strict";
  60425. __webpack_require__.r(__webpack_exports__);
  60426. /* 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&");
  60427. /* 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&");
  60428. /* 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");
  60429. /* normalize component */
  60430. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60431. _AutocompleteCustomDropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60432. _AutocompleteCustomDropdown_vue_vue_type_template_id_5fcc8b56___WEBPACK_IMPORTED_MODULE_0__["render"],
  60433. _AutocompleteCustomDropdown_vue_vue_type_template_id_5fcc8b56___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60434. false,
  60435. null,
  60436. null,
  60437. null
  60438. )
  60439. /* hot reload */
  60440. if (false) { var api; }
  60441. component.options.__file = "resources/js/components/AutocompleteCustomDropdown.vue"
  60442. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60443. /***/ }),
  60444. /***/ "./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js&":
  60445. /*!*****************************************************************************************!*\
  60446. !*** ./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js& ***!
  60447. \*****************************************************************************************/
  60448. /*! exports provided: default */
  60449. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60450. "use strict";
  60451. __webpack_require__.r(__webpack_exports__);
  60452. /* 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&");
  60453. /* 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"]);
  60454. /***/ }),
  60455. /***/ "./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56&":
  60456. /*!***********************************************************************************************!*\
  60457. !*** ./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56& ***!
  60458. \***********************************************************************************************/
  60459. /*! exports provided: render, staticRenderFns */
  60460. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60461. "use strict";
  60462. __webpack_require__.r(__webpack_exports__);
  60463. /* 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&");
  60464. /* 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"]; });
  60465. /* 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"]; });
  60466. /***/ }),
  60467. /***/ "./resources/js/components/CircleSpinner.vue":
  60468. /*!***************************************************!*\
  60469. !*** ./resources/js/components/CircleSpinner.vue ***!
  60470. \***************************************************/
  60471. /*! exports provided: default */
  60472. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60473. "use strict";
  60474. __webpack_require__.r(__webpack_exports__);
  60475. /* 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&");
  60476. /* 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&");
  60477. /* empty/unused harmony star reexport *//* 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&");
  60478. /* 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");
  60479. /* normalize component */
  60480. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__["default"])(
  60481. _CircleSpinner_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60482. _CircleSpinner_vue_vue_type_template_id_9a543b64_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"],
  60483. _CircleSpinner_vue_vue_type_template_id_9a543b64_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60484. false,
  60485. null,
  60486. "9a543b64",
  60487. null
  60488. )
  60489. /* hot reload */
  60490. if (false) { var api; }
  60491. component.options.__file = "resources/js/components/CircleSpinner.vue"
  60492. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60493. /***/ }),
  60494. /***/ "./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js&":
  60495. /*!****************************************************************************!*\
  60496. !*** ./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js& ***!
  60497. \****************************************************************************/
  60498. /*! exports provided: default */
  60499. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60500. "use strict";
  60501. __webpack_require__.r(__webpack_exports__);
  60502. /* 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&");
  60503. /* 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"]);
  60504. /***/ }),
  60505. /***/ "./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css&":
  60506. /*!************************************************************************************************************!*\
  60507. !*** ./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css& ***!
  60508. \************************************************************************************************************/
  60509. /*! no static exports found */
  60510. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60511. "use strict";
  60512. __webpack_require__.r(__webpack_exports__);
  60513. /* 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&");
  60514. /* 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__);
  60515. /* 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__));
  60516. /* 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);
  60517. /***/ }),
  60518. /***/ "./resources/js/components/CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true&":
  60519. /*!**********************************************************************************************!*\
  60520. !*** ./resources/js/components/CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true& ***!
  60521. \**********************************************************************************************/
  60522. /*! exports provided: render, staticRenderFns */
  60523. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60524. "use strict";
  60525. __webpack_require__.r(__webpack_exports__);
  60526. /* 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&");
  60527. /* 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"]; });
  60528. /* 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"]; });
  60529. /***/ }),
  60530. /***/ "./resources/js/components/Credential.vue":
  60531. /*!************************************************!*\
  60532. !*** ./resources/js/components/Credential.vue ***!
  60533. \************************************************/
  60534. /*! exports provided: default */
  60535. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60536. "use strict";
  60537. __webpack_require__.r(__webpack_exports__);
  60538. /* 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&");
  60539. /* 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&");
  60540. /* 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");
  60541. /* normalize component */
  60542. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60543. _Credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60544. _Credential_vue_vue_type_template_id_58b8dcfc___WEBPACK_IMPORTED_MODULE_0__["render"],
  60545. _Credential_vue_vue_type_template_id_58b8dcfc___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60546. false,
  60547. null,
  60548. null,
  60549. null
  60550. )
  60551. /* hot reload */
  60552. if (false) { var api; }
  60553. component.options.__file = "resources/js/components/Credential.vue"
  60554. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60555. /***/ }),
  60556. /***/ "./resources/js/components/Credential.vue?vue&type=script&lang=js&":
  60557. /*!*************************************************************************!*\
  60558. !*** ./resources/js/components/Credential.vue?vue&type=script&lang=js& ***!
  60559. \*************************************************************************/
  60560. /*! exports provided: default */
  60561. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60562. "use strict";
  60563. __webpack_require__.r(__webpack_exports__);
  60564. /* 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&");
  60565. /* 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"]);
  60566. /***/ }),
  60567. /***/ "./resources/js/components/Credential.vue?vue&type=template&id=58b8dcfc&":
  60568. /*!*******************************************************************************!*\
  60569. !*** ./resources/js/components/Credential.vue?vue&type=template&id=58b8dcfc& ***!
  60570. \*******************************************************************************/
  60571. /*! exports provided: render, staticRenderFns */
  60572. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60573. "use strict";
  60574. __webpack_require__.r(__webpack_exports__);
  60575. /* 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&");
  60576. /* 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"]; });
  60577. /* 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"]; });
  60578. /***/ }),
  60579. /***/ "./resources/js/components/CredentialFormModal.vue":
  60580. /*!*********************************************************!*\
  60581. !*** ./resources/js/components/CredentialFormModal.vue ***!
  60582. \*********************************************************/
  60583. /*! exports provided: default */
  60584. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60585. "use strict";
  60586. __webpack_require__.r(__webpack_exports__);
  60587. /* 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&");
  60588. /* 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&");
  60589. /* 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");
  60590. /* normalize component */
  60591. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60592. _CredentialFormModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60593. _CredentialFormModal_vue_vue_type_template_id_3cdb3697___WEBPACK_IMPORTED_MODULE_0__["render"],
  60594. _CredentialFormModal_vue_vue_type_template_id_3cdb3697___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60595. false,
  60596. null,
  60597. null,
  60598. null
  60599. )
  60600. /* hot reload */
  60601. if (false) { var api; }
  60602. component.options.__file = "resources/js/components/CredentialFormModal.vue"
  60603. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60604. /***/ }),
  60605. /***/ "./resources/js/components/CredentialFormModal.vue?vue&type=script&lang=js&":
  60606. /*!**********************************************************************************!*\
  60607. !*** ./resources/js/components/CredentialFormModal.vue?vue&type=script&lang=js& ***!
  60608. \**********************************************************************************/
  60609. /*! exports provided: default */
  60610. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60611. "use strict";
  60612. __webpack_require__.r(__webpack_exports__);
  60613. /* 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&");
  60614. /* 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"]);
  60615. /***/ }),
  60616. /***/ "./resources/js/components/CredentialFormModal.vue?vue&type=template&id=3cdb3697&":
  60617. /*!****************************************************************************************!*\
  60618. !*** ./resources/js/components/CredentialFormModal.vue?vue&type=template&id=3cdb3697& ***!
  60619. \****************************************************************************************/
  60620. /*! exports provided: render, staticRenderFns */
  60621. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60622. "use strict";
  60623. __webpack_require__.r(__webpack_exports__);
  60624. /* 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&");
  60625. /* 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"]; });
  60626. /* 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"]; });
  60627. /***/ }),
  60628. /***/ "./resources/js/components/CredentialList.vue":
  60629. /*!****************************************************!*\
  60630. !*** ./resources/js/components/CredentialList.vue ***!
  60631. \****************************************************/
  60632. /*! exports provided: default */
  60633. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60634. "use strict";
  60635. __webpack_require__.r(__webpack_exports__);
  60636. /* 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&");
  60637. /* 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&");
  60638. /* 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");
  60639. /* normalize component */
  60640. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60641. _CredentialList_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60642. _CredentialList_vue_vue_type_template_id_7264bb80___WEBPACK_IMPORTED_MODULE_0__["render"],
  60643. _CredentialList_vue_vue_type_template_id_7264bb80___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60644. false,
  60645. null,
  60646. null,
  60647. null
  60648. )
  60649. /* hot reload */
  60650. if (false) { var api; }
  60651. component.options.__file = "resources/js/components/CredentialList.vue"
  60652. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60653. /***/ }),
  60654. /***/ "./resources/js/components/CredentialList.vue?vue&type=script&lang=js&":
  60655. /*!*****************************************************************************!*\
  60656. !*** ./resources/js/components/CredentialList.vue?vue&type=script&lang=js& ***!
  60657. \*****************************************************************************/
  60658. /*! exports provided: default */
  60659. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60660. "use strict";
  60661. __webpack_require__.r(__webpack_exports__);
  60662. /* 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&");
  60663. /* 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"]);
  60664. /***/ }),
  60665. /***/ "./resources/js/components/CredentialList.vue?vue&type=template&id=7264bb80&":
  60666. /*!***********************************************************************************!*\
  60667. !*** ./resources/js/components/CredentialList.vue?vue&type=template&id=7264bb80& ***!
  60668. \***********************************************************************************/
  60669. /*! exports provided: render, staticRenderFns */
  60670. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60671. "use strict";
  60672. __webpack_require__.r(__webpack_exports__);
  60673. /* 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&");
  60674. /* 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"]; });
  60675. /* 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"]; });
  60676. /***/ }),
  60677. /***/ "./resources/js/components/ErrorList.vue":
  60678. /*!***********************************************!*\
  60679. !*** ./resources/js/components/ErrorList.vue ***!
  60680. \***********************************************/
  60681. /*! exports provided: default */
  60682. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60683. "use strict";
  60684. __webpack_require__.r(__webpack_exports__);
  60685. /* harmony import */ var _ErrorList_vue_vue_type_template_id_48c089eb___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ErrorList.vue?vue&type=template&id=48c089eb& */ "./resources/js/components/ErrorList.vue?vue&type=template&id=48c089eb&");
  60686. /* harmony import */ var _ErrorList_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ErrorList.vue?vue&type=script&lang=js& */ "./resources/js/components/ErrorList.vue?vue&type=script&lang=js&");
  60687. /* 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");
  60688. /* normalize component */
  60689. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60690. _ErrorList_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60691. _ErrorList_vue_vue_type_template_id_48c089eb___WEBPACK_IMPORTED_MODULE_0__["render"],
  60692. _ErrorList_vue_vue_type_template_id_48c089eb___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60693. false,
  60694. null,
  60695. null,
  60696. null
  60697. )
  60698. /* hot reload */
  60699. if (false) { var api; }
  60700. component.options.__file = "resources/js/components/ErrorList.vue"
  60701. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60702. /***/ }),
  60703. /***/ "./resources/js/components/ErrorList.vue?vue&type=script&lang=js&":
  60704. /*!************************************************************************!*\
  60705. !*** ./resources/js/components/ErrorList.vue?vue&type=script&lang=js& ***!
  60706. \************************************************************************/
  60707. /*! exports provided: default */
  60708. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60709. "use strict";
  60710. __webpack_require__.r(__webpack_exports__);
  60711. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_ErrorList_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!./ErrorList.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ErrorList.vue?vue&type=script&lang=js&");
  60712. /* 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_ErrorList_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  60713. /***/ }),
  60714. /***/ "./resources/js/components/ErrorList.vue?vue&type=template&id=48c089eb&":
  60715. /*!******************************************************************************!*\
  60716. !*** ./resources/js/components/ErrorList.vue?vue&type=template&id=48c089eb& ***!
  60717. \******************************************************************************/
  60718. /*! exports provided: render, staticRenderFns */
  60719. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60720. "use strict";
  60721. __webpack_require__.r(__webpack_exports__);
  60722. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_ErrorList_vue_vue_type_template_id_48c089eb___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!./ErrorList.vue?vue&type=template&id=48c089eb& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ErrorList.vue?vue&type=template&id=48c089eb&");
  60723. /* 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_ErrorList_vue_vue_type_template_id_48c089eb___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  60724. /* 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_ErrorList_vue_vue_type_template_id_48c089eb___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  60725. /***/ }),
  60726. /***/ "./resources/js/components/Modal.vue":
  60727. /*!*******************************************!*\
  60728. !*** ./resources/js/components/Modal.vue ***!
  60729. \*******************************************/
  60730. /*! exports provided: default */
  60731. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60732. "use strict";
  60733. __webpack_require__.r(__webpack_exports__);
  60734. /* 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&");
  60735. /* 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");
  60736. var script = {}
  60737. /* normalize component */
  60738. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(
  60739. script,
  60740. _Modal_vue_vue_type_template_id_53ab54d2___WEBPACK_IMPORTED_MODULE_0__["render"],
  60741. _Modal_vue_vue_type_template_id_53ab54d2___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60742. false,
  60743. null,
  60744. null,
  60745. null
  60746. )
  60747. /* hot reload */
  60748. if (false) { var api; }
  60749. component.options.__file = "resources/js/components/Modal.vue"
  60750. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60751. /***/ }),
  60752. /***/ "./resources/js/components/Modal.vue?vue&type=template&id=53ab54d2&":
  60753. /*!**************************************************************************!*\
  60754. !*** ./resources/js/components/Modal.vue?vue&type=template&id=53ab54d2& ***!
  60755. \**************************************************************************/
  60756. /*! exports provided: render, staticRenderFns */
  60757. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60758. "use strict";
  60759. __webpack_require__.r(__webpack_exports__);
  60760. /* 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&");
  60761. /* 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"]; });
  60762. /* 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"]; });
  60763. /***/ }),
  60764. /***/ "./resources/js/components/NoteFormModal.vue":
  60765. /*!***************************************************!*\
  60766. !*** ./resources/js/components/NoteFormModal.vue ***!
  60767. \***************************************************/
  60768. /*! exports provided: default */
  60769. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60770. "use strict";
  60771. __webpack_require__.r(__webpack_exports__);
  60772. /* harmony import */ var _NoteFormModal_vue_vue_type_template_id_1391a09c___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./NoteFormModal.vue?vue&type=template&id=1391a09c& */ "./resources/js/components/NoteFormModal.vue?vue&type=template&id=1391a09c&");
  60773. /* harmony import */ var _NoteFormModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./NoteFormModal.vue?vue&type=script&lang=js& */ "./resources/js/components/NoteFormModal.vue?vue&type=script&lang=js&");
  60774. /* 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");
  60775. /* normalize component */
  60776. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60777. _NoteFormModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60778. _NoteFormModal_vue_vue_type_template_id_1391a09c___WEBPACK_IMPORTED_MODULE_0__["render"],
  60779. _NoteFormModal_vue_vue_type_template_id_1391a09c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60780. false,
  60781. null,
  60782. null,
  60783. null
  60784. )
  60785. /* hot reload */
  60786. if (false) { var api; }
  60787. component.options.__file = "resources/js/components/NoteFormModal.vue"
  60788. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60789. /***/ }),
  60790. /***/ "./resources/js/components/NoteFormModal.vue?vue&type=script&lang=js&":
  60791. /*!****************************************************************************!*\
  60792. !*** ./resources/js/components/NoteFormModal.vue?vue&type=script&lang=js& ***!
  60793. \****************************************************************************/
  60794. /*! exports provided: default */
  60795. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60796. "use strict";
  60797. __webpack_require__.r(__webpack_exports__);
  60798. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_NoteFormModal_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!./NoteFormModal.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/NoteFormModal.vue?vue&type=script&lang=js&");
  60799. /* 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_NoteFormModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  60800. /***/ }),
  60801. /***/ "./resources/js/components/NoteFormModal.vue?vue&type=template&id=1391a09c&":
  60802. /*!**********************************************************************************!*\
  60803. !*** ./resources/js/components/NoteFormModal.vue?vue&type=template&id=1391a09c& ***!
  60804. \**********************************************************************************/
  60805. /*! exports provided: render, staticRenderFns */
  60806. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60807. "use strict";
  60808. __webpack_require__.r(__webpack_exports__);
  60809. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_NoteFormModal_vue_vue_type_template_id_1391a09c___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!./NoteFormModal.vue?vue&type=template&id=1391a09c& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/NoteFormModal.vue?vue&type=template&id=1391a09c&");
  60810. /* 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_NoteFormModal_vue_vue_type_template_id_1391a09c___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  60811. /* 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_NoteFormModal_vue_vue_type_template_id_1391a09c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  60812. /***/ }),
  60813. /***/ "./resources/js/components/Notes.vue":
  60814. /*!*******************************************!*\
  60815. !*** ./resources/js/components/Notes.vue ***!
  60816. \*******************************************/
  60817. /*! exports provided: default */
  60818. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60819. "use strict";
  60820. __webpack_require__.r(__webpack_exports__);
  60821. /* harmony import */ var _Notes_vue_vue_type_template_id_3d897ee6___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Notes.vue?vue&type=template&id=3d897ee6& */ "./resources/js/components/Notes.vue?vue&type=template&id=3d897ee6&");
  60822. /* harmony import */ var _Notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Notes.vue?vue&type=script&lang=js& */ "./resources/js/components/Notes.vue?vue&type=script&lang=js&");
  60823. /* 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");
  60824. /* normalize component */
  60825. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60826. _Notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60827. _Notes_vue_vue_type_template_id_3d897ee6___WEBPACK_IMPORTED_MODULE_0__["render"],
  60828. _Notes_vue_vue_type_template_id_3d897ee6___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60829. false,
  60830. null,
  60831. null,
  60832. null
  60833. )
  60834. /* hot reload */
  60835. if (false) { var api; }
  60836. component.options.__file = "resources/js/components/Notes.vue"
  60837. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60838. /***/ }),
  60839. /***/ "./resources/js/components/Notes.vue?vue&type=script&lang=js&":
  60840. /*!********************************************************************!*\
  60841. !*** ./resources/js/components/Notes.vue?vue&type=script&lang=js& ***!
  60842. \********************************************************************/
  60843. /*! exports provided: default */
  60844. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60845. "use strict";
  60846. __webpack_require__.r(__webpack_exports__);
  60847. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./Notes.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/Notes.vue?vue&type=script&lang=js&");
  60848. /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  60849. /***/ }),
  60850. /***/ "./resources/js/components/Notes.vue?vue&type=template&id=3d897ee6&":
  60851. /*!**************************************************************************!*\
  60852. !*** ./resources/js/components/Notes.vue?vue&type=template&id=3d897ee6& ***!
  60853. \**************************************************************************/
  60854. /*! exports provided: render, staticRenderFns */
  60855. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60856. "use strict";
  60857. __webpack_require__.r(__webpack_exports__);
  60858. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_Notes_vue_vue_type_template_id_3d897ee6___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./Notes.vue?vue&type=template&id=3d897ee6& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/Notes.vue?vue&type=template&id=3d897ee6&");
  60859. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_Notes_vue_vue_type_template_id_3d897ee6___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  60860. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_Notes_vue_vue_type_template_id_3d897ee6___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  60861. /***/ }),
  60862. /***/ "./resources/js/components/WoInfoEditModal.vue":
  60863. /*!*****************************************************!*\
  60864. !*** ./resources/js/components/WoInfoEditModal.vue ***!
  60865. \*****************************************************/
  60866. /*! exports provided: default */
  60867. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60868. "use strict";
  60869. __webpack_require__.r(__webpack_exports__);
  60870. /* 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&");
  60871. /* 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&");
  60872. /* 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");
  60873. /* normalize component */
  60874. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60875. _WoInfoEditModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60876. _WoInfoEditModal_vue_vue_type_template_id_352dd7a2___WEBPACK_IMPORTED_MODULE_0__["render"],
  60877. _WoInfoEditModal_vue_vue_type_template_id_352dd7a2___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60878. false,
  60879. null,
  60880. null,
  60881. null
  60882. )
  60883. /* hot reload */
  60884. if (false) { var api; }
  60885. component.options.__file = "resources/js/components/WoInfoEditModal.vue"
  60886. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60887. /***/ }),
  60888. /***/ "./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js&":
  60889. /*!******************************************************************************!*\
  60890. !*** ./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js& ***!
  60891. \******************************************************************************/
  60892. /*! exports provided: default */
  60893. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60894. "use strict";
  60895. __webpack_require__.r(__webpack_exports__);
  60896. /* 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&");
  60897. /* 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"]);
  60898. /***/ }),
  60899. /***/ "./resources/js/components/WoInfoEditModal.vue?vue&type=template&id=352dd7a2&":
  60900. /*!************************************************************************************!*\
  60901. !*** ./resources/js/components/WoInfoEditModal.vue?vue&type=template&id=352dd7a2& ***!
  60902. \************************************************************************************/
  60903. /*! exports provided: render, staticRenderFns */
  60904. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60905. "use strict";
  60906. __webpack_require__.r(__webpack_exports__);
  60907. /* 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&");
  60908. /* 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"]; });
  60909. /* 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"]; });
  60910. /***/ }),
  60911. /***/ "./resources/js/components/WorkOrderInfo.vue":
  60912. /*!***************************************************!*\
  60913. !*** ./resources/js/components/WorkOrderInfo.vue ***!
  60914. \***************************************************/
  60915. /*! exports provided: default */
  60916. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60917. "use strict";
  60918. __webpack_require__.r(__webpack_exports__);
  60919. /* 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&");
  60920. /* 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&");
  60921. /* 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");
  60922. /* normalize component */
  60923. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60924. _WorkOrderInfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60925. _WorkOrderInfo_vue_vue_type_template_id_50116330___WEBPACK_IMPORTED_MODULE_0__["render"],
  60926. _WorkOrderInfo_vue_vue_type_template_id_50116330___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60927. false,
  60928. null,
  60929. null,
  60930. null
  60931. )
  60932. /* hot reload */
  60933. if (false) { var api; }
  60934. component.options.__file = "resources/js/components/WorkOrderInfo.vue"
  60935. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60936. /***/ }),
  60937. /***/ "./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js&":
  60938. /*!****************************************************************************!*\
  60939. !*** ./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js& ***!
  60940. \****************************************************************************/
  60941. /*! exports provided: default */
  60942. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60943. "use strict";
  60944. __webpack_require__.r(__webpack_exports__);
  60945. /* 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&");
  60946. /* 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"]);
  60947. /***/ }),
  60948. /***/ "./resources/js/components/WorkOrderInfo.vue?vue&type=template&id=50116330&":
  60949. /*!**********************************************************************************!*\
  60950. !*** ./resources/js/components/WorkOrderInfo.vue?vue&type=template&id=50116330& ***!
  60951. \**********************************************************************************/
  60952. /*! exports provided: render, staticRenderFns */
  60953. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60954. "use strict";
  60955. __webpack_require__.r(__webpack_exports__);
  60956. /* 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&");
  60957. /* 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"]; });
  60958. /* 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"]; });
  60959. /***/ }),
  60960. /***/ "./resources/js/mixins/dateMixin.js":
  60961. /*!******************************************!*\
  60962. !*** ./resources/js/mixins/dateMixin.js ***!
  60963. \******************************************/
  60964. /*! exports provided: default */
  60965. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60966. "use strict";
  60967. __webpack_require__.r(__webpack_exports__);
  60968. /* harmony default export */ __webpack_exports__["default"] = ({
  60969. methods: {
  60970. treatAsUTC: function treatAsUTC(date) {
  60971. var result = new Date(date);
  60972. result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
  60973. return result;
  60974. },
  60975. daysSinceToday: function daysSinceToday(date) {
  60976. var currentDate = new Date();
  60977. var millisecondsPerDay = 24 * 60 * 60 * 1000;
  60978. return (this.treatAsUTC(currentDate) - this.treatAsUTC(date)) / millisecondsPerDay;
  60979. },
  60980. getHRDate: function getHRDate(dateString) {
  60981. var date = new Date(dateString);
  60982. return date.toLocaleString('default', {
  60983. month: 'short',
  60984. day: 'numeric',
  60985. year: 'numeric',
  60986. hour: 'numeric',
  60987. minute: 'numeric'
  60988. });
  60989. },
  60990. isZero: function isZero(dateString) {
  60991. return dateString === '0000-00-00 00:00:00';
  60992. }
  60993. }
  60994. });
  60995. /***/ }),
  60996. /***/ "./resources/js/notify.min.js":
  60997. /*!************************************!*\
  60998. !*** ./resources/js/notify.min.js ***!
  60999. \************************************/
  61000. /*! no static exports found */
  61001. /***/ (function(module, exports, __webpack_require__) {
  61002. 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); }
  61003. (function (e) {
  61004. true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (e),
  61005. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  61006. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  61007. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
  61008. })(function (e) {
  61009. function A(t, n, i) {
  61010. typeof i == "string" && (i = {
  61011. className: i
  61012. }), 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);
  61013. }
  61014. var t = [].indexOf || function (e) {
  61015. for (var t = 0, n = this.length; t < n; t++) {
  61016. if (t in this && this[t] === e) return t;
  61017. }
  61018. return -1;
  61019. },
  61020. n = "notify",
  61021. r = n + "js",
  61022. i = n + "!blank",
  61023. s = {
  61024. t: "top",
  61025. m: "middle",
  61026. b: "bottom",
  61027. l: "left",
  61028. c: "center",
  61029. r: "right"
  61030. },
  61031. o = ["l", "c", "r"],
  61032. u = ["t", "m", "b"],
  61033. a = ["t", "b", "l", "r"],
  61034. f = {
  61035. t: "b",
  61036. m: null,
  61037. b: "t",
  61038. l: "r",
  61039. c: null,
  61040. r: "l"
  61041. },
  61042. l = function l(t) {
  61043. var n;
  61044. return n = [], e.each(t.split(/\W+/), function (e, t) {
  61045. var r;
  61046. r = t.toLowerCase().charAt(0);
  61047. if (s[r]) return n.push(r);
  61048. }), n;
  61049. },
  61050. c = {},
  61051. h = {
  61052. name: "core",
  61053. html: '<div class="' + r + '-wrapper">\n <div class="' + r + '-arrow"></div>\n <div class="' + r + '-container"></div>\n</div>',
  61054. 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}"
  61055. },
  61056. p = {
  61057. "border-radius": ["-webkit-", "-moz-"]
  61058. },
  61059. d = function d(e) {
  61060. return c[e];
  61061. },
  61062. v = function v(e) {
  61063. if (!e) throw "Missing Style name";
  61064. c[e] && delete c[e];
  61065. },
  61066. m = function m(t, i) {
  61067. if (!t) throw "Missing Style name";
  61068. if (!i) throw "Missing Style definition";
  61069. if (!i.html) throw "Missing Style HTML";
  61070. var s = c[t];
  61071. s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
  61072. var o = "";
  61073. i.classes && e.each(i.classes, function (t, n) {
  61074. return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
  61075. return p[t] && e.each(p[t], function (e, r) {
  61076. return o += " " + r + t + ": " + n + ";\n";
  61077. }), o += " " + t + ": " + n + ";\n";
  61078. }), o += "}\n";
  61079. }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
  61080. var u = {},
  61081. a = e(i.html);
  61082. y("html", a, u), y("text", a, u), i.fields = u;
  61083. },
  61084. g = function g(t) {
  61085. var n, r, i;
  61086. r = x("style"), r.attr("type", "text/css"), e("head").append(r);
  61087. try {
  61088. r.html(t);
  61089. } catch (s) {
  61090. r[0].styleSheet.cssText = t;
  61091. }
  61092. return r;
  61093. },
  61094. y = function y(t, n, r) {
  61095. var s;
  61096. return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
  61097. var n;
  61098. n = e(this).attr(s), n || (n = i), r[n] = t;
  61099. });
  61100. },
  61101. b = function b(e, t) {
  61102. return e.is(t) ? e : e.find(t);
  61103. },
  61104. w = {
  61105. clickToHide: !0,
  61106. autoHide: !0,
  61107. autoHideDelay: 5e3,
  61108. arrowShow: !0,
  61109. arrowSize: 5,
  61110. breakNewLines: !0,
  61111. elementPosition: "bottom",
  61112. globalPosition: "top right",
  61113. style: "bootstrap",
  61114. className: "error",
  61115. showAnimation: "slideDown",
  61116. showDuration: 400,
  61117. hideAnimation: "slideUp",
  61118. hideDuration: 200,
  61119. gap: 5
  61120. },
  61121. E = function E(t, n) {
  61122. var r;
  61123. return r = function r() {}, r.prototype = t, e.extend(!0, new r(), n);
  61124. },
  61125. S = function S(t) {
  61126. return e.extend(w, t);
  61127. },
  61128. x = function x(t) {
  61129. return e("<" + t + "></" + t + ">");
  61130. },
  61131. T = {},
  61132. N = function N(t) {
  61133. var n;
  61134. return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
  61135. return e(r).attr("name") === t.attr("name");
  61136. }), t = n.first()), t;
  61137. },
  61138. C = function C(e, t, n) {
  61139. var r, i;
  61140. if (typeof n == "string") n = parseInt(n, 10);else if (typeof n != "number") return;
  61141. if (isNaN(n)) return;
  61142. 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;
  61143. },
  61144. k = function k(e, t, n) {
  61145. if (e === "l" || e === "t") return 0;
  61146. if (e === "c" || e === "m") return n / 2 - t / 2;
  61147. if (e === "r" || e === "b") return n - t;
  61148. throw "Invalid alignment";
  61149. },
  61150. L = function L(e) {
  61151. return L.e = L.e || x("div"), L.e.text(e).html();
  61152. };
  61153. A.prototype.loadHTML = function () {
  61154. var t;
  61155. t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields;
  61156. }, A.prototype.show = function (e, t) {
  61157. var n, r, i, s, o;
  61158. r = function (n) {
  61159. return function () {
  61160. !e && !n.elem && n.destroy();
  61161. if (t) return t();
  61162. };
  61163. }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
  61164. 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 {
  61165. if (!!o || !!e) return r();
  61166. s = this.options.hideAnimation, n.push(this.options.hideDuration);
  61167. }
  61168. return n.push(r), i[s].apply(i, n);
  61169. }, A.prototype.setGlobalPosition = function () {
  61170. var t = this.getPosition(),
  61171. n = t[0],
  61172. i = t[1],
  61173. o = s[n],
  61174. u = s[i],
  61175. a = n + "|" + i,
  61176. f = T[a];
  61177. if (!f || !document.body.contains(f[0])) {
  61178. f = T[a] = x("div");
  61179. var l = {};
  61180. 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);
  61181. }
  61182. return f.prepend(this.wrapper);
  61183. }, A.prototype.setElementPosition = function () {
  61184. 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;
  61185. 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"];
  61186. for (w = 0, S = B.length; w < S; w++) {
  61187. D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
  61188. }
  61189. b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
  61190. if (!this.options.arrowShow) this.arrow.hide();else {
  61191. 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";
  61192. for (E = 0, x = a.length; E < x; E++) {
  61193. D = a[E], P = s[D];
  61194. if (D === L) continue;
  61195. l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l;
  61196. }
  61197. C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2);
  61198. }
  61199. 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);
  61200. if (r) return this.arrow.removeAttr("style").css(r);
  61201. }, A.prototype.getPosition = function () {
  61202. var e, n, r, i, s, f, c, h;
  61203. h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
  61204. if (n = e[0], t.call(a, n) < 0) throw "Must be one of [" + a + "]";
  61205. 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";
  61206. return e.length === 2 && (e[2] = e[1]), e;
  61207. }, A.prototype.getStyle = function (e) {
  61208. var t;
  61209. e || (e = this.options.style), e || (e = "default"), t = c[e];
  61210. if (!t) throw "Missing style: " + e;
  61211. return t;
  61212. }, A.prototype.updateClasses = function () {
  61213. var t, n;
  61214. 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) {
  61215. return r + "-" + n.name + "-" + e;
  61216. }).join(" "), this.userContainer.attr("class", t);
  61217. }, A.prototype.run = function (t, n) {
  61218. var r, s, o, u, a;
  61219. e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
  61220. if (this.container && !t) {
  61221. this.show(!1);
  61222. return;
  61223. }
  61224. if (!this.container && !t) return;
  61225. s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
  61226. for (o in s) {
  61227. r = s[o], u = this.userFields[o];
  61228. if (!u) continue;
  61229. 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);
  61230. }
  61231. 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));
  61232. }, A.prototype.destroy = function () {
  61233. this.wrapper.data(r, null), this.wrapper.remove();
  61234. }, e[n] = function (t, r, i) {
  61235. return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t;
  61236. }, e.fn[n] = function (t, n) {
  61237. return e(this).each(function () {
  61238. var i = N(e(this)).data(r);
  61239. i && i.destroy();
  61240. var s = new A(e(this), t, n);
  61241. }), this;
  61242. }, e.extend(e[n], {
  61243. defaults: S,
  61244. addStyle: m,
  61245. removeStyle: v,
  61246. pluginOptions: w,
  61247. getStyle: d,
  61248. insertCSS: g
  61249. }), m("bootstrap", {
  61250. html: "<div>\n<span data-notify-text></span>\n</div>",
  61251. classes: {
  61252. base: {
  61253. "font-weight": "bold",
  61254. padding: "8px 15px 8px 14px",
  61255. "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
  61256. "background-color": "#fcf8e3",
  61257. border: "1px solid #fbeed5",
  61258. "border-radius": "4px",
  61259. "white-space": "nowrap",
  61260. "padding-left": "25px",
  61261. "background-repeat": "no-repeat",
  61262. "background-position": "3px 7px"
  61263. },
  61264. error: {
  61265. color: "#B94A48",
  61266. "background-color": "#F2DEDE",
  61267. "border-color": "#EED3D7",
  61268. "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=)"
  61269. },
  61270. success: {
  61271. color: "#468847",
  61272. "background-color": "#DFF0D8",
  61273. "border-color": "#D6E9C6",
  61274. "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==)"
  61275. },
  61276. info: {
  61277. color: "#3A87AD",
  61278. "background-color": "#D9EDF7",
  61279. "border-color": "#BCE8F1",
  61280. "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=)"
  61281. },
  61282. warn: {
  61283. color: "#C09853",
  61284. "background-color": "#FCF8E3",
  61285. "border-color": "#FBEED5",
  61286. "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)"
  61287. }
  61288. }
  61289. }), e(function () {
  61290. g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
  61291. e(this).trigger("notify-hide");
  61292. }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
  61293. var n = e(this).data(r);
  61294. n && n.show(!1);
  61295. });
  61296. });
  61297. });
  61298. /***/ }),
  61299. /***/ "./resources/js/views/App.vue":
  61300. /*!************************************!*\
  61301. !*** ./resources/js/views/App.vue ***!
  61302. \************************************/
  61303. /*! exports provided: default */
  61304. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61305. "use strict";
  61306. __webpack_require__.r(__webpack_exports__);
  61307. /* 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&");
  61308. /* 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&");
  61309. /* 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");
  61310. /* normalize component */
  61311. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  61312. _App_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61313. _App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__["render"],
  61314. _App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61315. false,
  61316. null,
  61317. null,
  61318. null
  61319. )
  61320. /* hot reload */
  61321. if (false) { var api; }
  61322. component.options.__file = "resources/js/views/App.vue"
  61323. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61324. /***/ }),
  61325. /***/ "./resources/js/views/App.vue?vue&type=script&lang=js&":
  61326. /*!*************************************************************!*\
  61327. !*** ./resources/js/views/App.vue?vue&type=script&lang=js& ***!
  61328. \*************************************************************/
  61329. /*! exports provided: default */
  61330. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61331. "use strict";
  61332. __webpack_require__.r(__webpack_exports__);
  61333. /* 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&");
  61334. /* 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"]);
  61335. /***/ }),
  61336. /***/ "./resources/js/views/App.vue?vue&type=template&id=91ac6b5c&":
  61337. /*!*******************************************************************!*\
  61338. !*** ./resources/js/views/App.vue?vue&type=template&id=91ac6b5c& ***!
  61339. \*******************************************************************/
  61340. /*! exports provided: render, staticRenderFns */
  61341. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61342. "use strict";
  61343. __webpack_require__.r(__webpack_exports__);
  61344. /* 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&");
  61345. /* 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"]; });
  61346. /* 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"]; });
  61347. /***/ }),
  61348. /***/ "./resources/js/views/Dashboard.vue":
  61349. /*!******************************************!*\
  61350. !*** ./resources/js/views/Dashboard.vue ***!
  61351. \******************************************/
  61352. /*! exports provided: default */
  61353. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61354. "use strict";
  61355. __webpack_require__.r(__webpack_exports__);
  61356. /* 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&");
  61357. /* 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&");
  61358. /* 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");
  61359. /* normalize component */
  61360. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  61361. _Dashboard_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61362. _Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__["render"],
  61363. _Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61364. false,
  61365. null,
  61366. null,
  61367. null
  61368. )
  61369. /* hot reload */
  61370. if (false) { var api; }
  61371. component.options.__file = "resources/js/views/Dashboard.vue"
  61372. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61373. /***/ }),
  61374. /***/ "./resources/js/views/Dashboard.vue?vue&type=script&lang=js&":
  61375. /*!*******************************************************************!*\
  61376. !*** ./resources/js/views/Dashboard.vue?vue&type=script&lang=js& ***!
  61377. \*******************************************************************/
  61378. /*! exports provided: default */
  61379. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61380. "use strict";
  61381. __webpack_require__.r(__webpack_exports__);
  61382. /* 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&");
  61383. /* 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"]);
  61384. /***/ }),
  61385. /***/ "./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6&":
  61386. /*!*************************************************************************!*\
  61387. !*** ./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6& ***!
  61388. \*************************************************************************/
  61389. /*! exports provided: render, staticRenderFns */
  61390. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61391. "use strict";
  61392. __webpack_require__.r(__webpack_exports__);
  61393. /* 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&");
  61394. /* 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"]; });
  61395. /* 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"]; });
  61396. /***/ }),
  61397. /***/ "./resources/js/views/Login.vue":
  61398. /*!**************************************!*\
  61399. !*** ./resources/js/views/Login.vue ***!
  61400. \**************************************/
  61401. /*! exports provided: default */
  61402. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61403. "use strict";
  61404. __webpack_require__.r(__webpack_exports__);
  61405. /* 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&");
  61406. /* 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&");
  61407. /* 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");
  61408. /* normalize component */
  61409. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  61410. _Login_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61411. _Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__["render"],
  61412. _Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61413. false,
  61414. null,
  61415. null,
  61416. null
  61417. )
  61418. /* hot reload */
  61419. if (false) { var api; }
  61420. component.options.__file = "resources/js/views/Login.vue"
  61421. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61422. /***/ }),
  61423. /***/ "./resources/js/views/Login.vue?vue&type=script&lang=js&":
  61424. /*!***************************************************************!*\
  61425. !*** ./resources/js/views/Login.vue?vue&type=script&lang=js& ***!
  61426. \***************************************************************/
  61427. /*! exports provided: default */
  61428. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61429. "use strict";
  61430. __webpack_require__.r(__webpack_exports__);
  61431. /* 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&");
  61432. /* 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"]);
  61433. /***/ }),
  61434. /***/ "./resources/js/views/Login.vue?vue&type=template&id=12f5395a&":
  61435. /*!*********************************************************************!*\
  61436. !*** ./resources/js/views/Login.vue?vue&type=template&id=12f5395a& ***!
  61437. \*********************************************************************/
  61438. /*! exports provided: render, staticRenderFns */
  61439. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61440. "use strict";
  61441. __webpack_require__.r(__webpack_exports__);
  61442. /* 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&");
  61443. /* 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"]; });
  61444. /* 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"]; });
  61445. /***/ }),
  61446. /***/ "./resources/js/views/Welcome.vue":
  61447. /*!****************************************!*\
  61448. !*** ./resources/js/views/Welcome.vue ***!
  61449. \****************************************/
  61450. /*! exports provided: default */
  61451. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61452. "use strict";
  61453. __webpack_require__.r(__webpack_exports__);
  61454. /* 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&");
  61455. /* 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&");
  61456. /* 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&");
  61457. /* 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");
  61458. /* normalize component */
  61459. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__["default"])(
  61460. _Welcome_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61461. _Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"],
  61462. _Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61463. false,
  61464. null,
  61465. "1ae8ae93",
  61466. null
  61467. )
  61468. /* hot reload */
  61469. if (false) { var api; }
  61470. component.options.__file = "resources/js/views/Welcome.vue"
  61471. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61472. /***/ }),
  61473. /***/ "./resources/js/views/Welcome.vue?vue&type=script&lang=js&":
  61474. /*!*****************************************************************!*\
  61475. !*** ./resources/js/views/Welcome.vue?vue&type=script&lang=js& ***!
  61476. \*****************************************************************/
  61477. /*! exports provided: default */
  61478. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61479. "use strict";
  61480. __webpack_require__.r(__webpack_exports__);
  61481. /* 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&");
  61482. /* 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"]);
  61483. /***/ }),
  61484. /***/ "./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css&":
  61485. /*!*************************************************************************************************!*\
  61486. !*** ./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css& ***!
  61487. \*************************************************************************************************/
  61488. /*! no static exports found */
  61489. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61490. "use strict";
  61491. __webpack_require__.r(__webpack_exports__);
  61492. /* 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&");
  61493. /* 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__);
  61494. /* 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__));
  61495. /* 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);
  61496. /***/ }),
  61497. /***/ "./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true&":
  61498. /*!***********************************************************************************!*\
  61499. !*** ./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true& ***!
  61500. \***********************************************************************************/
  61501. /*! exports provided: render, staticRenderFns */
  61502. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61503. "use strict";
  61504. __webpack_require__.r(__webpack_exports__);
  61505. /* 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&");
  61506. /* 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"]; });
  61507. /* 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"]; });
  61508. /***/ }),
  61509. /***/ "./resources/js/views/WorkOrder.vue":
  61510. /*!******************************************!*\
  61511. !*** ./resources/js/views/WorkOrder.vue ***!
  61512. \******************************************/
  61513. /*! exports provided: default */
  61514. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61515. "use strict";
  61516. __webpack_require__.r(__webpack_exports__);
  61517. /* 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&");
  61518. /* 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&");
  61519. /* 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");
  61520. /* normalize component */
  61521. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  61522. _WorkOrder_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61523. _WorkOrder_vue_vue_type_template_id_17837e2e___WEBPACK_IMPORTED_MODULE_0__["render"],
  61524. _WorkOrder_vue_vue_type_template_id_17837e2e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61525. false,
  61526. null,
  61527. null,
  61528. null
  61529. )
  61530. /* hot reload */
  61531. if (false) { var api; }
  61532. component.options.__file = "resources/js/views/WorkOrder.vue"
  61533. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61534. /***/ }),
  61535. /***/ "./resources/js/views/WorkOrder.vue?vue&type=script&lang=js&":
  61536. /*!*******************************************************************!*\
  61537. !*** ./resources/js/views/WorkOrder.vue?vue&type=script&lang=js& ***!
  61538. \*******************************************************************/
  61539. /*! exports provided: default */
  61540. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61541. "use strict";
  61542. __webpack_require__.r(__webpack_exports__);
  61543. /* 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&");
  61544. /* 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"]);
  61545. /***/ }),
  61546. /***/ "./resources/js/views/WorkOrder.vue?vue&type=template&id=17837e2e&":
  61547. /*!*************************************************************************!*\
  61548. !*** ./resources/js/views/WorkOrder.vue?vue&type=template&id=17837e2e& ***!
  61549. \*************************************************************************/
  61550. /*! exports provided: render, staticRenderFns */
  61551. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61552. "use strict";
  61553. __webpack_require__.r(__webpack_exports__);
  61554. /* 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&");
  61555. /* 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"]; });
  61556. /* 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"]; });
  61557. /***/ }),
  61558. /***/ "./resources/sass/app.scss":
  61559. /*!*********************************!*\
  61560. !*** ./resources/sass/app.scss ***!
  61561. \*********************************/
  61562. /*! no static exports found */
  61563. /***/ (function(module, exports) {
  61564. // removed by extract-text-webpack-plugin
  61565. /***/ }),
  61566. /***/ 0:
  61567. /*!*************************************************************!*\
  61568. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  61569. \*************************************************************/
  61570. /*! no static exports found */
  61571. /***/ (function(module, exports, __webpack_require__) {
  61572. __webpack_require__(/*! /home/vagrant/upccrt/resources/js/app.js */"./resources/js/app.js");
  61573. module.exports = __webpack_require__(/*! /home/vagrant/upccrt/resources/sass/app.scss */"./resources/sass/app.scss");
  61574. /***/ })
  61575. /******/ });